Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
f61d2073e5
25 changed files with 132 additions and 148 deletions
|
@ -70,3 +70,43 @@ void DummyCard::Update(const ULONG nExecutedCycles)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DummyCard::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
||||
{
|
||||
switch (QueryType())
|
||||
{
|
||||
case CT_GenericPrinter:
|
||||
Printer_SaveSnapshot(yamlSaveHelper, m_slot);
|
||||
break;
|
||||
case CT_MockingboardC:
|
||||
MB_SaveSnapshot(yamlSaveHelper, m_slot);
|
||||
break;
|
||||
case CT_Phasor:
|
||||
Phasor_SaveSnapshot(yamlSaveHelper, m_slot);
|
||||
break;
|
||||
case CT_Z80:
|
||||
Z80_SaveSnapshot(yamlSaveHelper, m_slot);
|
||||
break;
|
||||
case CT_Uthernet:
|
||||
tfe_SaveSnapshot(yamlSaveHelper, m_slot);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool DummyCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
|
||||
{
|
||||
switch (QueryType())
|
||||
{
|
||||
case CT_GenericPrinter:
|
||||
return Printer_LoadSnapshot(yamlLoadHelper, m_slot, version);
|
||||
case CT_MockingboardC:
|
||||
return MB_LoadSnapshot(yamlLoadHelper, m_slot, version);
|
||||
case CT_Phasor:
|
||||
return Phasor_LoadSnapshot(yamlLoadHelper, m_slot, version);
|
||||
case CT_Z80:
|
||||
return Z80_LoadSnapshot(yamlLoadHelper, m_slot, version);
|
||||
case CT_Uthernet:
|
||||
return tfe_LoadSnapshot(yamlLoadHelper, m_slot, version);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,9 @@ enum SS_CARDTYPE
|
|||
|
||||
enum SLOTS { SLOT0=0, SLOT1, SLOT2, SLOT3, SLOT4, SLOT5, SLOT6, SLOT7, NUM_SLOTS, SLOT_AUX };
|
||||
|
||||
class YamlSaveHelper;
|
||||
class YamlLoadHelper;
|
||||
|
||||
class Card
|
||||
{
|
||||
public:
|
||||
|
@ -38,6 +41,9 @@ public:
|
|||
virtual void Init(void) = 0;
|
||||
virtual void Reset(const bool powerCycle) = 0;
|
||||
virtual void Update(const ULONG nExecutedCycles) = 0;
|
||||
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper) = 0;
|
||||
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version) = 0;
|
||||
|
||||
SS_CARDTYPE QueryType(void) { return m_type; }
|
||||
|
||||
protected:
|
||||
|
@ -59,6 +65,8 @@ public:
|
|||
virtual void Init(void) {}
|
||||
virtual void Reset(const bool powerCycle) {}
|
||||
virtual void Update(const ULONG nExecutedCycles) {}
|
||||
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper) {}
|
||||
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version) { _ASSERT(0); return false; }
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -73,4 +81,6 @@ public:
|
|||
virtual void Init(void) {}
|
||||
virtual void Reset(const bool powerCycle) {}
|
||||
virtual void Update(const ULONG nExecutedCycles);
|
||||
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper);
|
||||
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version);
|
||||
};
|
||||
|
|
|
@ -213,3 +213,14 @@ void CardManager::Update(const ULONG nExecutedCycles)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CardManager::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
||||
{
|
||||
for (UINT i = 1; i < NUM_SLOTS; ++i)
|
||||
{
|
||||
if (m_slot[i])
|
||||
{
|
||||
m_slot[i]->SaveSnapshot(yamlSaveHelper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,14 +33,11 @@ public:
|
|||
SS_CARDTYPE QuerySlot(UINT slot) { _ASSERT(slot<NUM_SLOTS); return m_slot[slot]->QueryType(); }
|
||||
Card& GetRef(UINT slot)
|
||||
{
|
||||
SS_CARDTYPE t=QuerySlot(slot);
|
||||
_ASSERT((t==CT_GenericHDD || t==CT_SSC || t==CT_MouseInterface || t==CT_Disk2 || t == CT_FourPlay || t == CT_SNESMAX || t == CT_SAM) && m_slot[slot]);
|
||||
_ASSERT(m_slot[slot]);
|
||||
return *m_slot[slot];
|
||||
}
|
||||
Card* GetObj(UINT slot)
|
||||
{
|
||||
SS_CARDTYPE t=QuerySlot(slot);
|
||||
_ASSERT(t == CT_GenericHDD || t==CT_SSC || t==CT_MouseInterface || t==CT_Disk2 || t == CT_FourPlay || t == CT_SNESMAX || t == CT_SAM);
|
||||
return m_slot[slot];
|
||||
}
|
||||
|
||||
|
@ -59,6 +56,7 @@ public:
|
|||
|
||||
void InitializeIO(LPBYTE pCxRomPeripheral);
|
||||
void Update(const ULONG nExecutedCycles);
|
||||
void SaveSnapshot(YamlSaveHelper& yamlSaveHelper); // It DOES NOT save SLOT0
|
||||
|
||||
private:
|
||||
void InsertInternal(UINT slot, SS_CARDTYPE type);
|
||||
|
|
|
@ -60,6 +60,9 @@ const BYTE Disk2InterfaceCard::m_T00S00Pattern[] = {0xD5,0xAA,0x96,0xAA,0xAA,0xA
|
|||
Disk2InterfaceCard::Disk2InterfaceCard(UINT slot) :
|
||||
Card(CT_Disk2, slot)
|
||||
{
|
||||
if (m_slot != 5 && m_slot != 6) // fixme
|
||||
throw std::string("Card: wrong slot");
|
||||
|
||||
ResetSwitches();
|
||||
|
||||
m_floppyLatch = 0;
|
||||
|
@ -2027,7 +2030,7 @@ void Disk2InterfaceCard::SaveSnapshotDriveUnit(YamlSaveHelper& yamlSaveHelper, U
|
|||
SaveSnapshotFloppy(yamlSaveHelper, unit);
|
||||
}
|
||||
|
||||
void Disk2InterfaceCard::SaveSnapshot(class YamlSaveHelper& yamlSaveHelper)
|
||||
void Disk2InterfaceCard::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
||||
{
|
||||
YamlSaveHelper::Slot slot(yamlSaveHelper, GetSnapshotCardName(), m_slot, kUNIT_VERSION);
|
||||
|
||||
|
@ -2193,11 +2196,8 @@ void Disk2InterfaceCard::LoadSnapshotDriveUnit(YamlLoadHelper& yamlLoadHelper, U
|
|||
}
|
||||
}
|
||||
|
||||
bool Disk2InterfaceCard::LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version)
|
||||
bool Disk2InterfaceCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
|
||||
{
|
||||
if (slot != 5 && slot != 6) // fixme
|
||||
throw std::string("Card: wrong slot");
|
||||
|
||||
if (version < 1 || version > kUNIT_VERSION)
|
||||
throw std::string("Card: wrong version");
|
||||
|
||||
|
|
|
@ -166,8 +166,8 @@ public:
|
|||
bool IsDriveConnected(int drive) { return m_floppyDrive[drive].m_isConnected; }
|
||||
|
||||
static std::string GetSnapshotCardName(void);
|
||||
void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
||||
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper);
|
||||
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version);
|
||||
|
||||
void LoadLastDiskImage(const int drive);
|
||||
void SaveLastDiskImage(const int drive);
|
||||
|
|
|
@ -146,7 +146,7 @@ void FourPlayCard::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
|||
// NB. No state for this card
|
||||
}
|
||||
|
||||
bool FourPlayCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version)
|
||||
bool FourPlayCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
|
||||
{
|
||||
if (version < 1 || version > kUNIT_VERSION)
|
||||
throw std::string("Card: wrong version");
|
||||
|
|
|
@ -20,8 +20,8 @@ public:
|
|||
static BYTE __stdcall IORead(WORD pc, WORD addr, BYTE bWrite, BYTE value, ULONG nExecutedCycles);
|
||||
|
||||
static std::string GetSnapshotCardName(void);
|
||||
void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
||||
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper);
|
||||
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version);
|
||||
|
||||
static const UINT JOYSTICKSTATIONARY = 0x20;
|
||||
|
||||
|
|
|
@ -129,6 +129,9 @@ Overview
|
|||
HarddiskInterfaceCard::HarddiskInterfaceCard(UINT slot) :
|
||||
Card(CT_GenericHDD, slot)
|
||||
{
|
||||
if (m_slot != SLOT7) // fixme
|
||||
throw std::string("Card: wrong slot");
|
||||
|
||||
m_unitNum = HARDDISK_1 << 7; // b7=unit
|
||||
|
||||
// The HDD interface has a single Command register for both drives:
|
||||
|
@ -838,15 +841,12 @@ bool HarddiskInterfaceCard::LoadSnapshotHDDUnit(YamlLoadHelper& yamlLoadHelper,
|
|||
return bResSelectImage;
|
||||
}
|
||||
|
||||
bool HarddiskInterfaceCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version, const std::string& strSaveStatePath)
|
||||
bool HarddiskInterfaceCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
|
||||
{
|
||||
if (slot != SLOT7) // fixme
|
||||
throw std::string("Card: wrong slot");
|
||||
|
||||
if (version < 1 || version > kUNIT_VERSION)
|
||||
throw std::string("Card: wrong version");
|
||||
|
||||
if (version <= 2 && (regs.pc >> 8) == (0xC0|slot))
|
||||
if (version <= 2 && (regs.pc >> 8) == (0xC0|m_slot))
|
||||
throw std::string("HDD card: 6502 is running old HDD firmware");
|
||||
|
||||
m_unitNum = yamlLoadHelper.LoadUint(SS_YAML_KEY_CURRENT_UNIT); // b7=unit
|
||||
|
@ -866,7 +866,7 @@ bool HarddiskInterfaceCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT sl
|
|||
bool bResSelectImage2 = LoadSnapshotHDDUnit(yamlLoadHelper, HARDDISK_2);
|
||||
|
||||
if (!bResSelectImage1 && !bResSelectImage2)
|
||||
RegSaveString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_HDV_START_DIR), 1, strSaveStatePath);
|
||||
RegSaveString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_HDV_START_DIR), 1, Snapshot_GetPath());
|
||||
|
||||
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_DISK_STATUS);
|
||||
|
||||
|
|
|
@ -104,8 +104,8 @@ public:
|
|||
bool ImageSwap(void);
|
||||
|
||||
static std::string GetSnapshotCardName(void);
|
||||
void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version, const std::string& strSaveStatePath);
|
||||
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper);
|
||||
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version);
|
||||
|
||||
static BYTE __stdcall IORead(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);
|
||||
static BYTE __stdcall IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);
|
||||
|
|
|
@ -139,6 +139,9 @@ bool LanguageCardUnit::IsOpcodeRMWabs(WORD addr)
|
|||
LanguageCardSlot0::LanguageCardSlot0(SS_CARDTYPE type/*=CT_LanguageCard*/)
|
||||
: LanguageCardUnit(type)
|
||||
{
|
||||
if (m_slot != LanguageCardUnit::kSlot0)
|
||||
throw std::string("Card: wrong slot");
|
||||
|
||||
m_pMemory = new BYTE[kMemBankSize];
|
||||
SetMemMainLanguageCard(m_pMemory);
|
||||
}
|
||||
|
@ -152,7 +155,6 @@ LanguageCardSlot0::~LanguageCardSlot0(void)
|
|||
//
|
||||
|
||||
static const UINT kUNIT_LANGUAGECARD_VER = 1;
|
||||
static const UINT kSLOT_LANGUAGECARD = LanguageCardUnit::kSlot0;
|
||||
|
||||
#define SS_YAML_VALUE_CARD_LANGUAGECARD "Language Card"
|
||||
|
||||
|
@ -194,7 +196,7 @@ void LanguageCardSlot0::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
|||
return; // No Language Card support for //e and above
|
||||
}
|
||||
|
||||
YamlSaveHelper::Slot slot(yamlSaveHelper, GetSnapshotCardName(), kSLOT_LANGUAGECARD, kUNIT_LANGUAGECARD_VER);
|
||||
YamlSaveHelper::Slot slot(yamlSaveHelper, GetSnapshotCardName(), m_slot, kUNIT_LANGUAGECARD_VER);
|
||||
YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE);
|
||||
|
||||
SaveLCState(yamlSaveHelper);
|
||||
|
@ -205,11 +207,8 @@ void LanguageCardSlot0::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
|||
}
|
||||
}
|
||||
|
||||
bool LanguageCardSlot0::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version)
|
||||
bool LanguageCardSlot0::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
|
||||
{
|
||||
if (slot != kSLOT_LANGUAGECARD)
|
||||
throw std::string("Card: wrong slot");
|
||||
|
||||
if (version != kUNIT_LANGUAGECARD_VER)
|
||||
throw std::string("Card: wrong version");
|
||||
|
||||
|
@ -365,7 +364,6 @@ BYTE __stdcall Saturn128K::IO(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULO
|
|||
//
|
||||
|
||||
static const UINT kUNIT_SATURN_VER = 1;
|
||||
static const UINT kSLOT_SATURN = LanguageCardUnit::kSlot0;
|
||||
|
||||
#define SS_YAML_VALUE_CARD_SATURN128 "Saturn 128"
|
||||
|
||||
|
@ -393,7 +391,7 @@ void Saturn128K::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
|||
return; // No Saturn support for //e and above
|
||||
}
|
||||
|
||||
YamlSaveHelper::Slot slot(yamlSaveHelper, GetSnapshotCardName(), kSLOT_SATURN, kUNIT_SATURN_VER);
|
||||
YamlSaveHelper::Slot slot(yamlSaveHelper, GetSnapshotCardName(), m_slot, kUNIT_SATURN_VER);
|
||||
YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE);
|
||||
|
||||
SaveLCState(yamlSaveHelper);
|
||||
|
@ -409,11 +407,8 @@ void Saturn128K::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
|||
}
|
||||
}
|
||||
|
||||
bool Saturn128K::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version)
|
||||
bool Saturn128K::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
|
||||
{
|
||||
if (slot != kSLOT_SATURN) // fixme
|
||||
throw std::string("Card: wrong slot");
|
||||
|
||||
if (version != kUNIT_SATURN_VER)
|
||||
throw std::string("Card: wrong version");
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ public:
|
|||
virtual void InitializeIO(LPBYTE pCxRomPeripheral);
|
||||
virtual void SetMemorySize(UINT banks) {} // No-op for //e and slot-0 16K LC
|
||||
virtual UINT GetActiveBank(void) { return 0; } // Always 0 as only 1x 16K bank
|
||||
virtual void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper) { _ASSERT(0); } // Not used for //e
|
||||
virtual bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version) { _ASSERT(0); return false; } // Not used for //e
|
||||
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper) { _ASSERT(0); } // Not used for //e
|
||||
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version) { _ASSERT(0); return false; } // Not used for //e
|
||||
|
||||
BOOL GetLastRamWrite(void) { return m_uLastRamWrite; }
|
||||
void SetLastRamWrite(BOOL count) { m_uLastRamWrite = count; }
|
||||
|
@ -47,8 +47,8 @@ public:
|
|||
LanguageCardSlot0(SS_CARDTYPE = CT_LanguageCard);
|
||||
virtual ~LanguageCardSlot0(void);
|
||||
|
||||
virtual void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
virtual bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
||||
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper);
|
||||
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version);
|
||||
|
||||
static const UINT kMemBankSize = 16*1024;
|
||||
static std::string GetSnapshotCardName(void);
|
||||
|
@ -76,8 +76,8 @@ public:
|
|||
virtual void InitializeIO(LPBYTE pCxRomPeripheral);
|
||||
virtual void SetMemorySize(UINT banks);
|
||||
virtual UINT GetActiveBank(void);
|
||||
virtual void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
virtual bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
||||
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper);
|
||||
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version);
|
||||
|
||||
static BYTE __stdcall IO(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nExecutedCycles);
|
||||
|
||||
|
|
|
@ -138,6 +138,9 @@ CMouseInterface::CMouseInterface(UINT slot) :
|
|||
m_pSlotRom(NULL),
|
||||
m_syncEvent(slot, 0, SyncEventCallback) // use slot# as "unique" id for MouseInterfaces
|
||||
{
|
||||
if (m_slot != 4) // fixme
|
||||
throw std::string("Card: wrong slot");
|
||||
|
||||
m_6821.SetListenerB( this, M6821_Listener_B );
|
||||
m_6821.SetListenerA( this, M6821_Listener_A );
|
||||
|
||||
|
@ -651,7 +654,7 @@ void CMouseInterface::SaveSnapshotMC6821(YamlSaveHelper& yamlSaveHelper, std::st
|
|||
yamlSaveHelper.SaveUint(SS_YAML_KEY_IB, byIB);
|
||||
}
|
||||
|
||||
void CMouseInterface::SaveSnapshot(class YamlSaveHelper& yamlSaveHelper)
|
||||
void CMouseInterface::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
||||
{
|
||||
// if (!m_bActive)
|
||||
// return;
|
||||
|
@ -710,11 +713,8 @@ void CMouseInterface::LoadSnapshotMC6821(YamlLoadHelper& yamlLoadHelper, std::st
|
|||
yamlLoadHelper.PopMap();
|
||||
}
|
||||
|
||||
bool CMouseInterface::LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version)
|
||||
bool CMouseInterface::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
|
||||
{
|
||||
if (slot != 4) // fixme
|
||||
throw std::string("Card: wrong slot");
|
||||
|
||||
if (version != 1)
|
||||
throw std::string("Card: wrong version");
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ public:
|
|||
}
|
||||
|
||||
static std::string GetSnapshotCardName(void);
|
||||
void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
||||
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper);
|
||||
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version);
|
||||
|
||||
protected:
|
||||
void InitializeROM(void);
|
||||
|
|
|
@ -50,8 +50,6 @@ bool g_bFilterUnprintable = true;
|
|||
bool g_bPrinterAppend = false;
|
||||
bool g_bEnableDumpToRealPrinter = false;
|
||||
|
||||
static UINT g_uSlot = 0;
|
||||
|
||||
//===========================================================================
|
||||
|
||||
static BYTE __stdcall PrintStatus(WORD, WORD, BYTE, BYTE, ULONG);
|
||||
|
@ -71,8 +69,6 @@ VOID PrintLoadRom(LPBYTE pCxRomPeripheral, const UINT uSlot)
|
|||
//
|
||||
|
||||
RegisterIoHandler(uSlot, PrintStatus, PrintTransmit, NULL, NULL, NULL, NULL);
|
||||
|
||||
g_uSlot = uSlot;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -215,9 +211,9 @@ std::string Printer_GetSnapshotCardName(void)
|
|||
return name;
|
||||
}
|
||||
|
||||
void Printer_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper)
|
||||
void Printer_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper, const UINT uSlot)
|
||||
{
|
||||
YamlSaveHelper::Slot slot(yamlSaveHelper, Printer_GetSnapshotCardName(), g_uSlot, 1);
|
||||
YamlSaveHelper::Slot slot(yamlSaveHelper, Printer_GetSnapshotCardName(), uSlot, 1);
|
||||
|
||||
YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE);
|
||||
yamlSaveHelper.SaveUint(SS_YAML_KEY_INACTIVITY, inactivity);
|
||||
|
|
|
@ -10,7 +10,7 @@ void Printer_SetIdleLimit(unsigned int Duration);
|
|||
unsigned int Printer_GetIdleLimit();
|
||||
|
||||
std::string Printer_GetSnapshotCardName(void);
|
||||
void Printer_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
void Printer_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper, const UINT uSlot);
|
||||
bool Printer_LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
||||
|
||||
extern bool g_bDumpToPrinter;
|
||||
|
|
|
@ -110,7 +110,7 @@ void SAMCard::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
|||
// NB. No state for this card
|
||||
}
|
||||
|
||||
bool SAMCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version)
|
||||
bool SAMCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
|
||||
{
|
||||
if (version < 1 || version > kUNIT_VERSION)
|
||||
throw std::string("Card: wrong version");
|
||||
|
|
|
@ -20,8 +20,8 @@ public:
|
|||
static BYTE __stdcall IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE value, ULONG nExecutedCycles);
|
||||
|
||||
static std::string GetSnapshotCardName(void);
|
||||
void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
||||
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper);
|
||||
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version);
|
||||
|
||||
private:
|
||||
// no state
|
||||
|
|
|
@ -227,7 +227,7 @@ void SNESMAXCard::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
|||
yamlSaveHelper.SaveUint(SS_YAML_KEY_BUTTON_INDEX, m_buttonIndex);
|
||||
}
|
||||
|
||||
bool SNESMAXCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version)
|
||||
bool SNESMAXCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
|
||||
{
|
||||
if (version < 1 || version > kUNIT_VERSION)
|
||||
throw std::string("Card: wrong version");
|
||||
|
|
|
@ -28,8 +28,8 @@ public:
|
|||
static BYTE __stdcall IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE value, ULONG nExecutedCycles);
|
||||
|
||||
static std::string GetSnapshotCardName(void);
|
||||
void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
||||
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper);
|
||||
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version);
|
||||
|
||||
private:
|
||||
UINT m_buttonIndex;
|
||||
|
|
|
@ -328,94 +328,76 @@ static void ParseSlots(YamlLoadHelper& yamlLoadHelper, UINT unitVersion)
|
|||
if (card == Printer_GetSnapshotCardName())
|
||||
{
|
||||
type = CT_GenericPrinter;
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = Printer_LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == CSuperSerialCard::GetSnapshotCardName())
|
||||
{
|
||||
type = CT_SSC;
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = dynamic_cast<CSuperSerialCard&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == CMouseInterface::GetSnapshotCardName())
|
||||
{
|
||||
type = CT_MouseInterface;
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = dynamic_cast<CMouseInterface&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == Z80_GetSnapshotCardName())
|
||||
{
|
||||
type = CT_Z80;
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = Z80_LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == MB_GetSnapshotCardName())
|
||||
{
|
||||
type = CT_MockingboardC;
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = MB_LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == Phasor_GetSnapshotCardName())
|
||||
{
|
||||
type = CT_Phasor;
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = Phasor_LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == SAMCard::GetSnapshotCardName())
|
||||
{
|
||||
type = CT_SAM;
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = dynamic_cast<SAMCard&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == Disk2InterfaceCard::GetSnapshotCardName())
|
||||
{
|
||||
type = CT_Disk2;
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == HarddiskInterfaceCard::GetSnapshotCardName())
|
||||
{
|
||||
type = CT_GenericHDD;
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion, g_strSaveStatePath);
|
||||
}
|
||||
else if (card == tfe_GetSnapshotCardName())
|
||||
{
|
||||
type = CT_Uthernet;
|
||||
GetCardMgr().Insert(slot, type);
|
||||
tfe_LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == LanguageCardSlot0::GetSnapshotCardName())
|
||||
{
|
||||
type = CT_LanguageCard;
|
||||
SetExpansionMemType(type); // calls GetCardMgr().Insert() & InsertAux()
|
||||
CreateLanguageCard();
|
||||
bRes = GetLanguageCard()->LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == Saturn128K::GetSnapshotCardName())
|
||||
{
|
||||
type = CT_Saturn128K;
|
||||
SetExpansionMemType(type); // calls GetCardMgr().Insert() & InsertAux()
|
||||
CreateLanguageCard();
|
||||
bRes = GetLanguageCard()->LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == FourPlayCard::GetSnapshotCardName())
|
||||
{
|
||||
type = CT_FourPlay;
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = dynamic_cast<FourPlayCard&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else if (card == SNESMAXCard::GetSnapshotCardName())
|
||||
{
|
||||
type = CT_SNESMAX;
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = dynamic_cast<SNESMAXCard&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::string("Slots: Unknown card: " + card); // todo: don't throw - just ignore & continue
|
||||
}
|
||||
|
||||
if (slot == 0)
|
||||
{
|
||||
SetExpansionMemType(type); // calls GetCardMgr().Insert() & InsertAux()
|
||||
CreateLanguageCard();
|
||||
bRes = GetLanguageCard()->LoadSnapshot(yamlLoadHelper, cardVersion);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetCardMgr().Insert(slot, type);
|
||||
bRes = GetCardMgr().GetRef(slot).LoadSnapshot(yamlLoadHelper, cardVersion);
|
||||
}
|
||||
|
||||
cardInserted[slot] = true;
|
||||
|
||||
yamlLoadHelper.PopMap();
|
||||
|
@ -606,52 +588,7 @@ void Snapshot_SaveState(void)
|
|||
if (GetCardMgr().QuerySlot(SLOT0) != CT_Empty && IsApple2PlusOrClone(GetApple2Type()))
|
||||
GetLanguageCard()->SaveSnapshot(yamlSaveHelper); // Language Card or Saturn 128K
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT1) == CT_GenericPrinter)
|
||||
Printer_SaveSnapshot(yamlSaveHelper);
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT2) == CT_SSC)
|
||||
dynamic_cast<CSuperSerialCard&>(GetCardMgr().GetRef(SLOT2)).SaveSnapshot(yamlSaveHelper);
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT3) == CT_Uthernet)
|
||||
tfe_SaveSnapshot(yamlSaveHelper);
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT4) == CT_MouseInterface)
|
||||
dynamic_cast<CMouseInterface&>(GetCardMgr().GetRef(SLOT4)).SaveSnapshot(yamlSaveHelper);
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT4) == CT_Z80)
|
||||
Z80_SaveSnapshot(yamlSaveHelper, SLOT4);
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT5) == CT_Z80)
|
||||
Z80_SaveSnapshot(yamlSaveHelper, SLOT5);
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT4) == CT_MockingboardC)
|
||||
MB_SaveSnapshot(yamlSaveHelper, SLOT4);
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT5) == CT_MockingboardC)
|
||||
MB_SaveSnapshot(yamlSaveHelper, SLOT5);
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT4) == CT_Phasor)
|
||||
Phasor_SaveSnapshot(yamlSaveHelper, SLOT4);
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT5) == CT_SAM)
|
||||
dynamic_cast<SAMCard&>(GetCardMgr().GetRef(SLOT5)).SaveSnapshot(yamlSaveHelper);
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT5)).SaveSnapshot(yamlSaveHelper);
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).SaveSnapshot(yamlSaveHelper);
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
|
||||
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).SaveSnapshot(yamlSaveHelper);
|
||||
|
||||
for (UINT slot = SLOT3; slot <= SLOT5; slot++)
|
||||
{
|
||||
if (GetCardMgr().QuerySlot(slot) == CT_FourPlay)
|
||||
dynamic_cast<FourPlayCard&>(GetCardMgr().GetRef(slot)).SaveSnapshot(yamlSaveHelper);
|
||||
else if (GetCardMgr().QuerySlot(slot) == CT_SNESMAX)
|
||||
dynamic_cast<SNESMAXCard&>(GetCardMgr().GetRef(slot)).SaveSnapshot(yamlSaveHelper);
|
||||
}
|
||||
GetCardMgr().SaveSnapshot(yamlSaveHelper);
|
||||
}
|
||||
|
||||
// Miscellaneous
|
||||
|
|
|
@ -71,6 +71,9 @@ CSuperSerialCard::CSuperSerialCard(UINT slot) :
|
|||
m_bCfgSupportDCD(false),
|
||||
m_pExpansionRom(NULL)
|
||||
{
|
||||
if (m_slot != 2) // fixme
|
||||
throw std::string("Card: wrong slot");
|
||||
|
||||
m_dwSerialPortItem = 0;
|
||||
|
||||
m_hCommHandle = INVALID_HANDLE_VALUE;
|
||||
|
@ -1476,11 +1479,8 @@ void CSuperSerialCard::LoadSnapshotDIPSW(YamlLoadHelper& yamlLoadHelper, std::st
|
|||
yamlLoadHelper.PopMap();
|
||||
}
|
||||
|
||||
bool CSuperSerialCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version)
|
||||
bool CSuperSerialCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
|
||||
{
|
||||
if (slot != 2) // fixme
|
||||
throw std::string("Card: wrong slot");
|
||||
|
||||
if (version < 1 || version > kUNIT_VERSION)
|
||||
throw std::string("Card: wrong version");
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ public:
|
|||
void CommDestroy();
|
||||
void CommSetSerialPort(DWORD dwNewSerialPortItem);
|
||||
static std::string GetSnapshotCardName(void);
|
||||
void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
||||
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper);
|
||||
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version);
|
||||
|
||||
char* GetSerialPortChoices();
|
||||
DWORD GetSerialPort() { return m_dwSerialPortItem; } // Drop-down list item
|
||||
|
|
|
@ -48,8 +48,6 @@ typedef unsigned int UINT;
|
|||
#include "../Registry.h"
|
||||
#include "../YamlHelper.h"
|
||||
|
||||
static UINT g_slot = SLOT3;
|
||||
|
||||
/**/
|
||||
/** #define TFE_DEBUG_DUMP 1 **/
|
||||
|
||||
|
@ -1430,7 +1428,6 @@ return ret;
|
|||
|
||||
void tfe_InitializeIO(LPBYTE pCxRomPeripheral, UINT slot)
|
||||
{
|
||||
g_slot = slot;
|
||||
RegisterIoHandler(slot, TfeIo, TfeIo, TfeIoCxxx, TfeIoCxxx, NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -1481,9 +1478,9 @@ std::string tfe_GetSnapshotCardName(void)
|
|||
return name;
|
||||
}
|
||||
|
||||
void tfe_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper)
|
||||
void tfe_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper, const UINT uSlot)
|
||||
{
|
||||
YamlSaveHelper::Slot slot(yamlSaveHelper, tfe_GetSnapshotCardName(), g_slot, kUNIT_VERSION);
|
||||
YamlSaveHelper::Slot slot(yamlSaveHelper, tfe_GetSnapshotCardName(), uSlot, kUNIT_VERSION);
|
||||
|
||||
YamlSaveHelper::Label unit(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE);
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ void tfe_InitializeIO(LPBYTE pCxRomPeripheral, UINT slot);
|
|||
void tfe_SetRegistryInterface(UINT slot, const std::string& name);
|
||||
|
||||
std::string tfe_GetSnapshotCardName(void);
|
||||
void tfe_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
void tfe_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper, const UINT uSlot);
|
||||
bool tfe_LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue