Add support for the LanguageCard in Slot0 switch.

(not 100% sure how it is supposed to work).


Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2019-04-19 20:27:17 +01:00
parent 0a087e40ae
commit 629bbfb757
6 changed files with 41 additions and 7 deletions

View file

@ -55,6 +55,12 @@ namespace
} }
} }
void setSlot0(const SS_CARDTYPE newCardType)
{
g_Slot0 = newCardType;
REGSAVE(TEXT(REGVALUE_SLOT0), (DWORD)g_Slot0);
}
void setSlot4(const SS_CARDTYPE newCardType) void setSlot4(const SS_CARDTYPE newCardType)
{ {
g_Slot4 = newCardType; g_Slot4 = newCardType;
@ -122,6 +128,7 @@ Preferences::Data getCurrentOptions(const std::shared_ptr<QGamepad> & gamepad)
} }
} }
currentOptions.languageCardInSlot0 = g_Slot0 == CT_LanguageCard;
currentOptions.mouseInSlot4 = g_Slot4 == CT_MouseInterface; currentOptions.mouseInSlot4 = g_Slot4 == CT_MouseInterface;
currentOptions.cpmInSlot5 = g_Slot5 == CT_Z80; currentOptions.cpmInSlot5 = g_Slot5 == CT_Z80;
currentOptions.hdInSlot7 = HD_CardIsEnabled(); currentOptions.hdInSlot7 = HD_CardIsEnabled();
@ -160,7 +167,11 @@ void setNewOptions(const Preferences::Data & currentOptions, const Preferences::
SetMainCpu(cpu); SetMainCpu(cpu);
REGSAVE(TEXT(REGVALUE_CPU_TYPE), cpu); REGSAVE(TEXT(REGVALUE_CPU_TYPE), cpu);
} }
if (currentOptions.languageCardInSlot0 != newOptions.languageCardInSlot0)
{
const SS_CARDTYPE card = newOptions.languageCardInSlot0 ? CT_LanguageCard : CT_Empty;
setSlot0(card);
}
if (currentOptions.mouseInSlot4 != newOptions.mouseInSlot4) if (currentOptions.mouseInSlot4 != newOptions.mouseInSlot4)
{ {
const SS_CARDTYPE card = newOptions.mouseInSlot4 ? CT_MouseInterface : CT_Empty; const SS_CARDTYPE card = newOptions.mouseInSlot4 ? CT_MouseInterface : CT_Empty;

View file

@ -169,6 +169,7 @@ void Preferences::setData(const Data & data)
initialiseDisks(myHDs, data.hds); initialiseDisks(myHDs, data.hds);
apple2Type->setCurrentIndex(data.apple2Type); apple2Type->setCurrentIndex(data.apple2Type);
lc_0->setChecked(data.languageCardInSlot0);
mouse_4->setChecked(data.mouseInSlot4); mouse_4->setChecked(data.mouseInSlot4);
cpm_5->setChecked(data.cpmInSlot5); cpm_5->setChecked(data.cpmInSlot5);
hd_7->setChecked(data.hdInSlot7); hd_7->setChecked(data.hdInSlot7);
@ -190,6 +191,7 @@ Preferences::Data Preferences::getData() const
fillData(myHDs, data.hds); fillData(myHDs, data.hds);
data.apple2Type = apple2Type->currentIndex(); data.apple2Type = apple2Type->currentIndex();
data.languageCardInSlot0 = lc_0->isChecked();
data.mouseInSlot4 = mouse_4->isChecked(); data.mouseInSlot4 = mouse_4->isChecked();
data.cpmInSlot5 = cpm_5->isChecked(); data.cpmInSlot5 = cpm_5->isChecked();
data.hdInSlot7 = hd_7->isChecked(); data.hdInSlot7 = hd_7->isChecked();

View file

@ -15,6 +15,7 @@ public:
struct Data struct Data
{ {
int apple2Type; int apple2Type;
bool languageCardInSlot0;
bool mouseInSlot4; bool mouseInSlot4;
bool cpmInSlot5; bool cpmInSlot5;
bool hdInSlot7; bool hdInSlot7;

View file

@ -40,48 +40,62 @@
<string>Slots</string> <string>Slots</string>
</property> </property>
<layout class="QFormLayout" name="formLayout_2"> <layout class="QFormLayout" name="formLayout_2">
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
<string>Slot 4</string> <string>Slot 4</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<widget class="QCheckBox" name="mouse_4"> <widget class="QCheckBox" name="mouse_4">
<property name="text"> <property name="text">
<string>Mouse</string> <string>Mouse</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_9">
<property name="text"> <property name="text">
<string>Slot 5</string> <string>Slot 5</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="3" column="1">
<widget class="QCheckBox" name="cpm_5"> <widget class="QCheckBox" name="cpm_5">
<property name="text"> <property name="text">
<string>CP/M</string> <string>CP/M</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
<property name="text"> <property name="text">
<string>Slot 7</string> <string>Slot 7</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<widget class="QCheckBox" name="hd_7"> <widget class="QCheckBox" name="hd_7">
<property name="text"> <property name="text">
<string>Hard Disk</string> <string>Hard Disk</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QCheckBox" name="lc_0">
<property name="text">
<string>Language Card</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Slot 0</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View file

@ -61,6 +61,10 @@ namespace
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES); FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
if (g_Slot0 == CT_LanguageCard)
{
SetExpansionMemType(g_Slot0);
}
MemInitialize(); MemInitialize();
VideoInitialize(); VideoInitialize();
DiskReset(); DiskReset();

View file

@ -266,6 +266,8 @@ void LoadConfiguration(void)
sg_PropertySheet.SetMouseRestrictToWindow(dwTmp); sg_PropertySheet.SetMouseRestrictToWindow(dwTmp);
#endif #endif
if(REGLOAD(TEXT(REGVALUE_SLOT0), &dwTmp))
g_Slot0 = (SS_CARDTYPE) dwTmp;
if(REGLOAD(TEXT(REGVALUE_SLOT4), &dwTmp)) if(REGLOAD(TEXT(REGVALUE_SLOT4), &dwTmp))
g_Slot4 = (SS_CARDTYPE) dwTmp; g_Slot4 = (SS_CARDTYPE) dwTmp;
if(REGLOAD(TEXT(REGVALUE_SLOT5), &dwTmp)) if(REGLOAD(TEXT(REGVALUE_SLOT5), &dwTmp))