Disk II: 'Swap Disks' only swaps disk (not drive properties) - fixes #543

This commit is contained in:
tomcw 2018-02-25 14:05:45 +00:00
parent 92504e0751
commit e1286de7a9

View File

@ -138,7 +138,7 @@ const char* DiskGetCurrentState(void)
{ {
/*if (floppyloadmode) /*if (floppyloadmode)
{ {
if (g_aFloppyDrive[currdrive].bWriteProtected) if (g_aFloppyDrive[currdrive].disk.bWriteProtected)
return "Reading write protect state (write protected)"; return "Reading write protect state (write protected)";
else else
return "Reading write protect state (not write protected)"; return "Reading write protect state (not write protected)";
@ -259,8 +259,8 @@ static bool IsDriveValid(const int iDrive)
static void AllocTrack(const int iDrive) static void AllocTrack(const int iDrive)
{ {
Drive_t* pDrive = &g_aFloppyDrive[iDrive]; Disk_t* pFloppy = &g_aFloppyDrive[iDrive].disk;
pDrive->disk.trackimage = (LPBYTE)VirtualAlloc(NULL, NIBBLES_PER_TRACK, MEM_COMMIT, PAGE_READWRITE); pFloppy->trackimage = (LPBYTE)VirtualAlloc(NULL, NIBBLES_PER_TRACK, MEM_COMMIT, PAGE_READWRITE);
} }
//=========================================================================== //===========================================================================
@ -1153,8 +1153,7 @@ bool DiskDriveSwap(void)
// Swap disks between drives // Swap disks between drives
// . NB. We swap trackimage ptrs (so don't need to swap the buffers' data) // . NB. We swap trackimage ptrs (so don't need to swap the buffers' data)
// . TODO: Consider array of Pointers: Disk_t* g_aDrive[] std::swap(g_aFloppyDrive[0].disk, g_aFloppyDrive[1].disk);
std::swap(g_aFloppyDrive[0], g_aFloppyDrive[1]);
Disk_SaveLastDiskImage(DRIVE_1); Disk_SaveLastDiskImage(DRIVE_1);
Disk_SaveLastDiskImage(DRIVE_2); Disk_SaveLastDiskImage(DRIVE_2);