From b5c984271644772c4d8acaee8cec7e2f24b71c2b Mon Sep 17 00:00:00 2001 From: thrust26 Date: Fri, 17 Nov 2017 14:02:10 +0100 Subject: [PATCH] DeveloperDialog added - developer only options now have "dev." prefix - options relevant for players and developers are duplicated ("dev." prefix) --- src/debugger/gui/RiotWidget.cxx | 10 +++++----- src/emucore/Cart.cxx | 2 +- src/emucore/Console.cxx | 5 +++-- src/emucore/M6502.cxx | 2 +- src/emucore/M6532.cxx | 2 +- src/emucore/OSystem.hxx | 1 + src/emucore/Settings.cxx | 30 +++++++++++++++++++++++------- src/emucore/tia/TIA.cxx | 13 +++++++------ src/gui/OptionsDialog.cxx | 11 ++++++++++- src/gui/OptionsDialog.hxx | 4 ++++ src/gui/VideoDialog.cxx | 10 ++++++++-- src/windows/Stella.vcxproj | 2 ++ src/windows/Stella.vcxproj.filters | 6 ++++++ 13 files changed, 72 insertions(+), 26 deletions(-) diff --git a/src/debugger/gui/RiotWidget.cxx b/src/debugger/gui/RiotWidget.cxx index 7964de9c2..ca56e0ae1 100644 --- a/src/debugger/gui/RiotWidget.cxx +++ b/src/debugger/gui/RiotWidget.cxx @@ -361,9 +361,9 @@ void RiotWidget::loadConfig() myLeftControl->loadConfig(); myRightControl->loadConfig(); - myRandomizeRAM->setState(instance().settings().getBool("ramrandom")); + myRandomizeRAM->setState(instance().settings().getBool("dev.ramrandom")); - const string& cpurandom = instance().settings().getString("cpurandom"); + const string& cpurandom = instance().settings().getString("dev.cpurandom"); const char* const cpuregs[] = { "S", "A", "X", "Y", "P" }; for(int i = 0; i < 5; ++i) myRandomizeCPU[i]->setState(BSPF::containsIgnoreCase(cpurandom, cpuregs[i])); @@ -451,7 +451,7 @@ void RiotWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) handleConsole(); break; case kRandRAMID: - instance().settings().setValue("ramrandom", myRandomizeRAM->getState()); + instance().settings().setValue("dev.ramrandom", myRandomizeRAM->getState()); break; case kRandCPUID: handleRandomCPU(); @@ -523,7 +523,7 @@ void RiotWidget::handleConsole() { myTVType->setSelectedIndex(myPause->getState() ? 0 : 1); myRandomizeRAM->setState(false); - instance().settings().setValue("ramrandom", 0); + instance().settings().setValue("dev.ramrandom", 0); } else { @@ -541,5 +541,5 @@ void RiotWidget::handleRandomCPU() if(myRandomizeCPU[i]->getState()) cpurandom += cpuregs[i]; - instance().settings().setValue("cpurandom", cpurandom); + instance().settings().setValue("dev.cpurandom", cpurandom); } diff --git a/src/emucore/Cart.cxx b/src/emucore/Cart.cxx index f3d07f6ec..9ce4a8cad 100644 --- a/src/emucore/Cart.cxx +++ b/src/emucore/Cart.cxx @@ -91,7 +91,7 @@ void Cartridge::createCodeAccessBase(uInt32 size) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Cartridge::initializeRAM(uInt8* arr, uInt32 size, uInt8 val) const { - if(mySettings.getBool("ramrandom")) + if(mySettings.getBool("dev.ramrandom")) for(uInt32 i = 0; i < size; ++i) arr[i] = mySystem->randGenerator().next(); else diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 6b79dfd55..75ff524f7 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -366,10 +366,11 @@ void Console::toggleFormat(int direction) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Console::toggleColorLoss() { - bool colorloss = !myOSystem.settings().getBool("colorloss"); + bool devSettings = myOSystem.settings().getBool("dev.settings"); + bool colorloss = !myOSystem.settings().getBool(devSettings ? "dev.colorloss" : "colorloss"); if(myTIA->enableColorLoss(colorloss)) { - myOSystem.settings().setValue("colorloss", colorloss); + myOSystem.settings().setValue(devSettings ? "dev.colorloss" : "colorloss", colorloss); string message = string("PAL color-loss ") + (colorloss ? "enabled" : "disabled"); myOSystem.frameBuffer().showMessage(message); diff --git a/src/emucore/M6502.cxx b/src/emucore/M6502.cxx index db6f2039e..e78eb768c 100644 --- a/src/emucore/M6502.cxx +++ b/src/emucore/M6502.cxx @@ -85,7 +85,7 @@ void M6502::reset() myExecutionStatus = 0; // Set registers to random or default values - const string& cpurandom = mySettings.getString("cpurandom"); + const string& cpurandom = mySettings.getString("dev.cpurandom"); SP = BSPF::containsIgnoreCase(cpurandom, "S") ? mySystem->randGenerator().next() : 0xfd; A = BSPF::containsIgnoreCase(cpurandom, "A") ? diff --git a/src/emucore/M6532.cxx b/src/emucore/M6532.cxx index 6149e313e..cd8a06620 100644 --- a/src/emucore/M6532.cxx +++ b/src/emucore/M6532.cxx @@ -61,7 +61,7 @@ void M6532::reset() if(mySettings.getString("console") == "7800") for(uInt32 t = 0; t < 128; ++t) myRAM[t] = RAM_7800[t]; - else if(mySettings.getBool("ramrandom")) + else if(mySettings.getBool("dev.ramrandom")) for(uInt32 t = 0; t < 128; ++t) myRAM[t] = mySystem->randGenerator().next(); else diff --git a/src/emucore/OSystem.hxx b/src/emucore/OSystem.hxx index cd8d0fead..5be8f4b75 100644 --- a/src/emucore/OSystem.hxx +++ b/src/emucore/OSystem.hxx @@ -61,6 +61,7 @@ class OSystem { friend class EventHandler; friend class VideoDialog; + friend class DeveloperDialog; public: OSystem(); diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index a7df0ff2c..8492b3d30 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -130,10 +130,7 @@ Settings::Settings(OSystem& osystem) setInternal("autoslot", "false"); setInternal("loglevel", "1"); setInternal("logtoconsole", "0"); - setInternal("tiadriven", "false"); setInternal("console", "2600"); // 7800 - setInternal("cpurandom", ""); - setInternal("ramrandom", "true"); setInternal("avoxport", ""); setInternal("stats", "false"); setInternal("fastscbios", "true"); @@ -151,6 +148,17 @@ Settings::Settings(OSystem& osystem) setInternal("dis.relocate", "false"); #endif + // developer settings + setInternal("dev.settings", "false"); + setInternal("dev.bankrandom", "true"); + setInternal("dev.ramrandom", "true"); + setInternal("dev.cpurandom", "SAXYP"); + setInternal("dev.colorloss", "true"); + setInternal("dev.tv.jitter", "true"); + setInternal("dev.tv.jitter_recovery", "1"); + setInternal("dev.debugcolors", "false"); + setInternal("dev.tiadriven", "true"); + #ifdef DTHUMB_SUPPORT // Thumb ARM emulation options setInternal("thumb.trapfatal", "true"); @@ -291,6 +299,8 @@ void Settings::validate() i = getInt("tv.jitter_recovery"); if(i < 1 || i > 20) setInternal("tv.jitter_recovery", "10"); + i = getInt("dev.tv.jitter_recovery"); + if(i < 1 || i > 20) setInternal("dev.tv.jitter_recovery", "10"); #ifdef SOUND_SUPPORT i = getInt("volume"); @@ -455,9 +465,6 @@ void Settings::usage() const << " -holdselect Start the emulator with the Game Select switch held down\n" << " -holdjoy0 Start the emulator with the left joystick direction/fire button held down\n" << " -holdjoy1 Start the emulator with the right joystick direction/fire button held down\n" - << " -tiadriven <1|0> Drive unused TIA pins randomly on a read/peek\n" - << " -cpurandom <1|0> Randomize the contents of CPU registers on reset\n" - << " -ramrandom <1|0> Randomize the contents of RAM on reset\n" << " -maxres Used by developers to force the maximum size of the application window\n" << " -help Show the text you're now reading\n" #ifdef DEBUGGER_SUPPORT @@ -492,8 +499,17 @@ void Settings::usage() const << " -pp Sets the 'Display.Phosphor' property\n" << " -ppblend Sets the 'Display.PPBlend' property\n" #endif + + << " -dev.tiadriven <1|0> Drive unused TIA pins randomly on a read/peek\n" + << " -dev.cpurandom <1|0> Randomize the contents of CPU registers on reset\n" + << " -dev.ramrandom <1|0> Randomize the contents of RAM on reset\n" + << " -dev.colorloss <1|0> Enable PAL color-loss effect\n" + << " -dev.tv.jitter <1|0> Enable TV jitter effect\n" + << " -dev.tv.jitter_recovery <1-20> Set recovery time for TV jitter effect\n" + << " -dev.debugcolors <1|0> Enable debug colors\n" + #ifdef DTHUMB_SUPPORT - << " -thumb.trapfatal <1|0> Determines whether errors in ARM emulation throw an exception\n" + << " -dev.thumb.trapfatal <1|0> Determines whether errors in ARM emulation throw an exception\n" #endif << endl << std::flush; } diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index 2668a0010..2aca21477 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -79,7 +79,7 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings) mySpriteEnabledBits(0xFF), myCollisionsEnabledBits(0xFF) { - myTIAPinsDriven = mySettings.getBool("tiadriven"); + myTIAPinsDriven = mySettings.getBool("dev.tiadriven"); myBackground.setTIA(this); myPlayfield.setTIA(this); @@ -89,8 +89,9 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings) myMissile1.setTIA(this); myBall.setTIA(this); - myEnableJitter = mySettings.getBool("tv.jitter"); - myJitterFactor = mySettings.getInt("tv.jitter_recovery"); + bool devSettings = mySettings.getBool("dev.settings"); + myEnableJitter = mySettings.getBool(devSettings ? "dev.tv.jitter" : "tv.jitter"); + myJitterFactor = mySettings.getInt(devSettings ? "dev.tv.jitter_recovery" : "tv.jitter_recovery"); reset(); } @@ -172,7 +173,7 @@ void TIA::reset() frameReset(); // Recalculate the size of the display // Must be done last, after all other items have reset - enableFixedColors(false); + enableFixedColors(mySettings.getBool("dev.settings") && mySettings.getBool("dev.debugcolors")); setFixedColorPalette(mySettings.getString("tia.dbgcolors")); #ifdef DEBUGGER_SUPPORT @@ -185,7 +186,7 @@ void TIA::frameReset() { memset(myFramebuffer, 0, 160 * TIAConstants::frameBufferHeight); myAutoFrameEnabled = mySettings.getInt("framerate") <= 0; - enableColorLoss(mySettings.getBool("colorloss")); + enableColorLoss(mySettings.getBool(mySettings.getBool("dev.settings") ? "dev.colorloss" : "colorloss")); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1006,7 +1007,7 @@ bool TIA::driveUnusedPinsRandom(uInt8 mode) if (mode == 0 || mode == 1) { myTIAPinsDriven = bool(mode); - mySettings.setValue("tiadriven", myTIAPinsDriven); + mySettings.setValue("dev.tiadriven", myTIAPinsDriven); } return myTIAPinsDriven; } diff --git a/src/gui/OptionsDialog.cxx b/src/gui/OptionsDialog.cxx index 9db6294fb..804dec121 100644 --- a/src/gui/OptionsDialog.cxx +++ b/src/gui/OptionsDialog.cxx @@ -29,6 +29,7 @@ #include "RomAuditDialog.hxx" #include "GameInfoDialog.hxx" #include "LoggerDialog.hxx" +#include "DeveloperDialog.hxx" #include "HelpDialog.hxx" #include "AboutDialog.hxx" #include "OptionsDialog.hxx" @@ -47,7 +48,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent, myIsGlobal(global) { const GUI::Font& font = instance().frameBuffer().font(); - const int buttonWidth = font.getStringWidth("Snapshot Settings" + ELLIPSIS) + 20, + const int buttonWidth = font.getStringWidth("Developer Settings" + ELLIPSIS) + 20, buttonHeight = font.getLineHeight() + 6, rowHeight = font.getLineHeight() + 10; @@ -105,6 +106,9 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent, b = ADD_OD_BUTTON("System Logs" + ELLIPSIS, kLoggerCmd); wid.push_back(b); + b = ADD_OD_BUTTON("Developer Settings" + ELLIPSIS, kDevelopCmd); + wid.push_back(b); + b = ADD_OD_BUTTON("Help" + ELLIPSIS, kHelpCmd); wid.push_back(b); @@ -128,6 +132,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent, myCheatCodeDialog = make_unique(osystem, parent, font); #endif myLoggerDialog = make_unique(osystem, parent, font, max_w, max_h); + myDeveloperDialog = make_unique(osystem, parent, font, max_w, max_h); myHelpDialog = make_unique(osystem, parent, font); myAboutDialog = make_unique(osystem, parent, font); @@ -224,6 +229,10 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd, myLoggerDialog->open(); break; + case kDevelopCmd: + myDeveloperDialog->open(); + break; + case kHelpCmd: myHelpDialog->open(); break; diff --git a/src/gui/OptionsDialog.hxx b/src/gui/OptionsDialog.hxx index 70f757c50..f732bfce0 100644 --- a/src/gui/OptionsDialog.hxx +++ b/src/gui/OptionsDialog.hxx @@ -40,6 +40,8 @@ class OSystem; #include "LoggerDialog.hxx" #include "bspf.hxx" +class DeveloperDialog; + class OptionsDialog : public Dialog { public: @@ -64,6 +66,7 @@ class OptionsDialog : public Dialog unique_ptr myCheatCodeDialog; #endif unique_ptr myLoggerDialog; + unique_ptr myDeveloperDialog; unique_ptr myHelpDialog; unique_ptr myAboutDialog; @@ -85,6 +88,7 @@ class OptionsDialog : public Dialog kInfoCmd = 'INFO', kCheatCmd = 'CHET', kLoggerCmd = 'LOGG', + kDevelopCmd = 'DEVL', kHelpCmd = 'HELP', kAboutCmd = 'ABOU', kExitCmd = 'EXIM' diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx index 3977fb27a..fbd6521ae 100644 --- a/src/gui/VideoDialog.cxx +++ b/src/gui/VideoDialog.cxx @@ -436,6 +436,7 @@ void VideoDialog::loadConfig() // PAL color-loss effect myColorLoss->setState(instance().settings().getBool("colorloss")); + myColorLoss->setEnabled(!instance().settings().getBool("dev.settings")); // Show UI messages myUIMessages->setState(instance().settings().getBool("uimessages")); @@ -485,6 +486,8 @@ void VideoDialog::loadConfig() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void VideoDialog::saveConfig() { + bool devSettings = instance().settings().getBool("dev.settings"); + // Renderer setting instance().settings().setValue("video", myRenderer->getSelectedTag().toString()); @@ -524,7 +527,7 @@ void VideoDialog::saveConfig() // PAL color-loss effect instance().settings().setValue("colorloss", myColorLoss->getState()); - if(instance().hasConsole()) + if(instance().hasConsole() && !devSettings) instance().console().toggleColorLoss(myColorLoss->getState()); // Fullscreen stretch setting @@ -576,7 +579,7 @@ void VideoDialog::saveConfig() // TV jitter instance().settings().setValue("tv.jitter", myTVJitter->getState()); instance().settings().setValue("tv.jitter_recovery", myTVJitterRecLabel->getLabel()); - if(instance().hasConsole()) + if(instance().hasConsole() && !devSettings) { instance().console().tia().toggleJitter(myTVJitter->getState() ? 1 : 0); instance().console().tia().setJitterRecoveryFactor(myTVJitterRec->getValue()); @@ -708,7 +711,10 @@ void VideoDialog::handleTVModeChange(NTSCFilter::Preset preset) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void VideoDialog::handleTVJitterChange(bool enable) { + bool devSettings = instance().settings().getBool("dev.settings"); myTVJitter->setState(enable); + enable &= !devSettings; + myTVJitter->setEnabled(!devSettings); myTVJitterRec->setEnabled(enable); myTVJitterRecLabel->setEnabled(enable); } diff --git a/src/windows/Stella.vcxproj b/src/windows/Stella.vcxproj index 933063ac1..23db56a7d 100644 --- a/src/windows/Stella.vcxproj +++ b/src/windows/Stella.vcxproj @@ -339,6 +339,7 @@ + @@ -637,6 +638,7 @@ + diff --git a/src/windows/Stella.vcxproj.filters b/src/windows/Stella.vcxproj.filters index 25346cbdc..c443a3227 100644 --- a/src/windows/Stella.vcxproj.filters +++ b/src/windows/Stella.vcxproj.filters @@ -864,6 +864,9 @@ Source Files + + Source Files\gui + @@ -1763,6 +1766,9 @@ Header Files + + Header Files\gui +