made GameInfoDialog.Console settings immediate

This commit is contained in:
thrust26 2018-08-04 12:39:55 +02:00
parent a0550e7c08
commit 56979052f9
4 changed files with 80 additions and 23 deletions

View File

@ -178,7 +178,7 @@ void EventHandler::toggleSAPortOrder()
void EventHandler::set7800Mode()
{
if(myOSystem.hasConsole())
myIs7800 = myOSystem.console().switches().toggle7800Mode(myOSystem.settings());
myIs7800 = myOSystem.console().switches().check7800Mode(myOSystem.settings());
else
myIs7800 = false;
}

View File

@ -54,7 +54,7 @@ Switches::Switches(const Event& event, const Properties& properties,
mySwitches &= ~0x08;
}
toggle7800Mode(settings);
check7800Mode(settings);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -120,6 +120,45 @@ void Switches::update()
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Switches::setTvColor(bool setColor)
{
if(setColor)
{
mySwitches |= 0x08;
}
else
{
mySwitches &= ~0x08;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Switches::setLeftDifficultyA(bool setToA)
{
if(setToA)
{
mySwitches |= 0x40;
}
else
{
mySwitches &= ~0x40;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Switches::setRightDifficultyA(bool setToA)
{
if(setToA)
{
mySwitches |= 0x80;
}
else
{
mySwitches &= ~0x80;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Switches::save(Serializer& out) const
{
@ -151,7 +190,7 @@ bool Switches::load(Serializer& in)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Switches::toggle7800Mode(const Settings& settings)
bool Switches::check7800Mode(const Settings& settings)
{
bool devSettings = settings.getBool("dev.settings");
myIs7800 = (settings.getString(devSettings ? "dev.console" : "plr.console") == "7800");

View File

@ -92,6 +92,11 @@ class Switches : public Serializable
*/
bool tvColor() const { return mySwitches & 0x08; }
/**
Sets 'Console_TelevisionType' switches bit.
*/
void setTvColor(bool setColor);
/**
Query the 'Console_LeftDifficulty' switches bit.
@ -99,6 +104,11 @@ class Switches : public Serializable
*/
bool leftDifficultyA() const { return mySwitches & 0x40; }
/**
Sets 'Console_LeftDifficulty' switches bit.
*/
void setLeftDifficultyA(bool setA);
/**
Query the 'Console_RightDifficulty' switches bit.
@ -106,12 +116,18 @@ class Switches : public Serializable
*/
bool rightDifficultyA() const { return mySwitches & 0x80; }
/**
Sets 'Console_LeftDifficulty' switches bit.
*/
void setRightDifficultyA(bool setA);
/**
Toggle between 2600 and 7800 mode depending on settings.
@return True if 7800 mode enabled, else false
*/
bool toggle7800Mode(const Settings& settings);
bool check7800Mode(const Settings& settings);
private:
// Reference to the event object to use

View File

@ -35,6 +35,7 @@
#include "FrameBuffer.hxx"
#include "TIASurface.hxx"
#include "TIA.hxx"
#include "Switches.hxx"
#include "GameInfoDialog.hxx"
@ -139,9 +140,21 @@ GameInfoDialog::GameInfoDialog(
tabID = myTab->addTab("Console");
xpos = HBORDER; ypos = VBORDER;
StaticTextWidget* s = new StaticTextWidget(myTab, font, xpos, ypos+1, "Left difficulty ");
myLeftDiffGroup = new RadioButtonGroup();
StaticTextWidget* s = new StaticTextWidget(myTab, font, xpos, ypos + 1, "TV type ");
myTVTypeGroup = new RadioButtonGroup();
RadioButtonWidget* r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1,
"Color", myTVTypeGroup);
wid.push_back(r);
ypos += lineHeight;
r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1,
"B/W", myTVTypeGroup);
wid.push_back(r);
ypos += lineHeight + VGAP * 2;
s = new StaticTextWidget(myTab, font, xpos, ypos+1, "Left difficulty ");
myLeftDiffGroup = new RadioButtonGroup();
r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1,
"A", myLeftDiffGroup);
wid.push_back(r);
ypos += lineHeight;
@ -159,22 +172,6 @@ GameInfoDialog::GameInfoDialog(
r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1,
"B", myRightDiffGroup);
wid.push_back(r);
ypos += lineHeight + VGAP * 2;
s = new StaticTextWidget(myTab, font, xpos, ypos+1, "TV type ");
myTVTypeGroup = new RadioButtonGroup();
r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1,
"Color", myTVTypeGroup);
wid.push_back(r);
ypos += lineHeight;
r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1,
"B/W", myTVTypeGroup);
wid.push_back(r);
// Add message concerning usage
ypos = myTab->getHeight() - 5 - fontHeight - ifont.getFontHeight() - 10;
new StaticTextWidget(myTab, ifont, xpos, ypos,
"(*) Changes to properties require a ROM reload");
// Add items for tab 1
addToFocusList(wid, myTab, tabID);
@ -499,7 +496,12 @@ void GameInfoDialog::saveConfig()
{
instance().console().setProperties(myGameProperties);
// update display immediately
// update 'Console' tab settings immediately
instance().console().switches().setTvColor(myTVTypeGroup->getSelected() == 0);
instance().console().switches().setLeftDifficultyA(myLeftDiffGroup->getSelected() == 0);
instance().console().switches().setRightDifficultyA(myRightDiffGroup->getSelected() == 0);
// update 'Display' tab settings immediately
bool reset = false;
instance().console().setFormat(myFormat->getSelected());
if(uInt32(myYStart->getValue()) != TIAConstants::minYStart - 1 &&