diff --git a/source/Configuration/PropertySheetHelper.cpp b/source/Configuration/PropertySheetHelper.cpp index c8c7a6cb..51bcad30 100644 --- a/source/Configuration/PropertySheetHelper.cpp +++ b/source/Configuration/PropertySheetHelper.cpp @@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "../Interface.h" #include "../Uthernet2.h" #include "../Tfe/PCapBackend.h" +#include "../CmdLine.h" /* Config causing AfterClose msgs: @@ -134,6 +135,8 @@ void CPropertySheetHelper::SetSlot(UINT slot, SS_CARDTYPE newCardType) GetCardMgr().Insert(slot, newCardType); GetCardMgr().GetRef(slot).InitializeIO(GetCxRomPeripheral()); + if (newCardType == CT_GenericHDD) + dynamic_cast(GetCardMgr().GetRef(slot)).SetUserNumBlocks(g_cmdLine.uHarddiskNumBlocks); } // Used by: diff --git a/source/Harddisk.cpp b/source/Harddisk.cpp index 21098a49..0a0ddc57 100644 --- a/source/Harddisk.cpp +++ b/source/Harddisk.cpp @@ -37,7 +37,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Registry.h" #include "SaveState.h" #include "YamlHelper.h" -#include "CmdLine.h" #include "Debugger/Debug.h" #include "../resource/resource.h" @@ -677,13 +676,13 @@ BYTE __stdcall HarddiskInterfaceCard::IORead(WORD pc, WORD addr, BYTE bWrite, BY break; case 0x9: if (pHDD->m_imageloaded) - r = (BYTE)(GetImageSizeInBlocks(pHDD->m_imagehandle) & 0x00ff); + r = (BYTE)(pCard->GetImageSizeInBlocks(pHDD->m_imagehandle) & 0x00ff); else r = 0; break; case 0xa: if (pHDD->m_imageloaded) - r = (BYTE)((GetImageSizeInBlocks(pHDD->m_imagehandle) & 0xff00) >> 8); + r = (BYTE)((pCard->GetImageSizeInBlocks(pHDD->m_imagehandle) & 0xff00) >> 8); else r = 0; break; @@ -750,8 +749,8 @@ BYTE __stdcall HarddiskInterfaceCard::IOWrite(WORD pc, WORD addr, BYTE bWrite, B UINT HarddiskInterfaceCard::GetImageSizeInBlocks(ImageInfo* const pImageInfo) { - if (g_cmdLine.uHarddiskNumBlocks != 0) - return g_cmdLine.uHarddiskNumBlocks; + if (m_userNumBlocks != 0) + return m_userNumBlocks; UINT numberOfBlocks = (pImageInfo ? pImageInfo->uImageSize : 0) / HD_BLOCK_SIZE; if (numberOfBlocks > kHarddiskMaxNumBlocks) numberOfBlocks = kHarddiskMaxNumBlocks; diff --git a/source/Harddisk.h b/source/Harddisk.h index fc71d93d..048f0051 100644 --- a/source/Harddisk.h +++ b/source/Harddisk.h @@ -100,6 +100,7 @@ public: void Unplug(const int iDrive); bool IsDriveUnplugged(const int iDrive); void LoadLastDiskImage(const int iDrive); + void SetUserNumBlocks(UINT numBlocks) { m_userNumBlocks = numBlocks; } void GetLightStatus(Disk_Status_e* pDisk1Status); bool ImageSwap(void); @@ -119,7 +120,7 @@ private: const std::string& DiskGetBaseName(const int iDrive); bool SelectImage(const int drive, LPCSTR pszFilename); void UpdateLightStatus(HardDiskDrive* pHDD); - static UINT GetImageSizeInBlocks(ImageInfo* const pImageInfo); + UINT GetImageSizeInBlocks(ImageInfo* const pImageInfo); void SaveSnapshotHDDUnit(YamlSaveHelper& yamlSaveHelper, UINT unit); bool LoadSnapshotHDDUnit(YamlLoadHelper& yamlLoadHelper, UINT unit); @@ -128,6 +129,7 @@ private: BYTE m_unitNum; // b7=unit BYTE m_command; UINT64 m_notBusyCycle; + UINT m_userNumBlocks; bool m_saveDiskImage; // Save the DiskImage name to Registry diff --git a/source/Windows/AppleWin.cpp b/source/Windows/AppleWin.cpp index a1ec1818..0f711cff 100644 --- a/source/Windows/AppleWin.cpp +++ b/source/Windows/AppleWin.cpp @@ -802,6 +802,8 @@ static void RepeatInitialization(void) { if (GetCardMgr().QuerySlot(i) == CT_Disk2 && g_cmdLine.slotInfo[i].isDiskII13) dynamic_cast(GetCardMgr().GetRef(i)).SetFirmware13Sector(); + if (GetCardMgr().QuerySlot(i) == CT_GenericHDD) + dynamic_cast(GetCardMgr().GetRef(i)).SetUserNumBlocks(g_cmdLine.uHarddiskNumBlocks); } // Create window after inserting/removing VidHD card (as it affects width & height)