Breakpoint card: add save/load state support

This commit is contained in:
tomcw
2025-10-18 15:39:11 +01:00
parent dce193b760
commit 971793a53c
3 changed files with 37 additions and 3 deletions

View File

@@ -23,9 +23,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Uthernet1.h"
#include "Uthernet2.h"
#include "BreakpointCard.h"
#include "Mockingboard.h"
#include "ParallelPrinter.h"
#include "z80emu.h"
#include "FourPlay.h"
#include "LanguageCard.h"
#include "MouseInterface.h"
@@ -163,6 +163,8 @@ std::string Card::GetCardName(const SS_CARDTYPE cardType)
return MockingboardCard::GetSnapshotCardNameMegaAudio();
case CT_SDMusic:
return MockingboardCard::GetSnapshotCardNameSDMusic();
case CT_BreakpointCard:
return BreakpointCard::GetSnapshotCardName();
default:
return "Unknown";
}
@@ -242,6 +244,10 @@ SS_CARDTYPE Card::GetCardType(const std::string & card)
{
return CT_SDMusic;
}
else if (card == BreakpointCard::GetSnapshotCardName())
{
return CT_BreakpointCard;
}
else
{
throw std::runtime_error("Slots: Unknown card: " + card); // todo: don't throw - just ignore & continue

View File

@@ -70,6 +70,7 @@
#include "Debug.h"
#include "BreakpointCard.h"
#include "Memory.h"
#include "YamlHelper.h"
BreakpointCard::BreakpointCard(UINT slot) :
Card(CT_BreakpointCard, slot),
@@ -235,3 +236,29 @@ void BreakpointCard::Deferred(uint8_t type, uint16_t addrStart, uint16_t addrEnd
}
}
//===========================================================================
static const UINT kUNIT_VERSION = 1;
const std::string& BreakpointCard::GetSnapshotCardName(void)
{
static const std::string name("Breakpoint");
return name;
}
void BreakpointCard::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
{
YamlSaveHelper::Slot slot(yamlSaveHelper, GetSnapshotCardName(), m_slot, kUNIT_VERSION);
YamlSaveHelper::Label unit(yamlSaveHelper, "%s: null\n", SS_YAML_KEY_STATE);
// NB. No state for this card
}
bool BreakpointCard::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
{
if (version < 1 || version > kUNIT_VERSION)
ThrowErrorInvalidVersion(version);
return true;
}

View File

@@ -63,8 +63,9 @@ public:
static void CbFunction(uint8_t slot, INTERCEPTBREAKPOINT interceptBreakpoint);
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper) {}
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version) { return false; }
static const std::string& GetSnapshotCardName(void);
virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper);
virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version);
private:
static int SyncEventCallback(int id, int cycles, ULONG uExecutedCycles);