Save-state: Keyboard - save 'Key Waiting' flag. (Fixes #591)

This commit is contained in:
tomcw 2018-11-01 21:14:16 +00:00
parent c90eb07f17
commit 09ab12d0b6
3 changed files with 8 additions and 3 deletions

View File

@ -552,6 +552,7 @@ void KeybSetSnapshot_v1(const BYTE LastKey)
//
#define SS_YAML_KEY_LASTKEY "Last Key"
#define SS_YAML_KEY_KEYWAITING "Key Waiting"
static std::string KeybGetSnapshotStructName(void)
{
@ -563,14 +564,18 @@ void KeybSaveSnapshot(YamlSaveHelper& yamlSaveHelper)
{
YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", KeybGetSnapshotStructName().c_str());
yamlSaveHelper.SaveHexUint8(SS_YAML_KEY_LASTKEY, keycode);
yamlSaveHelper.SaveBool(SS_YAML_KEY_KEYWAITING, keywaiting ? true : false);
}
void KeybLoadSnapshot(YamlLoadHelper& yamlLoadHelper)
void KeybLoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
{
if (!yamlLoadHelper.GetSubMap(KeybGetSnapshotStructName()))
return;
keycode = (BYTE) yamlLoadHelper.LoadUint(SS_YAML_KEY_LASTKEY);
if (version == 2)
keywaiting = (BOOL) yamlLoadHelper.LoadBool(SS_YAML_KEY_KEYWAITING);
yamlLoadHelper.PopMap();
}

View File

@ -20,4 +20,4 @@ BYTE KeybReadData (void);
BYTE KeybReadFlag (void);
void KeybSetSnapshot_v1(const BYTE LastKey);
void KeybSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
void KeybLoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
void KeybLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT version);

View File

@ -335,7 +335,7 @@ static void ParseUnitApple2(YamlLoadHelper& yamlLoadHelper, UINT version)
m_ConfigNew.m_CpuType = GetMainCpu();
JoyLoadSnapshot(yamlLoadHelper);
KeybLoadSnapshot(yamlLoadHelper);
KeybLoadSnapshot(yamlLoadHelper, version);
SpkrLoadSnapshot(yamlLoadHelper);
VideoLoadSnapshot(yamlLoadHelper);
MemLoadSnapshot(yamlLoadHelper, version);