mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-11-15 09:05:39 +00:00
Save-state: Game I/O Connector: change yaml
This commit is contained in:
parent
4ca6aaea33
commit
dee264483a
@ -31,6 +31,7 @@
|
||||
Matthew D'Asaro Dec 2022
|
||||
*/
|
||||
#include "StdAfx.h"
|
||||
#include <sstream>
|
||||
|
||||
#include "CopyProtectionDongles.h"
|
||||
#include "Memory.h"
|
||||
@ -82,7 +83,11 @@ int CopyProtectionDonglePB2(void)
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& CopyProtectionDongle_GetSnapshotStructName_SDSSpeedStar(void)
|
||||
//===========================================================================
|
||||
|
||||
static const UINT kUNIT_VERSION = 1;
|
||||
|
||||
static const std::string& GetSnapshotStructName_SDSSpeedStar(void)
|
||||
{
|
||||
static const std::string name("SDS SpeedStar dongle");
|
||||
return name;
|
||||
@ -92,7 +97,7 @@ void CopyProtectionDongleSaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
||||
{
|
||||
if (copyProtectionDongleType == DT_SDSSPEEDSTAR)
|
||||
{
|
||||
YamlSaveHelper::Label label(yamlSaveHelper, "%s: null\n", CopyProtectionDongle_GetSnapshotStructName_SDSSpeedStar().c_str());
|
||||
yamlSaveHelper.SaveString(SS_YAML_KEY_DEVICE, GetSnapshotStructName_SDSSpeedStar());
|
||||
// NB. No state for this dongle
|
||||
}
|
||||
else
|
||||
@ -101,11 +106,20 @@ void CopyProtectionDongleSaveSnapshot(YamlSaveHelper& yamlSaveHelper)
|
||||
}
|
||||
}
|
||||
|
||||
void CopyProtectionDongleLoadSnapshot(YamlLoadHelper& yamlLoadHelper)
|
||||
void CopyProtectionDongleLoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
|
||||
{
|
||||
bool found = false;
|
||||
std::string s = yamlLoadHelper.LoadString_NoThrow(CopyProtectionDongle_GetSnapshotStructName_SDSSpeedStar(), found);
|
||||
if (found)
|
||||
if (version < 1 || version > kUNIT_VERSION)
|
||||
{
|
||||
std::ostringstream msg;
|
||||
msg << "Version " << version;
|
||||
msg << " is not supported for game I/O device.";
|
||||
|
||||
throw std::runtime_error(msg.str());
|
||||
}
|
||||
|
||||
std::string device = yamlLoadHelper.LoadString(SS_YAML_KEY_DEVICE);
|
||||
|
||||
if (device == GetSnapshotStructName_SDSSpeedStar())
|
||||
{
|
||||
copyProtectionDongleType = DT_SDSSPEEDSTAR;
|
||||
}
|
||||
|
@ -13,4 +13,4 @@ int CopyProtectionDonglePB2(void);
|
||||
bool SdsSpeedStar(void);
|
||||
|
||||
void CopyProtectionDongleSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||
void CopyProtectionDongleLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
||||
void CopyProtectionDongleLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT version);
|
||||
|
@ -341,7 +341,7 @@ static void ParseUnit(void)
|
||||
}
|
||||
else if (unit == GetSnapshotUnitGameIOConnectorName())
|
||||
{
|
||||
CopyProtectionDongleLoadSnapshot(yamlLoadHelper);
|
||||
CopyProtectionDongleLoadSnapshot(yamlLoadHelper, unitVersion);
|
||||
}
|
||||
else if (unit == GetSnapshotUnitMiscName())
|
||||
{
|
||||
|
@ -11,6 +11,7 @@
|
||||
#define SS_YAML_KEY_TYPE "Type"
|
||||
#define SS_YAML_KEY_CARD "Card"
|
||||
#define SS_YAML_KEY_STATE "State"
|
||||
#define SS_YAML_KEY_DEVICE "Device"
|
||||
|
||||
#define SS_YAML_VALUE_AWSS "AppleWin Save State"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user