Add save-state support for new unit: 'Game I/O Connector'
This commit is contained in:
parent
043bc49f3d
commit
4ca6aaea33
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "CopyProtectionDongles.h"
|
||||
#include "Memory.h"
|
||||
#include "YamlHelper.h"
|
||||
|
||||
static DONGLETYPE copyProtectionDongleType = DT_EMPTY;
|
||||
|
||||
|
@ -80,3 +81,36 @@ int CopyProtectionDonglePB2(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& CopyProtectionDongle_GetSnapshotStructName_SDSSpeedStar(void)
|
||||
{
|
||||
static const std::string name("SDS SpeedStar dongle");
|
||||
return name;
|
||||
}
|
||||
|
||||
void CopyProtectionDongleSaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
||||
{
|
||||
if (copyProtectionDongleType == DT_SDSSPEEDSTAR)
|
||||
{
|
||||
YamlSaveHelper::Label label(yamlSaveHelper, "%s: null\n", CopyProtectionDongle_GetSnapshotStructName_SDSSpeedStar().c_str());
|
||||
// NB. No state for this dongle
|
||||
}
|
||||
else
|
||||
{
|
||||
_ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CopyProtectionDongleLoadSnapshot(YamlLoadHelper& yamlLoadHelper)
|
||||
{
|
||||
bool found = false;
|
||||
std::string s = yamlLoadHelper.LoadString_NoThrow(CopyProtectionDongle_GetSnapshotStructName_SDSSpeedStar(), found);
|
||||
if (found)
|
||||
{
|
||||
copyProtectionDongleType = DT_SDSSPEEDSTAR;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,3 +11,6 @@ int CopyProtectionDonglePB0(void);
|
|||
int CopyProtectionDonglePB1(void);
|
||||
int CopyProtectionDonglePB2(void);
|
||||
bool SdsSpeedStar(void);
|
||||
|
||||
void CopyProtectionDongleSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
void CopyProtectionDongleLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
||||
|
|
|
@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
|
||||
#include "Interface.h"
|
||||
#include "CardManager.h"
|
||||
#include "CopyProtectionDongles.h"
|
||||
#include "Debug.h"
|
||||
#include "Joystick.h"
|
||||
#include "Keyboard.h"
|
||||
|
@ -66,10 +67,13 @@ static YamlHelper yamlHelper;
|
|||
// v5: Extended: cpu (added 'Defer IRQ By 1 Opcode')
|
||||
// v6: Added 'Unit Miscellaneous' for NoSlotClock(NSC)
|
||||
// v7: Extended: joystick (added 'Paddle Inactive Cycle')
|
||||
#define UNIT_APPLE2_VER 7
|
||||
// v8: Added 'Unit Game I/O Connector' for Game I/O Connector
|
||||
#define UNIT_APPLE2_VER 8
|
||||
|
||||
#define UNIT_SLOTS_VER 1
|
||||
|
||||
#define UNIT_GAME_IO_CONNECTOR_VER 1
|
||||
|
||||
#define UNIT_MISC_VER 1
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -178,6 +182,12 @@ static const std::string& GetSnapshotUnitSlotsName(void)
|
|||
return name;
|
||||
}
|
||||
|
||||
static const std::string& GetSnapshotUnitGameIOConnectorName(void)
|
||||
{
|
||||
static const std::string name("Game I/O Connector");
|
||||
return name;
|
||||
}
|
||||
|
||||
static const std::string& GetSnapshotUnitMiscName(void)
|
||||
{
|
||||
static const std::string name("Miscellaneous");
|
||||
|
@ -329,6 +339,10 @@ static void ParseUnit(void)
|
|||
{
|
||||
ParseSlots(yamlLoadHelper, unitVersion);
|
||||
}
|
||||
else if (unit == GetSnapshotUnitGameIOConnectorName())
|
||||
{
|
||||
CopyProtectionDongleLoadSnapshot(yamlLoadHelper);
|
||||
}
|
||||
else if (unit == GetSnapshotUnitMiscName())
|
||||
{
|
||||
// NB. could extend for other misc devices - see how ParseSlots() calls GetMapNextSlotNumber()
|
||||
|
@ -365,6 +379,8 @@ static void Snapshot_LoadState_v2(void)
|
|||
GetCardMgr().Remove(slot);
|
||||
GetCardMgr().RemoveAux();
|
||||
|
||||
SetCopyProtectionDongleType(DT_EMPTY);
|
||||
|
||||
MemReset(); // Also calls CpuInitialize()
|
||||
GetPravets().Reset();
|
||||
|
||||
|
@ -478,6 +494,15 @@ void Snapshot_SaveState(void)
|
|||
GetCardMgr().SaveSnapshot(yamlSaveHelper);
|
||||
}
|
||||
|
||||
// Unit: Game I/O Connector
|
||||
if (GetCopyProtectionDongleType() != DT_EMPTY)
|
||||
{
|
||||
yamlSaveHelper.UnitHdr(GetSnapshotUnitGameIOConnectorName(), UNIT_GAME_IO_CONNECTOR_VER);
|
||||
YamlSaveHelper::Label unit(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE);
|
||||
|
||||
CopyProtectionDongleSaveSnapshot(yamlSaveHelper);
|
||||
}
|
||||
|
||||
// Miscellaneous
|
||||
if (MemHasNoSlotClock())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue