diff --git a/src/debugger/gui/DataGridOpsWidget.cxx b/src/debugger/gui/DataGridOpsWidget.cxx index bbadb90de..cde71b509 100644 --- a/src/debugger/gui/DataGridOpsWidget.cxx +++ b/src/debugger/gui/DataGridOpsWidget.cxx @@ -31,9 +31,9 @@ DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, const GUI::Font& font, _shiftLeftButton(nullptr), _shiftRightButton(nullptr) { - const int bwidth = _font.getMaxCharWidth() * 4, + const int bwidth = _font.getMaxCharWidth() * 4+2, bheight = _font.getFontHeight() + 3, - space = 6; + space = 4; int xpos, ypos; // Create operations buttons diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index 4dbf8410c..fa133d782 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -42,6 +42,7 @@ #include "ConsoleMediumFont.hxx" #include "ConsoleMediumBFont.hxx" #include "StellaMediumFont.hxx" +#include "OptionsDialog.hxx" #include "DebuggerDialog.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -61,6 +62,8 @@ DebuggerDialog::DebuggerDialog(OSystem& osystem, DialogContainer& parent, // Inform the TIA output widget about its associated zoom widget myTiaOutput->setZoomWidget(myTiaZoom); + + myOptions = make_unique(osystem, parent, this, w, h, true); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -158,6 +161,11 @@ void DebuggerDialog::handleCommand(CommandSender* sender, int cmd, doExitRom(); break; + case kDDOptionsCmd: + myOptions->open(); + loadConfig(); + break; + case RomWidget::kInvalidateListing: // Only do a full redraw if the disassembly tab is actually showing myRom->invalidate(myRomTab->getActiveTab() == 0); @@ -369,7 +377,8 @@ void DebuggerDialog::addStatusArea() void DebuggerDialog::addRomArea() { const GUI::Rect& r = getRomBounds(); - const int vBorder = 4; + const int VBORDER = 4; + const string ELLIPSIS = "\x1d"; int bwidth = myLFont->getStringWidth("Frame +1 "), bheight = myLFont->getLineHeight() + 2; @@ -405,8 +414,13 @@ void DebuggerDialog::addRomArea() bwidth, bheight, ">", kDDUnwindCmd); myUnwindButton->clearFlags(WIDGET_ENABLED); + int xpos = buttonX - 8*myLFont->getMaxCharWidth() - 20, ypos = 30; + + bwidth = myLFont->getStringWidth("Options" + ELLIPSIS) + 8; + bheight = myLFont->getLineHeight() + 2; + + new ButtonWidget(this, *myLFont, xpos, r.top + 5, bwidth, bheight, "Options" + ELLIPSIS, kDDOptionsCmd); - int xpos = buttonX - 8*myLFont->getMaxCharWidth() - 20, ypos = 20; DataGridOpsWidget* ops = new DataGridOpsWidget(this, *myLFont, xpos, ypos); int max_w = xpos - r.left - 10; @@ -426,8 +440,8 @@ void DebuggerDialog::addRomArea() //////////////////////////////////////////////////////////////////// // Disassembly area - xpos = r.left + vBorder; ypos += myRam->getHeight() + 5; - const int tabWidth = r.width() - vBorder - 1; + xpos = r.left + VBORDER; ypos += myRam->getHeight() + 5; + const int tabWidth = r.width() - VBORDER - 1; const int tabHeight = r.height() - ypos - 1; int tabID; diff --git a/src/debugger/gui/DebuggerDialog.hxx b/src/debugger/gui/DebuggerDialog.hxx index 25996497a..315fc93f5 100644 --- a/src/debugger/gui/DebuggerDialog.hxx +++ b/src/debugger/gui/DebuggerDialog.hxx @@ -34,6 +34,8 @@ class TiaZoomWidget; class CartDebugWidget; class CartRamWidget; +class OptionsDialog; + namespace GUI { class MessageBox; struct Rect; @@ -103,7 +105,8 @@ class DebuggerDialog : public Dialog kDDRewindCmd = 'DDrw', kDDUnwindCmd = 'DDuw', kDDExitCmd = 'DDex', - kDDExitFatalCmd = 'DDer' + kDDExitFatalCmd = 'DDer', + kDDOptionsCmd = 'DDop' }; TabWidget *myTab, *myRomTab; @@ -120,7 +123,11 @@ class DebuggerDialog : public Dialog EditTextWidget* myMessageBox; ButtonWidget* myRewindButton; ButtonWidget* myUnwindButton; + + //ButtonWidget* myOptionsButton; + unique_ptr myFatalError; + unique_ptr myOptions; unique_ptr myLFont; // used for labels unique_ptr myNFont; // used for normal text diff --git a/src/debugger/gui/RamWidget.cxx b/src/debugger/gui/RamWidget.cxx index 497dfde41..18dfac08b 100644 --- a/src/debugger/gui/RamWidget.cxx +++ b/src/debugger/gui/RamWidget.cxx @@ -24,7 +24,6 @@ #include "CartDebug.hxx" #include "Font.hxx" #include "Widget.hxx" - #include "RamWidget.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -59,6 +58,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n // Create actions buttons to the left of the RAM grid int bx = xpos + myRamGrid->getWidth() + 4; int by = ypos; + myUndoButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight, "Undo", kUndoCmd); myUndoButton->setTarget(this); @@ -68,7 +68,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n "Revert", kRevertCmd); myRevertButton->setTarget(this); - by += 2 * bheight + 2; + by += bheight + 4 * 3; mySearchButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight, "Search", kSearchCmd); mySearchButton->setTarget(this); @@ -116,18 +116,16 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n // one resizes as much as possible // Add Binary display of selected RAM cell - xpos = x + w - 13*myFontWidth - 20; - new StaticTextWidget(boss, lfont, xpos, ypos, 3*myFontWidth, myFontHeight, - "Bin", kTextAlignLeft); + xpos = x + w - 11*myFontWidth - 22; + new StaticTextWidget(boss, lfont, xpos, ypos, "Bin"); myBinValue = new DataGridWidget(boss, nfont, xpos + 3*myFontWidth + 5, ypos-2, 1, 1, 8, 8, Common::Base::F_2); myBinValue->setTarget(this); myBinValue->setID(kRamBinID); // Add Decimal display of selected RAM cell - xpos -= 8*myFontWidth + 5 + 20; - new StaticTextWidget(boss, lfont, xpos, ypos, 3*myFontWidth, myFontHeight, - "Dec", kTextAlignLeft); + xpos -= 7*myFontWidth + 5 + 20; + new StaticTextWidget(boss, lfont, xpos, ypos, "Dec"); myDecValue = new DataGridWidget(boss, nfont, xpos + 3*myFontWidth + 5, ypos-2, 1, 1, 3, 8, Common::Base::F_10); myDecValue->setTarget(this); @@ -138,9 +136,8 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n // Add Label of selected RAM cell int xpos_r = xpos - 20; - xpos = x + 10; - new StaticTextWidget(boss, lfont, xpos, ypos, 5*myFontWidth, myFontHeight, - "Label", kTextAlignLeft); + xpos = x; + new StaticTextWidget(boss, lfont, xpos, ypos, "Label"); xpos += 5*myFontWidth + 5; myLabel = new EditTextWidget(boss, nfont, xpos, ypos-2, xpos_r-xpos, myLineHeight); diff --git a/src/debugger/gui/RiotWidget.cxx b/src/debugger/gui/RiotWidget.cxx index 1f7f3ba69..09017d47a 100644 --- a/src/debugger/gui/RiotWidget.cxx +++ b/src/debugger/gui/RiotWidget.cxx @@ -234,7 +234,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, myPause->setTarget(this); addFocusWidget(myPause); - // Randomize items + /*// Randomize items xpos = 10; ypos += 3 * lineHeight; new StaticTextWidget(boss, lfont, xpos, ypos, lfont.getStringWidth("When loading a ROM:"), fontHeight, @@ -263,7 +263,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, myRandomizeCPU[i]->setTarget(this); addFocusWidget(myRandomizeCPU[i]); xpos += CheckboxWidget::boxSize() + lfont.getStringWidth("XX") + 20; - } + }*/ } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -354,7 +354,11 @@ void RiotWidget::loadConfig() // means 'grounded' in the system) myP0Diff->setSelectedIndex(riot.diffP0()); myP1Diff->setSelectedIndex(riot.diffP1()); - myConsole->setSelectedIndex(instance().settings().getString("console") == "7800" ? 1 : 0); + + bool devSettings = instance().settings().getBool("dev.settings"); + myConsole->setSelectedIndex(devSettings && instance().settings().getString("dev.console") == "7800" ? 1 : 0); + myConsole->setEnabled(false); + myTVType->setSelectedIndex(riot.tvType()); mySelect->setState(!riot.select()); myReset->setState(!riot.reset()); @@ -362,12 +366,12 @@ void RiotWidget::loadConfig() myLeftControl->loadConfig(); myRightControl->loadConfig(); - myRandomizeRAM->setState(instance().settings().getBool("dev.ramrandom")); + /*myRandomizeRAM->setState(instance().settings().getBool("dev.ramrandom")); 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])); + myRandomizeCPU[i]->setState(BSPF::containsIgnoreCase(cpurandom, cpuregs[i]));*/ handleConsole(); } @@ -451,12 +455,12 @@ void RiotWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) case kPauseID: handleConsole(); break; - case kRandRAMID: + /*case kRandRAMID: instance().settings().setValue("dev.ramrandom", myRandomizeRAM->getState()); break; case kRandCPUID: handleRandomCPU(); - break; + break;*/ } break; @@ -515,16 +519,16 @@ void RiotWidget::handleConsole() { RiotDebug& riot = instance().debugger().riotDebug(); bool is7800 = myConsole->getSelected() == 1; - instance().settings().setValue("console", is7800 ? "7800" : "2600"); + //instance().settings().setValue("dev.console", is7800 ? "7800" : "2600"); myTVType->setEnabled(!is7800); myPause->setEnabled(is7800); - myRandomizeRAM->setEnabled(!is7800); + //myRandomizeRAM->setEnabled(!is7800); if(is7800) { myTVType->setSelectedIndex(myPause->getState() ? 0 : 1); - myRandomizeRAM->setState(false); - instance().settings().setValue("dev.ramrandom", 0); + //myRandomizeRAM->setState(false); + //instance().settings().setValue("dev.ramrandom", 0); } else { @@ -533,7 +537,7 @@ void RiotWidget::handleConsole() riot.tvType(myTVType->getSelected()); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +/*// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void RiotWidget::handleRandomCPU() { string cpurandom; @@ -543,4 +547,4 @@ void RiotWidget::handleRandomCPU() cpurandom += cpuregs[i]; instance().settings().setValue("dev.cpurandom", cpurandom); -} +}*/ diff --git a/src/debugger/gui/RiotWidget.hxx b/src/debugger/gui/RiotWidget.hxx index 7933df668..1c4a69ff1 100644 --- a/src/debugger/gui/RiotWidget.hxx +++ b/src/debugger/gui/RiotWidget.hxx @@ -41,7 +41,7 @@ class RiotWidget : public Widget, public CommandSender int x, int y, Controller& controller); void handleConsole(); - void handleRandomCPU(); + //void handleRandomCPU(); void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void loadConfig() override; @@ -69,8 +69,8 @@ class RiotWidget : public Widget, public CommandSender CheckboxWidget* myReset; CheckboxWidget* myPause; - CheckboxWidget* myRandomizeCPU[5]; - CheckboxWidget* myRandomizeRAM; + //CheckboxWidget* myRandomizeCPU[5]; + //CheckboxWidget* myRandomizeRAM; PopUpWidget* myConsole; // ID's for the various widgets @@ -79,7 +79,8 @@ class RiotWidget : public Widget, public CommandSender kTim1TID, kTim8TID, kTim64TID, kTim1024TID, kTimWriteID, kSWCHABitsID, kSWACNTBitsID, kSWCHBBitsID, kSWBCNTBitsID, kP0DiffChanged, kP1DiffChanged, kTVTypeChanged, kSelectID, kResetID, - kRandCPUID, kRandRAMID, kSWCHARBitsID, kConsoleChanged, kPauseID + //kRandCPUID, kRandRAMID, + kSWCHARBitsID, kConsoleChanged, kPauseID }; private: diff --git a/src/emucore/Cart.cxx b/src/emucore/Cart.cxx index 9ce4a8cad..aa0f23bdd 100644 --- a/src/emucore/Cart.cxx +++ b/src/emucore/Cart.cxx @@ -91,9 +91,17 @@ void Cartridge::createCodeAccessBase(uInt32 size) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Cartridge::initializeRAM(uInt8* arr, uInt32 size, uInt8 val) const { - if(mySettings.getBool("dev.ramrandom")) + if(mySettings.getBool("dev.settings") && mySettings.getBool("dev.ramrandom")) for(uInt32 i = 0; i < size; ++i) arr[i] = mySystem->randGenerator().next(); else memset(arr, val, size); } + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Cartridge::randomizeStartBank() +{ + if(mySettings.getBool("dev.settings") && mySettings.getBool("dev.bankrandom")) + myStartBank = mySystem->randGenerator().next() % bankCount(); +} + diff --git a/src/emucore/Cart.hxx b/src/emucore/Cart.hxx index cc18301ad..6ead1970c 100644 --- a/src/emucore/Cart.hxx +++ b/src/emucore/Cart.hxx @@ -81,6 +81,12 @@ class Cartridge : public Device */ uInt16 startBank() const { return myStartBank; } + /** + Defines the startup bank. if 'bank' is negative, a random bank will + be selected. + */ + void randomizeStartBank(); + /** Answer whether the bank has changed since the last time this method was called. Each cart class is able to override this diff --git a/src/emucore/CartDPC.cxx b/src/emucore/CartDPC.cxx index bf46166cd..93d550bbf 100644 --- a/src/emucore/CartDPC.cxx +++ b/src/emucore/CartDPC.cxx @@ -57,6 +57,9 @@ void CartridgeDPC::reset() myAudioCycles = 0; myFractionalClocks = 0.0; + // define random startup bank + randomizeStartBank(); + // Upon reset we switch to the startup bank bank(myStartBank); } diff --git a/src/emucore/CartF0.cxx b/src/emucore/CartF0.cxx index e312e77f6..63bcb099e 100644 --- a/src/emucore/CartF0.cxx +++ b/src/emucore/CartF0.cxx @@ -35,6 +35,9 @@ CartridgeF0::CartridgeF0(const BytePtr& image, uInt32 size, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF0::reset() { + // define random startup bank + randomizeStartBank(); + // Upon reset we switch to the startup bank bank(myStartBank); } diff --git a/src/emucore/CartF4.cxx b/src/emucore/CartF4.cxx index 6deb0a829..fac297a58 100644 --- a/src/emucore/CartF4.cxx +++ b/src/emucore/CartF4.cxx @@ -36,6 +36,9 @@ CartridgeF4::CartridgeF4(const BytePtr& image, uInt32 size, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF4::reset() { + // define random startup bank + randomizeStartBank(); + // Upon reset we switch to the startup bank bank(myStartBank); } diff --git a/src/emucore/CartF6.cxx b/src/emucore/CartF6.cxx index b8d6deba4..201f7eab9 100644 --- a/src/emucore/CartF6.cxx +++ b/src/emucore/CartF6.cxx @@ -35,6 +35,9 @@ CartridgeF6::CartridgeF6(const BytePtr& image, uInt32 size, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF6::reset() { + // define random startup bank + randomizeStartBank(); + // Upon reset we switch to the startup bank bank(myStartBank); } diff --git a/src/emucore/CartF6SC.cxx b/src/emucore/CartF6SC.cxx index 96d801acc..f95208446 100644 --- a/src/emucore/CartF6SC.cxx +++ b/src/emucore/CartF6SC.cxx @@ -35,6 +35,9 @@ CartridgeF6SC::CartridgeF6SC(const BytePtr& image, uInt32 size, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF6SC::reset() { + // define random startup bank + randomizeStartBank(); + initializeRAM(myRAM, 128); // Upon reset we switch to the startup bank diff --git a/src/emucore/CartF8.cxx b/src/emucore/CartF8.cxx index aaa163379..59d9f174e 100644 --- a/src/emucore/CartF8.cxx +++ b/src/emucore/CartF8.cxx @@ -43,6 +43,9 @@ CartridgeF8::CartridgeF8(const BytePtr& image, uInt32 size, const string& md5, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF8::reset() { + // define random startup bank + randomizeStartBank(); + // Upon reset we switch to the reset bank bank(myStartBank); } diff --git a/src/emucore/CartF8SC.cxx b/src/emucore/CartF8SC.cxx index 2694b7f2b..794051814 100644 --- a/src/emucore/CartF8SC.cxx +++ b/src/emucore/CartF8SC.cxx @@ -35,6 +35,9 @@ CartridgeF8SC::CartridgeF8SC(const BytePtr& image, uInt32 size, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeF8SC::reset() { + // define startup bank + randomizeStartBank(); + initializeRAM(myRAM, 128); // Upon reset we switch to the startup bank diff --git a/src/emucore/CartFA.cxx b/src/emucore/CartFA.cxx index 693706444..f1e57329f 100644 --- a/src/emucore/CartFA.cxx +++ b/src/emucore/CartFA.cxx @@ -35,6 +35,9 @@ CartridgeFA::CartridgeFA(const BytePtr& image, uInt32 size, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeFA::reset() { + // define random startup bank + randomizeStartBank(); + initializeRAM(myRAM, 256); // Upon reset we switch to the startup bank diff --git a/src/emucore/CartFA2.cxx b/src/emucore/CartFA2.cxx index 55a7074da..39da2de4f 100644 --- a/src/emucore/CartFA2.cxx +++ b/src/emucore/CartFA2.cxx @@ -47,6 +47,9 @@ CartridgeFA2::CartridgeFA2(const BytePtr& image, uInt32 size, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeFA2::reset() { + // define random startup bank + randomizeStartBank(); + initializeRAM(myRAM, 256); // Upon reset we switch to the startup bank diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 155b668fc..8c2664aaf 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -896,7 +896,8 @@ void EventHandler::handleEvent(Event::Type event, int state) { // Take care of special events that aren't part of the emulation core // or need to be preprocessed before passing them on - bool is7800 = (myOSystem.settings().getString("console") == "7800"); + bool devSettings = myOSystem.settings().getBool("dev.settings"); + bool is7800 = devSettings && (myOSystem.settings().getString("dev.console") == "7800"); switch(event) { diff --git a/src/emucore/M6502.cxx b/src/emucore/M6502.cxx index e78eb768c..9ba1dbc4f 100644 --- a/src/emucore/M6502.cxx +++ b/src/emucore/M6502.cxx @@ -85,7 +85,8 @@ void M6502::reset() myExecutionStatus = 0; // Set registers to random or default values - const string& cpurandom = mySettings.getString("dev.cpurandom"); + bool devSettings = mySettings.getBool("dev.settings"); + const string& cpurandom = devSettings ? 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 cd8a06620..18efd8411 100644 --- a/src/emucore/M6532.cxx +++ b/src/emucore/M6532.cxx @@ -58,10 +58,11 @@ void M6532::reset() }; // Initialize the 128 bytes of memory - if(mySettings.getString("console") == "7800") + bool devSettings = mySettings.getBool("dev.settings"); + if(devSettings && mySettings.getString("dev.console") == "7800") for(uInt32 t = 0; t < 128; ++t) myRAM[t] = RAM_7800[t]; - else if(mySettings.getBool("dev.ramrandom")) + else if(devSettings && mySettings.getBool("dev.ramrandom")) for(uInt32 t = 0; t < 128; ++t) myRAM[t] = mySystem->randGenerator().next(); else diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 2f10c6165..97a841c9f 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -130,7 +130,6 @@ Settings::Settings(OSystem& osystem) setInternal("autoslot", "false"); setInternal("loglevel", "1"); setInternal("logtoconsole", "0"); - setInternal("console", "2600"); // 7800 setInternal("avoxport", ""); setInternal("stats", "false"); setInternal("fastscbios", "true"); @@ -158,6 +157,7 @@ Settings::Settings(OSystem& osystem) setInternal("dev.tv.jitter_recovery", "2"); setInternal("dev.debugcolors", "false"); setInternal("dev.tiadriven", "true"); + setInternal("dev.console", "2600"); // 7800 #ifdef DTHUMB_SUPPORT // Thumb ARM emulation options @@ -500,6 +500,7 @@ void Settings::usage() const << " -ppblend Sets the 'Display.PPBlend' property\n" #endif + << " -dev.console <2600|7800> Select console for B/W and Pause key handling\n" << " -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" diff --git a/src/emucore/Switches.cxx b/src/emucore/Switches.cxx index d9c5afeda..07df17db6 100644 --- a/src/emucore/Switches.cxx +++ b/src/emucore/Switches.cxx @@ -55,7 +55,8 @@ Switches::Switches(const Event& event, const Properties& properties) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Switches::update(const Settings& settings) { - bool is7800 = (settings.getString("console") == "7800"); + bool devSettings = settings.getBool("dev.settings"); + bool is7800 = devSettings && (settings.getString("dev.console") == "7800"); if(is7800) { diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index 2aca21477..abd979f70 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -79,7 +79,8 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings) mySpriteEnabledBits(0xFF), myCollisionsEnabledBits(0xFF) { - myTIAPinsDriven = mySettings.getBool("dev.tiadriven"); + bool devSettings = mySettings.getBool("dev.settings"); + myTIAPinsDriven = devSettings && mySettings.getBool("dev.tiadriven"); myBackground.setTIA(this); myPlayfield.setTIA(this); @@ -89,7 +90,6 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings) myMissile1.setTIA(this); myBall.setTIA(this); - 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"); @@ -1007,7 +1007,7 @@ bool TIA::driveUnusedPinsRandom(uInt8 mode) if (mode == 0 || mode == 1) { myTIAPinsDriven = bool(mode); - mySettings.setValue("dev.tiadriven", myTIAPinsDriven); + //mySettings.setValue("dev.tiadriven", myTIAPinsDriven); } return myTIAPinsDriven; } diff --git a/src/gui/DeveloperDialog.cxx b/src/gui/DeveloperDialog.cxx index 47d70680d..2d3b5076c 100644 --- a/src/gui/DeveloperDialog.cxx +++ b/src/gui/DeveloperDialog.cxx @@ -92,6 +92,7 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font) int lineHeight = font.getLineHeight(); StringList actions; WidgetArray wid; + VariantList items; int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight(); tabID = myTab->addTab(" Emulation "); @@ -99,26 +100,36 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font) ypos = VBORDER; myDevSettings0 = new CheckboxWidget(myTab, font, HBORDER, ypos, "Enable developer settings", kDevSettings0); wid.push_back(myDevSettings0); + ypos += lineHeight + VGAP; + // 2600/7800 mode + items.clear(); + VarList::push_back(items, "Atari 2600", "2600"); + VarList::push_back(items, "Atari 7800", "7800"); + int lwidth = font.getStringWidth("Console "); + int pwidth = font.getStringWidth("Atari 2600"); + + myConsole = new PopUpWidget(myTab, font, HBORDER + INDENT * 1, ypos, pwidth, lineHeight, items, "Console ", lwidth, kConsole); + wid.push_back(myConsole); ypos += lineHeight + VGAP; // Randomize items myLoadingROMLabel = new StaticTextWidget(myTab, font, HBORDER + INDENT*1, ypos, "When loading a ROM:", kTextAlignLeft); wid.push_back(myLoadingROMLabel); - ypos += lineHeight + VGAP; + myRandomBank = new CheckboxWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1, "Random startup bank (TODO)"); wid.push_back(myRandomBank); + ypos += lineHeight + VGAP; // Randomize RAM - ypos += lineHeight + VGAP; myRandomizeRAM = new CheckboxWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1, "Randomize zero-page and extended RAM", kRandRAMID); wid.push_back(myRandomizeRAM); + ypos += lineHeight + VGAP; // Randomize CPU - ypos += lineHeight + VGAP; - int lwidth = font.getStringWidth("Randomize CPU "); + lwidth = font.getStringWidth("Randomize CPU "); myRandomizeCPULabel = new StaticTextWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1, "Randomize CPU "); wid.push_back(myRandomizeCPULabel); @@ -134,17 +145,17 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font) wid.push_back(myRandomizeCPU[i]); xpos += CheckboxWidget::boxSize() + font.getStringWidth("XX") + 20; } - ypos += lineHeight + VGAP; + /*myThumbException = new CheckboxWidget(myTab, font, HBORDER + INDENT, ypos + 1, "Thumb ARM emulation can throw an exception"); wid.push_back(myThumbException);*/ - //ypos += (lineHeight + VGAP) * 2; + myColorLoss = new CheckboxWidget(myTab, font, HBORDER + INDENT*1, ypos + 1, "PAL color-loss"); wid.push_back(myColorLoss); + ypos += lineHeight + VGAP; // TV jitter effect - ypos += lineHeight + VGAP; myTVJitter = new CheckboxWidget(myTab, font, HBORDER + INDENT*1, ypos + 1, "Jitter/Roll Effect", kTVJitter); wid.push_back(myTVJitter); myTVJitterRec = new SliderWidget(myTab, font, @@ -159,14 +170,14 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font) 5 * fontWidth, fontHeight, "", kTextAlignLeft); myTVJitterRecLabel->setFlags(WIDGET_CLEARBG); wid.push_back(myTVJitterRecLabel); + ypos += lineHeight + VGAP; // debug colors - ypos += lineHeight + VGAP; myDebugColors = new CheckboxWidget(myTab, font, HBORDER + INDENT*1, ypos + 1, "Debug Colors"); wid.push_back(myDebugColors); + ypos += lineHeight + VGAP; // How to handle undriven TIA pins - ypos += lineHeight + VGAP; myUndrivenPins = new CheckboxWidget(myTab, font, HBORDER + INDENT*1, ypos + 1, "Drive unused TIA pins randomly on a read/peek"); wid.push_back(myUndrivenPins); @@ -358,6 +369,7 @@ void DeveloperDialog::loadConfig() { myDevSettings0->setState(instance().settings().getBool("dev.settings")); + myConsole->setSelectedIndex(instance().settings().getString("dev.console") == "7800" ? 1 : 0); myRandomBank->setState(instance().settings().getBool("dev.bankrandom")); myRandomizeRAM->setState(instance().settings().getBool("dev.ramrandom")); @@ -409,11 +421,14 @@ void DeveloperDialog::saveConfig() //TODO // - bankrandom (not implemented yet) // - thumbexception (commandline only yet) - // - debugcolors (no effect yet) + // - remove settings from within debugger bool devSettings = myDevSettings0->getState(); instance().settings().setValue("dev.settings", devSettings); + 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()); @@ -458,7 +473,7 @@ void DeveloperDialog::saveConfig() instance().settings().setValue("dev.tiadriven", myUndrivenPins->getState()); // Finally, issue a complete framebuffer re-initialization - instance().createFrameBuffer(); + //instance().createFrameBuffer(); #ifdef DEBUGGER_SUPPORT // Debugger size @@ -479,6 +494,7 @@ void DeveloperDialog::setDefaults() switch(myTab->getActiveTab()) { case 0: + myConsole->setSelectedIndex(0); myRandomBank->setState(true); myRandomizeRAM->setState(true); for(int i = 0; i < 5; ++i) @@ -536,6 +552,10 @@ void DeveloperDialog::handleCommand(CommandSender* sender, int cmd, int data, in enableOptions(); break; + case kConsole: + handleConsole(); + break; + case kTVJitter: handleTVJitterChange(myTVJitter->getState()); break; @@ -603,14 +623,16 @@ void DeveloperDialog::enableOptions() { bool enable = myDevSettings0->getState(); + myConsole->setEnabled(enable); // CPU myLoadingROMLabel->setEnabled(enable); - myRandomBank->setEnabled(false/*enable*/); + myRandomBank->setEnabled(enable); myRandomizeRAM->setEnabled(enable); myRandomizeCPULabel->setEnabled(enable); for(int i = 0; i < 5; ++i) myRandomizeCPU[i]->setEnabled(enable); //myThumbException->setEnabled(enable); + handleConsole(); // TIA myColorLoss->setEnabled(enable); @@ -637,3 +659,17 @@ void DeveloperDialog::handleDebugColors() instance().console().tia().toggleFixedColors(); } } + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void DeveloperDialog::handleConsole() +{ + bool is7800 = myConsole->getSelected() == 1; + bool enable = myDevSettings0->getState(); + + myRandomizeRAM->setEnabled(enable && !is7800); + if(is7800) + { + myRandomizeRAM->setState(false); + instance().settings().setValue("dev.ramrandom", 0); + } +} \ No newline at end of file diff --git a/src/gui/DeveloperDialog.hxx b/src/gui/DeveloperDialog.hxx index f8eb5ac80..f5cf72f0c 100644 --- a/src/gui/DeveloperDialog.hxx +++ b/src/gui/DeveloperDialog.hxx @@ -59,6 +59,7 @@ class DeveloperDialog : public Dialog enum { kDevSettings0 = 'DVs0', + kConsole = 'DVco', kRandRAMID = 'DVrm', kRandCPUID = 'DVcp', kTVJitter = 'DVjt', @@ -79,6 +80,7 @@ class DeveloperDialog : public Dialog CheckboxWidget* myDevSettings0; CheckboxWidget* myDevSettings1; + PopUpWidget* myConsole; StaticTextWidget* myLoadingROMLabel; CheckboxWidget* myRandomBank; CheckboxWidget* myRandomizeRAM; @@ -117,6 +119,7 @@ class DeveloperDialog : public Dialog void enableOptions(); void handleTVJitterChange(bool enable); void handleDebugColors(); + void DeveloperDialog::handleConsole(); // Following constructors and assignment operators not supported DeveloperDialog() = delete;