Skip to content

Commit

Permalink
Flush current track (if dirty) before 'Send to CiderPress' (fix #499)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcw committed Oct 20, 2017
1 parent 1cb5c68 commit c49d68f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
18 changes: 12 additions & 6 deletions source/Disk.cpp
Expand Up @@ -320,14 +320,23 @@ static void ReadTrack(const int iDrive)

//===========================================================================

void DiskFlushCurrentTrack(const int iDrive)
{
Disk_t *pFloppy = &g_aFloppyDisk[iDrive];

if (pFloppy->trackimage && pFloppy->trackimagedirty)
WriteTrack(iDrive);
}

//===========================================================================

static void RemoveDisk(const int iDrive)
{
Disk_t *pFloppy = &g_aFloppyDisk[iDrive];

if (pFloppy->imagehandle)
{
if (pFloppy->trackimage && pFloppy->trackimagedirty)
WriteTrack( iDrive);
DiskFlushCurrentTrack(iDrive);

ImageClose(pFloppy->imagehandle);
pFloppy->imagehandle = NULL;
Expand Down Expand Up @@ -442,10 +451,7 @@ static void __stdcall DiskControlStepper(WORD, WORD address, BYTE, BYTE, ULONG u
: MIN(nNumTracksInImage-1, fptr->phase >> 1); // (round half tracks down)
if (newtrack != fptr->track)
{
if (fptr->trackimage && fptr->trackimagedirty)
{
WriteTrack(currdrive);
}
DiskFlushCurrentTrack(currdrive);
fptr->track = newtrack;
fptr->trackimagedata = 0;
}
Expand Down
1 change: 1 addition & 0 deletions source/Disk.h
Expand Up @@ -47,6 +47,7 @@ void DiskDestroy(void); // no, doesn't "destroy" the disk image. DiskIIManag

void DiskBoot(void);
void DiskEject(const int iDrive);
void DiskFlushCurrentTrack(const int iDrive);

LPCTSTR DiskGetFullName(const int iDrive);
LPCTSTR DiskGetFullDiskFilename(const int iDrive);
Expand Down
2 changes: 2 additions & 0 deletions source/Frame.cpp
Expand Up @@ -2040,6 +2040,8 @@ void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
"Please install CiderPress.\n"
"Otherwise set the path to CiderPress from Configuration->Disk.";

DiskFlushCurrentTrack(iDrive);

//if(!filename1.compare("\"\"") == false) //Do not use this, for some reason it does not work!!!
if(!filename1.compare(sFileNameEmpty) )
{
Expand Down

0 comments on commit c49d68f

Please sign in to comment.