mirror of https://github.com/stella-emu/stella.git
Fixed inconsistent Alt-p phosphor behaviour (fixes #196).
This commit is contained in:
parent
a9dd2b32cb
commit
6e55d98ad7
|
@ -424,32 +424,26 @@ void Console::setPalette(const string& type)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Console::togglePhosphor()
|
void Console::togglePhosphor()
|
||||||
{
|
{
|
||||||
const string& phosphor = myProperties.get(Display_Phosphor);
|
if(myOSystem.frameBuffer().tiaSurface().phosphorEnabled())
|
||||||
int blend = atoi(myProperties.get(Display_PPBlend).c_str());
|
|
||||||
bool enable;
|
|
||||||
if(phosphor == "YES")
|
|
||||||
{
|
{
|
||||||
myProperties.set(Display_Phosphor, "No");
|
myProperties.set(Display_Phosphor, "No");
|
||||||
enable = false;
|
myOSystem.frameBuffer().tiaSurface().enablePhosphor(false);
|
||||||
myOSystem.frameBuffer().showMessage("Phosphor effect disabled");
|
myOSystem.frameBuffer().showMessage("Phosphor effect disabled");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myProperties.set(Display_Phosphor, "Yes");
|
myProperties.set(Display_Phosphor, "Yes");
|
||||||
enable = true;
|
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true);
|
||||||
myOSystem.frameBuffer().showMessage("Phosphor effect enabled");
|
myOSystem.frameBuffer().showMessage("Phosphor effect enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
myOSystem.frameBuffer().tiaSurface().enablePhosphor(enable, blend);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Console::changePhosphor(int direction)
|
void Console::changePhosphor(int direction)
|
||||||
{
|
{
|
||||||
bool enable = myProperties.get(Display_Phosphor) == "YES";
|
|
||||||
int blend = atoi(myProperties.get(Display_PPBlend).c_str());
|
int blend = atoi(myProperties.get(Display_PPBlend).c_str());
|
||||||
|
|
||||||
if(enable)
|
if(myOSystem.frameBuffer().tiaSurface().phosphorEnabled())
|
||||||
{
|
{
|
||||||
if(direction == +1) // increase blend
|
if(direction == +1) // increase blend
|
||||||
{
|
{
|
||||||
|
@ -478,7 +472,7 @@ void Console::changePhosphor(int direction)
|
||||||
val << blend;
|
val << blend;
|
||||||
myProperties.set(Display_PPBlend, val.str());
|
myProperties.set(Display_PPBlend, val.str());
|
||||||
myOSystem.frameBuffer().showMessage("Phosphor blend " + val.str());
|
myOSystem.frameBuffer().showMessage("Phosphor blend " + val.str());
|
||||||
myOSystem.frameBuffer().tiaSurface().enablePhosphor(enable, blend);
|
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true, blend);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
myOSystem.frameBuffer().showMessage("Phosphor effect disabled");
|
myOSystem.frameBuffer().showMessage("Phosphor effect disabled");
|
||||||
|
|
|
@ -232,6 +232,7 @@ void TIASurface::enableScanlineInterpolation(bool enable)
|
||||||
void TIASurface::enablePhosphor(bool enable, int blend)
|
void TIASurface::enablePhosphor(bool enable, int blend)
|
||||||
{
|
{
|
||||||
myUsePhosphor = enable;
|
myUsePhosphor = enable;
|
||||||
|
if(blend >= 0)
|
||||||
myPhosphorPercent = blend / 100.0;
|
myPhosphorPercent = blend / 100.0;
|
||||||
myFilter = Filter(enable ? uInt8(myFilter) | 0x01 : uInt8(myFilter) & 0x10);
|
myFilter = Filter(enable ? uInt8(myFilter) | 0x01 : uInt8(myFilter) & 0x10);
|
||||||
|
|
||||||
|
|
|
@ -109,9 +109,10 @@ class TIASurface
|
||||||
void enableScanlineInterpolation(bool enable);
|
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.
|
Used to calculate an averaged color for the 'phosphor' effect.
|
||||||
|
|
Loading…
Reference in New Issue