two sets for developer related options defined

reverted some changes previous changes ("colorloss", "stats" and "grabmouse" are persisted again)
This commit is contained in:
thrust26 2017-11-24 20:38:21 +01:00
parent 1a7dff416a
commit 08f29ca808
13 changed files with 275 additions and 202 deletions

View File

@ -321,7 +321,7 @@ void RiotWidget::loadConfig()
myP1Diff->setSelectedIndex(riot.diffP1()); myP1Diff->setSelectedIndex(riot.diffP1());
bool devSettings = instance().settings().getBool("dev.settings"); bool devSettings = instance().settings().getBool("dev.settings");
myConsole->setText(devSettings && instance().settings().getString("dev.console") == "7800" ? "Atari 7800" : "Atari 2600"); myConsole->setText(instance().settings().getString(devSettings ? "dev.console" : "plr.console") == "7800" ? "Atari 7800" : "Atari 2600");
myConsole->setEditable(false, true); myConsole->setEditable(false, true);
myTVType->setSelectedIndex(riot.tvType()); myTVType->setSelectedIndex(riot.tvType());
@ -470,7 +470,7 @@ void RiotWidget::handleConsole()
{ {
RiotDebug& riot = instance().debugger().riotDebug(); RiotDebug& riot = instance().debugger().riotDebug();
bool devSettings = instance().settings().getBool("dev.settings"); bool devSettings = instance().settings().getBool("dev.settings");
bool is7800 = devSettings && instance().settings().getString("dev.console") == "7800"; bool is7800 = instance().settings().getString(devSettings ? "dev.console" : "plr.console") == "7800";
myTVType->setEnabled(!is7800); myTVType->setEnabled(!is7800);
myPause->setEnabled(is7800); myPause->setEnabled(is7800);

View File

@ -91,7 +91,7 @@ void Cartridge::createCodeAccessBase(uInt32 size)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge::initializeRAM(uInt8* arr, uInt32 size, uInt8 val) const void Cartridge::initializeRAM(uInt8* arr, uInt32 size, uInt8 val) const
{ {
if(mySettings.getBool("dev.settings") && mySettings.getBool("dev.ramrandom")) if(mySettings.getBool(mySettings.getBool("dev.settings") ? "dev.ramrandom" : "plr.ramrandom"))
for(uInt32 i = 0; i < size; ++i) for(uInt32 i = 0; i < size; ++i)
arr[i] = mySystem->randGenerator().next(); arr[i] = mySystem->randGenerator().next();
else else
@ -101,7 +101,7 @@ void Cartridge::initializeRAM(uInt8* arr, uInt32 size, uInt8 val) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge::randomizeStartBank() void Cartridge::randomizeStartBank()
{ {
if(mySettings.getBool("dev.settings") && mySettings.getBool("dev.bankrandom")) if(mySettings.getBool(mySettings.getBool("dev.settings") ? "dev.bankrandom" : "plr.bankrandom"))
myStartBank = mySystem->randGenerator().next() % bankCount(); myStartBank = mySystem->randGenerator().next() % bankCount();
} }

View File

@ -363,6 +363,9 @@ void Console::toggleColorLoss()
bool colorloss = !myTIA->colorLossEnabled(); bool colorloss = !myTIA->colorLossEnabled();
if(myTIA->enableColorLoss(colorloss)) if(myTIA->enableColorLoss(colorloss))
{ {
myOSystem.settings().setValue(
myOSystem.settings().getBool("dev.settings") ? "dev.colorloss" : "plr.colorloss", colorloss);
string message = string("PAL color-loss ") + string message = string("PAL color-loss ") +
(colorloss ? "enabled" : "disabled"); (colorloss ? "enabled" : "disabled");
myOSystem.frameBuffer().showMessage(message); myOSystem.frameBuffer().showMessage(message);
@ -527,8 +530,8 @@ FBInitStatus Console::initializeVideo(bool full)
if(fbstatus != kSuccess) if(fbstatus != kSuccess)
return fbstatus; return fbstatus;
myOSystem.frameBuffer().showFrameStats(myOSystem.settings().getBool("dev.settings") && myOSystem.frameBuffer().showFrameStats(
myOSystem.settings().getBool("dev.stats")); myOSystem.settings().getBool(myOSystem.settings().getBool("dev.settings") ? "dev.stats" : "plr.stats"));
generateColorLossPalette(); generateColorLossPalette();
} }
setPalette(myOSystem.settings().getString("palette")); setPalette(myOSystem.settings().getString("palette"));

View File

@ -901,7 +901,7 @@ void EventHandler::handleEvent(Event::Type event, int state)
// Take care of special events that aren't part of the emulation core // Take care of special events that aren't part of the emulation core
// or need to be preprocessed before passing them on // or need to be preprocessed before passing them on
bool devSettings = myOSystem.settings().getBool("dev.settings"); bool devSettings = myOSystem.settings().getBool("dev.settings");
bool is7800 = devSettings && (myOSystem.settings().getString("dev.console") == "7800"); bool is7800 = (myOSystem.settings().getString(devSettings ? "dev.console" : "plr.console") == "7800");
switch(event) switch(event)
{ {

View File

@ -372,6 +372,8 @@ void FrameBuffer::showMessage(const string& message, MessagePosition position,
void FrameBuffer::toggleFrameStats() void FrameBuffer::toggleFrameStats()
{ {
showFrameStats(!myStatsEnabled); showFrameStats(!myStatsEnabled);
myOSystem.settings().setValue(
myOSystem.settings().getBool("dev.settings") ? "dev.stats" : "plr.stats", myStatsEnabled);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -619,6 +621,7 @@ void FrameBuffer::toggleGrabMouse()
{ {
myGrabMouse = !myGrabMouse; myGrabMouse = !myGrabMouse;
setCursorState(); setCursorState();
myOSystem.settings().setValue("grabmouse", myGrabMouse);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -87,7 +87,7 @@ void M6502::reset()
// Set registers to random or default values // Set registers to random or default values
bool devSettings = mySettings.getBool("dev.settings"); bool devSettings = mySettings.getBool("dev.settings");
const string& cpurandom = devSettings ? mySettings.getString("dev.cpurandom") : ""; const string& cpurandom = mySettings.getString(devSettings ? "dev.cpurandom" : "plr.cpurandom");
SP = BSPF::containsIgnoreCase(cpurandom, "S") ? SP = BSPF::containsIgnoreCase(cpurandom, "S") ?
mySystem->randGenerator().next() : 0xfd; mySystem->randGenerator().next() : 0xfd;
A = BSPF::containsIgnoreCase(cpurandom, "A") ? A = BSPF::containsIgnoreCase(cpurandom, "A") ?

View File

@ -56,10 +56,10 @@ void M6532::reset()
// Initialize the 128 bytes of memory // Initialize the 128 bytes of memory
bool devSettings = mySettings.getBool("dev.settings"); bool devSettings = mySettings.getBool("dev.settings");
if(devSettings && mySettings.getString("dev.console") == "7800") if(mySettings.getString(devSettings ? "dev.console" : "plr.console") == "7800")
for(uInt32 t = 0; t < 128; ++t) for(uInt32 t = 0; t < 128; ++t)
myRAM[t] = RAM_7800[t]; myRAM[t] = RAM_7800[t];
else if(devSettings && mySettings.getBool("dev.ramrandom")) else if(mySettings.getBool(devSettings ? "dev.ramrandom" : "plr.ramrandom"))
for(uInt32 t = 0; t < 128; ++t) for(uInt32 t = 0; t < 128; ++t)
myRAM[t] = mySystem->randGenerator().next(); myRAM[t] = mySystem->randGenerator().next();
else else

View File

@ -145,25 +145,24 @@ Settings::Settings(OSystem& osystem)
#endif #endif
// player settings // player settings
setInternal("plr.settings", "false");
setInternal("plr.stats", "false"); setInternal("plr.stats", "false");
setInternal("plr.bankrandom", "true"); setInternal("plr.bankrandom", "false");
setInternal("plr.ramrandom", "true"); setInternal("plr.ramrandom", "false");
setInternal("plr.cpurandom", "SAXYP"); setInternal("plr.cpurandom", "");
setInternal("plr.colorloss", "true"); setInternal("plr.colorloss", "false");
setInternal("plr.tv.jitter", "true"); setInternal("plr.tv.jitter", "true");
setInternal("plr.tv.jitter_recovery", "2"); setInternal("plr.tv.jitter_recovery", "10");
setInternal("plr.debugcolors", "false"); setInternal("plr.debugcolors", "false");
setInternal("plr.tiadriven", "true"); setInternal("plr.tiadriven", "false");
setInternal("plr.console", "2600"); // 7800 setInternal("plr.console", "2600"); // 7800
setInternal("plr.rewind", false); setInternal("plr.rewind", false);
setInternal("plr.rewind.size", 100); setInternal("plr.rewind.size", 100);
setInternal("plr.rewind.interval", 2); // = 1 frame setInternal("plr.rewind.interval", 4); // = 1 frame
setInternal("plr.rewind.horizon", 3); // = ~10 seconds setInternal("plr.rewind.horizon", 5); // = ~10 minutes
// developer settings // developer settings
setInternal("dev.settings", "false"); setInternal("dev.settings", "false");
setInternal("dev.stats", "false"); setInternal("dev.stats", "true");
setInternal("dev.bankrandom", "true"); setInternal("dev.bankrandom", "true");
setInternal("dev.ramrandom", "true"); setInternal("dev.ramrandom", "true");
setInternal("dev.cpurandom", "SAXYP"); setInternal("dev.cpurandom", "SAXYP");
@ -554,6 +553,7 @@ void Settings::usage() const
<< " -plr.debugcolors <1|0> Enable debug colors\n" << " -plr.debugcolors <1|0> Enable debug colors\n"
<< endl << endl
<< " The same parameters but for developer settings mode\n" << " The same parameters but for developer settings mode\n"
<< " -dev.settings <1|0> Select developer settings mode\n"
<< " -dev.console <2600|7800> Select console for B/W and Pause key handling\n" << " -dev.console <2600|7800> Select console for B/W and Pause key handling\n"
<< " -dev.stats <1|0> Overlay console info during emulation\n" << " -dev.stats <1|0> Overlay console info during emulation\n"
<< " -dev.tiadriven <1|0> Drive unused TIA pins randomly on a read/peek\n" << " -dev.tiadriven <1|0> Drive unused TIA pins randomly on a read/peek\n"

View File

@ -80,7 +80,7 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
myCollisionsEnabledBits(0xFF) myCollisionsEnabledBits(0xFF)
{ {
bool devSettings = mySettings.getBool("dev.settings"); bool devSettings = mySettings.getBool("dev.settings");
myTIAPinsDriven = devSettings && mySettings.getBool("dev.tiadriven"); myTIAPinsDriven = mySettings.getBool(devSettings ? "dev.tiadriven" : "plr.tiadriven");
myBackground.setTIA(this); myBackground.setTIA(this);
myPlayfield.setTIA(this); myPlayfield.setTIA(this);
@ -90,8 +90,8 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
myMissile1.setTIA(this); myMissile1.setTIA(this);
myBall.setTIA(this); myBall.setTIA(this);
myEnableJitter = devSettings ? mySettings.getBool("dev.tv.jitter") : false; myEnableJitter = mySettings.getBool(devSettings ? "dev.tv.jitter" : "plr.tv.jitter");
myJitterFactor = devSettings ? mySettings.getInt("dev.tv.jitter_recovery") : 10; myJitterFactor = mySettings.getInt(devSettings ? "dev.tv.jitter_recovery" : "plr.tv.jitter_recovery");
reset(); reset();
} }
@ -173,7 +173,7 @@ void TIA::reset()
frameReset(); // Recalculate the size of the display frameReset(); // Recalculate the size of the display
// Must be done last, after all other items have reset // Must be done last, after all other items have reset
enableFixedColors(mySettings.getBool("dev.settings") && mySettings.getBool("dev.debugcolors")); enableFixedColors(mySettings.getBool(mySettings.getBool("dev.settings") ? "dev.debugcolors" : "plr.debugcolors"));
setFixedColorPalette(mySettings.getString("tia.dbgcolors")); setFixedColorPalette(mySettings.getString("tia.dbgcolors"));
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
@ -186,7 +186,7 @@ void TIA::frameReset()
{ {
memset(myFramebuffer, 0, 160 * TIAConstants::frameBufferHeight); memset(myFramebuffer, 0, 160 * TIAConstants::frameBufferHeight);
myAutoFrameEnabled = mySettings.getInt("framerate") <= 0; myAutoFrameEnabled = mySettings.getInt("framerate") <= 0;
enableColorLoss(mySettings.getBool("dev.settings") && mySettings.getBool("dev.colorloss")); enableColorLoss(mySettings.getBool("dev.settings") ? "dev.colorloss" : "plr.colorloss");
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1007,7 +1007,7 @@ bool TIA::driveUnusedPinsRandom(uInt8 mode)
if (mode == 0 || mode == 1) if (mode == 0 || mode == 1)
{ {
myTIAPinsDriven = bool(mode); myTIAPinsDriven = bool(mode);
//mySettings.setValue("dev.tiadriven", myTIAPinsDriven); mySettings.setValue(mySettings.getBool("dev.settings") ? "dev.tiadriven" : "plr.tiadriven", myTIAPinsDriven);
} }
return myTIAPinsDriven; return myTIAPinsDriven;
} }

View File

@ -26,6 +26,7 @@
#include "EventMappingWidget.hxx" #include "EventMappingWidget.hxx"
#include "EditTextWidget.hxx" #include "EditTextWidget.hxx"
#include "PopUpWidget.hxx" #include "PopUpWidget.hxx"
#include "RadioButtonWidget.hxx"
#include "TabWidget.hxx" #include "TabWidget.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "Font.hxx" #include "Font.hxx"
@ -81,12 +82,18 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
VariantList items; VariantList items;
int tabID = myTab->addTab(" Emulation "); int tabID = myTab->addTab(" Emulation ");
myDevSettings = new CheckboxWidget(myTab, font, HBORDER, ypos, "Enable developer settings", kDevSettings); mySettingsGroup = new RadioButtonGroup();
wid.push_back(myDevSettings);
myPlayerSettingsWidget = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1, "Player settings", mySettingsGroup, kPlrSettings);
wid.push_back(myPlayerSettingsWidget);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
myFrameStats = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos, "Show frame statistics"); myDevSettingsWidget = new RadioButtonWidget(myTab, font, HBORDER, ypos, "Developer settings", mySettingsGroup, kDevSettings);
wid.push_back(myFrameStats); wid.push_back(myDevSettingsWidget);
ypos += lineHeight + VGAP;
myFrameStatsWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos, "Show frame statistics");
wid.push_back(myFrameStatsWidget);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
// 2600/7800 mode // 2600/7800 mode
@ -96,8 +103,8 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
int lwidth = font.getStringWidth("Console "); int lwidth = font.getStringWidth("Console ");
int pwidth = font.getStringWidth("Atari 2600"); int pwidth = font.getStringWidth("Atari 2600");
myConsole = new PopUpWidget(myTab, font, HBORDER + INDENT * 1, ypos, pwidth, lineHeight, items, "Console ", lwidth, kConsole); myConsoleWidget = new PopUpWidget(myTab, font, HBORDER + INDENT * 1, ypos, pwidth, lineHeight, items, "Console ", lwidth, kConsole);
wid.push_back(myConsole); wid.push_back(myConsoleWidget);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
// Randomize items // Randomize items
@ -105,14 +112,14 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
wid.push_back(myLoadingROMLabel); wid.push_back(myLoadingROMLabel);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
myRandomBank = new CheckboxWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1, "Random startup bank"); myRandomBankWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1, "Random startup bank");
wid.push_back(myRandomBank); wid.push_back(myRandomBankWidget);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
// Randomize RAM // Randomize RAM
myRandomizeRAM = new CheckboxWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1, myRandomizeRAMWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1,
"Randomize zero-page and extended RAM", kRandRAMID); "Randomize zero-page and extended RAM", kRandRAMID);
wid.push_back(myRandomizeRAM); wid.push_back(myRandomizeRAMWidget);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
// Randomize CPU // Randomize CPU
@ -124,43 +131,43 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
const char* const cpuregs[] = { "SP", "A", "X", "Y", "PS" }; const char* const cpuregs[] = { "SP", "A", "X", "Y", "PS" };
for(int i = 0; i < 5; ++i) for(int i = 0; i < 5; ++i)
{ {
myRandomizeCPU[i] = new CheckboxWidget(myTab, font, xpos, ypos + 2, myRandomizeCPUWidget[i] = new CheckboxWidget(myTab, font, xpos, ypos + 2,
cpuregs[i], kRandCPUID); cpuregs[i], kRandCPUID);
wid.push_back(myRandomizeCPU[i]); wid.push_back(myRandomizeCPUWidget[i]);
xpos += CheckboxWidget::boxSize() + font.getStringWidth("XX") + 20; xpos += CheckboxWidget::boxSize() + font.getStringWidth("XX") + 20;
} }
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
// debug colors // debug colors
myDebugColors = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1, "Debug colors"); myDebugColorsWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1, "Debug colors");
wid.push_back(myDebugColors); wid.push_back(myDebugColorsWidget);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
myColorLoss = new CheckboxWidget(myTab, font, HBORDER + INDENT*1, ypos + 1, "PAL color-loss"); myColorLossWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT*1, ypos + 1, "PAL color-loss");
wid.push_back(myColorLoss); wid.push_back(myColorLossWidget);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
// TV jitter effect // TV jitter effect
myTVJitter = new CheckboxWidget(myTab, font, HBORDER + INDENT*1, ypos + 1, "Jitter/Roll effect", kTVJitter); myTVJitterWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT*1, ypos + 1, "Jitter/Roll effect", kTVJitter);
wid.push_back(myTVJitter); wid.push_back(myTVJitterWidget);
myTVJitterRec = new SliderWidget(myTab, font, myTVJitterRecWidget = new SliderWidget(myTab, font,
myTVJitter->getRight()+ 16, ypos - 1, myTVJitterWidget->getRight()+ 16, ypos - 1,
8 * fontWidth, lineHeight, "recovery ", 8 * fontWidth, lineHeight, "recovery ",
font.getStringWidth("recovery "), kTVJitterChanged); font.getStringWidth("recovery "), kTVJitterChanged);
myTVJitterRec->setMinValue(1); myTVJitterRec->setMaxValue(20); myTVJitterRecWidget->setMinValue(1); myTVJitterRecWidget->setMaxValue(20);
wid.push_back(myTVJitterRec); wid.push_back(myTVJitterRecWidget);
myTVJitterRecLabel = new StaticTextWidget(myTab, font, myTVJitterRecLabelWidget = new StaticTextWidget(myTab, font,
myTVJitterRec->getRight() + 4, myTVJitterRec->getTop(), myTVJitterRecWidget->getRight() + 4, myTVJitterRecWidget->getTop(),
5 * fontWidth, fontHeight, "", kTextAlignLeft); 5 * fontWidth, fontHeight, "", kTextAlignLeft);
myTVJitterRecLabel->setFlags(WIDGET_CLEARBG); myTVJitterRecLabelWidget->setFlags(WIDGET_CLEARBG);
wid.push_back(myTVJitterRecLabel); wid.push_back(myTVJitterRecLabelWidget);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
// How to handle undriven TIA pins // How to handle undriven TIA pins
myUndrivenPins = new CheckboxWidget(myTab, font, HBORDER + INDENT*1, ypos + 1, myUndrivenPinsWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT*1, ypos + 1,
"Drive unused TIA pins randomly on a read/peek"); "Drive unused TIA pins randomly on a read/peek");
wid.push_back(myUndrivenPins); wid.push_back(myUndrivenPinsWidget);
// Add items for tab 0 // Add items for tab 0
addToFocusList(wid, myTab, tabID); addToFocusList(wid, myTab, tabID);
@ -339,36 +346,119 @@ void DeveloperDialog::addDefaultOKCancelButtons(const GUI::Font& font)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::loadConfig() void DeveloperDialog::copySettingsToSet(SettingsSet set)
{ {
myDevSettings->setState(instance().settings().getBool("dev.settings")); string prefix = set == SettingsSet::player ? "plr." : "dev.";
myFrameStats->setState(instance().settings().getBool("dev.stats")); myFrameStats[set] = instance().settings().getBool(prefix + "stats");
myConsole->setSelectedIndex(instance().settings().getString("dev.console") == "7800" ? 1 : 0); myConsole[set] = instance().settings().getString(prefix + "console") == "7800" ? 1 : 0;
myRandomBank->setState(instance().settings().getBool("dev.bankrandom")); // Randomization
myRandomizeRAM->setState(instance().settings().getBool("dev.ramrandom")); myRandomBank[set] = instance().settings().getBool(prefix + "bankrandom");
myRandomizeRAM[set] = instance().settings().getBool(prefix + "ramrandom");
myRandomizeCPU[set] = instance().settings().getString(prefix + "cpurandom");
// Debug colors
myDebugColors[set] = instance().settings().getBool(prefix + "debugcolors");
// PAL color-loss effect
myColorLoss[set] = instance().settings().getBool(prefix + "colorloss");
// Jitter
myTVJitter[set] = instance().settings().getBool(prefix + "tv.jitter");
myTVJitterRec[set] = instance().settings().getInt(prefix + "tv.jitter_recovery");
// Undriven TIA pins
myUndrivenPins[set] = instance().settings().getBool(prefix + "tiadriven");
}
const string& cpurandom = instance().settings().getString("dev.cpurandom"); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::copySetToSettings(SettingsSet set)
{
string prefix = set == SettingsSet::player ? "plr." : "dev.";
instance().settings().setValue(prefix + "stats", myFrameStats[set]);
instance().settings().setValue(prefix + "console", myConsole[set] == 1 ? "7800" : "2600");
// Randomization
instance().settings().setValue(prefix + "bankrandom", myRandomBank[set]);
instance().settings().setValue(prefix + "ramrandom", myRandomizeRAM[set]);
instance().settings().setValue(prefix + "cpurandom", myRandomizeCPU[set]);
// Debug colors
instance().settings().setValue(prefix + "debugcolors", myDebugColors[set]);
// PAL color loss
instance().settings().setValue(prefix + "colorloss", myColorLoss[set]);
// Jitter
instance().settings().setValue(prefix + "tv.jitter", myTVJitter[set]);
instance().settings().setValue(prefix + "tv.jitter_recovery", myTVJitterRec[set]);
instance().settings().setValue(prefix + "tiadriven", myUndrivenPins[set]);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::copyStateToSet(SettingsSet set)
{
myFrameStats[set] = myFrameStatsWidget->getState();
myConsole[set] = myConsoleWidget->getSelected() == 1;
// Randomization
myRandomBank[set] = myRandomBankWidget->getState();
myRandomizeRAM[set] = myRandomizeRAMWidget->getState();
string cpurandom;
const char* const cpuregs[] = { "S", "A", "X", "Y", "P" }; const char* const cpuregs[] = { "S", "A", "X", "Y", "P" };
for(int i = 0; i < 5; ++i) for(int i = 0; i < 5; ++i)
myRandomizeCPU[i]->setState(BSPF::containsIgnoreCase(cpurandom, cpuregs[i])); if(myRandomizeCPUWidget[i]->getState())
cpurandom += cpuregs[i];
myRandomizeCPU[set] = cpurandom;
// Debug colors
myDebugColors[set] = myDebugColorsWidget->getState();
// PAL color-loss effect // PAL color-loss effect
myColorLoss->setState(instance().settings().getBool("dev.colorloss")); myColorLoss[set] = myColorLossWidget->getState();
// Jitter
myTVJitter->setState(instance().settings().getBool("dev.tv.jitter")); myTVJitter[set] = myTVJitterWidget->getState();
myTVJitterRec->setValue(instance().settings().getInt("dev.tv.jitter_recovery")); myTVJitterRec[set] = myTVJitterRecWidget->getValue();
myDebugColors->setState(instance().settings().getBool("dev.debugcolors"));
// Undriven TIA pins // Undriven TIA pins
myUndrivenPins->setState(instance().settings().getBool("dev.tiadriven")); myUndrivenPins[set] = myUndrivenPinsWidget->getState();
}
handleDeveloperOptions(); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::copySetToState(SettingsSet set)
{
myFrameStatsWidget->setState(myFrameStats[set]);
myConsoleWidget->setSelectedIndex(myConsole[set]);
// Randomization
myRandomBankWidget->setState(myRandomBank[set]);
myRandomizeRAMWidget->setState(myRandomizeRAM[set]);
myContinuousRewind->setState(instance().settings().getBool("dev.rewind")); const string& cpurandom = myRandomizeCPU[set];
myStateSize->setValue(instance().settings().getInt("dev.rewind.size")); const char* const cpuregs[] = { "S", "A", "X", "Y", "P" };
myStateInterval->setValue(instance().settings().getInt("dev.rewind.interval")); for(int i = 0; i < 5; ++i)
myStateHorizon->setValue(instance().settings().getInt("dev.rewind.horizon")); myRandomizeCPUWidget[i]->setState(BSPF::containsIgnoreCase(cpurandom, cpuregs[i]));
// Debug colors
myDebugColorsWidget->setState(myDebugColors[set]);
// PAL color-loss effect
myColorLossWidget->setState(myColorLoss[set]);
// Jitter
myTVJitterWidget->setState(myTVJitter[set]);
myTVJitterRecWidget->setValue(myTVJitterRec[set]);
// Undriven TIA pins
myUndrivenPinsWidget->setState(myUndrivenPins[set]);
handleConsole();
handleTVJitterChange(myTVJitterWidget->getState());
handleDebugColors();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::loadConfig()
{
bool devSettings = instance().settings().getBool("dev.settings");
myDevSettingsWidget->setState(devSettings);
myPlayerSettingsWidget->setState(!devSettings);
// load both setting sets...
copySettingsToSet(SettingsSet::player);
copySettingsToSet(SettingsSet::developer);
// ...and select the current one
copySetToState(devSettings ? SettingsSet::developer : SettingsSet::player);
myContinuousRewind->setState(instance().settings().getBool(devSettings ? "dev.rewind" : "plr.rewind"));
myStateSize->setValue(instance().settings().getInt(devSettings ? "dev.rewind.size": "plr.rewind.size"));
myStateInterval->setValue(instance().settings().getInt(devSettings ? "dev.rewind.interval" : "plr.rewind.interval"));
myStateHorizon->setValue(instance().settings().getInt(devSettings ? "dev.rewind.horizon" : "plr.rewind.horizon"));
handleRewind(); handleRewind();
handleSize(); handleSize();
@ -405,55 +495,25 @@ void DeveloperDialog::loadConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::saveConfig() void DeveloperDialog::saveConfig()
{ {
bool devSettings = myDevSettings->getState(); bool devSettings = myDevSettingsWidget->getState();
instance().settings().setValue("dev.settings", devSettings); instance().settings().setValue("dev.settings", devSettings);
copyStateToSet(devSettings ? SettingsSet::developer : SettingsSet::player);
copySetToSettings(SettingsSet::player);
copySetToSettings(SettingsSet::developer);
instance().settings().setValue("dev.stats", myFrameStats->getState()); //activate the current ones
instance().frameBuffer().showFrameStats(devSettings && myFrameStats->getState()); instance().frameBuffer().showFrameStats(myFrameStatsWidget->getState());
bool is7800 = myConsole->getSelected() == 1;
instance().settings().setValue("dev.console", is7800 ? "7800" : "2600");
instance().settings().setValue("dev.bankrandom", myRandomBank->getState());
instance().settings().setValue("dev.ramrandom", myRandomizeRAM->getState());
string cpurandom;
const char* const cpuregs[] = { "S", "A", "X", "Y", "P" };
for(int i = 0; i < 5; ++i)
if(myRandomizeCPU[i]->getState())
cpurandom += cpuregs[i];
instance().settings().setValue("dev.cpurandom", cpurandom);
// jitter // jitter
instance().settings().setValue("dev.tv.jitter", myTVJitter->getState());
instance().settings().setValue("dev.tv.jitter_recovery", myTVJitterRecLabel->getLabel());
if(instance().hasConsole()) if(instance().hasConsole())
{ {
if (devSettings) instance().console().tia().toggleJitter(myTVJitterWidget->getState() ? 1 : 0);
{ instance().console().tia().setJitterRecoveryFactor(myTVJitterRecWidget->getValue());
instance().console().tia().toggleJitter(myTVJitter->getState() ? 1 : 0);
instance().console().tia().setJitterRecoveryFactor(myTVJitterRec->getValue());
}
else
{
instance().console().tia().toggleJitter(0);
}
} }
instance().settings().setValue("dev.debugcolors", myDebugColors->getState());
handleDebugColors(); handleDebugColors();
// PAL color loss // PAL color loss
instance().settings().setValue("dev.colorloss", myColorLoss->getState());
if(instance().hasConsole()) if(instance().hasConsole())
{ instance().console().enableColorLoss(myColorLossWidget->getState());
if(devSettings)
instance().console().enableColorLoss(myColorLoss->getState());
else
instance().console().enableColorLoss(false);
}
instance().settings().setValue("dev.tiadriven", myUndrivenPins->getState());
// Finally, issue a complete framebuffer re-initialization // Finally, issue a complete framebuffer re-initialization
//instance().createFrameBuffer(); //instance().createFrameBuffer();
@ -512,33 +572,33 @@ void DeveloperDialog::saveConfig()
void DeveloperDialog::setDefaults() void DeveloperDialog::setDefaults()
{ {
myDevSettings->setState(false); bool devSettings = myDevSettingsWidget->getState();
switch(myTab->getActiveTab()) switch(myTab->getActiveTab())
{ {
case 0: case 0:
myFrameStats->setState(true); {
myConsole->setSelectedIndex(0); SettingsSet set = devSettings ? SettingsSet::developer : SettingsSet::player;
myRandomBank->setState(true);
myRandomizeRAM->setState(true);
for(int i = 0; i < 5; ++i)
myRandomizeCPU[i]->setState(true);
myFrameStats[set] = devSettings ? true : false;
myConsole[set] = 0;
// Randomization
myRandomBank[set] = devSettings ? true : false;
myRandomizeRAM[set] = devSettings ? true : false;
myRandomizeCPU[set] = devSettings ? "SAXYP" : "";
// Debug colors
myDebugColors[set] = false;
// PAL color-loss effect // PAL color-loss effect
myColorLoss->setState(true); myColorLoss[set] = devSettings ? true : false;
// jitter // Jitter
myTVJitter->setState(true); myTVJitter[set] = true;
myTVJitterRec->setValue(2); myTVJitterRec[set] = devSettings ? 2 : 10;
// debug colors
myDebugColors->setState(false);
// Undriven TIA pins // Undriven TIA pins
myUndrivenPins->setState(true); myUndrivenPins[set] = devSettings ? true : false;
handleDeveloperOptions(); copySetToState(set);
handleTVJitterChange(false);
handleDebugColors();
break; break;
}
case 1: // States case 1: // States
myContinuousRewind->setState(false); myContinuousRewind->setState(false);
myStateSize->setValue(100); myStateSize->setValue(100);
@ -576,8 +636,12 @@ void DeveloperDialog::handleCommand(CommandSender* sender, int cmd, int data, in
{ {
switch(cmd) switch(cmd)
{ {
case kPlrSettings:
handleSettings(false);
break;
case kDevSettings: case kDevSettings:
handleDeveloperOptions(); handleSettings(true);
break; break;
case kConsole: case kConsole:
@ -585,15 +649,15 @@ void DeveloperDialog::handleCommand(CommandSender* sender, int cmd, int data, in
break; break;
case kTVJitter: case kTVJitter:
handleTVJitterChange(myTVJitter->getState()); handleTVJitterChange(myTVJitterWidget->getState());
break; break;
case kTVJitterChanged: case kTVJitterChanged:
myTVJitterRecLabel->setValue(myTVJitterRec->getValue()); myTVJitterRecLabelWidget->setValue(myTVJitterRecWidget->getValue());
break; break;
case kPPinCmd: case kPPinCmd:
instance().console().tia().driveUnusedPinsRandom(myUndrivenPins->getState()); instance().console().tia().driveUnusedPinsRandom(myUndrivenPinsWidget->getState());
break; break;
case kRewind: case kRewind:
@ -646,43 +710,28 @@ void DeveloperDialog::handleCommand(CommandSender* sender, int cmd, int data, in
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::handleDeveloperOptions() void DeveloperDialog::handleSettings(bool devSettings)
{ {
bool enable = myDevSettings->getState(); myDevSettingsWidget->setState(devSettings );
myFrameStats->setEnabled(enable); copyStateToSet(devSettings ? SettingsSet::player : SettingsSet::developer);
myConsole->setEnabled(enable); copySetToState(devSettings ? SettingsSet::developer : SettingsSet::player);
// CPU
myLoadingROMLabel->setEnabled(enable);
myRandomBank->setEnabled(enable);
myRandomizeRAM->setEnabled(enable);
myRandomizeCPULabel->setEnabled(enable);
for(int i = 0; i < 5; ++i)
myRandomizeCPU[i]->setEnabled(enable);
handleConsole();
// TIA
myColorLoss->setEnabled(enable);
myTVJitter->setEnabled(enable);
handleTVJitterChange(enable && myTVJitter->getState());
myDebugColors->setEnabled(enable);
myUndrivenPins->setEnabled(enable);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::handleTVJitterChange(bool enable) void DeveloperDialog::handleTVJitterChange(bool enable)
{ {
myTVJitterRec->setEnabled(enable); myTVJitterRecWidget->setEnabled(enable);
myTVJitterRecLabel->setEnabled(enable); myTVJitterRecLabelWidget->setEnabled(enable);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::handleDebugColors() void DeveloperDialog::handleDebugColors()
{ {
if(instance().hasConsole() && myDevSettings->getState()) if(instance().hasConsole() && myDevSettingsWidget->getState())
{ {
bool fixed = instance().console().tia().usingFixedColors(); bool fixed = instance().console().tia().usingFixedColors();
if(fixed != myDebugColors->getState()) if(fixed != myDebugColorsWidget->getState())
instance().console().tia().toggleFixedColors(); instance().console().tia().toggleFixedColors();
} }
} }
@ -690,12 +739,11 @@ void DeveloperDialog::handleDebugColors()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::handleConsole() void DeveloperDialog::handleConsole()
{ {
bool is7800 = myConsole->getSelected() == 1; bool is7800 = myConsoleWidget->getSelected() == 1;
bool enable = myDevSettings->getState();
myRandomizeRAM->setEnabled(enable && !is7800); myRandomizeRAMWidget->setEnabled(!is7800);
if(is7800) if(is7800)
myRandomizeRAM->setState(false); myRandomizeRAMWidget->setState(false);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -25,6 +25,8 @@ class EventMappingWidget;
class CheckboxWidget; class CheckboxWidget;
class EditTextWidget; class EditTextWidget;
class PopUpWidget; class PopUpWidget;
class RadioButtonGroup;
class RadioButtonWidget;
class SliderWidget; class SliderWidget;
class StaticTextWidget; class StaticTextWidget;
@ -52,7 +54,8 @@ class DeveloperDialog : public Dialog
private: private:
enum enum
{ {
kDevSettings = 'DVst', kPlrSettings = 'DVpl',
kDevSettings = 'DVdv',
kConsole = 'DVco', kConsole = 'DVco',
kRandRAMID = 'DVrm', kRandRAMID = 'DVrm',
kRandCPUID = 'DVcp', kRandCPUID = 'DVcp',
@ -69,6 +72,11 @@ class DeveloperDialog : public Dialog
kDFontSizeChanged = 'UIfs', kDFontSizeChanged = 'UIfs',
#endif #endif
}; };
enum SettingsSet
{
player,
developer
};
static const int NUM_INTERVALS = 6; static const int NUM_INTERVALS = 6;
// TODO: check for intervals shorter than 1 frame (adjust horizon too!) // TODO: check for intervals shorter than 1 frame (adjust horizon too!)
@ -84,42 +92,55 @@ class DeveloperDialog : public Dialog
TabWidget* myTab; TabWidget* myTab;
// Emulator // Emulator
CheckboxWidget* myDevSettings; RadioButtonGroup* mySettingsGroup;
CheckboxWidget* myFrameStats; RadioButtonWidget* myPlayerSettingsWidget;
PopUpWidget* myConsole; RadioButtonWidget* myDevSettingsWidget;
StaticTextWidget* myLoadingROMLabel; CheckboxWidget* myFrameStatsWidget;
CheckboxWidget* myRandomBank; PopUpWidget* myConsoleWidget;
CheckboxWidget* myRandomizeRAM; StaticTextWidget* myLoadingROMLabel;
StaticTextWidget* myRandomizeCPULabel; CheckboxWidget* myRandomBankWidget;
CheckboxWidget* myRandomizeCPU[5]; CheckboxWidget* myRandomizeRAMWidget;
CheckboxWidget* myColorLoss; StaticTextWidget* myRandomizeCPULabel;
CheckboxWidget* myTVJitter; CheckboxWidget* myRandomizeCPUWidget[5];
SliderWidget* myTVJitterRec; CheckboxWidget* myColorLossWidget;
StaticTextWidget* myTVJitterRecLabel; CheckboxWidget* myTVJitterWidget;
CheckboxWidget* myDebugColors; SliderWidget* myTVJitterRecWidget;
CheckboxWidget* myUndrivenPins; StaticTextWidget* myTVJitterRecLabelWidget;
CheckboxWidget* myDebugColorsWidget;
CheckboxWidget* myUndrivenPinsWidget;
// States // States
CheckboxWidget* myContinuousRewind; CheckboxWidget* myContinuousRewind;
SliderWidget* myStateSize; SliderWidget* myStateSize;
StaticTextWidget* myStateSizeLabel; StaticTextWidget* myStateSizeLabel;
SliderWidget* myStateInterval; SliderWidget* myStateInterval;
StaticTextWidget* myStateIntervalLabel; StaticTextWidget* myStateIntervalLabel;
SliderWidget* myStateHorizon; SliderWidget* myStateHorizon;
StaticTextWidget* myStateHorizonLabel; StaticTextWidget* myStateHorizonLabel;
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
// Debugger UI // Debugger UI
SliderWidget* myDebuggerWidthSlider; SliderWidget* myDebuggerWidthSlider;
StaticTextWidget* myDebuggerWidthLabel; StaticTextWidget* myDebuggerWidthLabel;
SliderWidget* myDebuggerHeightSlider; SliderWidget* myDebuggerHeightSlider;
StaticTextWidget* myDebuggerHeightLabel; StaticTextWidget* myDebuggerHeightLabel;
PopUpWidget* myDebuggerFontSize; PopUpWidget* myDebuggerFontSize;
PopUpWidget* myDebuggerFontStyle; PopUpWidget* myDebuggerFontStyle;
#endif #endif
// Maximum width and height for this dialog // Maximum width and height for this dialog
int myMaxWidth, myMaxHeight; int myMaxWidth, myMaxHeight;
bool myFrameStats[2];
int myConsole[2];
bool myRandomBank[2];
bool myRandomizeRAM[2];
string myRandomizeCPU[2];
bool myColorLoss[2];
bool myTVJitter[2];
int myTVJitterRec[2];
bool myDebugColors[2];
bool myUndrivenPins[2];
private: private:
void addEmulationTab(const GUI::Font& font); void addEmulationTab(const GUI::Font& font);
void addDebuggerTab(const GUI::Font& font); void addDebuggerTab(const GUI::Font& font);
@ -127,14 +148,19 @@ class DeveloperDialog : public Dialog
// Add Defaults, OK and Cancel buttons // Add Defaults, OK and Cancel buttons
void addDefaultOKCancelButtons(const GUI::Font& font); void addDefaultOKCancelButtons(const GUI::Font& font);
void handleDeveloperOptions(); void copySettingsToSet(SettingsSet set);
void copySetToSettings(SettingsSet set);
void copyStateToSet(SettingsSet set);
void copySetToState(SettingsSet set);
void handleSettings(bool devSettings);
void handleTVJitterChange(bool enable); void handleTVJitterChange(bool enable);
void handleDebugColors(); void handleDebugColors();
void handleConsole(); void handleConsole();
void handleRewind(); void handleRewind();
void handleSize(); void handleSize();
void handleInterval(); void handleInterval();
void handleHorizon(); void handleHorizon();
void handleFontSize(); void handleFontSize();
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported

View File

@ -114,12 +114,7 @@ void RadioButtonWidget::handleMouseUp(int x, int y, int button, int clickCount)
if(isEnabled() && _editable && x >= 0 && x < _w && y >= 0 && y < _h) if(isEnabled() && _editable && x >= 0 && x < _w && y >= 0 && y < _h)
{ {
if(!_state) if(!_state)
{
setState(true); setState(true);
// We only send a command when the widget has been changed interactively
sendCommand(_cmd, _state, _id);
}
} }
} }
@ -130,7 +125,7 @@ void RadioButtonWidget::setState(bool state, bool send)
{ {
_state = state; _state = state;
setDirty(); setDirty();
if(send) if(_state && send)
sendCommand(_cmd, _state, _id); sendCommand(_cmd, _state, _id);
if (state) if (state)
myGroup->select(this); myGroup->select(this);

View File

@ -462,8 +462,6 @@ void VideoDialog::loadConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::saveConfig() void VideoDialog::saveConfig()
{ {
bool devSettings = instance().settings().getBool("dev.settings");
// Renderer setting // Renderer setting
instance().settings().setValue("video", instance().settings().setValue("video",
myRenderer->getSelectedTag().toString()); myRenderer->getSelectedTag().toString());