Make sure Mockingboard slots are conistent.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2021-06-05 18:04:46 +01:00
parent abc4a4e1d3
commit 24971328ba

View file

@ -104,6 +104,17 @@ namespace
const std::vector<SS_CARDTYPE> 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)