From 859f33f54ce55a1067983aaced86478ef9dea80b Mon Sep 17 00:00:00 2001 From: thrust26 Date: Wed, 26 Aug 2020 23:39:20 +0200 Subject: [PATCH] added delayed background color glitch developer option --- Changes.txt | 4 +++- src/emucore/Settings.cxx | 5 ++++- src/emucore/tia/TIA.cxx | 25 +++++++++++++++++++++++-- src/emucore/tia/TIA.hxx | 8 ++++++++ src/gui/DeveloperDialog.cxx | 19 +++++++++++++++++++ src/gui/DeveloperDialog.hxx | 3 +++ 6 files changed, 60 insertions(+), 4 deletions(-) diff --git a/Changes.txt b/Changes.txt index ba992d5d2..b0691039e 100644 --- a/Changes.txt +++ b/Changes.txt @@ -41,6 +41,8 @@ * Added option to display detected settings info when a ROM is loaded. + * Added another oddball TIA glitch option for delayed background color. (TODO: DOC) + * Replaced "Re-disassemble" with "Disassemble @ current line" in debugger. * Fixed bug when taking fullscreen snapshots; the dimensions were @@ -51,7 +53,7 @@ 6.2.1 to 6.2.2 (August 25, 2020) - * Fixed bug in initial controller mapping. + * Fixed a bug in initial controller mapping. 6.2 to 6.2.1: (June 20, 2020) diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 5cf836954..e9d0de8c8 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -220,6 +220,7 @@ Settings::Settings() setPermanent("dev.tia.blinvphase", "true"); setPermanent("dev.tia.delaypfbits", "true"); setPermanent("dev.tia.delaypfcolor", "true"); + setPermanent("dev.tia.delaybkcolor", "true"); setPermanent("dev.tia.delayplswap", "true"); setPermanent("dev.tia.delayblswap", "true"); setPermanent("dev.timemachine", true); @@ -659,13 +660,15 @@ void Settings::usage() const << " -dev.tia.type \n" + << " quickstep|\n" + << " indy500|heman|>\n" << " -dev.tia.plinvphase <1|0> Enable inverted HMOVE clock phase for players\n" << " -dev.tia.msinvphase <1|0> Enable inverted HMOVE clock phase for\n" << " missiles\n" << " -dev.tia.blinvphase <1|0> Enable inverted HMOVE clock phase for ball\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.delaybkcolor <1|0> Enable extra delay cycle for background color\n" << " -dev.tia.delayplswap <1|0> Enable extra delay cycle for VDELP0/1 swap\n" << " -dev.tia.delayblswap <1|0> Enable extra delay cycle for VDELBL swap\n" << endl << std::flush; diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index b3a48c335..7e4cdbf04 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -285,6 +285,7 @@ bool TIA::save(Serializer& out) const out.putByte(myPFBitsDelay); out.putByte(myPFColorDelay); + out.putByte(myBKColorDelay); out.putByte(myPlSwapDelay); } catch(...) @@ -356,6 +357,7 @@ bool TIA::load(Serializer& in) myPFBitsDelay = in.getByte(); myPFColorDelay = in.getByte(); + myBKColorDelay = in.getByte(); myPlSwapDelay = in.getByte(); // Re-apply dev settings @@ -605,8 +607,13 @@ bool TIA::poke(uInt16 address, uInt8 value) case COLUBK: { value &= 0xFE; - myBackground.setColor(value); - myShadowRegisters[address] = value; + if(myBKColorDelay) + myDelayQueue.push(COLUBK, value, 1); + else + { + myBackground.setColor(value); + myShadowRegisters[address] = value; + } #ifdef DEBUGGER_SUPPORT uInt16 dataAddr = mySystem->m6502().lastDataAddressForPoke(); if(dataAddr) @@ -918,6 +925,9 @@ void TIA::applyDeveloperSettings() setPFColorDelay(custom ? mySettings.getBool("dev.tia.delaypfcolor") : BSPF::equalsIgnoreCase("quickstep", mySettings.getString("dev.tia.type"))); + setBKColorDelay(custom + ? mySettings.getBool("dev.tia.delaybkcolor") + : BSPF::equalsIgnoreCase("indy500", mySettings.getString("dev.tia.type"))); setPlSwapDelay(custom ? mySettings.getBool("dev.tia.delayplswap") : BSPF::equalsIgnoreCase("heman", mySettings.getString("dev.tia.type"))); @@ -930,6 +940,7 @@ void TIA::applyDeveloperSettings() setBlInvertedPhaseClock(false); setPFBitsDelay(false); setPFColorDelay(false); + setBKColorDelay(false); setPlSwapDelay(false); setBlSwapDelay(false); } @@ -1608,6 +1619,12 @@ void TIA::setPFColorDelay(bool delayed) myPFColorDelay = delayed ? 1 : 0; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TIA::setBKColorDelay(bool delayed) +{ + myBKColorDelay = delayed ? 1 : 0; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIA::setPlSwapDelay(bool delayed) { @@ -1683,6 +1700,10 @@ void TIA::delayedWrite(uInt8 address, uInt8 value) myPlayfield.pf2(value); break; + case COLUBK: + myBackground.setColor(value); + break; + case COLUPF: myPlayfield.setColor(value); myBall.setColor(value); diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index 608caf184..ada06a042 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -435,6 +435,13 @@ class TIA : public Device */ void setPFColorDelay(bool delayed); + /** + Enables/disables delayed background colors. + + @param delayed Wether to enable delayed background colors + */ + void setBKColorDelay(bool delayed); + /** Enables/disables delayed player swapping. @@ -740,6 +747,7 @@ class TIA : public Device */ uInt8 myPFBitsDelay{0}; uInt8 myPFColorDelay{0}; + uInt8 myBKColorDelay{0}; uInt8 myPlSwapDelay{0}; uInt8 myBlSwapDelay{0}; diff --git a/src/gui/DeveloperDialog.cxx b/src/gui/DeveloperDialog.cxx index 336c5e1e8..6406e33d5 100644 --- a/src/gui/DeveloperDialog.cxx +++ b/src/gui/DeveloperDialog.cxx @@ -233,6 +233,7 @@ void DeveloperDialog::addTiaTab(const GUI::Font& font) VarList::push_back(items, "Faulty Cosmic Ark stars", "cosmicark"); VarList::push_back(items, "Glitched Pesco", "pesco"); VarList::push_back(items, "Glitched Quick Step!", "quickstep"); + VarList::push_back(items, "Glitched Indy 500 menu", "indy500"); VarList::push_back(items, "Glitched He-Man title", "heman"); VarList::push_back(items, "Custom", "custom"); myTIATypeWidget = new PopUpWidget(myTab, font, HBORDER + INDENT, ypos - 1, @@ -271,6 +272,15 @@ void DeveloperDialog::addTiaTab(const GUI::Font& font) wid.push_back(myPFColorWidget); ypos += lineHeight + VGAP * 1; + myBackgroundLabel = new StaticTextWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1, + "Delayed background"); + wid.push_back(myBackgroundLabel); + ypos += lineHeight + VGAP * 1; + + myBKColorWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 3, ypos + 1, "Color"); + wid.push_back(myBKColorWidget); + ypos += lineHeight + VGAP * 1; + ostringstream ss; ss << "Delayed VDEL" << ELLIPSIS << " swap for"; mySwapLabel = new StaticTextWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1, ss.str()); @@ -644,6 +654,7 @@ void DeveloperDialog::loadSettings(SettingsSet set) myBlInvPhase[set] = devSettings ? instance().settings().getBool("dev.tia.blinvphase") : false; myPFBits[set] = devSettings ? instance().settings().getBool("dev.tia.delaypfbits") : false; myPFColor[set] = devSettings ? instance().settings().getBool("dev.tia.delaypfcolor") : false; + myBKColor[set] = devSettings ? instance().settings().getBool("dev.tia.delaybkcolor") : false; myPlSwap[set] = devSettings ? instance().settings().getBool("dev.tia.delayplswap") : false; myBlSwap[set] = devSettings ? instance().settings().getBool("dev.tia.delayblswap") : false; @@ -708,6 +719,7 @@ void DeveloperDialog::saveSettings(SettingsSet set) instance().settings().setValue("dev.tia.blinvphase", myBlInvPhase[set]); instance().settings().setValue("dev.tia.delaypfbits", myPFBits[set]); instance().settings().setValue("dev.tia.delaypfcolor", myPFColor[set]); + instance().settings().setValue("dev.tia.delaybkcolor", myBKColor[set]); instance().settings().setValue("dev.tia.delayplswap", myPlSwap[set]); instance().settings().setValue("dev.tia.delayblswap", myBlSwap[set]); } @@ -762,6 +774,7 @@ void DeveloperDialog::getWidgetStates(SettingsSet set) myBlInvPhase[set] = myBlInvPhaseWidget->getState(); myPFBits[set] = myPFBitsWidget->getState(); myPFColor[set] = myPFColorWidget->getState(); + myBKColor[set] = myBKColorWidget->getState(); myPlSwap[set] = myPlSwapWidget->getState(); myBlSwap[set] = myBlSwapWidget->getState(); @@ -909,6 +922,7 @@ void DeveloperDialog::saveConfig() instance().console().tia().setBlInvertedPhaseClock(myBlInvPhaseWidget->getState()); instance().console().tia().setPFBitsDelay(myPFBitsWidget->getState()); instance().console().tia().setPFColorDelay(myPFColorWidget->getState()); + instance().console().tia().setBKColorDelay(myBKColorWidget->getState()); instance().console().tia().setPlSwapDelay(myPlSwapWidget->getState()); instance().console().tia().setBlSwapDelay(myBlSwapWidget->getState()); } @@ -995,6 +1009,7 @@ void DeveloperDialog::setDefaults() myBlInvPhase[set] = devSettings ? true : false; myPFBits[set] = devSettings ? true : false; myPFColor[set] = devSettings ? true : false; + myBKColor[set] = devSettings ? true : false; myPlSwap[set] = devSettings ? true : false; myBlSwap[set] = devSettings ? true : false; @@ -1210,8 +1225,10 @@ void DeveloperDialog::handleTia() myMsInvPhaseWidget->setEnabled(enable); myBlInvPhaseWidget->setEnabled(enable); myPlayfieldLabel->setEnabled(enable); + myBackgroundLabel->setEnabled(enable); myPFBitsWidget->setEnabled(enable); myPFColorWidget->setEnabled(enable); + myBKColorWidget->setEnabled(enable); mySwapLabel->setEnabled(enable); myPlSwapWidget->setEnabled(enable); myBlSwapWidget->setEnabled(enable); @@ -1223,6 +1240,7 @@ void DeveloperDialog::handleTia() myBlInvPhaseWidget->setState(myBlInvPhase[SettingsSet::developer]); myPFBitsWidget->setState(myPFBits[SettingsSet::developer]); myPFColorWidget->setState(myPFColor[SettingsSet::developer]); + myBKColorWidget->setState(myBKColor[SettingsSet::developer]); myPlSwapWidget->setState(myPlSwap[SettingsSet::developer]); myBlSwapWidget->setState(myBlSwap[SettingsSet::developer]); } @@ -1233,6 +1251,7 @@ void DeveloperDialog::handleTia() myBlInvPhaseWidget->setState(false); myPFBitsWidget->setState(BSPF::equalsIgnoreCase("pesco", myTIATypeWidget->getSelectedTag().toString())); myPFColorWidget->setState(BSPF::equalsIgnoreCase("quickstep", myTIATypeWidget->getSelectedTag().toString())); + myBKColorWidget->setState(BSPF::equalsIgnoreCase("indy500", myTIATypeWidget->getSelectedTag().toString())); myPlSwapWidget->setState(BSPF::equalsIgnoreCase("heman", myTIATypeWidget->getSelectedTag().toString())); myBlSwapWidget->setState(false); } diff --git a/src/gui/DeveloperDialog.hxx b/src/gui/DeveloperDialog.hxx index c2e88828b..f66d58378 100644 --- a/src/gui/DeveloperDialog.hxx +++ b/src/gui/DeveloperDialog.hxx @@ -115,6 +115,8 @@ class DeveloperDialog : public Dialog StaticTextWidget* myPlayfieldLabel{nullptr}; CheckboxWidget* myPFBitsWidget{nullptr}; CheckboxWidget* myPFColorWidget{nullptr}; + StaticTextWidget* myBackgroundLabel{nullptr}; + CheckboxWidget* myBKColorWidget{nullptr}; StaticTextWidget* mySwapLabel{nullptr}; CheckboxWidget* myPlSwapWidget{nullptr}; CheckboxWidget* myBlSwapWidget{nullptr}; @@ -172,6 +174,7 @@ class DeveloperDialog : public Dialog std::array myBlInvPhase; std::array myPFBits; std::array myPFColor; + std::array myBKColor; std::array myPlSwap; std::array myBlSwap; // States sets