MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / restore_disk

Function restore_disk

src/disk.cpp:5911–6002  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5909}
5910
5911uae_u8 *restore_disk (int num,uae_u8 *src)
5912{
5913 drive *drv;
5914 int state, dfxtype;
5915 TCHAR old[MAX_DPATH];
5916 TCHAR *s;
5917 int newis;
5918
5919 drv = &floppy[num];
5920 disabled &= ~(1 << num);
5921 drv->drive_id = restore_u32 ();
5922 drv->motoroff = 1;
5923 drv->idbit = 0;
5924 state = restore_u8 ();
5925 if (state & 2) {
5926 disabled |= 1 << num;
5927 if (changed_prefs.nr_floppies > num)
5928 changed_prefs.nr_floppies = num;
5929 changed_prefs.floppyslots[num].dfxtype = -1;
5930 } else {
5931 drv->motoroff = (state & 1) ? 0 : 1;
5932 drv->idbit = (state & 4) ? 1 : 0;
5933 switch (drv->drive_id)
5934 {
5935 case DRIVE_ID_35HD:
5936 dfxtype = DRV_35_HD;
5937 break;
5938 case DRIVE_ID_525SD:
5939 dfxtype = DRV_525_SD;
5940 break;
5941 default:
5942 dfxtype = DRV_35_DD;
5943 break;
5944 }
5945 currprefs.floppyslots[num].dfxtype = changed_prefs.floppyslots[num].dfxtype = dfxtype;
5946 }
5947 drv->dskchange = (state & 8) != 0;
5948 side = (state & 16) ? 1 : 0;
5949 drv->indexhackmode = 0;
5950 if (num == 0 && currprefs.floppyslots[num].dfxtype == 0)
5951 drv->indexhackmode = 1;
5952 drv->buffered_cyl = -1;
5953 drv->buffered_side = -1;
5954 drv->cyl = restore_u8 ();
5955 drv->dskready = restore_u8 () != 0;
5956 drv->drive_id_scnt = restore_u8 ();
5957 int mfmpos = restore_u32 ();
5958 drv->dskchange_time = 0;
5959 restore_u32 ();
5960 s = restore_path (SAVESTATE_PATH_FLOPPY);
5961 int dskready_up_time = restore_u16 ();
5962 int dskready_down_time = restore_u16 ();
5963 if (restore_u32() & 1) {
5964 xfree(s);
5965 s = restore_path_full();
5966 }
5967 if (s && s[0])
5968 write_log(_T("-> '%s'\n"), s);

Callers 3

restore_state_fileFunction · 0.85
restore_stateFunction · 0.85
savestate_rewindFunction · 0.85

Calls 4

drive_emptyFunction · 0.85
zfile_existsFunction · 0.85
reset_drive_guiFunction · 0.85
write_logFunction · 0.70

Tested by

no test coverage detected