From da269fefed5e9ebd5981ea96a2b240fc02fd0ff0 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sun, 6 Jan 2019 13:48:53 +0100 Subject: [PATCH] added TIA tab to developer options with 5 options for oddball TIAs started disabling some options for player settings --- src/emucore/CartBUS.cxx | 4 +- src/emucore/CartCDF.cxx | 4 +- src/emucore/CartDPCPlus.cxx | 4 +- src/emucore/M6502.cxx | 2 +- src/emucore/Settings.cxx | 22 ++-- src/emucore/tia/Player.cxx | 21 +++- src/emucore/tia/Player.hxx | 4 + src/emucore/tia/TIA.cxx | 50 +++++++-- src/emucore/tia/TIA.hxx | 40 ++++++- src/gui/DeveloperDialog.cxx | 209 ++++++++++++++++++++++++++++-------- src/gui/DeveloperDialog.hxx | 25 ++++- 11 files changed, 298 insertions(+), 87 deletions(-) diff --git a/src/emucore/CartBUS.cxx b/src/emucore/CartBUS.cxx index fa353d354..dcaa670af 100644 --- a/src/emucore/CartBUS.cxx +++ b/src/emucore/CartBUS.cxx @@ -65,10 +65,10 @@ CartridgeBUS::CartridgeBUS(const BytePtr& image, uInt32 size, myDisplayImage = myBUSRAM + DSRAM; // Create Thumbulator ARM emulator - const string& prefix = settings.getBool("dev.settings") ? "dev." : "plr."; + bool devSettings = settings.getBool("dev.settings"); myThumbEmulator = make_unique( reinterpret_cast(myImage), reinterpret_cast(myBUSRAM), - settings.getBool(prefix + "thumb.trapfatal"), Thumbulator::ConfigureFor::BUS, this + devSettings ? settings.getBool("dev.thumb.trapfatal") : false, Thumbulator::ConfigureFor::BUS, this ); setInitialState(); diff --git a/src/emucore/CartCDF.cxx b/src/emucore/CartCDF.cxx index 3500e8de6..c3a58b004 100644 --- a/src/emucore/CartCDF.cxx +++ b/src/emucore/CartCDF.cxx @@ -68,10 +68,10 @@ CartridgeCDF::CartridgeCDF(const BytePtr& image, uInt32 size, setVersion(); // Create Thumbulator ARM emulator - const string& prefix = settings.getBool("dev.settings") ? "dev." : "plr."; + bool devSettings = settings.getBool("dev.settings"); myThumbEmulator = make_unique( reinterpret_cast(myImage), reinterpret_cast(myCDFRAM), - settings.getBool(prefix + "thumb.trapfatal"), myVersion ? + devSettings ? settings.getBool("dev.thumb.trapfatal") : false, myVersion ? Thumbulator::ConfigureFor::CDF1 : Thumbulator::ConfigureFor::CDF, this); setInitialState(); diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx index 1923fb017..9d71cc646 100644 --- a/src/emucore/CartDPCPlus.cxx +++ b/src/emucore/CartDPCPlus.cxx @@ -54,11 +54,11 @@ CartridgeDPCPlus::CartridgeDPCPlus(const BytePtr& image, uInt32 size, myFrequencyImage = myDisplayImage + 0x1000; // Create Thumbulator ARM emulator - const string& prefix = settings.getBool("dev.settings") ? "dev." : "plr."; + bool devSettings = settings.getBool("dev.settings"); myThumbEmulator = make_unique (reinterpret_cast(myImage), reinterpret_cast(myDPCRAM), - settings.getBool(prefix + "thumb.trapfatal"), + devSettings ? settings.getBool("dev.thumb.trapfatal") : false, Thumbulator::ConfigureFor::DPCplus, this); diff --git a/src/emucore/M6502.cxx b/src/emucore/M6502.cxx index 0c86d8016..2fff129ea 100644 --- a/src/emucore/M6502.cxx +++ b/src/emucore/M6502.cxx @@ -125,7 +125,7 @@ void M6502::reset() myHaltRequested = false; myGhostReadsTrap = mySettings.getBool("dbg.ghostreadstrap"); - myReadFromWritePortBreak = mySettings.getBool(devSettings ? "dev.rwportbreak" : "plr.rwportbreak"); + myReadFromWritePortBreak = devSettings ? mySettings.getBool("dev.rwportbreak") : false; myLastBreakCycle = ULLONG_MAX; } diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 8dc717891..06615fd0d 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -149,7 +149,6 @@ Settings::Settings(OSystem& osystem) setInternal("dis.gfxformat", "2"); setInternal("dis.showaddr", "true"); setInternal("dis.relocate", "false"); - setInternal("plr.rwportbreak", "false"); setInternal("dev.rwportbreak", "true"); #endif @@ -164,14 +163,11 @@ Settings::Settings(OSystem& osystem) setInternal("plr.debugcolors", "false"); setInternal("plr.tiadriven", "false"); setInternal("plr.console", "2600"); // 7800 - setInternal("plr.extrapfdelay", "false"); setInternal("plr.timemachine", true); setInternal("plr.tm.size", 200); setInternal("plr.tm.uncompressed", 60); setInternal("plr.tm.interval", "30f"); // = 0.5 seconds setInternal("plr.tm.horizon", "10m"); // = ~10 minutes - // Thumb ARM emulation options - setInternal("plr.thumb.trapfatal", "false"); setInternal("plr.eepromaccess", "false"); // developer settings @@ -186,7 +182,11 @@ Settings::Settings(OSystem& osystem) setInternal("dev.debugcolors", "false"); setInternal("dev.tiadriven", "true"); setInternal("dev.console", "2600"); // 7800 - setInternal("dev.extrapfdelay", "false"); + setInternal("dev.tia.delaypfbits", "false"); + setInternal("dev.tia.delaycolorbits", "false"); + setInternal("dev.tia.delayp0swap", "false"); + setInternal("dev.tia.delayp1swap", "false"); + setInternal("dev.tia.stuffplayerhm", "false"); setInternal("dev.timemachine", true); setInternal("dev.tm.size", 1000); setInternal("dev.tm.uncompressed", 600); @@ -614,7 +614,6 @@ void Settings::usage() const << " -plr.stats <1|0> Overlay console info during emulation\n" << " -plr.console <2600|7800> Select console for B/W and Pause key\n" << " handling and RAM initialization\n" - << " -plr.extrapfdelay <1|0> Enable extra delay cycle for PF access\n" << " -plr.bankrandom <1|0> Randomize the startup bank on reset\n" << " -plr.ramrandom <1|0> Randomize the contents of RAM on reset\n" << " -plr.cpurandom <1|0> Randomize the contents of CPU registers on\n" @@ -625,11 +624,6 @@ void Settings::usage() const << " -plr.tv.jitter_recovery <1-20> Set recovery time for TV jitter effect\n" << " -plr.tiadriven <1|0> Drive unused TIA pins randomly on a\n" << " read/peek\n" - #ifdef DEBUGGER_SUPPORT - << " -plr.rwportbreak <1|0> Debugger breaks on reads from write ports\n" - #endif - << " -plr.thumb.trapfatal <1|0> Determines whether errors in ARM emulation\n" - << " throw an exception\n" << " -plr.eepromaccess <1|0> Enable messages for AtariVox/SaveKey access\n" << " messages\n" << endl @@ -637,7 +631,6 @@ void Settings::usage() const << " -dev.stats <1|0> Overlay console info during emulation\n" << " -dev.console <2600|7800> Select console for B/W and Pause key\n" << " handling and RAM initialization\n" - << " -dev.extrapfdelay <1|0> Enable extra delay cycle for PF access\n" << " -dev.bankrandom <1|0> Randomize the startup bank on reset\n" << " -dev.ramrandom <1|0> Randomize the contents of RAM on reset\n" << " -dev.cpurandom <1|0> Randomize the contents of CPU registers on\n" @@ -655,6 +648,11 @@ void Settings::usage() const << " throw an exception\n" << " -dev.eepromaccess <1|0> Enable messages for AtariVox/SaveKey access\n" << " messages\n" + << " -dev.tia.delaypfbits <1|0> Enable extra delay cycle for PF bits access\n" + << " -dev.tia.delaypfcolor <1|0> Enable extra delay cycle for PF color\n" + << " -dev.tia.delayp0swap <1|0> Enable extra delay cycle for PF color\n" + << " -dev.tia.delayp1swap <1|0> Enable extra delay cycle for PF color\n" + << " -dev.tia.stuffplayerhm <1|0> Enable extra delay cycle for PF color\n" << endl << std::flush; } diff --git a/src/emucore/tia/Player.cxx b/src/emucore/tia/Player.cxx index 452068661..9f11980cb 100644 --- a/src/emucore/tia/Player.cxx +++ b/src/emucore/tia/Player.cxx @@ -53,6 +53,8 @@ void Player::reset() mySampleCounter = 0; myDividerPending = 0; myDividerChangeCounter = -1; + myStuffedClock = false; + myUseStuffedClock = false; myPattern = 0; setDivider(1); @@ -251,6 +253,12 @@ void Player::applyColorLoss() applyColors(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Player::setStuffedClock(bool enable) +{ + myUseStuffedClock = enable; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Player::startMovement() { @@ -264,7 +272,12 @@ bool Player::movementTick(uInt32 clock, bool apply) myIsMoving = false; } - if (myIsMoving && apply) tick(); + //if(myIsMoving && apply) tick(); + if(myIsMoving) + { + if(apply) tick(); + else myStuffedClock = true; + } return myIsMoving; } @@ -272,6 +285,12 @@ bool Player::movementTick(uInt32 clock, bool apply) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Player::tick() { + if(myUseStuffedClock && myStuffedClock) + { + myStuffedClock = false; + return; + } + if (!myIsRendering || myRenderCounter < myRenderCounterTripPoint) collision = myCollisionMaskDisabled; else diff --git a/src/emucore/tia/Player.hxx b/src/emucore/tia/Player.hxx index 6579dda2f..348754994 100644 --- a/src/emucore/tia/Player.hxx +++ b/src/emucore/tia/Player.hxx @@ -57,6 +57,8 @@ class Player : public Serializable void applyColorLoss(); + void setStuffedClock(bool enable); + void startMovement(); bool movementTick(uInt32 clock, bool apply); @@ -130,6 +132,8 @@ class Player : public Serializable bool myIsReflected; bool myIsDelaying; + bool myStuffedClock; + bool myUseStuffedClock; TIA* myTIA; diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index 271ae2222..ed1dcfcac 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -172,7 +172,11 @@ void TIA::reset() paddleReader.reset(myTimestamp); bool devSettings = mySettings.getBool("dev.settings"); - setPFDelay(mySettings.getBool(devSettings ? "dev.extrapfdelay" : "plr.extrapfdelay")); + setPFBitsDelay(devSettings ? mySettings.getBool("dev.tia.delaypfbits") : false); + setPFColorDelay(devSettings ? mySettings.getBool("dev.tia.delaypfcolor") : false); + setP0SwapDelay(devSettings ? mySettings.getBool("dev.tia.delayp0swap") : false); + setP1SwapDelay(devSettings ? mySettings.getBool("dev.tia.delayp1swap") : false); + setStuffPlayerMove(devSettings ? mySettings.getBool("dev.tia.stuffplayerhm") : false); myDelayQueue.reset(); myCyclesAtFrameStart = 0; @@ -290,7 +294,7 @@ bool TIA::save(Serializer& out) const out.putInt(myFrameBufferScanlines); out.putInt(myFrontBufferScanlines); - out.putByte(myPFDelay); + out.putByte(myPFBitsDelay); out.putByte(myPFColorDelay); } catch(...) @@ -362,7 +366,7 @@ bool TIA::load(Serializer& in) myFrameBufferScanlines = in.getInt(); myFrontBufferScanlines = in.getInt(); - myPFDelay = in.getByte(); + myPFBitsDelay = in.getByte(); myPFColorDelay = in.getByte(); } catch(...) @@ -613,7 +617,7 @@ bool TIA::poke(uInt16 address, uInt8 value) case PF0: { - myDelayQueue.push(PF0, value, myPFDelay); + myDelayQueue.push(PF0, value, myPFBitsDelay); #ifdef DEBUGGER_SUPPORT uInt16 dataAddr = mySystem->m6502().lastDataAddressForPoke(); if(dataAddr) @@ -624,7 +628,7 @@ bool TIA::poke(uInt16 address, uInt8 value) case PF1: { - myDelayQueue.push(PF1, value, myPFDelay); + myDelayQueue.push(PF1, value, myPFBitsDelay); #ifdef DEBUGGER_SUPPORT uInt16 dataAddr = mySystem->m6502().lastDataAddressForPoke(); if(dataAddr) @@ -635,7 +639,7 @@ bool TIA::poke(uInt16 address, uInt8 value) case PF2: { - myDelayQueue.push(PF2, value, myPFDelay); + myDelayQueue.push(PF2, value, myPFBitsDelay); #ifdef DEBUGGER_SUPPORT uInt16 dataAddr = mySystem->m6502().lastDataAddressForPoke(); if(dataAddr) @@ -703,7 +707,7 @@ bool TIA::poke(uInt16 address, uInt8 value) case GRP0: { myDelayQueue.push(GRP0, value, Delay::grp); - myDelayQueue.push(DummyRegisters::shuffleP1, 0, Delay::shufflePlayer); + myDelayQueue.push(DummyRegisters::shuffleP1, 0, myP0SwapDelay); #ifdef DEBUGGER_SUPPORT uInt16 dataAddr = mySystem->m6502().lastDataAddressForPoke(); if(dataAddr) @@ -715,7 +719,7 @@ bool TIA::poke(uInt16 address, uInt8 value) case GRP1: { myDelayQueue.push(GRP1, value, Delay::grp); - myDelayQueue.push(DummyRegisters::shuffleP0, 0, Delay::shufflePlayer); + myDelayQueue.push(DummyRegisters::shuffleP0, 0, myP1SwapDelay); myDelayQueue.push(DummyRegisters::shuffleBL, 0, Delay::shuffleBall); #ifdef DEBUGGER_SUPPORT uInt16 dataAddr = mySystem->m6502().lastDataAddressForPoke(); @@ -1471,10 +1475,34 @@ void TIA::clearHmoveComb() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TIA::setPFDelay(bool slow) +void TIA::setPFBitsDelay(bool delayed) { - myPFDelay = slow ? Delay::pf + 1 : Delay::pf; - myPFColorDelay = slow ? 1 : 0; + myPFBitsDelay = delayed ? Delay::pf + 1 : Delay::pf; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TIA::setPFColorDelay(bool delayed) +{ + myPFColorDelay = delayed ? 1 : 0; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TIA::setP0SwapDelay(bool delayed) +{ + myP0SwapDelay = delayed ? Delay::shufflePlayer + 1 : Delay::shufflePlayer; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TIA::setP1SwapDelay(bool delayed) +{ + myP1SwapDelay = delayed ? Delay::shufflePlayer + 1 : Delay::shufflePlayer; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TIA::setStuffPlayerMove(bool enable) +{ + myPlayer0.setStuffedClock(enable); + myPlayer1.setStuffedClock(enable); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index f71bfddca..47ca9db0f 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -418,11 +418,39 @@ class TIA : public Device void setJitterRecoveryFactor(Int32 factor); /** - Enables/disables slower playfield values. + Enables/disables delayed playfield bits values. - @param slow Wether to enable slow playfield delays + @param delayed Wether to enable delayed playfield delays */ - void setPFDelay(bool slow); + void setPFBitsDelay(bool delayed); + + /** + Enables/disables delayed playfield colors. + + @param delayed Wether to enable delayed playfield colors + */ + void setPFColorDelay(bool delayed); + + /** + Enables/disables delayed player 0 swapping. + + @param delayed Wether to enable player 0 swapping + */ + void setP0SwapDelay(bool delayed); + + /** + Enables/disables delayed player 1 swapping. + + @param delayed Wether to enable player 1 swapping + */ + void setP1SwapDelay(bool delayed); + + /** + Enables/disables stuffed player moving. + + @param enable Wether to enable stuffed player moving + */ + void setStuffPlayerMove(bool enable); /** This method should be called to update the TIA with a new scanline. @@ -669,10 +697,12 @@ class TIA : public Device DelayQueue myDelayQueue; /** - Variable delay values for PF writes. + Variable delay values for TIA writes. */ - uInt8 myPFDelay; + uInt8 myPFBitsDelay; uInt8 myPFColorDelay; + uInt8 myP0SwapDelay; + uInt8 myP1SwapDelay; /** * The frame manager is responsible for detecting frame boundaries and the visible diff --git a/src/gui/DeveloperDialog.cxx b/src/gui/DeveloperDialog.cxx index 8ba92a1e0..ccdaa2db0 100644 --- a/src/gui/DeveloperDialog.cxx +++ b/src/gui/DeveloperDialog.cxx @@ -56,7 +56,7 @@ DeveloperDialog::DeveloperDialog(OSystem& osystem, DialogContainer& parent, int xpos, ypos; // Set real dimensions - setSize(53 * fontWidth + 10, 15 * (lineHeight + VGAP) + 14 + _th, max_w, max_h); + setSize(54 * fontWidth + 10, 15 * (lineHeight + VGAP) + 14 + _th, max_w, max_h); // The tab widget xpos = 2; ypos = 4; @@ -64,6 +64,7 @@ DeveloperDialog::DeveloperDialog(OSystem& osystem, DialogContainer& parent, addTabWidget(myTab); addEmulationTab(font); + addTiaTab(font); addVideoTab(font); addTimeMachineTab(font); addDebuggerTab(font); @@ -90,13 +91,13 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font) int tabID = myTab->addTab("Emulation"); // settings set - mySettingsGroup0 = new RadioButtonGroup(); + mySettingsGroupEmulation = new RadioButtonGroup(); RadioButtonWidget* r = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1, - "Player settings", mySettingsGroup0, kPlrSettings); + "Player settings", mySettingsGroupEmulation, kPlrSettings); wid.push_back(r); ypos += lineHeight + VGAP; r = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1, - "Developer settings", mySettingsGroup0, kDevSettings); + "Developer settings", mySettingsGroupEmulation, kDevSettings); wid.push_back(r); ypos += lineHeight + VGAP * 1; @@ -114,11 +115,6 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font) myConsoleWidget = new PopUpWidget(myTab, font, HBORDER + INDENT * 1, ypos, pwidth, lineHeight, items, "Console ", lwidth, kConsole); wid.push_back(myConsoleWidget); - - myPFDelaykWidget = new CheckboxWidget(myTab, font, myConsoleWidget->getRight() + 20, ypos + 1, - "Extra playfield delay"); - wid.push_back(myPFDelaykWidget); - ypos += lineHeight + VGAP; // Randomize items @@ -180,6 +176,60 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font) addToFocusList(wid, myTab, tabID); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void DeveloperDialog::addTiaTab(const GUI::Font& font) +{ + const int HBORDER = 10; + const int INDENT = 16 + 4; + const int VBORDER = 8; + const int VGAP = 4; + int ypos = VBORDER; + int lineHeight = font.getLineHeight(); + WidgetArray wid; + int tabID = myTab->addTab("TIA"); + + wid.clear(); + + // settings set + mySettingsGroupTia = new RadioButtonGroup(); + RadioButtonWidget* r = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1, + "Player settings", mySettingsGroupTia, kPlrSettings); + wid.push_back(r); + ypos += lineHeight + VGAP; + r = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1, + "Developer settings", mySettingsGroupTia, kDevSettings); + wid.push_back(r); + ypos += lineHeight + VGAP * 1; + + myPFBitsWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT, ypos + 1, + "Delayed playfield bits"); + wid.push_back(myPFBitsWidget); + ypos += lineHeight + VGAP * 1; + + myPFColorWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT, ypos + 1, + "Delayed playfield color"); + wid.push_back(myPFColorWidget); + ypos += lineHeight + VGAP * 1; + + myGRP0SwapWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT, ypos + 1, + "Delayed player 0 swap"); + wid.push_back(myGRP0SwapWidget); + ypos += lineHeight + VGAP * 1; + + myGRP1SwapWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT, ypos + 1, + "Delayed player 1 swap"); + wid.push_back(myGRP1SwapWidget); + ypos += lineHeight + VGAP * 1; + + myGRPxStuffedWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT, ypos + 1, + "Stuffed player move"); + wid.push_back(myGRPxStuffedWidget); + ypos += lineHeight + VGAP * 1; + + // Add items for tab 2 + addToFocusList(wid, myTab, tabID); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DeveloperDialog::addVideoTab(const GUI::Font& font) { @@ -199,13 +249,13 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font) wid.clear(); // settings set - mySettingsGroup1 = new RadioButtonGroup(); + mySettingsGroupVideo = new RadioButtonGroup(); RadioButtonWidget* r = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1, - "Player settings", mySettingsGroup1, kPlrSettings); + "Player settings", mySettingsGroupVideo, kPlrSettings); wid.push_back(r); ypos += lineHeight + VGAP; r = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1, - "Developer settings", mySettingsGroup1, kDevSettings); + "Developer settings", mySettingsGroupVideo, kDevSettings); wid.push_back(r); ypos += lineHeight + VGAP * 1; @@ -329,16 +379,16 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font) lwidth = fontWidth * 11; WidgetArray wid; VariantList items; - int tabID = myTab->addTab("Time Machine"); + int tabID = myTab->addTab("Time Mach."); // settings set - mySettingsGroup2 = new RadioButtonGroup(); + mySettingsGroupTM = new RadioButtonGroup(); RadioButtonWidget* r = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1, - "Player settings", mySettingsGroup2, kPlrSettings); + "Player settings", mySettingsGroupTM, kPlrSettings); wid.push_back(r); ypos += lineHeight + VGAP; r = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1, - "Developer settings", mySettingsGroup2, kDevSettings); + "Developer settings", mySettingsGroupTM, kDevSettings); wid.push_back(r); ypos += lineHeight + VGAP * 1; @@ -491,11 +541,11 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DeveloperDialog::loadSettings(SettingsSet set) { - const string& prefix = set == SettingsSet::player ? "plr." : "dev."; + bool devSettings = set == SettingsSet::developer; + const string& prefix = devSettings ? "dev." : "plr."; myFrameStats[set] = instance().settings().getBool(prefix + "stats"); myConsole[set] = instance().settings().getString(prefix + "console") == "7800" ? 1 : 0; - myPFDelay[set] = instance().settings().getBool(prefix + "extrapfdelay"); // Randomization myRandomBank[set] = instance().settings().getBool(prefix + "bankrandom"); myRandomizeRAM[set] = instance().settings().getBool(prefix + "ramrandom"); @@ -504,13 +554,20 @@ void DeveloperDialog::loadSettings(SettingsSet set) myUndrivenPins[set] = instance().settings().getBool(prefix + "tiadriven"); #ifdef DEBUGGER_SUPPORT // Read from write ports break - myRWPortBreak[set] = instance().settings().getBool(prefix + "rwportbreak"); + myRWPortBreak[set] = devSettings ? instance().settings().getBool("dev.rwportbreak") : false; #endif // Thumb ARM emulation exception - myThumbException[set] = instance().settings().getBool(prefix + "thumb.trapfatal"); + myThumbException[set] = devSettings ? instance().settings().getBool("dev.thumb.trapfatal") : false; // AtariVox/SaveKey EEPROM access myEEPROMAccess[set] = instance().settings().getBool(prefix + "eepromaccess"); + // TIA tab + myPFBits[set] = devSettings ? instance().settings().getBool("dev.tia.delaypfbits") : false; + myPFColor[set] = devSettings ? instance().settings().getBool("dev.tia.delaypfcolor") : false; + myGRP0Swap[set] = devSettings ? instance().settings().getBool("dev.tia.delayp0swap") : false; + myGRP1Swap[set] = devSettings ? instance().settings().getBool("dev.tia.delayp1swap") : false; + myGRPxStuffed[set] = devSettings ? instance().settings().getBool("dev.tia.stuffplayerhm") : false; + // Debug colors myDebugColors[set] = instance().settings().getBool(prefix + "debugcolors"); // PAL color-loss effect @@ -530,13 +587,13 @@ void DeveloperDialog::loadSettings(SettingsSet set) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DeveloperDialog::saveSettings(SettingsSet set) { - const string& prefix = set == SettingsSet::player ? "plr." : "dev."; + bool devSettings = set == SettingsSet::developer; + const string& prefix = devSettings ? "dev." : "plr."; instance().settings().setValue(prefix + "stats", myFrameStats[set]); instance().settings().setValue(prefix + "console", myConsole[set] == 1 ? "7800" : "2600"); if(instance().hasConsole()) instance().eventHandler().set7800Mode(); - instance().settings().setValue(prefix + "extrapfdelay", myPFDelay[set]); // Randomization instance().settings().setValue(prefix + "bankrandom", myRandomBank[set]); @@ -545,14 +602,26 @@ void DeveloperDialog::saveSettings(SettingsSet set) // Undriven TIA pins instance().settings().setValue(prefix + "tiadriven", myUndrivenPins[set]); #ifdef DEBUGGER_SUPPORT - // Read from write ports break - instance().settings().setValue(prefix + "rwportbreak", myRWPortBreak[set]); + if(devSettings) + // Read from write ports break + instance().settings().setValue("dev.rwportbreak", myRWPortBreak[set]); #endif - // Thumb ARM emulation exception - instance().settings().setValue(prefix + "thumb.trapfatal", myThumbException[set]); + if(devSettings) + // Thumb ARM emulation exception + instance().settings().setValue("dev.thumb.trapfatal", myThumbException[set]); // AtariVox/SaveKey EEPROM access instance().settings().setValue(prefix + "eepromaccess", myEEPROMAccess[set]); + // TIA tab + if (devSettings) + { + instance().settings().setValue("dev.tia.delaypfbits", myPFBits[set]); + instance().settings().setValue("dev.tia.delaypfcolor", myPFColor[set]); + instance().settings().setValue("dev.tia.delayp0swap", myGRP0Swap[set]); + instance().settings().setValue("dev.tia.delayp1swap", myGRP1Swap[set]); + instance().settings().setValue("dev.tia.stuffplayerhm", myGRPxStuffed[set]); + } + // Debug colors instance().settings().setValue(prefix + "debugcolors", myDebugColors[set]); // PAL color loss @@ -574,7 +643,6 @@ void DeveloperDialog::getWidgetStates(SettingsSet set) { myFrameStats[set] = myFrameStatsWidget->getState(); myConsole[set] = myConsoleWidget->getSelected() == 1; - myPFDelay[set] = myPFDelaykWidget->getState(); // Randomization myRandomBank[set] = myRandomBankWidget->getState(); myRandomizeRAM[set] = myRandomizeRAMWidget->getState(); @@ -595,6 +663,13 @@ void DeveloperDialog::getWidgetStates(SettingsSet set) // AtariVox/SaveKey EEPROM access myEEPROMAccess[set] = myEEPROMAccessWidget->getState(); + // TIA tab + myPFBits[set] = myPFBitsWidget->getState(); + myPFColor[set] = myPFColorWidget->getState(); + myGRP0Swap[set] = myGRP0SwapWidget->getState(); + myGRP1Swap[set] = myGRP1SwapWidget->getState(); + myGRPxStuffed[set] = myGRPxStuffedWidget->getState(); + // Debug colors myDebugColors[set] = myDebugColorsWidget->getState(); // PAL color-loss effect @@ -617,7 +692,6 @@ void DeveloperDialog::setWidgetStates(SettingsSet set) { myFrameStatsWidget->setState(myFrameStats[set]); myConsoleWidget->setSelectedIndex(myConsole[set]); - myPFDelaykWidget->setState(myPFDelay[set]); // Randomization myRandomBankWidget->setState(myRandomBank[set]); myRandomizeRAMWidget->setState(myRandomizeRAM[set]); @@ -636,9 +710,16 @@ void DeveloperDialog::setWidgetStates(SettingsSet set) myThumbExceptionWidget->setState(myThumbException[set]); // AtariVox/SaveKey EEPROM access myEEPROMAccessWidget->setState(myEEPROMAccess[set]); - handleConsole(); + // TIA tab + myPFBitsWidget->setState(myPFBits[set]); + myPFColorWidget->setState(myPFColor[set]); + myGRP0SwapWidget->setState(myGRP0Swap[set]); + myGRP1SwapWidget->setState(myGRP1Swap[set]); + myGRPxStuffedWidget->setState(myGRPxStuffed[set]); + handleTia(); + // Debug colors myDebugColorsWidget->setState(myDebugColors[set]); // PAL color-loss effect @@ -669,15 +750,16 @@ void DeveloperDialog::loadConfig() { bool devSettings = instance().settings().getBool("dev.settings"); mySettings = devSettings; - mySettingsGroup0->setSelected(devSettings ? 1 : 0); - mySettingsGroup1->setSelected(devSettings ? 1 : 0); - mySettingsGroup2->setSelected(devSettings ? 1 : 0); + mySettingsGroupEmulation->setSelected(devSettings ? 1 : 0); + mySettingsGroupTia->setSelected(devSettings ? 1 : 0); + mySettingsGroupVideo->setSelected(devSettings ? 1 : 0); + mySettingsGroupTM->setSelected(devSettings ? 1 : 0); // load both setting sets... loadSettings(SettingsSet::player); loadSettings(SettingsSet::developer); // ...and select the current one - setWidgetStates(SettingsSet(mySettingsGroup0->getSelected())); + setWidgetStates(SettingsSet(mySettingsGroupEmulation->getSelected())); // Debug colours handleDebugColours(instance().settings().getString("tia.dbgcolors")); @@ -712,22 +794,33 @@ void DeveloperDialog::loadConfig() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DeveloperDialog::saveConfig() { - instance().settings().setValue("dev.settings", mySettingsGroup0->getSelected() == SettingsSet::developer); + instance().settings().setValue("dev.settings", mySettingsGroupEmulation->getSelected() == SettingsSet::developer); // copy current widget status into set... - getWidgetStates(SettingsSet(mySettingsGroup0->getSelected())); + getWidgetStates(SettingsSet(mySettingsGroupEmulation->getSelected())); // ...and save both sets saveSettings(SettingsSet::player); saveSettings(SettingsSet::developer); // activate the current settings instance().frameBuffer().showFrameStats(myFrameStatsWidget->getState()); - // playfield delay & jitter + // jitter if(instance().hasConsole()) { - instance().console().tia().setPFDelay(myPFDelaykWidget->getState()); instance().console().tia().toggleJitter(myTVJitterWidget->getState() ? 1 : 0); instance().console().tia().setJitterRecoveryFactor(myTVJitterRecWidget->getValue()); } + + // TIA tab + if(instance().hasConsole()) + { + // playfield delay + instance().console().tia().setPFBitsDelay(myPFBitsWidget->getState()); + instance().console().tia().setPFColorDelay(myPFColorWidget->getState()); + instance().console().tia().setP0SwapDelay(myGRP0SwapWidget->getState()); + instance().console().tia().setP1SwapDelay(myGRP1SwapWidget->getState()); + instance().console().tia().setStuffPlayerMove(myGRPxStuffedWidget->getState()); + } + handleEnableDebugColors(); // PAL color loss if(instance().hasConsole()) @@ -771,15 +864,14 @@ void DeveloperDialog::saveConfig() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DeveloperDialog::setDefaults() { - bool devSettings = mySettingsGroup0->getSelected() == 1; - SettingsSet set = SettingsSet(mySettingsGroup0->getSelected()); + bool devSettings = mySettingsGroupEmulation->getSelected() == 1; + SettingsSet set = SettingsSet(mySettingsGroupEmulation->getSelected()); switch(myTab->getActiveTab()) { case 0: // Emulation myFrameStats[set] = devSettings ? true : false; myConsole[set] = 0; - myPFDelay[set] = false; // Randomization myRandomBank[set] = devSettings ? true : false; myRandomizeRAM[set] = true; @@ -798,7 +890,17 @@ void DeveloperDialog::setDefaults() setWidgetStates(set); break; - case 1: // Video + case 1: // TIA + myPFBits[set] = false; + myPFColor[set] = false; + myGRP0Swap[set] = false; + myGRP1Swap[set] = false; + myGRPxStuffed[set] = false; + + setWidgetStates(set); + break; + + case 2: // Video // Jitter myTVJitter[set] = true; myTVJitterRec[set] = devSettings ? 2 : 10; @@ -811,7 +913,7 @@ void DeveloperDialog::setDefaults() setWidgetStates(set); break; - case 2: // States + case 3: // States myTimeMachine[set] = true; myStateSize[set] = devSettings ? 1000 : 200; myUncompressed[set] = devSettings ? 600 : 60; @@ -821,7 +923,7 @@ void DeveloperDialog::setDefaults() setWidgetStates(set); break; - case 3: // Debugger options + case 4: // Debugger options { #ifdef DEBUGGER_SUPPORT uInt32 w = std::min(instance().frameBuffer().desktopSize().w, uInt32(DebuggerDialog::kMediumFontMinW)); @@ -944,12 +1046,16 @@ void DeveloperDialog::handleCommand(CommandSender* sender, int cmd, int data, in // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DeveloperDialog::handleSettings(bool devSettings) { + myRWPortBreakWidget->setEnabled(devSettings); + myThumbExceptionWidget->setEnabled(devSettings); + if (mySettings != devSettings) { mySettings = devSettings; // block redundant events first! - mySettingsGroup0->setSelected(devSettings ? 1 : 0); - mySettingsGroup1->setSelected(devSettings ? 1 : 0); - mySettingsGroup2->setSelected(devSettings ? 1 : 0); + mySettingsGroupEmulation->setSelected(devSettings ? 1 : 0); + mySettingsGroupTia->setSelected(devSettings ? 1 : 0); + mySettingsGroupVideo->setSelected(devSettings ? 1 : 0); + mySettingsGroupTM->setSelected(devSettings ? 1 : 0); getWidgetStates(devSettings ? SettingsSet::player : SettingsSet::developer); setWidgetStates(devSettings ? SettingsSet::developer : SettingsSet::player); } @@ -983,6 +1089,17 @@ void DeveloperDialog::handleConsole() myRandomizeRAMWidget->setState(false); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void DeveloperDialog::handleTia() +{ + bool enable = mySettingsGroupEmulation->getSelected() == SettingsSet::developer; + myPFBitsWidget->setEnabled(enable); + myPFColorWidget->setEnabled(enable); + myGRP0SwapWidget->setEnabled(enable); + myGRP1SwapWidget->setEnabled(enable); + myGRPxStuffedWidget->setEnabled(enable); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DeveloperDialog::handleTimeMachine() { diff --git a/src/gui/DeveloperDialog.hxx b/src/gui/DeveloperDialog.hxx index a000a3757..44f0e082a 100644 --- a/src/gui/DeveloperDialog.hxx +++ b/src/gui/DeveloperDialog.hxx @@ -91,10 +91,9 @@ class DeveloperDialog : public Dialog TabWidget* myTab; // Emulator widgets - RadioButtonGroup* mySettingsGroup0; + RadioButtonGroup* mySettingsGroupEmulation; CheckboxWidget* myFrameStatsWidget; PopUpWidget* myConsoleWidget; - CheckboxWidget* myPFDelaykWidget; StaticTextWidget* myLoadingROMLabel; CheckboxWidget* myRandomBankWidget; CheckboxWidget* myRandomizeRAMWidget; @@ -107,8 +106,16 @@ class DeveloperDialog : public Dialog CheckboxWidget* myThumbExceptionWidget; CheckboxWidget* myEEPROMAccessWidget; + // TIA widgets + RadioButtonGroup* mySettingsGroupTia; + CheckboxWidget* myPFBitsWidget; + CheckboxWidget* myPFColorWidget; + CheckboxWidget* myGRP0SwapWidget; + CheckboxWidget* myGRP1SwapWidget; + CheckboxWidget* myGRPxStuffedWidget; + // Video widgets - RadioButtonGroup* mySettingsGroup1; + RadioButtonGroup* mySettingsGroupVideo; CheckboxWidget* myTVJitterWidget; SliderWidget* myTVJitterRecWidget; StaticTextWidget* myTVJitterRecLabelWidget; @@ -118,7 +125,7 @@ class DeveloperDialog : public Dialog ColorWidget* myDbgColourSwatch[DEBUG_COLORS]; // States widgets - RadioButtonGroup* mySettingsGroup2; + RadioButtonGroup* mySettingsGroupTM; CheckboxWidget* myTimeMachineWidget; SliderWidget* myStateSizeWidget; SliderWidget* myUncompressedWidget; @@ -138,7 +145,6 @@ class DeveloperDialog : public Dialog // Emulator sets bool myFrameStats[2]; int myConsole[2]; - bool myPFDelay[2]; bool myRandomBank[2]; bool myRandomizeRAM[2]; string myRandomizeCPU[2]; @@ -152,6 +158,12 @@ class DeveloperDialog : public Dialog #endif bool myThumbException[2]; bool myEEPROMAccess[2]; + // TIA sets + bool myPFBits[2]; + bool myPFColor[2]; + bool myGRP0Swap[2]; + bool myGRP1Swap[2]; + bool myGRPxStuffed[2]; // States sets bool myTimeMachine[2]; int myStateSize[2]; @@ -162,6 +174,7 @@ class DeveloperDialog : public Dialog private: void addEmulationTab(const GUI::Font& font); void addTimeMachineTab(const GUI::Font& font); + void addTiaTab(const GUI::Font& font); void addVideoTab(const GUI::Font& font); void addDebuggerTab(const GUI::Font& font); @@ -175,6 +188,8 @@ class DeveloperDialog : public Dialog void handleEnableDebugColors(); void handleConsole(); + void handleTia(); + void handleDebugColours(int cmd, int color); void handleDebugColours(const string& colors);