diff --git a/source/Disk.cpp b/source/Disk.cpp index ad8ff51e..b0848700 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -845,33 +845,20 @@ void Disk2InterfaceCard::NotifyInvalidImage(const int drive, LPCTSTR pszImageFil bool Disk2InterfaceCard::GetProtect(const int drive) { - if (IsDriveValid(drive)) - { - if (m_floppyDrive[drive].m_disk.m_bWriteProtected) - return true; - } + if (!IsDriveValid(drive)) + return true; - return false; + return m_floppyDrive[drive].m_disk.m_bWriteProtected; } //=========================================================================== void Disk2InterfaceCard::SetProtect(const int drive, const bool bWriteProtect) -{ - if (IsDriveValid( drive )) - { - m_floppyDrive[drive].m_disk.m_bWriteProtected = bWriteProtect; - } -} - -//=========================================================================== - -bool Disk2InterfaceCard::IsDiskImageWriteProtected(const int drive) { if (!IsDriveValid(drive)) - return true; + return; - return ImageIsWriteProtected(m_floppyDrive[drive].m_disk.m_imagehandle); + m_floppyDrive[drive].m_disk.m_bWriteProtected = bWriteProtect; } //=========================================================================== @@ -886,6 +873,16 @@ bool Disk2InterfaceCard::IsDriveEmpty(const int drive) //=========================================================================== +bool Disk2InterfaceCard::IsWozImageInDrive(const int drive) +{ + if (!IsDriveValid(drive)) + return false; + + return ImageIsWOZ(m_floppyDrive[drive].m_disk.m_imagehandle); +} + +//=========================================================================== + #if LOG_DISK_NIBBLES_WRITE bool Disk2InterfaceCard::LogWriteCheckSyncFF(ULONG& uCycleDelta) { diff --git a/source/Disk.h b/source/Disk.h index 484e5adf..651f39c6 100644 --- a/source/Disk.h +++ b/source/Disk.h @@ -148,8 +148,6 @@ public: bool IsConditionForFullSpeed(void); void NotifyInvalidImage(const int drive, LPCTSTR pszImageFilename, const ImageError_e Error); - bool GetProtect(const int drive); - void SetProtect(const int drive, const bool bWriteProtect); UINT GetCurrentFirmware(void) { return m_is13SectorFirmware ? 13 : 16; } int GetCurrentDrive(void); int GetCurrentTrack(void); @@ -173,8 +171,10 @@ public: void LoadLastDiskImage(const int drive); void SaveLastDiskImage(const int drive); - bool IsDiskImageWriteProtected(const int drive); + bool GetProtect(const int drive); + void SetProtect(const int drive, const bool bWriteProtect); bool IsDriveEmpty(const int drive); + bool IsWozImageInDrive(const int drive); bool GetEnhanceDisk(void); void SetEnhanceDisk(bool bEnhanceDisk); @@ -201,7 +201,6 @@ private: void DataLoadWriteWOZ(WORD pc, WORD addr, UINT bitCellRemainder); void DataShiftWriteWOZ(WORD pc, WORD addr, ULONG uExecutedCycles); void SetSequencerFunction(WORD addr); - void DumpSectorWOZ(FloppyDisk floppy); void DumpTrackWOZ(FloppyDisk floppy); bool GetFirmware(WORD lpNameId, BYTE* pDst); void InitFirmware(LPBYTE pCxRomPeripheral); diff --git a/source/DiskImage.cpp b/source/DiskImage.cpp index 1dc0e3d9..1f2f48ee 100644 --- a/source/DiskImage.cpp +++ b/source/DiskImage.cpp @@ -196,11 +196,6 @@ UINT ImageGetNumTracks(ImageInfo* const pImageInfo) return pImageInfo ? pImageInfo->uNumTracks : 0; } -bool ImageIsWriteProtected(ImageInfo* const pImageInfo) -{ - return pImageInfo ? pImageInfo->bWriteProtected : true; -} - bool ImageIsMultiFileZip(ImageInfo* const pImageInfo) { return pImageInfo ? (pImageInfo->uNumValidImagesInZip > 1) : false; diff --git a/source/DiskImage.h b/source/DiskImage.h index 1d6a30e1..7e91b9c5 100644 --- a/source/DiskImage.h +++ b/source/DiskImage.h @@ -86,7 +86,6 @@ bool ImageReadBlock(ImageInfo* const pImageInfo, UINT nBlock, LPBYTE pBlockBuffe bool ImageWriteBlock(ImageInfo* const pImageInfo, UINT nBlock, LPBYTE pBlockBuffer); UINT ImageGetNumTracks(ImageInfo* const pImageInfo); -bool ImageIsWriteProtected(ImageInfo* const pImageInfo); bool ImageIsMultiFileZip(ImageInfo* const pImageInfo); const std::string & ImageGetPathname(ImageInfo* const pImageInfo); UINT ImageGetImageSize(ImageInfo* const pImageInfo); diff --git a/source/Windows/WinFrame.cpp b/source/Windows/WinFrame.cpp index 6f2473fd..8b3e5b5a 100644 --- a/source/Windows/WinFrame.cpp +++ b/source/Windows/WinFrame.cpp @@ -2005,7 +2005,7 @@ void Win32Frame::ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive) // Check menu depending on current floppy protection { int iMenuItem = ID_DISKMENU_WRITEPROTECTION_OFF; - if (disk2Card.GetProtect( iDrive )) + if (disk2Card.GetProtect(iDrive)) iMenuItem = ID_DISKMENU_WRITEPROTECTION_ON; CheckMenuItem(hmenu, iMenuItem, MF_CHECKED); @@ -2014,7 +2014,7 @@ void Win32Frame::ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive) if (disk2Card.IsDriveEmpty(iDrive)) EnableMenuItem(hmenu, ID_DISKMENU_EJECT, MF_GRAYED); - if (disk2Card.IsDiskImageWriteProtected(iDrive)) + if (disk2Card.GetProtect(iDrive)) { // If image-file is read-only (or a gzip) then disable these menu items EnableMenuItem(hmenu, ID_DISKMENU_WRITEPROTECTION_ON, MF_GRAYED);