From bd759b68cb14cef23ea0db894cba57c7509e4714 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Fri, 14 Jul 2017 21:28:26 -0230 Subject: [PATCH] Added ability to force-enable TV phosphor mode. This is enabled in the UI or through the 'tv.phosphor' commandline argument. Note that what was previously 'tv.phosphor' (for setting the blend level) is now 'tv.phosblend'. Updated documentation in various places. --- Changes.txt | 23 ++++++++++++++++++----- src/emucore/EventHandler.cxx | 2 +- src/emucore/Settings.cxx | 13 +++++++++---- src/emucore/TIASurface.cxx | 4 +++- src/gui/VideoDialog.cxx | 30 ++++++++++++++++++++++-------- src/gui/VideoDialog.hxx | 2 +- 6 files changed, 54 insertions(+), 20 deletions(-) diff --git a/Changes.txt b/Changes.txt index 4733212bc..743a72c4d 100644 --- a/Changes.txt +++ b/Changes.txt @@ -14,9 +14,16 @@ 4.7.3 to 5.0: (July 16, 2017) + * Note: because of major TIA/6502/RIOT changes, the state file format + has changed, and old state files will not work with this release. + * Stella has moved from Sourceforge to Github. - * New TIA core: TODO - gather info on all new functionality: + * Completely new TIA core is now available, ported from 6502ts by + Christian Speckner. This new core is extremely accurate, and matches + real hardware in almost every test we've performed. New features + include: + - TODO - gather info on all new functionality: - RSYNC - YStart autodetection - Proper emulation of RDY during write cycles (WSYNC). @@ -28,10 +35,15 @@ * Implemented new phosphor emulation mode, which is much closer to real TV output. Related to this, added ability to change the default - phosphor blend level in the UI and through the new 'tv.phosphor' + phosphor blend level in the UI and through the new 'tv.phosblend' commandline argument. Special thanks to Thomas Jentzsch for the idea and implementation. + * TV phosphor effect can now be force-enabled for all ROMs, instead + of manually setting ROM properties for each ROM. This is accessible + in the UI and through the 'tv.phosphor' commandline argument, and + defaults to being off (or enabled per-ROM). + * Much improved RIOT timer emulation never before seen in any emulator. Special thanks to DirtyHairy for the implementation, and alex_79 for finding documentation that finally describes in more detail how the @@ -69,8 +81,8 @@ clearly indicate if an item can be modified. - Debugger '.lst' and '.sym' files are now searched based on the name of the ROM file, and not on the internal properties name. - - Snapshots can now be saved by pressing F12 key (the various other - ways to save snapshots still exist). + - Snapshots can now be saved by pressing the F12 key (the various + other ways to save snapshots still exist). * Mouse grabbing is now enabled in windowed mode only when the ROM is using a virtual analog controller (paddles, trakball, etc). @@ -99,6 +111,7 @@ easier to read. * When in 'ROM launcher mode', Stella now uses slightly less CPU time. + More work is required in this area, though. * Added ROM properties for D.K. VCS homebrew ROM, thanks to Andreas Dietrich. @@ -141,7 +154,7 @@ * Updated build scripts for Visual Studio 2017 (Windows) and MacOS Sierra (latest version of Xcode), and make these the minimum supported - versions. + versions for building Stella. * Updated UNIX configure script to work with the clang 5+ and gcc 7+ compiler versions, and fixed compile issues on AArch64 and ppc64le diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index dcf8624f3..a10e0eb19 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -106,7 +106,7 @@ void EventHandler::initialize() // Default phosphor blend Properties::setDefault(Display_PPBlend, - myOSystem.settings().getString("tv.phosphor")); + myOSystem.settings().getString("tv.phosblend")); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 2ed76ce6a..d9d402a1f 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -55,7 +55,8 @@ Settings::Settings(OSystem& osystem) // TV filtering options setInternal("tv.filter", "0"); - setInternal("tv.phosphor", "50"); + setInternal("tv.phosphor", "byrom"); + setInternal("tv.phosblend", "50"); setInternal("tv.jitter", "true"); setInternal("tv.jitter_recovery", "10"); setInternal("tv.scanlines", "25"); @@ -279,8 +280,11 @@ void Settings::validate() sort(s.begin(), s.end()); if(s != "bgopry") setInternal("tia.dbgcolors", "roygpb"); - i = getInt("tv.phosphor"); - if(i < 0 || i > 100) setInternal("tv.phosphor", "50"); + s = getString("tv.phosphor"); + if(s != "always" && s != "byrom") setInternal("tv.phosphor", "byrom"); + + i = getInt("tv.phosblend"); + if(i < 0 || i > 100) setInternal("tv.phosblend", "50"); i = getInt("tv.filter"); if(i < 0 || i > 5) setInternal("tv.filter", "0"); @@ -380,7 +384,8 @@ void Settings::usage() const << " -tia.dbgcolors Debug colors to use for each object (see manual for description)\n" << endl << " -tv.filter <0-5> Set TV effects off (0) or to specified mode (1-5)\n" - << " -tv.phosphor <0-100> Set default blend level in phosphor mode\n" + << " -tv.phosphor When to use phosphor mode\n" + << " -tv.phosblend <0-100> Set default blend level in phosphor mode\n" << " -tv.jitter <1|0> Enable TV jitter effect\n" << " -tv.jitter_recovery <1-20> Set recovery time for TV jitter effect\n" << " -tv.scanlines <0-100> Set scanline intensity to percentage (0 disables completely)\n" diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx index 1b45914c9..ed020e230 100644 --- a/src/emucore/TIASurface.cxx +++ b/src/emucore/TIASurface.cxx @@ -67,7 +67,9 @@ void TIASurface::initialize(const Console& console, const VideoMode& mode) mySLineSurface->setDstPos(mode.image.x(), mode.image.y()); mySLineSurface->setDstSize(mode.image.width(), mode.image.height()); - bool p_enable = console.properties().get(Display_Phosphor) == "YES"; + // Phosphor mode can be enabled either globally or per-ROM + bool p_enable = myOSystem.settings().getString("tv.phosphor") == "always" || + console.properties().get(Display_Phosphor) == "YES"; int p_blend = atoi(console.properties().get(Display_PPBlend).c_str()); enablePhosphor(p_enable, p_blend); setNTSC(NTSCFilter::Preset(myOSystem.settings().getInt("tv.filter")), false); diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx index e5a39f69b..75a938a04 100644 --- a/src/gui/VideoDialog.cxx +++ b/src/gui/VideoDialog.cxx @@ -53,7 +53,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent, // Set real dimensions _w = std::min(52 * fontWidth + 10, max_w); - _h = std::min(16 * (lineHeight + 4) + 10, max_h); + _h = std::min(16 * (lineHeight + 4) + 14, max_h); // The tab widget xpos = ypos = 5; @@ -249,10 +249,13 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent, pwidth = font.getMaxCharWidth() * 6; // TV Phosphor effect - myTVPhosLabel = new StaticTextWidget(myTab, font, xpos, ypos, - font.getStringWidth("Phosphor Effect"), fontHeight, - "Phosphor Effect", kTextAlignLeft); - ypos += lineHeight; + items.clear(); + VarList::push_back(items, "Always", "always"); + VarList::push_back(items, "Per-ROM", "byrom"); + myTVPhosphor = new PopUpWidget(myTab, font, xpos, ypos, + font.getStringWidth("Per-ROM"), lineHeight, items, + "TV Phosphor ", font.getStringWidth("TV Phosphor ")); + ypos += lineHeight + 4; // TV Phosphor default level xpos += 20; @@ -440,9 +443,13 @@ void VideoDialog::loadConfig() // TV Custom adjustables loadTVAdjustables(NTSCFilter::PRESET_CUSTOM); + // TV phosphor mode + myTVPhosphor->setSelected( + instance().settings().getString("tv.phosphor"), "byrom"); + // TV phosphor blend - myTVPhosLevel->setValue(instance().settings().getInt("tv.phosphor")); - myTVPhosLevelLabel->setLabel(instance().settings().getString("tv.phosphor")); + myTVPhosLevel->setValue(instance().settings().getInt("tv.phosblend")); + myTVPhosLevelLabel->setLabel(instance().settings().getString("tv.phosblend")); // TV jitter myTVJitterRec->setValue(instance().settings().getInt("tv.jitter_recovery")); @@ -538,8 +545,12 @@ void VideoDialog::saveConfig() adj.bleed = myTVBleed->getValue(); instance().frameBuffer().tiaSurface().ntsc().setCustomAdjustables(adj); + // TV phosphor mode + instance().settings().setValue("tv.phosphor", + myTVPhosphor->getSelectedTag().toString()); + // TV phosphor blend - instance().settings().setValue("tv.phosphor", myTVPhosLevelLabel->getLabel()); + instance().settings().setValue("tv.phosblend", myTVPhosLevelLabel->getLabel()); Properties::setDefault(Display_PPBlend, myTVPhosLevelLabel->getLabel()); // TV jitter @@ -600,6 +611,9 @@ void VideoDialog::setDefaults() { myTVMode->setSelected("0", "0"); + // TV phosphor mode + myTVPhosphor->setSelected("byrom", "byrom"); + // TV phosphor blend myTVPhosLevel->setValue(50); myTVPhosLevelLabel->setLabel("50"); diff --git a/src/gui/VideoDialog.hxx b/src/gui/VideoDialog.hxx index 9286a250d..b15bcd128 100644 --- a/src/gui/VideoDialog.hxx +++ b/src/gui/VideoDialog.hxx @@ -104,7 +104,7 @@ class VideoDialog : public Dialog StaticTextWidget* myTVJitterRecLabel; // TV phosphor effect - StaticTextWidget* myTVPhosLabel; + PopUpWidget* myTVPhosphor; SliderWidget* myTVPhosLevel; StaticTextWidget* myTVPhosLevelLabel;