Skip to content

Commit

Permalink
Disk II: 'Swap Disks' only swaps disk (not drive properties) - fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcw committed Feb 25, 2018
1 parent 92504e0 commit e1286de
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions source/Disk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const char* DiskGetCurrentState(void)
{
/*if (floppyloadmode)
{
if (g_aFloppyDrive[currdrive].bWriteProtected)
if (g_aFloppyDrive[currdrive].disk.bWriteProtected)
return "Reading write protect state (write protected)";
else
return "Reading write protect state (not write protected)";
Expand Down Expand Up @@ -259,8 +259,8 @@ static bool IsDriveValid(const int iDrive)

static void AllocTrack(const int iDrive)
{
Drive_t* pDrive = &g_aFloppyDrive[iDrive];
pDrive->disk.trackimage = (LPBYTE)VirtualAlloc(NULL, NIBBLES_PER_TRACK, MEM_COMMIT, PAGE_READWRITE);
Disk_t* pFloppy = &g_aFloppyDrive[iDrive].disk;
pFloppy->trackimage = (LPBYTE)VirtualAlloc(NULL, NIBBLES_PER_TRACK, MEM_COMMIT, PAGE_READWRITE);
}

//===========================================================================
Expand Down Expand Up @@ -1153,8 +1153,7 @@ bool DiskDriveSwap(void)

// Swap disks between drives
// . 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], g_aFloppyDrive[1]);
std::swap(g_aFloppyDrive[0].disk, g_aFloppyDrive[1].disk);

Disk_SaveLastDiskImage(DRIVE_1);
Disk_SaveLastDiskImage(DRIVE_2);
Expand Down

0 comments on commit e1286de

Please sign in to comment.