Refactor: remove slot from InitializeIO() calls for card objects

This commit is contained in:
tomcw
2021-11-01 20:39:26 +00:00
parent ff7c9dc185
commit 67b3c28833
17 changed files with 52 additions and 54 deletions
+16 -16
View File
@@ -130,7 +130,7 @@ HarddiskInterfaceCard::HarddiskInterfaceCard(UINT slot) :
// if created by user in Config->Disk, then MemInitializeIO() won't be called
if (GetCxRomPeripheral())
Initialize(GetCxRomPeripheral()); // During regular start-up, Initialize() will be called later by MemInitializeIO()
InitializeIO(GetCxRomPeripheral()); // During regular start-up, Initialize() will be called later by MemInitializeIO()
}
HarddiskInterfaceCard::~HarddiskInterfaceCard(void)
@@ -150,6 +150,21 @@ void HarddiskInterfaceCard::Reset(const bool powerCycle)
//===========================================================================
void HarddiskInterfaceCard::InitializeIO(const LPBYTE pCxRomPeripheral)
{
const DWORD HARDDISK_FW_SIZE = APPLE_SLOT_SIZE;
BYTE* pData = GetFrame().GetResource(IDR_HDDRVR_FW, "FIRMWARE", HARDDISK_FW_SIZE);
if (pData == NULL)
return;
memcpy(pCxRomPeripheral + m_slot * APPLE_SLOT_SIZE, pData, HARDDISK_FW_SIZE);
RegisterIoHandler(m_slot, IORead, IOWrite, NULL, NULL, this, NULL);
}
//===========================================================================
void HarddiskInterfaceCard::CleanupDriveInternal(const int iDrive)
{
if (m_hardDiskDrive[iDrive].m_imagehandle)
@@ -281,21 +296,6 @@ void HarddiskInterfaceCard::GetFilenameAndPathForSaveState(std::string& filename
//===========================================================================
void HarddiskInterfaceCard::Initialize(const LPBYTE pCxRomPeripheral)
{
const DWORD HARDDISK_FW_SIZE = APPLE_SLOT_SIZE;
BYTE* pData = GetFrame().GetResource(IDR_HDDRVR_FW, "FIRMWARE", HARDDISK_FW_SIZE);
if (pData == NULL)
return;
memcpy(pCxRomPeripheral + m_slot * APPLE_SLOT_SIZE, pData, HARDDISK_FW_SIZE);
RegisterIoHandler(m_slot, IORead, IOWrite, NULL, NULL, this, NULL);
}
//===========================================================================
void HarddiskInterfaceCard::Destroy(void)
{
m_saveDiskImage = false;