From 24971328ba1c124e25fe8a941e357158c892362f Mon Sep 17 00:00:00 2001 From: Andrea Odetti Date: Sat, 5 Jun 2021 18:04:46 +0100 Subject: [PATCH] Make sure Mockingboard slots are conistent. Signed-off-by: Andrea Odetti --- source/frontends/sdl/imgui/settingshelper.cpp | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/source/frontends/sdl/imgui/settingshelper.cpp b/source/frontends/sdl/imgui/settingshelper.cpp index 85380b48..7d1b0007 100644 --- a/source/frontends/sdl/imgui/settingshelper.cpp +++ b/source/frontends/sdl/imgui/settingshelper.cpp @@ -104,6 +104,17 @@ namespace const std::vector expansionCards = {CT_Empty, CT_LanguageCard, CT_Extended80Col, CT_Saturn128K, CT_RamWorksIII}; + + void internalInsertCard(const size_t slot, const SS_CARDTYPE card) + { + CardManager & cardManager = GetCardMgr(); + + // we do not use REGVALUE_SLOT5 as they are not "runtime friendly" + const std::string label = "Slot " + std::to_string(slot); + REGSAVE(label.c_str(), (DWORD)card); + cardManager.Insert(slot, card); + } + } namespace sa2 @@ -156,8 +167,6 @@ namespace sa2 void insertCard(size_t slot, SS_CARDTYPE card) { - CardManager & cardManager = GetCardMgr(); - switch (slot) { case 3: @@ -167,6 +176,23 @@ namespace sa2 // needs a reboot anyway break; } + case 4: + case 5: + { + if (card == CT_MockingboardC) + { + internalInsertCard(9 - slot, card); // the other + } + else + { + CardManager & cardManager = GetCardMgr(); + if (cardManager.QuerySlot(slot) == CT_MockingboardC) + { + internalInsertCard(9 - slot, CT_Empty); // the other + } + } + break; + } case 7: { const bool enabled = card == CT_GenericHDD; @@ -176,10 +202,7 @@ namespace sa2 } }; - // we do not use REGVALUE_SLOT5 as they are not "runtime friendly" - const std::string label = "Slot " + std::to_string(slot); - REGSAVE(label.c_str(), (DWORD)card); - cardManager.Insert(slot, card); + internalInsertCard(slot, card); } void setVideoStyle(Video & video, const VideoStyle_e style, const bool enabled)