DiskII: Remove superfluous IsDiskImageWriteProtected()

This commit is contained in:
tomcw 2021-10-18 21:13:37 +01:00
parent f2843d4d71
commit 18f5fafb30
5 changed files with 20 additions and 30 deletions

View File

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

View File

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

View File

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

View File

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

View File

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