Add 4Play & SNES MAX card support (#946, #972, PR #982)

Support these new cards in slots 3, 4 or 5; based on code from Lukazi.
- extend Configuration's Input prop sheet page.
- add save/load snapshot for both cards.
- add command line switch for alt controller type (for SNES MAX card).
Change to using Registry's 'Configuration\Slot 3' for slot 3 cards (Uthernet, 4Play & SNES MAX).
Update help doc.
This commit is contained in:
TomCh
2021-09-10 13:57:55 +01:00
committed by GitHub
parent 7f2dd9727d
commit 685b93f387
35 changed files with 1000 additions and 108 deletions
+23 -1
View File
@@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "CPU.h"
#include "Debug.h"
#include "Disk.h"
#include "FourPlay.h"
#include "Joystick.h"
#include "Keyboard.h"
#include "LanguageCard.h"
@@ -45,6 +46,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "ParallelPrinter.h"
#include "Pravets.h"
#include "SerialComms.h"
#include "SNESMAX.h"
#include "Speaker.h"
#include "Speech.h"
#include "z80emu.h"
@@ -314,7 +316,7 @@ static void ParseSlots(YamlLoadHelper& yamlLoadHelper, UINT unitVersion)
std::string card = yamlLoadHelper.LoadString(SS_YAML_KEY_CARD);
UINT cardVersion = yamlLoadHelper.LoadUint(SS_YAML_KEY_VERSION);
if (!yamlLoadHelper.GetSubMap(std::string(SS_YAML_KEY_STATE)))
if (!yamlLoadHelper.GetSubMap(std::string(SS_YAML_KEY_STATE), true)) // NB. For some cards, State can be null
throw std::string(SS_YAML_KEY_UNIT ": Expected sub-map name: " SS_YAML_KEY_STATE);
SS_CARDTYPE type = CT_Empty;
@@ -378,6 +380,18 @@ static void ParseSlots(YamlLoadHelper& yamlLoadHelper, UINT unitVersion)
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
@@ -635,6 +649,14 @@ void Snapshot_SaveState(void)
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
HD_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);
}
}
// Miscellaneous