Flush current track (if dirty) before 'Send to CiderPress' (fix #499)

This commit is contained in:
tomcw 2017-10-19 22:49:10 -07:00
parent 1cb5c6868d
commit c49d68f2b5
3 changed files with 15 additions and 6 deletions

View File

@ -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;
@ -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;
}

View File

@ -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);

View File

@ -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) )
{