diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index a5591490d..de4baaf35 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -424,32 +424,26 @@ void Console::setPalette(const string& type) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Console::togglePhosphor() { - const string& phosphor = myProperties.get(Display_Phosphor); - int blend = atoi(myProperties.get(Display_PPBlend).c_str()); - bool enable; - if(phosphor == "YES") + if(myOSystem.frameBuffer().tiaSurface().phosphorEnabled()) { myProperties.set(Display_Phosphor, "No"); - enable = false; + myOSystem.frameBuffer().tiaSurface().enablePhosphor(false); myOSystem.frameBuffer().showMessage("Phosphor effect disabled"); } else { myProperties.set(Display_Phosphor, "Yes"); - enable = true; + myOSystem.frameBuffer().tiaSurface().enablePhosphor(true); myOSystem.frameBuffer().showMessage("Phosphor effect enabled"); } - - myOSystem.frameBuffer().tiaSurface().enablePhosphor(enable, blend); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Console::changePhosphor(int direction) { - bool enable = myProperties.get(Display_Phosphor) == "YES"; int blend = atoi(myProperties.get(Display_PPBlend).c_str()); - if(enable) + if(myOSystem.frameBuffer().tiaSurface().phosphorEnabled()) { if(direction == +1) // increase blend { @@ -478,7 +472,7 @@ void Console::changePhosphor(int direction) val << blend; myProperties.set(Display_PPBlend, val.str()); myOSystem.frameBuffer().showMessage("Phosphor blend " + val.str()); - myOSystem.frameBuffer().tiaSurface().enablePhosphor(enable, blend); + myOSystem.frameBuffer().tiaSurface().enablePhosphor(true, blend); } else myOSystem.frameBuffer().showMessage("Phosphor effect disabled"); diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx index f46162b94..76d104597 100644 --- a/src/emucore/TIASurface.cxx +++ b/src/emucore/TIASurface.cxx @@ -232,7 +232,8 @@ void TIASurface::enableScanlineInterpolation(bool enable) void TIASurface::enablePhosphor(bool enable, int blend) { myUsePhosphor = enable; - myPhosphorPercent = blend / 100.0; + if(blend >= 0) + myPhosphorPercent = blend / 100.0; myFilter = Filter(enable ? uInt8(myFilter) | 0x01 : uInt8(myFilter) & 0x10); myTiaSurface->setDirty(); diff --git a/src/emucore/TIASurface.hxx b/src/emucore/TIASurface.hxx index 4ebe0b87a..f8f35db26 100644 --- a/src/emucore/TIASurface.hxx +++ b/src/emucore/TIASurface.hxx @@ -109,9 +109,10 @@ class TIASurface void enableScanlineInterpolation(bool enable); /** - Enable/disable phosphor effect. + Enable/disable/query phosphor effect. */ - void enablePhosphor(bool enable, int blend); + void enablePhosphor(bool enable, int blend = -1); + bool phosphorEnabled() const { return myUsePhosphor; } /** Used to calculate an averaged color for the 'phosphor' effect.