Replaced global g_CardMgr with a singleton object & GetCardMgr() call. (Fixes #843)

This commit is contained in:
tomcw 2020-10-11 17:34:44 +01:00
parent b0b033da49
commit 1a11c65d37
16 changed files with 212 additions and 207 deletions

View file

@ -110,7 +110,6 @@ bool g_bDisableDirectSound = false;
bool g_bDisableDirectSoundMockingboard = false; bool g_bDisableDirectSoundMockingboard = false;
int g_nMemoryClearType = MIP_FF_FF_00_00; // Note: -1 = random MIP in Memory.cpp MemReset() int g_nMemoryClearType = MIP_FF_FF_00_00; // Note: -1 = random MIP in Memory.cpp MemReset()
CardManager g_CardMgr;
IPropertySheet& sg_PropertySheet = * new CPropertySheet; IPropertySheet& sg_PropertySheet = * new CPropertySheet;
SynchronousEventManager g_SynchronousEventMgr; SynchronousEventManager g_SynchronousEventMgr;
@ -235,6 +234,12 @@ bool GetHookAltGrControl(void)
return g_bHookAltGrControl; return g_bHookAltGrControl;
} }
CardManager& GetCardMgr(void)
{
static CardManager g_CardMgr; // singleton
return g_CardMgr;
}
static void ResetToLogoMode(void) static void ResetToLogoMode(void)
{ {
g_nAppMode = MODE_LOGO; g_nAppMode = MODE_LOGO;
@ -321,7 +326,7 @@ static void ContinueExecution(void)
const bool bWasFullSpeed = g_bFullSpeed; const bool bWasFullSpeed = g_bFullSpeed;
g_bFullSpeed = (g_dwSpeed == SPEED_MAX) || g_bFullSpeed = (g_dwSpeed == SPEED_MAX) ||
bScrollLock_FullSpeed || bScrollLock_FullSpeed ||
(g_CardMgr.GetDisk2CardMgr().IsConditionForFullSpeed() && !Spkr_IsActive() && !MB_IsActive()) || (GetCardMgr().GetDisk2CardMgr().IsConditionForFullSpeed() && !Spkr_IsActive() && !MB_IsActive()) ||
IsDebugSteppingAtFullSpeed(); IsDebugSteppingAtFullSpeed();
if (g_bFullSpeed) if (g_bFullSpeed)
@ -368,7 +373,7 @@ static void ContinueExecution(void)
const DWORD uActualCyclesExecuted = CpuExecute(uCyclesToExecute, bVideoUpdate); const DWORD uActualCyclesExecuted = CpuExecute(uCyclesToExecute, bVideoUpdate);
g_dwCyclesThisFrame += uActualCyclesExecuted; g_dwCyclesThisFrame += uActualCyclesExecuted;
g_CardMgr.GetDisk2CardMgr().UpdateDriveState(uActualCyclesExecuted); GetCardMgr().GetDisk2CardMgr().UpdateDriveState(uActualCyclesExecuted);
JoyUpdateButtonLatch(nExecutionPeriodUsec); // Button latch time is independent of CPU clock frequency JoyUpdateButtonLatch(nExecutionPeriodUsec); // Button latch time is independent of CPU clock frequency
PrintUpdate(uActualCyclesExecuted); PrintUpdate(uActualCyclesExecuted);
MB_PeriodicUpdate(uActualCyclesExecuted); MB_PeriodicUpdate(uActualCyclesExecuted);
@ -702,8 +707,8 @@ void LoadConfiguration(void)
serialPortName, serialPortName,
CSuperSerialCard::SIZEOF_SERIALCHOICE_ITEM)) CSuperSerialCard::SIZEOF_SERIALCHOICE_ITEM))
{ {
if (g_CardMgr.IsSSCInstalled()) if (GetCardMgr().IsSSCInstalled())
g_CardMgr.GetSSC()->SetSerialPortName(serialPortName); GetCardMgr().GetSSC()->SetSerialPortName(serialPortName);
} }
REGLOAD_DEFAULT(TEXT(REGVALUE_EMULATION_SPEED), &g_dwSpeed, SPEED_NORMAL); REGLOAD_DEFAULT(TEXT(REGVALUE_EMULATION_SPEED), &g_dwSpeed, SPEED_NORMAL);
@ -712,7 +717,7 @@ void LoadConfiguration(void)
DWORD dwEnhanceDisk; DWORD dwEnhanceDisk;
REGLOAD_DEFAULT(TEXT(REGVALUE_ENHANCE_DISK_SPEED), &dwEnhanceDisk, 1); REGLOAD_DEFAULT(TEXT(REGVALUE_ENHANCE_DISK_SPEED), &dwEnhanceDisk, 1);
g_CardMgr.GetDisk2CardMgr().SetEnhanceDisk(dwEnhanceDisk ? true : false); GetCardMgr().GetDisk2CardMgr().SetEnhanceDisk(dwEnhanceDisk ? true : false);
// //
@ -773,9 +778,9 @@ void LoadConfiguration(void)
sg_PropertySheet.SetMouseRestrictToWindow(dwTmp); sg_PropertySheet.SetMouseRestrictToWindow(dwTmp);
if(REGLOAD(TEXT(REGVALUE_SLOT4), &dwTmp)) if(REGLOAD(TEXT(REGVALUE_SLOT4), &dwTmp))
g_CardMgr.Insert(4, (SS_CARDTYPE)dwTmp); GetCardMgr().Insert(4, (SS_CARDTYPE)dwTmp);
if(REGLOAD(TEXT(REGVALUE_SLOT5), &dwTmp)) if(REGLOAD(TEXT(REGVALUE_SLOT5), &dwTmp))
g_CardMgr.Insert(5, (SS_CARDTYPE)dwTmp); GetCardMgr().Insert(5, (SS_CARDTYPE)dwTmp);
// //
@ -797,7 +802,7 @@ void LoadConfiguration(void)
GetCurrentDirectory(sizeof(szFilename), szFilename); GetCurrentDirectory(sizeof(szFilename), szFilename);
SetCurrentImageDir(szFilename); SetCurrentImageDir(szFilename);
g_CardMgr.GetDisk2CardMgr().LoadLastDiskImage(); GetCardMgr().GetDisk2CardMgr().LoadLastDiskImage();
// //
@ -1169,7 +1174,7 @@ static void SetCurrentDir(std::string pathname)
static bool DoDiskInsert(const UINT slot, const int nDrive, LPCSTR szFileName) static bool DoDiskInsert(const UINT slot, const int nDrive, LPCSTR szFileName)
{ {
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(slot)); Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot));
std::string strPathName = GetFullPath(szFileName); std::string strPathName = GetFullPath(szFileName);
if (strPathName.empty()) return false; if (strPathName.empty()) return false;
@ -1417,7 +1422,7 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
MB_Reset(); MB_Reset();
LogFileOutput("Main: MB_Reset()\n"); LogFileOutput("Main: MB_Reset()\n");
CMouseInterface* pMouseCard = g_CardMgr.GetMouseCard(); CMouseInterface* pMouseCard = GetCardMgr().GetMouseCard();
if (pMouseCard) if (pMouseCard)
{ {
pMouseCard->Reset(); // Deassert any pending IRQs - GH#514 pMouseCard->Reset(); // Deassert any pending IRQs - GH#514
@ -1742,8 +1747,8 @@ static bool ProcessCmdLine(LPSTR lpCmdLine)
} }
else if ((strcmp(lpCmdLine, "-dcd") == 0) || (strcmp(lpCmdLine, "-modem") == 0)) // GH#386 else if ((strcmp(lpCmdLine, "-dcd") == 0) || (strcmp(lpCmdLine, "-modem") == 0)) // GH#386
{ {
if (g_CardMgr.IsSSCInstalled()) if (GetCardMgr().IsSSCInstalled())
g_CardMgr.GetSSC()->SupportDCD(true); GetCardMgr().GetSSC()->SupportDCD(true);
} }
else if (strcmp(lpCmdLine, "-alt-enter=toggle-full-screen") == 0) // GH#556 else if (strcmp(lpCmdLine, "-alt-enter=toggle-full-screen") == 0) // GH#556
{ {
@ -2058,23 +2063,23 @@ static void RepeatInitialization(void)
// NB. this state is not persisted to the Registry/conf.ini (just as '-s7 empty' isn't) // NB. this state is not persisted to the Registry/conf.ini (just as '-s7 empty' isn't)
// TODO: support bSlotEmpty[] for slots: 0,4,5 // TODO: support bSlotEmpty[] for slots: 0,4,5
if (g_cmdLine.bSlotEmpty[SLOT1]) if (g_cmdLine.bSlotEmpty[SLOT1])
g_CardMgr.Remove(SLOT1); GetCardMgr().Remove(SLOT1);
if (g_cmdLine.bSlotEmpty[SLOT2]) if (g_cmdLine.bSlotEmpty[SLOT2])
g_CardMgr.Remove(SLOT2); GetCardMgr().Remove(SLOT2);
if (g_cmdLine.bSlotEmpty[SLOT3]) if (g_cmdLine.bSlotEmpty[SLOT3])
g_CardMgr.Remove(SLOT3); GetCardMgr().Remove(SLOT3);
if (g_cmdLine.bSlotEmpty[SLOT6]) if (g_cmdLine.bSlotEmpty[SLOT6])
g_CardMgr.Remove(SLOT6); GetCardMgr().Remove(SLOT6);
if (g_cmdLine.slotInsert[SLOT5] != CT_Empty) if (g_cmdLine.slotInsert[SLOT5] != CT_Empty)
{ {
if (g_CardMgr.QuerySlot(SLOT4) == CT_MockingboardC && g_cmdLine.slotInsert[SLOT5] != CT_MockingboardC) // Currently MB occupies slot4+5 when enabled if (GetCardMgr().QuerySlot(SLOT4) == CT_MockingboardC && g_cmdLine.slotInsert[SLOT5] != CT_MockingboardC) // Currently MB occupies slot4+5 when enabled
{ {
g_CardMgr.Remove(SLOT4); GetCardMgr().Remove(SLOT4);
g_CardMgr.Remove(SLOT5); GetCardMgr().Remove(SLOT5);
} }
g_CardMgr.Insert(SLOT5, g_cmdLine.slotInsert[SLOT5]); GetCardMgr().Insert(SLOT5, g_cmdLine.slotInsert[SLOT5]);
} }
// Pre: may need g_hFrameWindow for MessageBox errors // Pre: may need g_hFrameWindow for MessageBox errors
@ -2126,7 +2131,7 @@ static void RepeatInitialization(void)
} }
// Need to test if it's safe to call ResetMachineState(). In the meantime, just call Disk2Card's Reset(): // Need to test if it's safe to call ResetMachineState(). In the meantime, just call Disk2Card's Reset():
g_CardMgr.GetDisk2CardMgr().Reset(true); // Switch from a booting A][+ to a non-autostart A][, so need to turn off floppy motor GetCardMgr().GetDisk2CardMgr().Reset(true); // Switch from a booting A][+ to a non-autostart A][, so need to turn off floppy motor
LogFileOutput("Main: DiskReset()\n"); LogFileOutput("Main: DiskReset()\n");
HD_Reset(); // GH#515 HD_Reset(); // GH#515
LogFileOutput("Main: HDDReset()\n"); LogFileOutput("Main: HDDReset()\n");

View file

@ -52,7 +52,7 @@ extern bool g_bDisableDirectSound; // Cmd line switch: don't init DS (s
extern bool g_bDisableDirectSoundMockingboard; // Cmd line switch: don't init MB support extern bool g_bDisableDirectSoundMockingboard; // Cmd line switch: don't init MB support
extern int g_nMemoryClearType; // Cmd line switch: use specific MIP (Memory Initialization Pattern) extern int g_nMemoryClearType; // Cmd line switch: use specific MIP (Memory Initialization Pattern)
extern class CardManager g_CardMgr; extern class CardManager& GetCardMgr(void);
extern class SynchronousEventManager g_SynchronousEventMgr; extern class SynchronousEventManager g_SynchronousEventMgr;
extern HANDLE g_hCustomRomF8; // INVALID_HANDLE_VALUE if no custom F8 rom extern HANDLE g_hCustomRomF8; // INVALID_HANDLE_VALUE if no custom F8 rom

View file

@ -20,9 +20,9 @@ public:
m_bEnableTheFreezesF8Rom = bEnableTheFreezesF8Rom; m_bEnableTheFreezesF8Rom = bEnableTheFreezesF8Rom;
memset(&m_Slot, 0, sizeof(m_Slot)); memset(&m_Slot, 0, sizeof(m_Slot));
m_SlotAux = CT_Empty; m_SlotAux = CT_Empty;
m_Slot[SLOT4] = g_CardMgr.QuerySlot(SLOT4); m_Slot[SLOT4] = GetCardMgr().QuerySlot(SLOT4);
m_Slot[SLOT5] = g_CardMgr.QuerySlot(SLOT5); m_Slot[SLOT5] = GetCardMgr().QuerySlot(SLOT5);
m_Slot[SLOT7] = g_CardMgr.QuerySlot(SLOT7); m_Slot[SLOT7] = GetCardMgr().QuerySlot(SLOT7);
} }
const CConfigNeedingRestart& operator= (const CConfigNeedingRestart& other) const CConfigNeedingRestart& operator= (const CConfigNeedingRestart& other)

View file

@ -206,9 +206,9 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM
CheckDlgButton(hWnd, IDC_CHECK_VERTICAL_BLEND, IsVideoStyle(VS_COLOR_VERTICAL_BLEND) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hWnd, IDC_CHECK_VERTICAL_BLEND, IsVideoStyle(VS_COLOR_VERTICAL_BLEND) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_CHECK_VERTICAL_BLEND), (GetVideoType() == VT_COLOR_MONITOR_RGB) ? TRUE : FALSE); EnableWindow(GetDlgItem(hWnd, IDC_CHECK_VERTICAL_BLEND), (GetVideoType() == VT_COLOR_MONITOR_RGB) ? TRUE : FALSE);
if (g_CardMgr.IsSSCInstalled()) if (GetCardMgr().IsSSCInstalled())
{ {
CSuperSerialCard* pSSC = g_CardMgr.GetSSC(); CSuperSerialCard* pSSC = GetCardMgr().GetSSC();
m_PropertySheetHelper.FillComboBox(hWnd, IDC_SERIALPORT, pSSC->GetSerialPortChoices(), pSSC->GetSerialPort()); m_PropertySheetHelper.FillComboBox(hWnd, IDC_SERIALPORT, pSSC->GetSerialPortChoices(), pSSC->GetSerialPort());
EnableWindow(GetDlgItem(hWnd, IDC_SERIALPORT), !pSSC->IsActive() ? TRUE : FALSE); EnableWindow(GetDlgItem(hWnd, IDC_SERIALPORT), !pSSC->IsActive() ? TRUE : FALSE);
} }
@ -344,9 +344,9 @@ void CPageConfig::DlgOK(HWND hWnd)
// //
if (g_CardMgr.IsSSCInstalled()) if (GetCardMgr().IsSSCInstalled())
{ {
CSuperSerialCard* pSSC = g_CardMgr.GetSSC(); CSuperSerialCard* pSSC = GetCardMgr().GetSSC();
const DWORD uNewSerialPort = (DWORD) SendDlgItemMessage(hWnd, IDC_SERIALPORT, CB_GETCURSEL, 0, 0); const DWORD uNewSerialPort = (DWORD) SendDlgItemMessage(hWnd, IDC_SERIALPORT, CB_GETCURSEL, 0, 0);
pSSC->CommSetSerialPort(hWnd, uNewSerialPort); pSSC->CommSetSerialPort(hWnd, uNewSerialPort);
RegSaveString( TEXT(REG_CONFIG), RegSaveString( TEXT(REG_CONFIG),

View file

@ -131,9 +131,9 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
m_PropertySheetHelper.FillComboBox(hWnd, IDC_DISKTYPE, m_discchoices, g_CardMgr.GetDisk2CardMgr().GetEnhanceDisk() ? 1 : 0); m_PropertySheetHelper.FillComboBox(hWnd, IDC_DISKTYPE, m_discchoices, GetCardMgr().GetDisk2CardMgr().GetEnhanceDisk() ? 1 : 0);
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
InitComboFloppyDrive(hWnd, SLOT6); InitComboFloppyDrive(hWnd, SLOT6);
else else
EnableFloppyDrive(hWnd, FALSE); EnableFloppyDrive(hWnd, FALSE);
@ -160,7 +160,7 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l
void CPageDisk::InitComboFloppyDrive(HWND hWnd, UINT slot) void CPageDisk::InitComboFloppyDrive(HWND hWnd, UINT slot)
{ {
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(slot)); Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot));
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK1, m_defaultDiskOptions, -1); m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK1, m_defaultDiskOptions, -1);
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK2, m_defaultDiskOptions, -1); m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK2, m_defaultDiskOptions, -1);
@ -199,9 +199,9 @@ void CPageDisk::InitComboHDD(HWND hWnd, UINT /*slot*/)
void CPageDisk::DlgOK(HWND hWnd) void CPageDisk::DlgOK(HWND hWnd)
{ {
const bool bNewEnhanceDisk = SendDlgItemMessage(hWnd, IDC_DISKTYPE,CB_GETCURSEL, 0, 0) ? true : false; const bool bNewEnhanceDisk = SendDlgItemMessage(hWnd, IDC_DISKTYPE,CB_GETCURSEL, 0, 0) ? true : false;
if (bNewEnhanceDisk != g_CardMgr.GetDisk2CardMgr().GetEnhanceDisk()) if (bNewEnhanceDisk != GetCardMgr().GetDisk2CardMgr().GetEnhanceDisk())
{ {
g_CardMgr.GetDisk2CardMgr().SetEnhanceDisk(bNewEnhanceDisk); GetCardMgr().GetDisk2CardMgr().SetEnhanceDisk(bNewEnhanceDisk);
REGSAVE(TEXT(REGVALUE_ENHANCE_DISK_SPEED), (DWORD)bNewEnhanceDisk); REGSAVE(TEXT(REGVALUE_ENHANCE_DISK_SPEED), (DWORD)bNewEnhanceDisk);
} }
@ -302,13 +302,13 @@ void CPageDisk::HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected
void CPageDisk::HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT comboSelected) void CPageDisk::HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT comboSelected)
{ {
if (g_CardMgr.QuerySlot(SLOT6) != CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) != CT_Disk2)
{ {
_ASSERT(0); // Shouldn't come here, as the combo is disabled _ASSERT(0); // Shouldn't come here, as the combo is disabled
return; return;
} }
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)); Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6));
// Search from "select floppy drive" // Search from "select floppy drive"
DWORD dwOpenDialogIndex = (DWORD)SendDlgItemMessage(hWnd, comboSelected, CB_FINDSTRINGEXACT, -1, (LPARAM)&m_defaultDiskOptions[0]); DWORD dwOpenDialogIndex = (DWORD)SendDlgItemMessage(hWnd, comboSelected, CB_FINDSTRINGEXACT, -1, (LPARAM)&m_defaultDiskOptions[0]);

View file

@ -117,7 +117,7 @@ BOOL CPageSound::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM
SendDlgItemMessage(hWnd,IDC_MB_VOLUME,TBM_SETTICFREQ,10,0); SendDlgItemMessage(hWnd,IDC_MB_VOLUME,TBM_SETTICFREQ,10,0);
SendDlgItemMessage(hWnd,IDC_MB_VOLUME,TBM_SETPOS,1,MB_GetVolume()); SendDlgItemMessage(hWnd,IDC_MB_VOLUME,TBM_SETPOS,1,MB_GetVolume());
if (g_CardMgr.QuerySlot(SLOT5) == CT_SAM) if (GetCardMgr().QuerySlot(SLOT5) == CT_SAM)
m_NewCardType = CT_SAM; m_NewCardType = CT_SAM;
else else
m_NewCardType = MB_GetSoundcardType(); // Reinit 1st time page is activated (fires before PSN_SETACTIVE) m_NewCardType = MB_GetSoundcardType(); // Reinit 1st time page is activated (fires before PSN_SETACTIVE)

View file

@ -128,8 +128,8 @@ void CPropertySheetHelper::SetSlot(UINT slot, SS_CARDTYPE newCardType)
// Two paths: // Two paths:
// 1) Via Config dialog: card not inserted yet // 1) Via Config dialog: card not inserted yet
// 2) Snapshot_LoadState_v2(): card already inserted // 2) Snapshot_LoadState_v2(): card already inserted
if (g_CardMgr.QuerySlot(slot) != newCardType) if (GetCardMgr().QuerySlot(slot) != newCardType)
g_CardMgr.Insert(slot, newCardType); GetCardMgr().Insert(slot, newCardType);
std::string slotText; std::string slotText;
switch (slot) switch (slot)
@ -214,10 +214,10 @@ void CPropertySheetHelper::SaveStateUpdate()
void CPropertySheetHelper::GetDiskBaseNameWithAWS(std::string & pszFilename) void CPropertySheetHelper::GetDiskBaseNameWithAWS(std::string & pszFilename)
{ {
if (g_CardMgr.QuerySlot(SLOT6) != CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) != CT_Disk2)
return; return;
const std::string& diskName = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).GetBaseName(DRIVE_1); const std::string& diskName = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).GetBaseName(DRIVE_1);
if (!diskName.empty()) if (!diskName.empty())
{ {
pszFilename = diskName + ".aws.yaml"; pszFilename = diskName + ".aws.yaml";
@ -453,8 +453,8 @@ void CPropertySheetHelper::SaveCurrentConfig(void)
// NB. clone-type is encoded in g_Apple2Type // NB. clone-type is encoded in g_Apple2Type
m_ConfigOld.m_Apple2Type = GetApple2Type(); m_ConfigOld.m_Apple2Type = GetApple2Type();
m_ConfigOld.m_CpuType = GetMainCpu(); m_ConfigOld.m_CpuType = GetMainCpu();
m_ConfigOld.m_Slot[SLOT4] = g_CardMgr.QuerySlot(SLOT4); m_ConfigOld.m_Slot[SLOT4] = GetCardMgr().QuerySlot(SLOT4);
m_ConfigOld.m_Slot[SLOT5] = g_CardMgr.QuerySlot(SLOT5); m_ConfigOld.m_Slot[SLOT5] = GetCardMgr().QuerySlot(SLOT5);
m_ConfigOld.m_bEnableHDD = HD_CardIsEnabled(); m_ConfigOld.m_bEnableHDD = HD_CardIsEnabled();
m_ConfigOld.m_bEnableTheFreezesF8Rom = sg_PropertySheet.GetTheFreezesF8Rom(); m_ConfigOld.m_bEnableTheFreezesF8Rom = sg_PropertySheet.GetTheFreezesF8Rom();
m_ConfigOld.m_videoRefreshRate = GetVideoRefreshRate(); m_ConfigOld.m_videoRefreshRate = GetVideoRefreshRate();
@ -472,8 +472,8 @@ void CPropertySheetHelper::RestoreCurrentConfig(void)
// NB. clone-type is encoded in g_Apple2Type // NB. clone-type is encoded in g_Apple2Type
SetApple2Type(m_ConfigOld.m_Apple2Type); SetApple2Type(m_ConfigOld.m_Apple2Type);
SetMainCpu(m_ConfigOld.m_CpuType); SetMainCpu(m_ConfigOld.m_CpuType);
g_CardMgr.Insert(SLOT4, m_ConfigOld.m_Slot[SLOT4]); GetCardMgr().Insert(SLOT4, m_ConfigOld.m_Slot[SLOT4]);
g_CardMgr.Insert(SLOT5, m_ConfigOld.m_Slot[SLOT5]); GetCardMgr().Insert(SLOT5, m_ConfigOld.m_Slot[SLOT5]);
HD_SetEnabled(m_ConfigOld.m_bEnableHDD); HD_SetEnabled(m_ConfigOld.m_bEnableHDD);
sg_PropertySheet.SetTheFreezesF8Rom(m_ConfigOld.m_bEnableTheFreezesF8Rom); sg_PropertySheet.SetTheFreezesF8Rom(m_ConfigOld.m_bEnableTheFreezesF8Rom);
SetVideoRefreshRate(m_ConfigOld.m_videoRefreshRate); SetVideoRefreshRate(m_ConfigOld.m_videoRefreshRate);

View file

@ -3768,10 +3768,10 @@ Update_t CmdDisk ( int nArgs)
if (! nArgs) if (! nArgs)
return HelpLastCommand(); return HelpLastCommand();
if (g_CardMgr.QuerySlot(SLOT6) != CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) != CT_Disk2)
return ConsoleDisplayError("No DiskII card in slot-6"); return ConsoleDisplayError("No DiskII card in slot-6");
Disk2InterfaceCard& diskCard = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)); Disk2InterfaceCard& diskCard = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6));
// check for info command // check for info command
int iParam = 0; int iParam = 0;

View file

@ -38,9 +38,9 @@ bool Disk2CardManager::IsConditionForFullSpeed(void)
{ {
for (UINT i = 0; i < NUM_SLOTS; i++) for (UINT i = 0; i < NUM_SLOTS; i++)
{ {
if (g_CardMgr.QuerySlot(i) == CT_Disk2) if (GetCardMgr().QuerySlot(i) == CT_Disk2)
{ {
if (dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).IsConditionForFullSpeed()) if (dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).IsConditionForFullSpeed())
return true; // if any card is true then the condition for full-speed is true return true; // if any card is true then the condition for full-speed is true
} }
} }
@ -52,9 +52,9 @@ void Disk2CardManager::UpdateDriveState(UINT cycles)
{ {
for (UINT i = 0; i < NUM_SLOTS; i++) for (UINT i = 0; i < NUM_SLOTS; i++)
{ {
if (g_CardMgr.QuerySlot(i) == CT_Disk2) if (GetCardMgr().QuerySlot(i) == CT_Disk2)
{ {
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).UpdateDriveState(cycles); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).UpdateDriveState(cycles);
} }
} }
} }
@ -63,9 +63,9 @@ void Disk2CardManager::Reset(const bool powerCycle /*=false*/)
{ {
for (UINT i = 0; i < NUM_SLOTS; i++) for (UINT i = 0; i < NUM_SLOTS; i++)
{ {
if (g_CardMgr.QuerySlot(i) == CT_Disk2) if (GetCardMgr().QuerySlot(i) == CT_Disk2)
{ {
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).Reset(powerCycle); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).Reset(powerCycle);
} }
} }
} }
@ -74,10 +74,10 @@ bool Disk2CardManager::GetEnhanceDisk(void)
{ {
for (UINT i = 0; i < NUM_SLOTS; i++) for (UINT i = 0; i < NUM_SLOTS; i++)
{ {
if (g_CardMgr.QuerySlot(i) == CT_Disk2) if (GetCardMgr().QuerySlot(i) == CT_Disk2)
{ {
// All Disk2 cards should have the same setting, so just return the state of the first card // All Disk2 cards should have the same setting, so just return the state of the first card
return dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).GetEnhanceDisk(); return dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).GetEnhanceDisk();
} }
} }
return false; return false;
@ -87,9 +87,9 @@ void Disk2CardManager::SetEnhanceDisk(bool enhanceDisk)
{ {
for (UINT i = 0; i < NUM_SLOTS; i++) for (UINT i = 0; i < NUM_SLOTS; i++)
{ {
if (g_CardMgr.QuerySlot(i) == CT_Disk2) if (GetCardMgr().QuerySlot(i) == CT_Disk2)
{ {
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).SetEnhanceDisk(enhanceDisk); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).SetEnhanceDisk(enhanceDisk);
} }
} }
} }
@ -100,10 +100,10 @@ void Disk2CardManager::LoadLastDiskImage(void)
{ {
if (i != SLOT6) continue; // FIXME if (i != SLOT6) continue; // FIXME
if (g_CardMgr.QuerySlot(i) == CT_Disk2) if (GetCardMgr().QuerySlot(i) == CT_Disk2)
{ {
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).LoadLastDiskImage(DRIVE_1); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).LoadLastDiskImage(DRIVE_1);
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).LoadLastDiskImage(DRIVE_2); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).LoadLastDiskImage(DRIVE_2);
} }
} }
} }
@ -112,9 +112,9 @@ void Disk2CardManager::Destroy(void)
{ {
for (UINT i = 0; i < NUM_SLOTS; i++) for (UINT i = 0; i < NUM_SLOTS; i++)
{ {
if (g_CardMgr.QuerySlot(i) == CT_Disk2) if (GetCardMgr().QuerySlot(i) == CT_Disk2)
{ {
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).Destroy(); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).Destroy();
} }
} }
} }
@ -123,10 +123,10 @@ bool Disk2CardManager::IsAnyFirmware13Sector(void)
{ {
for (UINT i = 0; i < NUM_SLOTS; i++) for (UINT i = 0; i < NUM_SLOTS; i++)
{ {
if (g_CardMgr.QuerySlot(i) == CT_Disk2) if (GetCardMgr().QuerySlot(i) == CT_Disk2)
{ {
// If any Disk2 card has 13-sector firmware then return true // If any Disk2 card has 13-sector firmware then return true
if (dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).GetCurrentFirmware() == 13) if (dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).GetCurrentFirmware() == 13)
return true; return true;
} }
} }

View file

@ -281,7 +281,7 @@ static void GetAppleWindowTitle()
g_pAppTitle += VideoGetAppWindowTitle(); g_pAppTitle += VideoGetAppWindowTitle();
if (g_CardMgr.GetDisk2CardMgr().IsAnyFirmware13Sector()) if (GetCardMgr().GetDisk2CardMgr().IsAnyFirmware13Sector())
g_pAppTitle += " (S6-13) "; g_pAppTitle += " (S6-13) ";
if (g_hCustomRomF8 != INVALID_HANDLE_VALUE) if (g_hCustomRomF8 != INVALID_HANDLE_VALUE)
@ -328,7 +328,7 @@ static void FrameShowCursor(BOOL bShow)
// . AppleWin's main window is activated/deactivated // . AppleWin's main window is activated/deactivated
static void RevealCursor() static void RevealCursor()
{ {
CMouseInterface* pMouseCard = g_CardMgr.GetMouseCard(); CMouseInterface* pMouseCard = GetCardMgr().GetMouseCard();
if (!pMouseCard || !pMouseCard->IsActiveAndEnabled()) if (!pMouseCard || !pMouseCard->IsActiveAndEnabled())
return; return;
@ -355,7 +355,7 @@ static void FullScreenRevealCursor(void)
if (!g_bIsFullScreen) if (!g_bIsFullScreen)
return; return;
if (g_CardMgr.IsMouseCardInstalled()) if (GetCardMgr().IsMouseCardInstalled())
return; return;
if (!g_bUsingCursor && !g_bShowingCursor) if (!g_bUsingCursor && !g_bShowingCursor)
@ -521,8 +521,8 @@ static void DrawButton (HDC passdc, int number) {
SetTextAlign(dc,TA_CENTER | TA_TOP); SetTextAlign(dc,TA_CENTER | TA_TOP);
SetBkMode(dc,TRANSPARENT); SetBkMode(dc,TRANSPARENT);
LPCTSTR pszBaseName = (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2) LPCTSTR pszBaseName = (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
? dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).GetBaseName(number-BTN_DRIVE1).c_str() ? dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).GetBaseName(number-BTN_DRIVE1).c_str()
: ""; : "";
ExtTextOut(dc,x+offset+22,rect.top,ETO_CLIPPED,&rect, ExtTextOut(dc,x+offset+22,rect.top,ETO_CLIPPED,&rect,
@ -717,15 +717,15 @@ void FrameDrawDiskLEDS( HDC passdc )
g_eStatusDrive2 = DISK_STATUS_OFF; g_eStatusDrive2 = DISK_STATUS_OFF;
// Slot6 drive takes priority unless it's off: // Slot6 drive takes priority unless it's off:
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).GetLightStatus(&g_eStatusDrive1, &g_eStatusDrive2); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).GetLightStatus(&g_eStatusDrive1, &g_eStatusDrive2);
// Slot5: // Slot5:
{ {
Disk_Status_e eDrive1StatusSlot5 = DISK_STATUS_OFF; Disk_Status_e eDrive1StatusSlot5 = DISK_STATUS_OFF;
Disk_Status_e eDrive2StatusSlot5 = DISK_STATUS_OFF; Disk_Status_e eDrive2StatusSlot5 = DISK_STATUS_OFF;
if (g_CardMgr.QuerySlot(SLOT5) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT5)).GetLightStatus(&eDrive1StatusSlot5, &eDrive2StatusSlot5); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT5)).GetLightStatus(&eDrive1StatusSlot5, &eDrive2StatusSlot5);
if (g_eStatusDrive1 == DISK_STATUS_OFF) g_eStatusDrive1 = eDrive1StatusSlot5; if (g_eStatusDrive1 == DISK_STATUS_OFF) g_eStatusDrive1 = eDrive1StatusSlot5;
if (g_eStatusDrive2 == DISK_STATUS_OFF) g_eStatusDrive2 = eDrive2StatusSlot5; if (g_eStatusDrive2 == DISK_STATUS_OFF) g_eStatusDrive2 = eDrive2StatusSlot5;
@ -783,10 +783,10 @@ void FrameDrawDiskStatus( HDC passdc )
// Sector $B7ED LC1 $D357 // Sector $B7ED LC1 $D357
// RWTS LC1 $D300 // RWTS LC1 $D300
if (g_CardMgr.QuerySlot(SLOT6) != CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) != CT_Disk2)
return; return;
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)); Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6));
int nActiveFloppy = disk2Card.GetCurrentDrive(); int nActiveFloppy = disk2Card.GetCurrentDrive();
int nDisk1Track = disk2Card.GetTrack(DRIVE_1); int nDisk1Track = disk2Card.GetTrack(DRIVE_1);
int nDisk2Track = disk2Card.GetTrack(DRIVE_2); int nDisk2Track = disk2Card.GetTrack(DRIVE_2);
@ -1149,13 +1149,13 @@ LRESULT CALLBACK FrameWndProc (
Snapshot_Shutdown(); Snapshot_Shutdown();
DebugDestroy(); DebugDestroy();
if (!g_bRestart) { if (!g_bRestart) {
g_CardMgr.GetDisk2CardMgr().Destroy(); GetCardMgr().GetDisk2CardMgr().Destroy();
ImageDestroy(); ImageDestroy();
HD_Destroy(); HD_Destroy();
} }
PrintDestroy(); PrintDestroy();
if (g_CardMgr.IsSSCInstalled()) if (GetCardMgr().IsSSCInstalled())
g_CardMgr.GetSSC()->CommDestroy(); GetCardMgr().GetSSC()->CommDestroy();
CpuDestroy(); CpuDestroy();
MemDestroy(); MemDestroy();
SpkrDestroy(); SpkrDestroy();
@ -1207,9 +1207,9 @@ LRESULT CALLBACK FrameWndProc (
case WM_DDE_EXECUTE: case WM_DDE_EXECUTE:
{ {
LogFileOutput("WM_DDE_EXECUTE\n"); LogFileOutput("WM_DDE_EXECUTE\n");
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
{ {
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)); Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6));
LPTSTR filename = (LPTSTR)GlobalLock((HGLOBAL)lparam); LPTSTR filename = (LPTSTR)GlobalLock((HGLOBAL)lparam);
ImageError_e Error = disk2Card.InsertDisk(DRIVE_1, filename, IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE); ImageError_e Error = disk2Card.InsertDisk(DRIVE_1, filename, IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
if (Error == eIMAGE_ERROR_NONE) if (Error == eIMAGE_ERROR_NONE)
@ -1235,9 +1235,9 @@ LRESULT CALLBACK FrameWndProc (
case WM_DROPFILES: case WM_DROPFILES:
{ {
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
{ {
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)); Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6));
TCHAR filename[MAX_PATH]; TCHAR filename[MAX_PATH];
DragQueryFile((HDROP)wparam,0,filename,sizeof(filename)); DragQueryFile((HDROP)wparam,0,filename,sizeof(filename));
POINT point; POINT point;
@ -1569,7 +1569,7 @@ LRESULT CALLBACK FrameWndProc (
DrawButton((HDC)0,buttonactive); DrawButton((HDC)0,buttonactive);
SetCapture(window); SetCapture(window);
} }
else if (g_bUsingCursor && !g_CardMgr.IsMouseCardInstalled()) else if (g_bUsingCursor && !GetCardMgr().IsMouseCardInstalled())
{ {
if (wparam & (MK_CONTROL | MK_SHIFT)) if (wparam & (MK_CONTROL | MK_SHIFT))
{ {
@ -1584,7 +1584,7 @@ LRESULT CALLBACK FrameWndProc (
{ {
SetUsingCursor(TRUE); SetUsingCursor(TRUE);
} }
else if (g_CardMgr.IsMouseCardInstalled()) else if (GetCardMgr().IsMouseCardInstalled())
{ {
if (wparam & (MK_CONTROL | MK_SHIFT)) if (wparam & (MK_CONTROL | MK_SHIFT))
{ {
@ -1592,7 +1592,7 @@ LRESULT CALLBACK FrameWndProc (
} }
else if (g_nAppMode == MODE_RUNNING || g_nAppMode == MODE_STEPPING) else if (g_nAppMode == MODE_RUNNING || g_nAppMode == MODE_STEPPING)
{ {
CMouseInterface* pMouseCard = g_CardMgr.GetMouseCard(); CMouseInterface* pMouseCard = GetCardMgr().GetMouseCard();
if (pMouseCard) if (pMouseCard)
{ {
@ -1634,13 +1634,13 @@ LRESULT CALLBACK FrameWndProc (
} }
buttonactive = -1; buttonactive = -1;
} }
else if (g_bUsingCursor && !g_CardMgr.IsMouseCardInstalled()) else if (g_bUsingCursor && !GetCardMgr().IsMouseCardInstalled())
{ {
JoySetButton(BUTTON0, BUTTON_UP); JoySetButton(BUTTON0, BUTTON_UP);
} }
else if (g_CardMgr.IsMouseCardInstalled()) else if (GetCardMgr().IsMouseCardInstalled())
{ {
g_CardMgr.GetMouseCard()->SetButton(BUTTON0, BUTTON_UP); GetCardMgr().GetMouseCard()->SetButton(BUTTON0, BUTTON_UP);
} }
RelayEvent(WM_LBUTTONUP,wparam,lparam); RelayEvent(WM_LBUTTONUP,wparam,lparam);
break; break;
@ -1668,12 +1668,12 @@ LRESULT CALLBACK FrameWndProc (
if (buttonover != -1) if (buttonover != -1)
DrawButton((HDC)0,buttonover); DrawButton((HDC)0,buttonover);
} }
else if (g_bUsingCursor && !g_CardMgr.IsMouseCardInstalled()) else if (g_bUsingCursor && !GetCardMgr().IsMouseCardInstalled())
{ {
DrawCrosshairs(x,y); DrawCrosshairs(x,y);
JoySetPosition(x-viewportx-2, g_nViewportCX-4, y-viewporty-2, g_nViewportCY-4); JoySetPosition(x-viewportx-2, g_nViewportCX-4, y-viewporty-2, g_nViewportCY-4);
} }
else if (g_CardMgr.IsMouseCardInstalled() && g_CardMgr.GetMouseCard()->IsActiveAndEnabled() && (g_nAppMode == MODE_RUNNING || g_nAppMode == MODE_STEPPING)) else if (GetCardMgr().IsMouseCardInstalled() && GetCardMgr().GetMouseCard()->IsActiveAndEnabled() && (g_nAppMode == MODE_RUNNING || g_nAppMode == MODE_STEPPING))
{ {
if (g_bLastCursorInAppleViewport) if (g_bLastCursorInAppleViewport)
break; break;
@ -1706,7 +1706,7 @@ LRESULT CALLBACK FrameWndProc (
if (wparam == IDEVENT_TIMER_MOUSE) if (wparam == IDEVENT_TIMER_MOUSE)
{ {
// NB. Need to check /g_bAppActive/ since WM_TIMER events still occur after AppleWin app has lost focus // NB. Need to check /g_bAppActive/ since WM_TIMER events still occur after AppleWin app has lost focus
if (g_bAppActive && g_CardMgr.IsMouseCardInstalled() && g_CardMgr.GetMouseCard()->IsActiveAndEnabled() && (g_nAppMode == MODE_RUNNING || g_nAppMode == MODE_STEPPING)) if (g_bAppActive && GetCardMgr().IsMouseCardInstalled() && GetCardMgr().GetMouseCard()->IsActiveAndEnabled() && (g_nAppMode == MODE_RUNNING || g_nAppMode == MODE_STEPPING))
{ {
if (!g_bLastCursorInAppleViewport) if (!g_bLastCursorInAppleViewport)
break; break;
@ -1717,7 +1717,7 @@ LRESULT CALLBACK FrameWndProc (
long dX,dY; long dX,dY;
if (DIMouse::ReadImmediateData(&dX, &dY) == S_OK) if (DIMouse::ReadImmediateData(&dX, &dY) == S_OK)
g_CardMgr.GetMouseCard()->SetPositionRel(dX, dY, &iOutOfBoundsX, &iOutOfBoundsY); GetCardMgr().GetMouseCard()->SetPositionRel(dX, dY, &iOutOfBoundsX, &iOutOfBoundsY);
UpdateMouseInAppleViewport(iOutOfBoundsX, iOutOfBoundsY); UpdateMouseInAppleViewport(iOutOfBoundsX, iOutOfBoundsY);
} }
@ -1725,7 +1725,7 @@ LRESULT CALLBACK FrameWndProc (
else if (wparam == IDEVENT_TIMER_100MSEC) // GH#504 else if (wparam == IDEVENT_TIMER_100MSEC) // GH#504
{ {
if (g_bIsFullScreen if (g_bIsFullScreen
&& !g_CardMgr.IsMouseCardInstalled() // Don't interfere if there's a mousecard present! && !GetCardMgr().IsMouseCardInstalled() // Don't interfere if there's a mousecard present!
&& !g_bUsingCursor // Using mouse for joystick emulation (or mousecard restricted to window) && !g_bUsingCursor // Using mouse for joystick emulation (or mousecard restricted to window)
&& g_bShowingCursor && g_bShowingCursor
&& g_bFrameActive) // Frame inactive when eg. Config or 'Select Disk Image' dialogs are opened && g_bFrameActive) // Frame inactive when eg. Config or 'Select Disk Image' dialogs are opened
@ -1766,10 +1766,10 @@ LRESULT CALLBACK FrameWndProc (
Disk2InterfaceCard *pDisk2Slot5 = NULL, *pDisk2Slot6 = NULL; Disk2InterfaceCard *pDisk2Slot5 = NULL, *pDisk2Slot6 = NULL;
if (g_CardMgr.QuerySlot(SLOT5) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
pDisk2Slot5 = dynamic_cast<Disk2InterfaceCard*>(g_CardMgr.GetObj(SLOT5)); pDisk2Slot5 = dynamic_cast<Disk2InterfaceCard*>(GetCardMgr().GetObj(SLOT5));
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
pDisk2Slot6 = dynamic_cast<Disk2InterfaceCard*>(g_CardMgr.GetObj(SLOT6)); pDisk2Slot6 = dynamic_cast<Disk2InterfaceCard*>(GetCardMgr().GetObj(SLOT6));
std::string slot5 = pDisk2Slot5 ? pDisk2Slot5->GetFullDiskFilename(((LPNMTTDISPINFO)lparam)->hdr.idFrom) : ""; std::string slot5 = pDisk2Slot5 ? pDisk2Slot5->GetFullDiskFilename(((LPNMTTDISPINFO)lparam)->hdr.idFrom) : "";
std::string slot6 = pDisk2Slot6 ? pDisk2Slot6->GetFullDiskFilename(((LPNMTTDISPINFO)lparam)->hdr.idFrom) : ""; std::string slot6 = pDisk2Slot6 ? pDisk2Slot6->GetFullDiskFilename(((LPNMTTDISPINFO)lparam)->hdr.idFrom) : "";
@ -1845,10 +1845,10 @@ LRESULT CALLBACK FrameWndProc (
} }
} }
if (g_bUsingCursor && !g_CardMgr.IsMouseCardInstalled()) if (g_bUsingCursor && !GetCardMgr().IsMouseCardInstalled())
JoySetButton(BUTTON1, (message == WM_RBUTTONDOWN) ? BUTTON_DOWN : BUTTON_UP); JoySetButton(BUTTON1, (message == WM_RBUTTONDOWN) ? BUTTON_DOWN : BUTTON_UP);
else if (g_CardMgr.IsMouseCardInstalled()) else if (GetCardMgr().IsMouseCardInstalled())
g_CardMgr.GetMouseCard()->SetButton(BUTTON1, (message == WM_RBUTTONDOWN) ? BUTTON_DOWN : BUTTON_UP); GetCardMgr().GetMouseCard()->SetButton(BUTTON1, (message == WM_RBUTTONDOWN) ? BUTTON_DOWN : BUTTON_UP);
RelayEvent(message,wparam,lparam); RelayEvent(message,wparam,lparam);
break; break;
@ -1948,13 +1948,13 @@ LRESULT CALLBACK FrameWndProc (
case WSAECONNRESET: case WSAECONNRESET:
case WSAENOTCONN: case WSAENOTCONN:
case WSAETIMEDOUT: case WSAETIMEDOUT:
if (g_CardMgr.IsSSCInstalled()) if (GetCardMgr().IsSSCInstalled())
g_CardMgr.GetSSC()->CommTcpSerialClose(); GetCardMgr().GetSSC()->CommTcpSerialClose();
break; break;
default: default:
if (g_CardMgr.IsSSCInstalled()) if (GetCardMgr().IsSSCInstalled())
g_CardMgr.GetSSC()->CommTcpSerialCleanup(); GetCardMgr().GetSSC()->CommTcpSerialCleanup();
break; break;
} }
} }
@ -1964,18 +1964,18 @@ LRESULT CALLBACK FrameWndProc (
switch(wSelectEvent) switch(wSelectEvent)
{ {
case FD_ACCEPT: case FD_ACCEPT:
if (g_CardMgr.IsSSCInstalled()) if (GetCardMgr().IsSSCInstalled())
g_CardMgr.GetSSC()->CommTcpSerialAccept(); GetCardMgr().GetSSC()->CommTcpSerialAccept();
break; break;
case FD_CLOSE: case FD_CLOSE:
if (g_CardMgr.IsSSCInstalled()) if (GetCardMgr().IsSSCInstalled())
g_CardMgr.GetSSC()->CommTcpSerialClose(); GetCardMgr().GetSSC()->CommTcpSerialClose();
break; break;
case FD_READ: case FD_READ:
if (g_CardMgr.IsSSCInstalled()) if (GetCardMgr().IsSSCInstalled())
g_CardMgr.GetSSC()->CommTcpSerialReceive(); GetCardMgr().GetSSC()->CommTcpSerialReceive();
break; break;
} }
} }
@ -2090,8 +2090,8 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
if (g_nAppMode == MODE_LOGO) if (g_nAppMode == MODE_LOGO)
{ {
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).Boot(); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).Boot();
LogFileTimeUntilFirstKeyReadReset(); LogFileTimeUntilFirstKeyReadReset();
g_nAppMode = MODE_RUNNING; g_nAppMode = MODE_RUNNING;
@ -2115,18 +2115,18 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
case BTN_DRIVE1: case BTN_DRIVE1:
case BTN_DRIVE2: case BTN_DRIVE2:
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
{ {
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).UserSelectNewDiskImage(button-BTN_DRIVE1); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).UserSelectNewDiskImage(button-BTN_DRIVE1);
if (!g_bIsFullScreen) if (!g_bIsFullScreen)
DrawButton((HDC)0,button); DrawButton((HDC)0,button);
} }
break; break;
case BTN_DRIVESWAP: case BTN_DRIVESWAP:
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
{ {
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).DriveSwap(); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).DriveSwap();
} }
break; break;
@ -2182,10 +2182,10 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive) void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
{ {
if (g_CardMgr.QuerySlot(SLOT6) != CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) != CT_Disk2)
return; return;
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)); Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6));
// This is the default installation path of CiderPress. // This is the default installation path of CiderPress.
// It shall not be left blank, otherwise an explorer window will be open. // It shall not be left blank, otherwise an explorer window will be open.
@ -2324,24 +2324,24 @@ void RelayEvent (UINT message, WPARAM wparam, LPARAM lparam) {
// todo: consolidate CtrlReset() and ResetMachineState() // todo: consolidate CtrlReset() and ResetMachineState()
void ResetMachineState () void ResetMachineState ()
{ {
g_CardMgr.GetDisk2CardMgr().Reset(true); GetCardMgr().GetDisk2CardMgr().Reset(true);
HD_Reset(); HD_Reset();
g_bFullSpeed = 0; // Might've hit reset in middle of InternalCpuExecute() - so beep may get (partially) muted g_bFullSpeed = 0; // Might've hit reset in middle of InternalCpuExecute() - so beep may get (partially) muted
MemReset(); // calls CpuInitialize(), CNoSlotClock.Reset() MemReset(); // calls CpuInitialize(), CNoSlotClock.Reset()
PravetsReset(); PravetsReset();
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).Boot(); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).Boot();
VideoResetState(); VideoResetState();
KeybReset(); KeybReset();
if (g_CardMgr.IsSSCInstalled()) if (GetCardMgr().IsSSCInstalled())
g_CardMgr.GetSSC()->CommReset(); GetCardMgr().GetSSC()->CommReset();
PrintReset(); PrintReset();
JoyReset(); JoyReset();
MB_Reset(); MB_Reset();
SpkrReset(); SpkrReset();
if (g_CardMgr.IsMouseCardInstalled()) if (GetCardMgr().IsMouseCardInstalled())
g_CardMgr.GetMouseCard()->Reset(); GetCardMgr().GetMouseCard()->Reset();
SetActiveCpu( GetMainCpu() ); SetActiveCpu( GetMainCpu() );
#ifdef USE_SPEECH_API #ifdef USE_SPEECH_API
g_Speech.Reset(); g_Speech.Reset();
@ -2379,14 +2379,14 @@ void CtrlReset()
} }
PravetsReset(); PravetsReset();
g_CardMgr.GetDisk2CardMgr().Reset(); GetCardMgr().GetDisk2CardMgr().Reset();
HD_Reset(); HD_Reset();
KeybReset(); KeybReset();
if (g_CardMgr.IsSSCInstalled()) if (GetCardMgr().IsSSCInstalled())
g_CardMgr.GetSSC()->CommReset(); GetCardMgr().GetSSC()->CommReset();
MB_Reset(); MB_Reset();
if (g_CardMgr.IsMouseCardInstalled()) if (GetCardMgr().IsMouseCardInstalled())
g_CardMgr.GetMouseCard()->Reset(); // Deassert any pending IRQs - GH#514 GetCardMgr().GetMouseCard()->Reset(); // Deassert any pending IRQs - GH#514
#ifdef USE_SPEECH_API #ifdef USE_SPEECH_API
g_Speech.Reset(); g_Speech.Reset();
#endif #endif
@ -2792,8 +2792,8 @@ static bool FileExists(std::string strFilename)
// . UpdateMouseInAppleViewport() is called and inside Apple screen // . UpdateMouseInAppleViewport() is called and inside Apple screen
void FrameSetCursorPosByMousePos() void FrameSetCursorPosByMousePos()
{ {
// _ASSERT(g_CardMgr.IsMouseCardInstalled()); // CMouseInterface::ctor calls this function, ie. before g_CardMgr::m_pMouseCard is setup // _ASSERT(GetCardMgr().IsMouseCardInstalled()); // CMouseInterface::ctor calls this function, ie. before GetCardMgr()::m_pMouseCard is setup
if (!g_CardMgr.IsMouseCardInstalled()) if (!GetCardMgr().IsMouseCardInstalled())
return; return;
if (!g_hFrameWindow || g_bShowingCursor) if (!g_hFrameWindow || g_bShowingCursor)
@ -2801,7 +2801,7 @@ void FrameSetCursorPosByMousePos()
int iX, iMinX, iMaxX; int iX, iMinX, iMaxX;
int iY, iMinY, iMaxY; int iY, iMinY, iMaxY;
g_CardMgr.GetMouseCard()->GetXY(iX, iMinX, iMaxX, iY, iMinY, iMaxY); GetCardMgr().GetMouseCard()->GetXY(iX, iMinX, iMaxX, iY, iMinY, iMaxY);
float fScaleX = (float)(iX-iMinX) / ((float)(iMaxX-iMinX)); float fScaleX = (float)(iX-iMinX) / ((float)(iMaxX-iMinX));
float fScaleY = (float)(iY-iMinY) / ((float)(iMaxY-iMinY)); float fScaleY = (float)(iY-iMinY) / ((float)(iMaxY-iMinY));
@ -2831,8 +2831,8 @@ void FrameSetCursorPosByMousePos()
// . NB. Not called when leaving & mouse clipped to Apple screen area // . NB. Not called when leaving & mouse clipped to Apple screen area
static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeavingAppleScreen) static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeavingAppleScreen)
{ {
_ASSERT(g_CardMgr.IsMouseCardInstalled()); _ASSERT(GetCardMgr().IsMouseCardInstalled());
if (!g_CardMgr.IsMouseCardInstalled()) if (!GetCardMgr().IsMouseCardInstalled())
return; return;
// char szDbg[200]; // char szDbg[200];
@ -2841,7 +2841,7 @@ static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeav
int iX, iMinX, iMaxX; int iX, iMinX, iMaxX;
int iY, iMinY, iMaxY; int iY, iMinY, iMaxY;
g_CardMgr.GetMouseCard()->GetXY(iX, iMinX, iMaxX, iY, iMinY, iMaxY); GetCardMgr().GetMouseCard()->GetXY(iX, iMinX, iMaxX, iY, iMinY, iMaxY);
if (bLeavingAppleScreen) if (bLeavingAppleScreen)
{ {
@ -2879,7 +2879,7 @@ static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeav
int iAppleX = iMinX + (int)(fScaleX * (float)(iMaxX-iMinX)); int iAppleX = iMinX + (int)(fScaleX * (float)(iMaxX-iMinX));
int iAppleY = iMinY + (int)(fScaleY * (float)(iMaxY-iMinY)); int iAppleY = iMinY + (int)(fScaleY * (float)(iMaxY-iMinY));
g_CardMgr.GetMouseCard()->SetCursorPos(iAppleX, iAppleY); // Set new entry position GetCardMgr().GetMouseCard()->SetCursorPos(iAppleX, iAppleY); // Set new entry position
// Dump initial deltas (otherwise can get big deltas since last read when entering Apple screen area) // Dump initial deltas (otherwise can get big deltas since last read when entering Apple screen area)
DIMouse::ReadImmediateData(); DIMouse::ReadImmediateData();
@ -2888,8 +2888,8 @@ static void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeav
static void DrawCrosshairsMouse() static void DrawCrosshairsMouse()
{ {
_ASSERT(g_CardMgr.IsMouseCardInstalled()); _ASSERT(GetCardMgr().IsMouseCardInstalled());
if (!g_CardMgr.IsMouseCardInstalled()) if (!GetCardMgr().IsMouseCardInstalled())
return; return;
if (!sg_PropertySheet.GetMouseShowCrosshair()) if (!sg_PropertySheet.GetMouseShowCrosshair())
@ -2897,7 +2897,7 @@ static void DrawCrosshairsMouse()
int iX, iMinX, iMaxX; int iX, iMinX, iMaxX;
int iY, iMinY, iMaxY; int iY, iMinY, iMaxY;
g_CardMgr.GetMouseCard()->GetXY(iX, iMinX, iMaxX, iY, iMinY, iMaxY); GetCardMgr().GetMouseCard()->GetXY(iX, iMinX, iMaxX, iY, iMinY, iMaxY);
_ASSERT(iMinX == 0 && iMinY == 0); _ASSERT(iMinX == 0 && iMinY == 0);
float fScaleX = (float)(iX-iMinX) / ((float)(iMaxX-iMinX)); float fScaleX = (float)(iX-iMinX) / ((float)(iMaxX-iMinX));

View file

@ -279,9 +279,9 @@ void HD_SetEnabled(const bool bEnabled)
g_bHD_Enabled = bEnabled; g_bHD_Enabled = bEnabled;
if (bEnabled) if (bEnabled)
g_CardMgr.Insert(SLOT7, CT_GenericHDD); GetCardMgr().Insert(SLOT7, CT_GenericHDD);
else else
g_CardMgr.Remove(SLOT7); GetCardMgr().Remove(SLOT7);
#if 0 #if 0
// FIXME: For LoadConfiguration(), g_uSlot=7 (see definition at start of file) // FIXME: For LoadConfiguration(), g_uSlot=7 (see definition at start of file)

View file

@ -305,8 +305,8 @@ void SetExpansionMemType(const SS_CARDTYPE type)
newSlotAuxCard = type; newSlotAuxCard = type;
} }
g_CardMgr.Insert(SLOT0, newSlot0Card); GetCardMgr().Insert(SLOT0, newSlot0Card);
g_CardMgr.InsertAux(newSlotAuxCard); GetCardMgr().InsertAux(newSlotAuxCard);
} }
void CreateLanguageCard(void) void CreateLanguageCard(void)
@ -316,9 +316,9 @@ void CreateLanguageCard(void)
if (IsApple2PlusOrClone(GetApple2Type())) if (IsApple2PlusOrClone(GetApple2Type()))
{ {
if (g_CardMgr.QuerySlot(SLOT0) == CT_Saturn128K) if (GetCardMgr().QuerySlot(SLOT0) == CT_Saturn128K)
g_pLanguageCard = new Saturn128K(g_uSaturnBanksFromCmdLine); g_pLanguageCard = new Saturn128K(g_uSaturnBanksFromCmdLine);
else if (g_CardMgr.QuerySlot(SLOT0) == CT_LanguageCard) else if (GetCardMgr().QuerySlot(SLOT0) == CT_LanguageCard)
g_pLanguageCard = new LanguageCardSlot0; g_pLanguageCard = new LanguageCardSlot0;
else else
g_pLanguageCard = NULL; g_pLanguageCard = NULL;
@ -332,9 +332,9 @@ void CreateLanguageCard(void)
SS_CARDTYPE GetCurrentExpansionMemType(void) SS_CARDTYPE GetCurrentExpansionMemType(void)
{ {
if (IsApple2PlusOrClone(GetApple2Type())) if (IsApple2PlusOrClone(GetApple2Type()))
return g_CardMgr.QuerySlot(SLOT0); return GetCardMgr().QuerySlot(SLOT0);
else else
return g_CardMgr.QueryAux(); return GetCardMgr().QueryAux();
} }
// //
@ -1077,7 +1077,7 @@ static void ResetPaging(BOOL initialize)
{ {
SetLastRamWrite(0); SetLastRamWrite(0);
if (IsApple2PlusOrClone(GetApple2Type()) && g_CardMgr.QuerySlot(SLOT0) == CT_Empty) if (IsApple2PlusOrClone(GetApple2Type()) && GetCardMgr().QuerySlot(SLOT0) == CT_Empty)
SetMemMode(0); SetMemMode(0);
else else
SetMemMode(LanguageCardUnit::kMemModeInitialState); SetMemMode(LanguageCardUnit::kMemModeInitialState);
@ -1495,7 +1495,7 @@ void MemInitialize()
SetExpansionMemTypeDefault(); SetExpansionMemTypeDefault();
#ifdef RAMWORKS #ifdef RAMWORKS
if (g_CardMgr.QueryAux() == CT_RamWorksIII) if (GetCardMgr().QueryAux() == CT_RamWorksIII)
{ {
// allocate memory for RAMWorks III - up to 8MB // allocate memory for RAMWorks III - up to 8MB
g_uActiveBank = 0; g_uActiveBank = 0;
@ -1606,7 +1606,7 @@ void MemInitializeCustomF8ROM(void)
const UINT F8RomSize = 0x800; const UINT F8RomSize = 0x800;
const UINT F8RomOffset = Apple2RomSize-F8RomSize; const UINT F8RomOffset = Apple2RomSize-F8RomSize;
if (IsApple2Original(GetApple2Type()) && g_CardMgr.QuerySlot(SLOT0) == CT_LanguageCard) if (IsApple2Original(GetApple2Type()) && GetCardMgr().QuerySlot(SLOT0) == CT_LanguageCard)
{ {
try try
{ {
@ -1729,13 +1729,13 @@ void MemInitializeIO(void)
else else
RegisterIoHandler(LanguageCardUnit::kSlot0, IO_Null, IO_Null, NULL, NULL, NULL, NULL); RegisterIoHandler(LanguageCardUnit::kSlot0, IO_Null, IO_Null, NULL, NULL, NULL, NULL);
if (g_CardMgr.QuerySlot(SLOT1) == CT_GenericPrinter) if (GetCardMgr().QuerySlot(SLOT1) == CT_GenericPrinter)
PrintLoadRom(pCxRomPeripheral, SLOT1); // $C100 : Parallel printer f/w PrintLoadRom(pCxRomPeripheral, SLOT1); // $C100 : Parallel printer f/w
if (g_CardMgr.QuerySlot(SLOT2) == CT_SSC) if (GetCardMgr().QuerySlot(SLOT2) == CT_SSC)
dynamic_cast<CSuperSerialCard&>(g_CardMgr.GetRef(SLOT2)).CommInitialize(pCxRomPeripheral, SLOT2); // $C200 : SSC dynamic_cast<CSuperSerialCard&>(GetCardMgr().GetRef(SLOT2)).CommInitialize(pCxRomPeripheral, SLOT2); // $C200 : SSC
if (g_CardMgr.QuerySlot(SLOT3) == CT_Uthernet) if (GetCardMgr().QuerySlot(SLOT3) == CT_Uthernet)
{ {
// Slot 3 contains the Uthernet card (which can coexist with an 80-col+Ram card in AUX slot) // Slot 3 contains the Uthernet card (which can coexist with an 80-col+Ram card in AUX slot)
// . Uthernet card has no ROM and only IO mapped at $C0Bx // . Uthernet card has no ROM and only IO mapped at $C0Bx
@ -1744,40 +1744,40 @@ void MemInitializeIO(void)
// Apple//e: Auxilary slot contains Extended 80 Column card or RamWorksIII card // Apple//e: Auxilary slot contains Extended 80 Column card or RamWorksIII card
if (g_CardMgr.QuerySlot(SLOT4) == CT_MouseInterface) if (GetCardMgr().QuerySlot(SLOT4) == CT_MouseInterface)
{ {
dynamic_cast<CMouseInterface&>(g_CardMgr.GetRef(SLOT4)).Initialize(pCxRomPeripheral, SLOT4); // $C400 : Mouse f/w dynamic_cast<CMouseInterface&>(GetCardMgr().GetRef(SLOT4)).Initialize(pCxRomPeripheral, SLOT4); // $C400 : Mouse f/w
} }
else if (g_CardMgr.QuerySlot(SLOT4) == CT_MockingboardC || g_CardMgr.QuerySlot(SLOT4) == CT_Phasor) else if (GetCardMgr().QuerySlot(SLOT4) == CT_MockingboardC || GetCardMgr().QuerySlot(SLOT4) == CT_Phasor)
{ {
MB_InitializeIO(pCxRomPeripheral, SLOT4, SLOT5); MB_InitializeIO(pCxRomPeripheral, SLOT4, SLOT5);
} }
else if (g_CardMgr.QuerySlot(SLOT4) == CT_Z80) else if (GetCardMgr().QuerySlot(SLOT4) == CT_Z80)
{ {
ConfigureSoftcard(pCxRomPeripheral, SLOT4); // $C400 : Z80 card ConfigureSoftcard(pCxRomPeripheral, SLOT4); // $C400 : Z80 card
} }
// else if (g_CardMgr.QuerySlot(SLOT4) == CT_GenericClock) // else if (GetCardMgr().QuerySlot(SLOT4) == CT_GenericClock)
// { // {
// LoadRom_Clock_Generic(pCxRomPeripheral, SLOT4); // LoadRom_Clock_Generic(pCxRomPeripheral, SLOT4);
// } // }
if (g_CardMgr.QuerySlot(SLOT5) == CT_Z80) if (GetCardMgr().QuerySlot(SLOT5) == CT_Z80)
{ {
ConfigureSoftcard(pCxRomPeripheral, SLOT5); // $C500 : Z80 card ConfigureSoftcard(pCxRomPeripheral, SLOT5); // $C500 : Z80 card
} }
else if (g_CardMgr.QuerySlot(SLOT5) == CT_SAM) else if (GetCardMgr().QuerySlot(SLOT5) == CT_SAM)
{ {
ConfigureSAM(pCxRomPeripheral, SLOT5); // $C500 : Z80 card ConfigureSAM(pCxRomPeripheral, SLOT5); // $C500 : Z80 card
} }
else if (g_CardMgr.QuerySlot(SLOT5) == CT_Disk2) else if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
{ {
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT5)).Initialize(pCxRomPeripheral, SLOT5); // $C500 : Disk][ card dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT5)).Initialize(pCxRomPeripheral, SLOT5); // $C500 : Disk][ card
} }
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).Initialize(pCxRomPeripheral, SLOT6); // $C600 : Disk][ card dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).Initialize(pCxRomPeripheral, SLOT6); // $C600 : Disk][ card
if (g_CardMgr.QuerySlot(SLOT7) == CT_GenericHDD) if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
HD_Load_Rom(pCxRomPeripheral, SLOT7); // $C700 : HDD f/w HD_Load_Rom(pCxRomPeripheral, SLOT7); // $C700 : HDD f/w
} }
@ -2475,8 +2475,8 @@ static void MemLoadSnapshotAuxCommon(YamlLoadHelper& yamlLoadHelper, const std::
yamlLoadHelper.PopMap(); yamlLoadHelper.PopMap();
} }
g_CardMgr.Remove(SLOT0); GetCardMgr().Remove(SLOT0);
g_CardMgr.InsertAux(type); GetCardMgr().InsertAux(type);
memaux = RWpages[g_uActiveBank]; memaux = RWpages[g_uActiveBank];
// NB. MemUpdatePaging(TRUE) called at end of Snapshot_LoadState_v2() // NB. MemUpdatePaging(TRUE) called at end of Snapshot_LoadState_v2()

View file

@ -1933,21 +1933,21 @@ void MB_InitializeIO(LPBYTE pCxRomPeripheral, UINT uSlot4, UINT uSlot5)
// Phasor : Slot 4 // Phasor : Slot 4
// <other> : Slot 4 & 5 // <other> : Slot 4 & 5
if (g_CardMgr.QuerySlot(SLOT4) != CT_MockingboardC && g_CardMgr.QuerySlot(SLOT4) != CT_Phasor) if (GetCardMgr().QuerySlot(SLOT4) != CT_MockingboardC && GetCardMgr().QuerySlot(SLOT4) != CT_Phasor)
{ {
MB_SetSoundcardType(CT_Empty); MB_SetSoundcardType(CT_Empty);
return; return;
} }
if (g_CardMgr.QuerySlot(SLOT4) == CT_MockingboardC) if (GetCardMgr().QuerySlot(SLOT4) == CT_MockingboardC)
RegisterIoHandler(uSlot4, IO_Null, IO_Null, MB_Read, MB_Write, NULL, NULL); RegisterIoHandler(uSlot4, IO_Null, IO_Null, MB_Read, MB_Write, NULL, NULL);
else // Phasor else // Phasor
RegisterIoHandler(uSlot4, PhasorIO, PhasorIO, MB_Read, MB_Write, NULL, NULL); RegisterIoHandler(uSlot4, PhasorIO, PhasorIO, MB_Read, MB_Write, NULL, NULL);
if (g_CardMgr.QuerySlot(SLOT5) == CT_MockingboardC) if (GetCardMgr().QuerySlot(SLOT5) == CT_MockingboardC)
RegisterIoHandler(uSlot5, IO_Null, IO_Null, MB_Read, MB_Write, NULL, NULL); RegisterIoHandler(uSlot5, IO_Null, IO_Null, MB_Read, MB_Write, NULL, NULL);
MB_SetSoundcardType(g_CardMgr.QuerySlot(SLOT4)); MB_SetSoundcardType(GetCardMgr().QuerySlot(SLOT4));
if (g_bDisableDirectSound || g_bDisableDirectSoundMockingboard) if (g_bDisableDirectSound || g_bDisableDirectSoundMockingboard)
return; return;

View file

@ -490,7 +490,7 @@ void CMouseInterface::OnMouseEvent(bool bEventVBL)
int CMouseInterface::SyncEventCallback(int id, int cycles, ULONG /*uExecutedCycles*/) int CMouseInterface::SyncEventCallback(int id, int cycles, ULONG /*uExecutedCycles*/)
{ {
g_CardMgr.GetMouseCard()->OnMouseEvent(true); GetCardMgr().GetMouseCard()->OnMouseEvent(true);
return NTSC_GetCyclesUntilVBlank(cycles); return NTSC_GetCyclesUntilVBlank(cycles);
} }

View file

@ -283,14 +283,14 @@ static void ParseSlots(YamlLoadHelper& yamlLoadHelper, UINT unitVersion)
else if (card == CSuperSerialCard::GetSnapshotCardName()) else if (card == CSuperSerialCard::GetSnapshotCardName())
{ {
type = CT_SSC; type = CT_SSC;
g_CardMgr.Insert(slot, type); GetCardMgr().Insert(slot, type);
bRes = dynamic_cast<CSuperSerialCard&>(g_CardMgr.GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion); bRes = dynamic_cast<CSuperSerialCard&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
} }
else if (card == CMouseInterface::GetSnapshotCardName()) else if (card == CMouseInterface::GetSnapshotCardName())
{ {
type = CT_MouseInterface; type = CT_MouseInterface;
g_CardMgr.Insert(slot, type); GetCardMgr().Insert(slot, type);
bRes = dynamic_cast<CMouseInterface&>(g_CardMgr.GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion); bRes = dynamic_cast<CMouseInterface&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
} }
else if (card == Z80_GetSnapshotCardName()) else if (card == Z80_GetSnapshotCardName())
{ {
@ -310,8 +310,8 @@ static void ParseSlots(YamlLoadHelper& yamlLoadHelper, UINT unitVersion)
else if (card == Disk2InterfaceCard::GetSnapshotCardName()) else if (card == Disk2InterfaceCard::GetSnapshotCardName())
{ {
type = CT_Disk2; type = CT_Disk2;
g_CardMgr.Insert(slot, type); GetCardMgr().Insert(slot, type);
bRes = dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion); bRes = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
} }
else if (card == HD_GetSnapshotCardName()) else if (card == HD_GetSnapshotCardName())
{ {
@ -423,23 +423,23 @@ static void Snapshot_LoadState_v2(void)
MemReset(); // Also calls CpuInitialize() MemReset(); // Also calls CpuInitialize()
PravetsReset(); PravetsReset();
if (g_CardMgr.IsSSCInstalled()) if (GetCardMgr().IsSSCInstalled())
{ {
g_CardMgr.GetSSC()->CommReset(); GetCardMgr().GetSSC()->CommReset();
} }
else else
{ {
_ASSERT(g_CardMgr.QuerySlot(SLOT2) == CT_Empty); _ASSERT(GetCardMgr().QuerySlot(SLOT2) == CT_Empty);
ConfigOld.m_Slot[2] = CT_Empty; ConfigOld.m_Slot[2] = CT_Empty;
} }
if (g_CardMgr.QuerySlot(SLOT4) == CT_MouseInterface) if (GetCardMgr().QuerySlot(SLOT4) == CT_MouseInterface)
g_CardMgr.Remove(SLOT4); // Remove Mouse card from slot-4 GetCardMgr().Remove(SLOT4); // Remove Mouse card from slot-4
if (g_CardMgr.QuerySlot(SLOT5) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
g_CardMgr.Remove(SLOT5); // Remove Disk2 card from slot-5 GetCardMgr().Remove(SLOT5); // Remove Disk2 card from slot-5
g_CardMgr.GetDisk2CardMgr().Reset(false); GetCardMgr().GetDisk2CardMgr().Reset(false);
HD_Reset(); HD_Reset();
HD_SetEnabled(false); HD_SetEnabled(false);
@ -550,43 +550,43 @@ void Snapshot_SaveState(void)
yamlSaveHelper.UnitHdr(GetSnapshotUnitSlotsName(), UNIT_SLOTS_VER); yamlSaveHelper.UnitHdr(GetSnapshotUnitSlotsName(), UNIT_SLOTS_VER);
YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE); YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE);
if (g_CardMgr.QuerySlot(SLOT0) != CT_Empty && IsApple2PlusOrClone(GetApple2Type())) if (GetCardMgr().QuerySlot(SLOT0) != CT_Empty && IsApple2PlusOrClone(GetApple2Type()))
GetLanguageCard()->SaveSnapshot(yamlSaveHelper); // Language Card or Saturn 128K GetLanguageCard()->SaveSnapshot(yamlSaveHelper); // Language Card or Saturn 128K
if (g_CardMgr.QuerySlot(SLOT1) == CT_GenericPrinter) if (GetCardMgr().QuerySlot(SLOT1) == CT_GenericPrinter)
Printer_SaveSnapshot(yamlSaveHelper); Printer_SaveSnapshot(yamlSaveHelper);
if (g_CardMgr.QuerySlot(SLOT2) == CT_SSC) if (GetCardMgr().QuerySlot(SLOT2) == CT_SSC)
dynamic_cast<CSuperSerialCard&>(g_CardMgr.GetRef(SLOT2)).SaveSnapshot(yamlSaveHelper); dynamic_cast<CSuperSerialCard&>(GetCardMgr().GetRef(SLOT2)).SaveSnapshot(yamlSaveHelper);
// if (g_CardMgr.QuerySlot(SLOT3) == CT_Uthernet) // if (GetCardMgr().QuerySlot(SLOT3) == CT_Uthernet)
// sg_Uthernet.SaveSnapshot(yamlSaveHelper); // sg_Uthernet.SaveSnapshot(yamlSaveHelper);
if (g_CardMgr.QuerySlot(SLOT4) == CT_MouseInterface) if (GetCardMgr().QuerySlot(SLOT4) == CT_MouseInterface)
dynamic_cast<CMouseInterface&>(g_CardMgr.GetRef(SLOT4)).SaveSnapshot(yamlSaveHelper); dynamic_cast<CMouseInterface&>(GetCardMgr().GetRef(SLOT4)).SaveSnapshot(yamlSaveHelper);
if (g_CardMgr.QuerySlot(SLOT4) == CT_Z80) if (GetCardMgr().QuerySlot(SLOT4) == CT_Z80)
Z80_SaveSnapshot(yamlSaveHelper, SLOT4); Z80_SaveSnapshot(yamlSaveHelper, SLOT4);
if (g_CardMgr.QuerySlot(SLOT5) == CT_Z80) if (GetCardMgr().QuerySlot(SLOT5) == CT_Z80)
Z80_SaveSnapshot(yamlSaveHelper, SLOT5); Z80_SaveSnapshot(yamlSaveHelper, SLOT5);
if (g_CardMgr.QuerySlot(SLOT4) == CT_MockingboardC) if (GetCardMgr().QuerySlot(SLOT4) == CT_MockingboardC)
MB_SaveSnapshot(yamlSaveHelper, SLOT4); MB_SaveSnapshot(yamlSaveHelper, SLOT4);
if (g_CardMgr.QuerySlot(SLOT5) == CT_MockingboardC) if (GetCardMgr().QuerySlot(SLOT5) == CT_MockingboardC)
MB_SaveSnapshot(yamlSaveHelper, SLOT5); MB_SaveSnapshot(yamlSaveHelper, SLOT5);
if (g_CardMgr.QuerySlot(SLOT4) == CT_Phasor) if (GetCardMgr().QuerySlot(SLOT4) == CT_Phasor)
Phasor_SaveSnapshot(yamlSaveHelper, SLOT4); Phasor_SaveSnapshot(yamlSaveHelper, SLOT4);
if (g_CardMgr.QuerySlot(SLOT5) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT5)).SaveSnapshot(yamlSaveHelper); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT5)).SaveSnapshot(yamlSaveHelper);
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2) if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(SLOT6)).SaveSnapshot(yamlSaveHelper); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).SaveSnapshot(yamlSaveHelper);
if (g_CardMgr.QuerySlot(SLOT7) == CT_GenericHDD) if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
HD_SaveSnapshot(yamlSaveHelper); HD_SaveSnapshot(yamlSaveHelper);
} }

View file

@ -310,7 +310,7 @@ void VideoBenchmark () {
while (cycles > 0) { while (cycles > 0) {
DWORD executedcycles = CpuExecute(103, true); DWORD executedcycles = CpuExecute(103, true);
cycles -= executedcycles; cycles -= executedcycles;
g_CardMgr.GetDisk2CardMgr().UpdateDriveState(executedcycles); GetCardMgr().GetDisk2CardMgr().UpdateDriveState(executedcycles);
JoyUpdateButtonLatch(executedcycles); JoyUpdateButtonLatch(executedcycles);
} }
} }