Some changes to phosphor blending:

- Updated default phosphor blend to '30'.
 - Added shortcut keys Alt-i and Alt-o to decrease/increase phosphor
blend mode dynamically, while a ROM is running.
 - Made range of blending 0 - 100.
This commit is contained in:
Stephen Anthony 2017-05-29 10:49:50 -02:30
parent 47aa5d4e5f
commit 5dbd9fee51
10 changed files with 82 additions and 14 deletions

View File

@ -1550,6 +1550,18 @@
<td>Cmd + p</td>
</tr>
<tr>
<td>Decrease 'phosphor' blend in phosphor mode</td>
<td>Alt + i</td>
<td>Cmd + i</td>
</tr>
<tr>
<td>Increase 'phosphor' blend in phosphor mode</td>
<td>Alt + o</td>
<td>Cmd + o</td>
</tr>
<tr>
<td>Toggle palette</td>
<td>Control + p</td>

View File

@ -440,6 +440,47 @@ void Console::togglePhosphor()
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(direction == +1) // increase blend
{
if(blend >= 100)
{
myOSystem.frameBuffer().showMessage("Phosphor blend at maximum");
return;
}
else
blend = std::min(blend+2, 100);
}
else if(direction == -1) // decrease blend
{
if(blend <= 0)
{
myOSystem.frameBuffer().showMessage("Phosphor blend at minimum");
return;
}
else
blend = std::max(blend-2, 0);
}
else
return;
ostringstream val;
val << blend;
myProperties.set(Display_PPBlend, val.str());
myOSystem.frameBuffer().showMessage("Phosphor blend " + val.str());
myOSystem.frameBuffer().tiaSurface().enablePhosphor(enable, blend);
}
else
myOSystem.frameBuffer().showMessage("Phosphor effect disabled");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::setProperties(const Properties& props)
{

View File

@ -210,6 +210,13 @@ class Console : public Serializable
*/
void togglePhosphor();
/**
Change the "Display.PPBlend" variable.
@param direction +1 indicates increase, -1 indicates decrease.
*/
void changePhosphor(int direction);
/**
Toggles the PAL color-loss effect.
*/

View File

@ -2368,7 +2368,7 @@ static const char* DefProps[DEF_PROPS_SIZE][21] = {
{ "b9336ed6d94a5cc81a16483b0a946a73", "Atari, Jerome Domurat, Michael Sierchio", "CX2667, CX2667P", "RealSports Soccer (1983) (Atari) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "b958d5fd9574c5cf9ece4b9421c28ecd", "Piero Cavina", "", "Multi-Sprite Game V1.0 (Piero Cavina) (PD)", "", "New Release", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "b95a6274ca0e0c773bfdc06b4c3daa42", "Paul Slocum", "", "3-D Corridor (29-03-2003) (Paul Slocum)", "", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "b98cc2c6f7a0f05176f74f0f62c45488", "Spectravideo", "SV-010", "CompuMate (1983) (Spectravideo)", "", "", "", "CM", "", "", "", "", "COMPUMATE", "COMPUMATE", "", "", "", "", "", "YES", "" },
{ "b98cc2c6f7a0f05176f74f0f62c45488", "Spectravideo", "SV-010", "CompuMate (1983) (Spectravideo)", "", "", "", "CM", "", "", "", "", "COMPUMATE", "COMPUMATE", "", "", "", "", "", "YES", "60" },
{ "b9b4612358a0b2c1b4d66bb146767306", "Commavid, Ben Burch", "CM-010", "Rush Hour (1983) (Commavid) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "23", "245", "", "" },
{ "b9d1e3be30b131324482345959aed5e5", "Activision, Rex Bradford", "", "Kabobber (07-25-1983) (Activision) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "b9f6fa399b8cd386c235983ec45e4355", "Parker Brothers, John Emerson", "931511", "Action Force (1983) (Parker Bros) (PAL)", "AKA G.I. Joe - Cobra Strike", "", "", "", "", "", "", "", "PADDLES", "", "", "01 55", "", "", "", "", "" },
@ -2985,7 +2985,7 @@ static const char* DefProps[DEF_PROPS_SIZE][21] = {
{ "e7864caaf9ec49ed67b1904ce8602690", "", "", "Donkey Kong 2K3 Pic (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e7a758bb0b43d0f7004e92b9abf4bc83", "", "", "Troll's Adventure (Hack)", "Hack of Adventure", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e7dd8c2e6c100044002c1086d02b366e", "Activision, Steve Cartwright - Ariola", "EAX-013, PAX-013, 711 013-720", "Barnstorming (1982) (Activision) (PAL)", "AKA Die tollkeuhnen Flieger", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e7f005ddb6902c648de098511f6ae2e5", "Spectravideo - Universum", "SV-010", "CompuMate (1983) (Spectravideo) (PAL)", "", "", "", "CM", "", "", "", "", "COMPUMATE", "COMPUMATE", "", "", "", "", "", "YES", "" },
{ "e7f005ddb6902c648de098511f6ae2e5", "Spectravideo - Universum", "SV-010", "CompuMate (1983) (Spectravideo) (PAL)", "", "", "", "CM", "", "", "", "", "COMPUMATE", "COMPUMATE", "", "", "", "", "", "YES", "60" },
{ "e800e4aec7c6c54c9cf3db0d1d030058", "", "", "Qb (2.06) (Retroactive) (Stella)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "e80a4026d29777c3c7993fbfaee8920f", "", "", "Frisco (Unknown)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e823b13751e4388f1f2a375d3560a8d7", "Arcadia Corporation, Stephen Harland Landrum", "AR-4105", "Official Frogger (Preview) (1983) (Arcadia) [a]", "", "", "", "", "", "", "", "", "", "", "", "", "", "32", "", "", "" },

View File

@ -404,6 +404,14 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state)
myOSystem.console().toggleBits();
break;
case KBDK_I: // Alt-i decreases phosphor blend
myOSystem.console().changePhosphor(-1);
break;
case KBDK_O: // Alt-o increases phosphor blend
myOSystem.console().changePhosphor(+1);
break;
case KBDK_P: // Alt-p toggles phosphor effect
myOSystem.console().togglePhosphor();
break;

View File

@ -66,7 +66,7 @@ void Properties::set(PropertyType key, const string& value)
case Display_PPBlend:
{
int blend = atoi(myProperties[key].c_str());
if(blend < 50 || blend > 100) blend = 77;
if(blend < 0 || blend > 100) blend = 30;
ostringstream buf;
buf << blend;
myProperties[key] = buf.str();
@ -324,7 +324,7 @@ const char* Properties::ourDefaultProperties[LastPropType] = {
"0", // Display.YStart
"0", // Display.Height
"NO", // Display.Phosphor
"60" // Display.PPBlend
"30" // Display.PPBlend
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -223,7 +223,7 @@ void TIASurface::enableScanlineInterpolation(bool enable)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIASurface::enablePhosphor(bool enable, int blend)
{
myUsePhosphor = enable;
myUsePhosphor = enable;
myPhosphorPercent = blend / 100.0;
myFilterType = FilterType(enable ? myFilterType | 0x01 : myFilterType & 0x10);
myTiaSurface->setDirty();
@ -231,7 +231,7 @@ void TIASurface::enablePhosphor(bool enable, int blend)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 TIASurface::getRGBPhosphor(uInt32 c, uInt32 p, uInt8 shift) const
inline uInt32 TIASurface::getRGBPhosphor(uInt32 c, uInt32 p, uInt8 shift) const
{
uInt8 rc, gc, bc, rp, gp, bp;
@ -320,11 +320,10 @@ void TIASurface::render()
{
case kNormal:
{
uInt32 bufofsY = 0;
uInt32 screenofsY = 0;
uInt32 bufofsY = 0, screenofsY = 0, pos = 0;
for(uInt32 y = 0; y < height; ++y)
{
uInt32 pos = screenofsY;
pos = screenofsY;
for(uInt32 x = 0; x < width; ++x)
buffer[pos++] = myPalette[tiaFrame[bufofsY + x]];
@ -335,11 +334,10 @@ void TIASurface::render()
}
case kPhosphor:
{
uInt32 bufofsY = 0;
uInt32 screenofsY = 0;
uInt32 bufofsY = 0, screenofsY = 0, pos = 0;
for(uInt32 y = 0; y < height; ++y)
{
uInt32 pos = screenofsY;
pos = screenofsY;
for(uInt32 x = 0; x < width; ++x)
{
const uInt32 bufofs = bufofsY + x;

View File

@ -14365,6 +14365,7 @@
"Controller.Left" "COMPUMATE"
"Controller.Right" "COMPUMATE"
"Display.Phosphor" "YES"
"Display.PPBlend" "60"
""
"Cartridge.MD5" "b9b4612358a0b2c1b4d66bb146767306"
@ -18155,6 +18156,7 @@
"Controller.Left" "COMPUMATE"
"Controller.Right" "COMPUMATE"
"Display.Phosphor" "YES"
"Display.PPBlend" "60"
""
"Cartridge.MD5" "e800e4aec7c6c54c9cf3db0d1d030058"

View File

@ -355,7 +355,7 @@ GameInfoDialog::GameInfoDialog(
ypos, 8*fontWidth, lineHeight, "Blend ",
font.getStringWidth("Blend "),
kPPBlendChanged);
myPPBlend->setMinValue(50); myPPBlend->setMaxValue(100);
myPPBlend->setMinValue(0); myPPBlend->setMaxValue(100);
wid.push_back(myPPBlend);
myPPBlendLabel = new StaticTextWidget(myTab, font,

View File

@ -70,7 +70,7 @@ my @prop_defaults = (
"0",
"0",
"NO",
"60"
"30"
);
# Load and parse a properties file into an hash table of property