Turned ppblend into a ROM property named 'Display.PPBlend', which means

that blending is now per-ROM.

Added slider widget to GameProperties dialog to change the phosphor
blend amount.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1139 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-11-04 19:38:25 +00:00
parent 1fd458c9e9
commit ba82080839
19 changed files with 4224 additions and 4150 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferGL.cxx,v 1.67 2006-11-03 16:55:44 stephena Exp $
// $Id: FrameBufferGL.cxx,v 1.68 2006-11-04 19:38:24 stephena Exp $
//============================================================================
#ifdef DISPLAY_OPENGL
@ -640,10 +640,10 @@ void FrameBufferGL::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::enablePhosphor(bool enable)
void FrameBufferGL::enablePhosphor(bool enable, int blend)
{
myUsePhosphor = enable;
myPhosphorBlend = myOSystem->settings().getInt("ppblend");
myPhosphorBlend = blend;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferGL.hxx,v 1.35 2006-11-03 16:50:16 stephena Exp $
// $Id: FrameBufferGL.hxx,v 1.36 2006-11-04 19:38:24 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_GL_HXX
@ -40,7 +40,7 @@ class GUI::Font;
This class implements an SDL OpenGL framebuffer.
@author Stephen Anthony
@version $Id: FrameBufferGL.hxx,v 1.35 2006-11-03 16:50:16 stephena Exp $
@version $Id: FrameBufferGL.hxx,v 1.36 2006-11-04 19:38:24 stephena Exp $
*/
class FrameBufferGL : public FrameBuffer
{
@ -215,7 +215,7 @@ class FrameBufferGL : public FrameBuffer
/**
Enable/disable phosphor effect.
*/
virtual void enablePhosphor(bool enable);
virtual void enablePhosphor(bool enable, int blend);
/**
Completely erase contents of the screen.

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferSoft.cxx,v 1.56 2006-10-22 18:58:45 stephena Exp $
// $Id: FrameBufferSoft.cxx,v 1.57 2006-11-04 19:38:24 stephena Exp $
//============================================================================
#include <SDL.h>
@ -643,10 +643,10 @@ void FrameBufferSoft::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSoft::enablePhosphor(bool enable)
void FrameBufferSoft::enablePhosphor(bool enable, int blend)
{
myUsePhosphor = enable;
myPhosphorBlend = myOSystem->settings().getInt("ppblend");
myPhosphorBlend = blend;
if(myUsePhosphor)
{

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferSoft.hxx,v 1.35 2006-10-14 20:08:29 stephena Exp $
// $Id: FrameBufferSoft.hxx,v 1.36 2006-11-04 19:38:24 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_SOFT_HXX
@ -35,7 +35,7 @@ class RectList;
This class implements an SDL software framebuffer.
@author Stephen Anthony
@version $Id: FrameBufferSoft.hxx,v 1.35 2006-10-14 20:08:29 stephena Exp $
@version $Id: FrameBufferSoft.hxx,v 1.36 2006-11-04 19:38:24 stephena Exp $
*/
class FrameBufferSoft : public FrameBuffer
{
@ -201,7 +201,7 @@ class FrameBufferSoft : public FrameBuffer
/**
Enable/disable phosphor effect.
*/
virtual void enablePhosphor(bool enable);
virtual void enablePhosphor(bool enable, int blend);
/**
Completely erase contents of the screen.

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Console.cxx,v 1.96 2006-10-22 18:58:46 stephena Exp $
// $Id: Console.cxx,v 1.97 2006-11-04 19:38:24 stephena Exp $
//============================================================================
#include <assert.h>
@ -340,6 +340,7 @@ void Console::togglePalette(const string& palette)
void Console::togglePhosphor()
{
const string& phosphor = myProperties.get(Display_Phosphor);
int blend = atoi(myProperties.get(Display_PPBlend).c_str());
bool enable;
if(phosphor == "YES")
{
@ -354,7 +355,7 @@ void Console::togglePhosphor()
myOSystem->frameBuffer().showMessage("Phosphor effect enabled");
}
myOSystem->frameBuffer().enablePhosphor(enable);
myOSystem->frameBuffer().enablePhosphor(enable, blend);
setPalette();
}
@ -448,7 +449,8 @@ void Console::initializeVideo()
myMediaSource->width() << 1,
myMediaSource->height());
bool enable = myProperties.get(Display_Phosphor) == "YES";
myOSystem->frameBuffer().enablePhosphor(enable);
int blend = atoi(myProperties.get(Display_PPBlend).c_str());
myOSystem->frameBuffer().enablePhosphor(enable, blend);
setPalette();
}
@ -745,6 +747,10 @@ void Console::setDeveloperProperties()
if(s != "")
myProperties.set(Display_Phosphor, s);
s = settings.getString("ppblend");
if(s != "")
myProperties.set(Display_PPBlend, s);
s = settings.getString("hmove");
if(s != "")
myProperties.set(Emulation_HmoveBlanks, s);

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBuffer.cxx,v 1.94 2006-10-22 18:58:46 stephena Exp $
// $Id: FrameBuffer.cxx,v 1.95 2006-11-04 19:38:24 stephena Exp $
//============================================================================
#include <sstream>
@ -312,7 +312,9 @@ void FrameBuffer::pause(bool status)
{
if(&myOSystem->console() && myOSystem->console().isInitialized())
{
enablePhosphor(myOSystem->console().properties().get(Display_Phosphor) == "YES");
bool enable = myOSystem->console().properties().get(Display_Phosphor) == "YES";
int blend = atoi(myOSystem->console().properties().get(Display_PPBlend).c_str());
enablePhosphor(enable, blend);
setPalette(myOSystem->console().mediaSource().palette());
}
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBuffer.hxx,v 1.73 2006-10-22 18:58:46 stephena Exp $
// $Id: FrameBuffer.hxx,v 1.74 2006-11-04 19:38:24 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_HXX
@ -96,7 +96,7 @@ struct Scaler {
All GUI elements (ala ScummVM) are drawn here as well.
@author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.73 2006-10-22 18:58:46 stephena Exp $
@version $Id: FrameBuffer.hxx,v 1.74 2006-11-04 19:38:24 stephena Exp $
*/
class FrameBuffer
{
@ -443,7 +443,7 @@ class FrameBuffer
/**
Enable/disable phosphor effect.
*/
virtual void enablePhosphor(bool enable) = 0;
virtual void enablePhosphor(bool enable, int blend) = 0;
/**
Completely erase contents of the screen.

View File

@ -13,11 +13,12 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Props.cxx,v 1.12 2006-03-05 01:18:42 stephena Exp $
// $Id: Props.cxx,v 1.13 2006-11-04 19:38:24 stephena Exp $
//============================================================================
#include <cctype>
#include <algorithm>
#include <sstream>
#include "GuiUtils.hxx"
#include "Props.hxx"
@ -74,6 +75,16 @@ void Properties::set(PropertyType key, const string& value)
break;
}
case Display_PPBlend:
{
int blend = atoi(myProperties[key].c_str());
if(blend < 0 || blend > 100) blend = 77;
ostringstream buf;
buf << blend;
myProperties[key] = buf.str();
break;
}
default:
break;
}
@ -282,6 +293,7 @@ const char* Properties::ourDefaultProperties[LastPropType] = {
"34", // Display.YStart
"210", // Display.Height
"NO", // Display.Phosphor
"77", // Display.PPBlend
"YES" // Emulation.HmoveBlanks
};
@ -307,5 +319,6 @@ const char* Properties::ourPropertyNames[LastPropType] = {
"Display.YStart",
"Display.Height",
"Display.Phosphor",
"Display.PPBlend",
"Emulation.HmoveBlanks"
};

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Props.hxx,v 1.8 2006-03-19 00:46:04 stephena Exp $
// $Id: Props.hxx,v 1.9 2006-11-04 19:38:24 stephena Exp $
//============================================================================
#ifndef PROPERTIES_HXX
@ -42,6 +42,7 @@ enum PropertyType {
Display_YStart,
Display_Height,
Display_Phosphor,
Display_PPBlend,
Emulation_HmoveBlanks,
LastPropType
};
@ -55,7 +56,7 @@ enum PropertyType {
if the property key is not found in the original property list.
@author Bradford W. Mott
@version $Id: Props.hxx,v 1.8 2006-03-19 00:46:04 stephena Exp $
@version $Id: Props.hxx,v 1.9 2006-11-04 19:38:24 stephena Exp $
*/
class Properties
{

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Settings.cxx,v 1.86 2006-10-14 20:08:29 stephena Exp $
// $Id: Settings.cxx,v 1.87 2006-11-04 19:38:24 stephena Exp $
//============================================================================
#include <cassert>
@ -35,7 +35,6 @@ Settings::Settings(OSystem* osystem)
// Add options that are common to all versions of Stella
setInternal("video", "soft");
setInternal("dirtyrects", "true");
setInternal("ppblend", "77");
setInternal("gl_filter", "nearest");
setInternal("gl_aspect", "2.0");
@ -266,10 +265,6 @@ void Settings::validate()
if(s != "standard" && s != "original" && s != "z26")
setInternal("palette", "standard");
i = getInt("ppblend");
if(i < 0) setInternal("ppblend", "0");
if(i > 100) setInternal("ppblend", "100");
s = getString("ssname");
if(s != "romname" && s != "md5sum")
setInternal("ssname", "romname");
@ -308,7 +303,6 @@ void Settings::usage()
<< " standard|\n"
<< " z26>\n"
<< " -framerate <number> Display the given number of frames per second\n"
<< " -ppblend <number> Set blending for phosphor effect, if enabled (0-100)\n"
<< endl
#ifdef SOUND_SUPPORT
<< " -sound <1|0> Enable sound generation\n"
@ -370,6 +364,7 @@ void Settings::usage()
<< " -width <arg> Sets the 'Display.Width' property\n"
<< " -height <arg> Sets the 'Display.Height' property\n"
<< " -pp <arg> Sets the 'Display.Phosphor' property\n"
<< " -ppblend <arg> Sets the 'Display.PPBlend' property\n"
<< " -hmove <arg> Sets the 'Emulation.HmoveBlanks' property\n"
#endif
<< endl;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GameInfoDialog.cxx,v 1.25 2006-05-04 17:45:25 stephena Exp $
// $Id: GameInfoDialog.cxx,v 1.26 2006-11-04 19:38:25 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -243,11 +243,24 @@ GameInfoDialog::GameInfoDialog(
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Use Phosphor:", kTextAlignLeft);
myPhosphor = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, "", 0, 0);
pwidth, lineHeight, "", 0, kPhosphorChanged);
myPhosphor->appendEntry("Yes", 1);
myPhosphor->appendEntry("No", 2);
wid.push_back(myPhosphor);
myPPBlend = new SliderWidget(myTab, font, xpos + lwidth + myPhosphor->getWidth() + 10,
ypos, 30, lineHeight, "Blend: ",
font.getStringWidth("Blend: "),
kPPBlendChanged);
myPPBlend->setMinValue(1); myPPBlend->setMaxValue(100);
wid.push_back(myPPBlend);
myPPBlendLabel = new StaticTextWidget(myTab, font,
xpos + lwidth + myPhosphor->getWidth() + 10 + \
myPPBlend->getWidth() + 4, ypos+1,
15, fontHeight, "", kTextAlignLeft);
myPPBlendLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Use HMBlanks:", kTextAlignLeft);
@ -405,14 +418,24 @@ void GameInfoDialog::loadConfig()
s = myGameProperties->get(Display_Height);
myHeight->setEditString(s);
myPPBlend->setEnabled(false);
myPPBlendLabel->setEnabled(false);
s = myGameProperties->get(Display_Phosphor);
if(s == "YES")
{
myPhosphor->setSelectedTag(1);
myPPBlend->setEnabled(true);
myPPBlendLabel->setEnabled(true);
}
else if(s == "NO")
myPhosphor->setSelectedTag(2);
else
myPhosphor->setSelectedTag(0);
s = myGameProperties->get(Display_PPBlend);
myPPBlend->setValue(atoi(s.c_str()));
myPPBlendLabel->setLabel(s);
s = myGameProperties->get(Emulation_HmoveBlanks);
if(s == "YES")
myHmoveBlanks->setSelectedTag(1);
@ -519,6 +542,9 @@ void GameInfoDialog::saveConfig()
s = (tag == 1) ? "Yes" : "No";
myGameProperties->set(Display_Phosphor, s);
s = myPPBlendLabel->getLabel();
myGameProperties->set(Display_PPBlend, s);
tag = myHmoveBlanks->getSelectedTag();
s = (tag == 1) ? "Yes" : "No";
myGameProperties->set(Emulation_HmoveBlanks, s);
@ -536,6 +562,18 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
close();
break;
case kPhosphorChanged:
{
bool status = myPhosphor->getSelectedTag() == 1 ? true : false;
myPPBlend->setEnabled(status);
myPPBlendLabel->setEnabled(status);
break;
}
case kPPBlendChanged:
myPPBlendLabel->setValue(myPPBlend->getValue());
break;
default:
Dialog::handleCommand(sender, cmd, data, 0);
break;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GameInfoDialog.hxx,v 1.16 2006-03-05 01:18:42 stephena Exp $
// $Id: GameInfoDialog.hxx,v 1.17 2006-11-04 19:38:25 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -29,6 +29,7 @@ class PopUpWidget;
class StaticTextWidget;
class TabWidget;
class Properties;
class SliderWidget;
#include "Array.hxx"
#include "Dialog.hxx"
@ -72,13 +73,15 @@ class GameInfoDialog : public Dialog, public CommandSender
PopUpWidget* myRightController;
// Display properties
PopUpWidget* myFormat;
EditTextWidget* myXStart;
EditTextWidget* myWidth;
EditTextWidget* myYStart;
EditTextWidget* myHeight;
PopUpWidget* myPhosphor;
PopUpWidget* myHmoveBlanks;
PopUpWidget* myFormat;
EditTextWidget* myXStart;
EditTextWidget* myWidth;
EditTextWidget* myYStart;
EditTextWidget* myHeight;
PopUpWidget* myPhosphor;
SliderWidget* myPPBlend;
StaticTextWidget* myPPBlendLabel;
PopUpWidget* myHmoveBlanks;
// Structure used for cartridge and controller types
struct PropType {
@ -86,6 +89,11 @@ class GameInfoDialog : public Dialog, public CommandSender
const char* comparitor;
};
enum {
kPhosphorChanged = 'PPch',
kPPBlendChanged = 'PBch'
};
/** Game properties for currently loaded ROM */
Properties* myGameProperties;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ListWidget.cxx,v 1.43 2006-05-05 18:00:51 stephena Exp $
// $Id: ListWidget.cxx,v 1.44 2006-11-04 19:38:25 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -302,7 +302,7 @@ bool ListWidget::handleKeyUp(int ascii, int keycode, int modifiers)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ListWidget::handleEvent(Event::Type e)
{
if(_editMode)
if(!isEnabled() || _editMode)
return false;
bool handled = true;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: PopUpWidget.cxx,v 1.26 2006-05-05 18:00:51 stephena Exp $
// $Id: PopUpWidget.cxx,v 1.27 2006-11-04 19:38:25 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -440,6 +440,9 @@ void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PopUpWidget::handleEvent(Event::Type e)
{
if(!isEnabled())
return false;
switch(e)
{
case Event::UISelect:

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: VideoDialog.hxx,v 1.12 2006-03-19 20:57:55 stephena Exp $
// $Id: VideoDialog.hxx,v 1.13 2006-11-04 19:38:25 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -33,13 +33,6 @@ class CheckboxWidget;
#include "Dialog.hxx"
#include "bspf.hxx"
enum {
kRendererChanged = 'VDrd',
kAspectRatioChanged = 'VDar',
kFrameRateChanged = 'VDfr',
kZoomChanged = 'VDzm'
};
class VideoDialog : public Dialog
{
public:
@ -62,6 +55,13 @@ class VideoDialog : public Dialog
CheckboxWidget* myUseDeskResCheckbox;
CheckboxWidget* myTiaDefaultsCheckbox;
enum {
kRendererChanged = 'VDrd',
kAspectRatioChanged = 'VDar',
kFrameRateChanged = 'VDfr',
kZoomChanged = 'VDzm'
};
private:
void loadConfig();
void saveConfig();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Widget.cxx,v 1.44 2006-05-04 17:45:25 stephena Exp $
// $Id: Widget.cxx,v 1.45 2006-11-04 19:38:25 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -363,6 +363,9 @@ void ButtonWidget::handleMouseLeft(int button)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ButtonWidget::handleEvent(Event::Type e)
{
if(!isEnabled())
return false;
switch(e)
{
case Event::UISelect:
@ -580,6 +583,9 @@ void SliderWidget::handleMouseUp(int x, int y, int button, int clickCount)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SliderWidget::handleEvent(Event::Type e)
{
if(!isEnabled())
return false;
switch(e)
{
case Event::UILeft:

View File

@ -27,7 +27,8 @@ my %proptype = (
"Display.YStart" => 17,
"Display.Height" => 18,
"Display.Phosphor" => 19,
"Emulation.HmoveBlanks" => 20
"Display.PPBlend" => 20,
"Emulation.HmoveBlanks" => 21
);
my @prop_defaults = (
@ -51,6 +52,7 @@ my @prop_defaults = (
"34",
"210",
"NO",
"77",
"YES"
);

View File

@ -68,7 +68,7 @@ class FrameBufferWinCE : public FrameBuffer
virtual void drawBitmap(uInt32* bitmap, Int32 x, Int32 y, int color, Int32 h = 8);
virtual void translateCoords(Int32* x, Int32* y);
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
virtual void enablePhosphor(bool enable) { return; };
virtual void enablePhosphor(bool enable, int blend) { return; };
virtual uInt32 lineDim();
void wipescreen(void);
virtual void cls() { return; };