The 'video' commandline option now allows to select between different

renderer backends (in SDL).  This allows to select software mode (not
recommended) or Direct3D/OpenGL in Windows.

The app icon is now loaded in Windows.

Cleaned up the VideoDialog UI, removing references to double-buffering
and OpenGL-specific settings.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2867 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-03-07 22:12:39 +00:00
parent 81347af093
commit 9da99f56d2
8 changed files with 173 additions and 295 deletions

View File

@ -81,7 +81,7 @@ FrameBufferSDL2::~FrameBufferSDL2()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferSDL2::queryHardware(uInt32& w, uInt32& h, ResolutionList& res) void FrameBufferSDL2::queryHardware(uInt32& w, uInt32& h, VariantList& renderers)
{ {
// First get the maximum windowed desktop resolution // First get the maximum windowed desktop resolution
SDL_DisplayMode desktop; SDL_DisplayMode desktop;
@ -89,7 +89,15 @@ bool FrameBufferSDL2::queryHardware(uInt32& w, uInt32& h, ResolutionList& res)
w = desktop.w; w = desktop.w;
h = desktop.h; h = desktop.h;
return true; // For now, supported render types are hardcoded; eventually, SDL may
// provide a method to query this
#if defined(BSPF_WINDOWS)
renderers.push_back("Direct3D", "direct3d");
#endif
renderers.push_back("OpenGL", "opengl");
renderers.push_back("OpenGLES2", "opengles2");
renderers.push_back("OpenGLES", "opengles");
renderers.push_back("Software", "software");
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -190,6 +198,10 @@ bool FrameBufferSDL2::setVideoMode(const string& title, VideoMode& mode, bool fu
Uint32 renderFlags = SDL_RENDERER_ACCELERATED; Uint32 renderFlags = SDL_RENDERER_ACCELERATED;
if(myOSystem->settings().getBool("vsync")) if(myOSystem->settings().getBool("vsync"))
renderFlags |= SDL_RENDERER_PRESENTVSYNC; renderFlags |= SDL_RENDERER_PRESENTVSYNC;
// Render hint
const string& video = myOSystem->settings().getString("video");
if(video != "")
SDL_SetHint(SDL_HINT_RENDER_DRIVER, video.c_str());
myRenderer = SDL_CreateRenderer(myWindow, -1, renderFlags); myRenderer = SDL_CreateRenderer(myWindow, -1, renderFlags);
if(myWindow == NULL) if(myWindow == NULL)
{ {
@ -197,6 +209,9 @@ bool FrameBufferSDL2::setVideoMode(const string& title, VideoMode& mode, bool fu
myOSystem->logMessage(msg, 0); myOSystem->logMessage(msg, 0);
return false; return false;
} }
SDL_RendererInfo renderinfo;
if(SDL_GetRendererInfo(myRenderer, &renderinfo) >= 0)
myOSystem->settings().setValue("video", renderinfo.name);
// The framebuffer only takes responsibility for TIA surfaces // The framebuffer only takes responsibility for TIA surfaces
// Other surfaces (such as the ones used for dialogs) are allocated // Other surfaces (such as the ones used for dialogs) are allocated
@ -283,14 +298,12 @@ return false;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL2::setWindowIcon() void FrameBufferSDL2::setWindowIcon()
{ {
#if 0 //FIXSDL
#if !defined(BSPF_MAC_OSX) && !defined(BSPF_UNIX) #if !defined(BSPF_MAC_OSX) && !defined(BSPF_UNIX)
#include "stella.xpm" // The Stella icon #include "stella.xpm" // The Stella icon
// Set the window icon // Set the window icon
uInt32 w, h, ncols, nbytes; uInt32 w, h, ncols, nbytes;
uInt32 rgba[256], icon[32 * 32]; uInt32 rgba[256], icon[32 * 32];
uInt8 mask[32][4];
sscanf(stella_icon[0], "%u %u %u %u", &w, &h, &ncols, &nbytes); sscanf(stella_icon[0], "%u %u %u %u", &w, &h, &ncols, &nbytes);
if((w != 32) || (h != 32) || (ncols > 255) || (nbytes > 1)) if((w != 32) || (h != 32) || (ncols > 255) || (nbytes > 1))
@ -323,24 +336,11 @@ void FrameBufferSDL2::setWindowIcon()
rgba[code] = col; rgba[code] = col;
} }
memset(mask, 0, sizeof(mask));
for(h = 0; h < 32; h++)
{
const char* line = stella_icon[1 + ncols + h];
for(w = 0; w < 32; w++)
{
icon[w + 32 * h] = rgba[(int)line[w]];
if(rgba[(int)line[w]] & 0xFF000000)
mask[h][w >> 3] |= 1 << (7 - (w & 0x07));
}
}
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(icon, 32, 32, 32, SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(icon, 32, 32, 32,
32 * 4, 0xFF0000, 0x00FF00, 0x0000FF, 0xFF000000); 32 * 4, 0xFF0000, 0x00FF00, 0x0000FF, 0xFF000000);
SDL_WM_SetIcon(surface, (unsigned char *) mask); SDL_SetWindowIcon(myWindow, surface);
SDL_FreeSurface(surface); SDL_FreeSurface(surface);
#endif #endif
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -137,10 +137,8 @@ class FrameBufferSDL2 : public FrameBuffer
/** /**
This method is called to query and initialize the video hardware This method is called to query and initialize the video hardware
for desktop and fullscreen resolution information. for desktop and fullscreen resolution information.
@return False on any errors, else true
*/ */
bool queryHardware(uInt32& w, uInt32& h, ResolutionList& res); void queryHardware(uInt32& w, uInt32& h, VariantList& renderers);
/** /**
This method is called to change to the given video mode. If the mode This method is called to change to the given video mode. If the mode

View File

@ -22,7 +22,7 @@
#include <cstdlib> #include <cstdlib>
#define STELLA_VERSION "3.9.101_svn" #define STELLA_VERSION "3.9.102_svn"
#define STELLA_BUILD atoi("$Rev$" + 6) #define STELLA_BUILD atoi("$Rev$" + 6)
#endif #endif

View File

@ -78,9 +78,8 @@ FrameBuffer::~FrameBuffer(void)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBuffer::initialize() bool FrameBuffer::initialize()
{ {
// Get desktop resolution information // Get desktop resolution and supported renderers
if(!queryHardware(myDesktopWidth, myDesktopHeight, myResolutions)) queryHardware(myDesktopWidth, myDesktopHeight, myRenderers);
return false;
// Check the 'maxres' setting, which is an undocumented developer feature // Check the 'maxres' setting, which is an undocumented developer feature
// that specifies the desktop size (not normally set) // that specifies the desktop size (not normally set)
@ -241,10 +240,10 @@ FBInitStatus FrameBuffer::createDisplay(const string& title,
// Take care of some items that are only done once per framebuffer creation. // Take care of some items that are only done once per framebuffer creation.
if(myInitializedCount == 1) if(myInitializedCount == 1)
{ {
myOSystem->logMessage(about(), 1);
setUIPalette(); setUIPalette();
setWindowIcon(); setWindowIcon();
} }
myOSystem->logMessage(about(), 1);
return kSuccess; return kSuccess;
} }
@ -873,11 +872,10 @@ uInt8 FrameBuffer::getPhosphor(uInt8 c1, uInt8 c2) const
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const VariantList& FrameBuffer::supportedTIAFilters(const string& type) const VariantList& FrameBuffer::supportedTIAFilters()
{ {
uInt32 max_zoom = maxWindowSizeForScreen(320, 210, uInt32 max_zoom = maxWindowSizeForScreen(320, 210,
myOSystem->desktopWidth(), myOSystem->desktopHeight()); myOSystem->desktopWidth(), myOSystem->desktopHeight());
uInt8 mask = (type == "soft" ? 0x1 : 0x2);
uInt32 firstmode = 1; uInt32 firstmode = 1;
if(myOSystem->desktopWidth() < 640 || myOSystem->desktopHeight() < 480) if(myOSystem->desktopWidth() < 640 || myOSystem->desktopHeight() < 480)
@ -886,9 +884,7 @@ const VariantList& FrameBuffer::supportedTIAFilters(const string& type)
myTIAFilters.clear(); myTIAFilters.clear();
for(uInt32 i = firstmode; i < GFX_NumModes; ++i) for(uInt32 i = firstmode; i < GFX_NumModes; ++i)
{ {
// For now, just include all filters if(ourGraphicsModes[i].zoom <= max_zoom)
// This will change once OpenGL-only filters are added
if((ourGraphicsModes[i].avail & mask) && ourGraphicsModes[i].zoom <= max_zoom)
{ {
myTIAFilters.push_back(ourGraphicsModes[i].description, myTIAFilters.push_back(ourGraphicsModes[i].description,
ourGraphicsModes[i].name); ourGraphicsModes[i].name);
@ -985,6 +981,7 @@ void FrameBuffer::addVidMode(VideoMode& mode)
mode.image_y = (mode.screen_h - mode.image_h) >> 1; mode.image_y = (mode.screen_h - mode.image_h) >> 1;
myWindowedModeList.add(mode); myWindowedModeList.add(mode);
#if 0 //FIXSDL
// There are often stricter requirements on fullscreen modes, and they're // There are often stricter requirements on fullscreen modes, and they're
// normally different depending on the OSystem in use // normally different depending on the OSystem in use
// As well, we usually can't get fullscreen modes in the exact size // As well, we usually can't get fullscreen modes in the exact size
@ -1003,6 +1000,7 @@ void FrameBuffer::addVidMode(VideoMode& mode)
break; break;
} }
} }
#endif
myFullscreenModeList.add(mode); myFullscreenModeList.add(mode);
} }
@ -1351,16 +1349,16 @@ void FBSurface::drawString(const GUI::Font& font, const string& s,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBuffer::GraphicsMode FrameBuffer::ourGraphicsModes[GFX_NumModes] = { FrameBuffer::GraphicsMode FrameBuffer::ourGraphicsModes[GFX_NumModes] = {
{ GFX_Zoom1x, "zoom1x", "Zoom 1x", 1, 0x3 }, { GFX_Zoom1x, "zoom1x", "Zoom 1x", 1 },
{ GFX_Zoom2x, "zoom2x", "Zoom 2x", 2, 0x3 }, { GFX_Zoom2x, "zoom2x", "Zoom 2x", 2 },
{ GFX_Zoom3x, "zoom3x", "Zoom 3x", 3, 0x3 }, { GFX_Zoom3x, "zoom3x", "Zoom 3x", 3 },
{ GFX_Zoom4x, "zoom4x", "Zoom 4x", 4, 0x3 }, { GFX_Zoom4x, "zoom4x", "Zoom 4x", 4 },
{ GFX_Zoom5x, "zoom5x", "Zoom 5x", 5, 0x3 }, { GFX_Zoom5x, "zoom5x", "Zoom 5x", 5 },
{ GFX_Zoom6x, "zoom6x", "Zoom 6x", 6, 0x3 }, { GFX_Zoom6x, "zoom6x", "Zoom 6x", 6 },
{ GFX_Zoom7x, "zoom7x", "Zoom 7x", 7, 0x3 }, { GFX_Zoom7x, "zoom7x", "Zoom 7x", 7 },
{ GFX_Zoom8x, "zoom8x", "Zoom 8x", 8, 0x3 }, { GFX_Zoom8x, "zoom8x", "Zoom 8x", 8 },
{ GFX_Zoom9x, "zoom9x", "Zoom 9x", 9, 0x3 }, { GFX_Zoom9x, "zoom9x", "Zoom 9x", 9 },
{ GFX_Zoom10x, "zoom10x", "Zoom 10x", 10, 0x3 } { GFX_Zoom10x, "zoom10x", "Zoom 10x", 10 }
}; };
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -98,14 +98,6 @@ enum {
kNumColors kNumColors
}; };
// Fullscreen resolutions supported by the underlying hardware
struct Resolution {
uInt32 width;
uInt32 height;
string name;
};
typedef Common::Array<Resolution> ResolutionList;
/** /**
This class encapsulates all video buffers and is the basis for the video This class encapsulates all video buffers and is the basis for the video
@ -222,11 +214,11 @@ class FrameBuffer
uInt32 desktopHeight() const { return myDesktopHeight; } uInt32 desktopHeight() const { return myDesktopHeight; }
/** /**
Get the supported fullscreen resolutions for the video hardware. Get the supported renderers for the video hardware.
@return An array of supported resolutions @return An array of supported renderers
*/ */
const ResolutionList& supportedResolutions() const { return myResolutions; } const VariantList& supportedRenderers() const { return myRenderers; }
/** /**
Get the font object(s) of the framebuffer Get the font object(s) of the framebuffer
@ -280,9 +272,9 @@ class FrameBuffer
void toggleGrabMouse(); void toggleGrabMouse();
/** /**
Get the supported TIA filters for the given framebuffer type. Get the supported TIA filters for the framebuffer.
*/ */
const VariantList& supportedTIAFilters(const string& type); const VariantList& supportedTIAFilters();
/** /**
Get the TIA pixel associated with the given TIA buffer index, Get the TIA pixel associated with the given TIA buffer index,
@ -415,7 +407,6 @@ class FrameBuffer
const char* name; const char* name;
const char* description; const char* description;
uInt32 zoom; uInt32 zoom;
uInt8 avail; // 0x1 bit -> software, 0x2 bit -> opengl
}; };
// Contains all relevant info for the dimensions of a video screen // Contains all relevant info for the dimensions of a video screen
@ -442,10 +433,8 @@ class FrameBuffer
/** /**
This method is called to query and initialize the video hardware This method is called to query and initialize the video hardware
for desktop and fullscreen resolution information. for desktop and fullscreen resolution information.
@return False on any errors, else true
*/ */
virtual bool queryHardware(uInt32& w, uInt32& h, ResolutionList& res) = 0; virtual void queryHardware(uInt32& w, uInt32& h, VariantList& ren) = 0;
/** /**
This method is called to change to the given video mode. If the mode This method is called to change to the given video mode. If the mode
@ -630,8 +619,8 @@ class FrameBuffer
// Maximum dimensions of the desktop area // Maximum dimensions of the desktop area
uInt32 myDesktopWidth, myDesktopHeight; uInt32 myDesktopWidth, myDesktopHeight;
// Supported fullscreen resolutions // Supported renderers
ResolutionList myResolutions; VariantList myRenderers;
// The font object to use for the normal in-game GUI // The font object to use for the normal in-game GUI
GUI::Font* myFont; GUI::Font* myFont;

View File

@ -47,10 +47,10 @@ class PopUpWidget : public Widget, public CommandSender
~PopUpWidget(); ~PopUpWidget();
/** Add the given items to the widget. */ /** Add the given items to the widget. */
void addItems(const VariantList& items) { myMenu->addItems(items); }
/** Various selection methods passed directly to the underlying menu /** Various selection methods passed directly to the underlying menu
See ContextMenu.hxx for more information. */ See ContextMenu.hxx for more information. */
void addItems(const VariantList& items) { myMenu->addItems(items); }
void setSelected(const Variant& tag, void setSelected(const Variant& tag,
const Variant& def = EmptyVariant) const Variant& def = EmptyVariant)
{ myMenu->setSelected(tag, def); } { myMenu->setSelected(tag, def); }

View File

@ -48,9 +48,8 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
buttonWidth = font.getStringWidth("Defaults") + 20, buttonWidth = font.getStringWidth("Defaults") + 20,
buttonHeight = font.getLineHeight() + 4; buttonHeight = font.getLineHeight() + 4;
int xpos, ypos, tabID; int xpos, ypos, tabID;
int lwidth = font.getStringWidth("GL Aspect (P): "), int lwidth = font.getStringWidth("NTSC Aspect: "),
pwidth = font.getStringWidth("1920x1200"), pwidth = font.getStringWidth("XXXXxXXXX");
fwidth = font.getStringWidth("Renderer: ");
WidgetArray wid; WidgetArray wid;
VariantList items; VariantList items;
@ -69,27 +68,17 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
tabID = myTab->addTab(" General "); tabID = myTab->addTab(" General ");
// Video renderer // Video renderer
new StaticTextWidget(myTab, font, xpos + (lwidth-fwidth), ypos, fwidth, myRenderer = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
fontHeight, "Renderer:", kTextAlignLeft); instance().frameBuffer().supportedRenderers(),
myRenderer = new StaticTextWidget(myTab, font, xpos+lwidth, ypos, "Renderer: ", lwidth);
fwidth, fontHeight, "", kTextAlignLeft); wid.push_back(myRenderer);
ypos += lineHeight + 4;
items.clear();
items.push_back("Software", "soft");
//FIXSDL
items.push_back("OpenGL", "gl");
/////////////
myRendererPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
items, "(*) ", lwidth);
wid.push_back(myRendererPopup);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// TIA filters (will be dynamically filled later) // TIA filters (will be dynamically filled later)
items.clear(); items.clear();
myTIAFilterPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, myTIAFilter = new PopUpWidget(myTab, font, xpos, ypos, pwidth,
lineHeight, items, "TIA Filter: ", lwidth); lineHeight, items, "TIA Filter: ", lwidth);
wid.push_back(myTIAFilterPopup); wid.push_back(myTIAFilter);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// TIA Palette // TIA Palette
@ -97,72 +86,62 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
items.push_back("Standard", "standard"); items.push_back("Standard", "standard");
items.push_back("Z26", "z26"); items.push_back("Z26", "z26");
items.push_back("User", "user"); items.push_back("User", "user");
myTIAPalettePopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, myTIAPalette = new PopUpWidget(myTab, font, xpos, ypos, pwidth,
lineHeight, items, "TIA Palette: ", lwidth); lineHeight, items, "TIA Palette: ", lwidth);
wid.push_back(myTIAPalettePopup); wid.push_back(myTIAPalette);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// Fullscreen resolution // TIA interpolation
items.clear(); items.clear();
items.push_back("Auto", "auto"); items.push_back("Linear", "linear");
for(uInt32 i = 0; i < instance().frameBuffer().supportedResolutions().size(); ++i) items.push_back("Nearest", "nearest");
items.push_back(instance().frameBuffer().supportedResolutions()[i].name); myTIAInterpolate = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
myFSResPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, items, "TIA Inter: ", lwidth);
lineHeight, items, "Fullscrn Res: ", lwidth); wid.push_back(myTIAInterpolate);
wid.push_back(myFSResPopup);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// Timing to use between frames // Timing to use between frames
items.clear(); items.clear();
items.push_back("Sleep", "sleep"); items.push_back("Sleep", "sleep");
items.push_back("Busy-wait", "busy"); items.push_back("Busy-wait", "busy");
myFrameTimingPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, myFrameTiming = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
items, "Timing (*): ", lwidth); items, "Timing (*): ", lwidth);
wid.push_back(myFrameTimingPopup); wid.push_back(myFrameTiming);
ypos += lineHeight + 4;
// GL Video filter
items.clear();
items.push_back("Linear", "linear");
items.push_back("Nearest", "nearest");
myGLFilterPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
items, "GL Filter: ", lwidth);
wid.push_back(myGLFilterPopup);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// GL aspect ratio (NTSC mode) // GL aspect ratio (NTSC mode)
myNAspectRatioSlider = myNAspectRatio =
new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight, new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"GL Aspect (N): ", lwidth, kNAspectRatioChanged); "NTSC Aspect: ", lwidth, kNAspectRatioChanged);
myNAspectRatioSlider->setMinValue(80); myNAspectRatioSlider->setMaxValue(120); myNAspectRatio->setMinValue(80); myNAspectRatio->setMaxValue(120);
wid.push_back(myNAspectRatioSlider); wid.push_back(myNAspectRatio);
myNAspectRatioLabel = myNAspectRatioLabel =
new StaticTextWidget(myTab, font, xpos + myNAspectRatioSlider->getWidth() + 4, new StaticTextWidget(myTab, font, xpos + myNAspectRatio->getWidth() + 4,
ypos + 1, fontWidth * 3, fontHeight, "", kTextAlignLeft); ypos + 1, fontWidth * 3, fontHeight, "", kTextAlignLeft);
myNAspectRatioLabel->setFlags(WIDGET_CLEARBG); myNAspectRatioLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// GL aspect ratio (PAL mode) // GL aspect ratio (PAL mode)
myPAspectRatioSlider = myPAspectRatio =
new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight, new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"GL Aspect (P): ", lwidth, kPAspectRatioChanged); "PAL Aspect: ", lwidth, kPAspectRatioChanged);
myPAspectRatioSlider->setMinValue(80); myPAspectRatioSlider->setMaxValue(120); myPAspectRatio->setMinValue(80); myPAspectRatio->setMaxValue(120);
wid.push_back(myPAspectRatioSlider); wid.push_back(myPAspectRatio);
myPAspectRatioLabel = myPAspectRatioLabel =
new StaticTextWidget(myTab, font, xpos + myPAspectRatioSlider->getWidth() + 4, new StaticTextWidget(myTab, font, xpos + myPAspectRatio->getWidth() + 4,
ypos + 1, fontWidth * 3, fontHeight, "", kTextAlignLeft); ypos + 1, fontWidth * 3, fontHeight, "", kTextAlignLeft);
myPAspectRatioLabel->setFlags(WIDGET_CLEARBG); myPAspectRatioLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// Framerate // Framerate
myFrameRateSlider = myFrameRate =
new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight, new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Framerate: ", lwidth, kFrameRateChanged); "Framerate: ", lwidth, kFrameRateChanged);
myFrameRateSlider->setMinValue(0); myFrameRateSlider->setMaxValue(300); myFrameRate->setMinValue(0); myFrameRate->setMaxValue(300);
myFrameRateSlider->setStepValue(10); myFrameRate->setStepValue(10);
wid.push_back(myFrameRateSlider); wid.push_back(myFrameRate);
myFrameRateLabel = myFrameRateLabel =
new StaticTextWidget(myTab, font, xpos + myFrameRateSlider->getWidth() + 4, new StaticTextWidget(myTab, font, xpos + myFrameRate->getWidth() + 4,
ypos + 1, fontWidth * 4, fontHeight, "", kTextAlignLeft); ypos + 1, fontWidth * 4, fontHeight, "", kTextAlignLeft);
myFrameRateLabel->setFlags(WIDGET_CLEARBG); myFrameRateLabel->setFlags(WIDGET_CLEARBG);
@ -174,7 +153,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
"(*) Requires application restart", kTextAlignLeft); "(*) Requires application restart", kTextAlignLeft);
// Move over to the next column // Move over to the next column
xpos += myNAspectRatioSlider->getWidth() + myNAspectRatioLabel->getWidth() + 14; xpos += myNAspectRatio->getWidth() + myNAspectRatioLabel->getWidth() + 30;
ypos = 10; ypos = 10;
// Fullscreen // Fullscreen
@ -184,49 +163,43 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
items.push_back("Never", "-1"); items.push_back("Never", "-1");
lwidth = font.getStringWidth("Fullscreen: "); lwidth = font.getStringWidth("Fullscreen: ");
pwidth = font.getStringWidth("Never"), pwidth = font.getStringWidth("Never"),
myFullscreenPopup = myFullscreen =
new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
items, "Fullscreen: ", lwidth, kFullScrChanged); items, "Fullscreen: ", lwidth, kFullScrChanged);
wid.push_back(myFullscreenPopup); wid.push_back(myFullscreen);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// GL FS stretch // GL FS stretch
myGLStretchCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, myGLStretch = new CheckboxWidget(myTab, font, xpos, ypos, "GL FS Stretch");
"GL FS Stretch"); wid.push_back(myGLStretch);
wid.push_back(myGLStretchCheckbox);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// Use sync to vblank in OpenGL // Use sync to vblank in OpenGL
myUseVSyncCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, myUseVSync = new CheckboxWidget(myTab, font, xpos, ypos, "VSync");
"GL VSync"); wid.push_back(myUseVSync);
wid.push_back(myUseVSyncCheckbox);
ypos += lineHeight + 4; ypos += lineHeight + 4;
ypos += lineHeight; ypos += lineHeight;
// PAL color-loss effect // PAL color-loss effect
myColorLossCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, myColorLoss = new CheckboxWidget(myTab, font, xpos, ypos, "PAL color-loss");
"PAL color-loss"); wid.push_back(myColorLoss);
wid.push_back(myColorLossCheckbox);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// Skip progress load bars for SuperCharger ROMs // Skip progress load bars for SuperCharger ROMs
// Doesn't really belong here, but I couldn't find a better place for it // Doesn't really belong here, but I couldn't find a better place for it
myFastSCBiosCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, myFastSCBios = new CheckboxWidget(myTab, font, xpos, ypos, "Fast SC/AR BIOS");
"Fast SC/AR BIOS"); wid.push_back(myFastSCBios);
wid.push_back(myFastSCBiosCheckbox);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// Show UI messages onscreen // Show UI messages onscreen
myUIMessagesCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, myUIMessages = new CheckboxWidget(myTab, font, xpos, ypos, "Show UI messages");
"Show UI messages"); wid.push_back(myUIMessages);
wid.push_back(myUIMessagesCheckbox);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// Center window (in windowed mode) // Center window (in windowed mode)
myCenterCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, myCenter = new CheckboxWidget(myTab, font, xpos, ypos, "Center window");
"Center window"); wid.push_back(myCenter);
wid.push_back(myCenterCheckbox);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// Add items for tab 0 // Add items for tab 0
@ -335,54 +308,9 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
addBGroupToFocusList(wid); addBGroupToFocusList(wid);
// Disable certain functions when we know they aren't present // Disable certain functions when we know they aren't present
//FIXSDL
myGLFilterPopup->clearFlags(WIDGET_ENABLED);
myNAspectRatioSlider->clearFlags(WIDGET_ENABLED);
myNAspectRatioLabel->clearFlags(WIDGET_ENABLED);
myPAspectRatioSlider->clearFlags(WIDGET_ENABLED);
myPAspectRatioLabel->clearFlags(WIDGET_ENABLED);
myGLStretchCheckbox->clearFlags(WIDGET_ENABLED);
myUseVSyncCheckbox->clearFlags(WIDGET_ENABLED);
myTVMode->clearFlags(WIDGET_ENABLED);
myTVSharp->clearFlags(WIDGET_ENABLED);
myTVSharpLabel->clearFlags(WIDGET_ENABLED);
myTVHue->clearFlags(WIDGET_ENABLED);
myTVHueLabel->clearFlags(WIDGET_ENABLED);
myTVRes->clearFlags(WIDGET_ENABLED);
myTVResLabel->clearFlags(WIDGET_ENABLED);
myTVArtifacts->clearFlags(WIDGET_ENABLED);
myTVArtifactsLabel->clearFlags(WIDGET_ENABLED);
myTVFringe->clearFlags(WIDGET_ENABLED);
myTVFringeLabel->clearFlags(WIDGET_ENABLED);
myTVBleed->clearFlags(WIDGET_ENABLED);
myTVBleedLabel->clearFlags(WIDGET_ENABLED);
myTVBright->clearFlags(WIDGET_ENABLED);
myTVBrightLabel->clearFlags(WIDGET_ENABLED);
myTVContrast->clearFlags(WIDGET_ENABLED);
myTVContrastLabel->clearFlags(WIDGET_ENABLED);
myTVSatur->clearFlags(WIDGET_ENABLED);
myTVSaturLabel->clearFlags(WIDGET_ENABLED);
myTVGamma->clearFlags(WIDGET_ENABLED);
myTVGammaLabel->clearFlags(WIDGET_ENABLED);
myTVScanLabel->clearFlags(WIDGET_ENABLED);
myTVScanIntense->clearFlags(WIDGET_ENABLED);
myTVScanIntenseLabel->clearFlags(WIDGET_ENABLED);
myTVScanInterpolate->clearFlags(WIDGET_ENABLED);
myCloneComposite->clearFlags(WIDGET_ENABLED);
myCloneSvideo->clearFlags(WIDGET_ENABLED);
myCloneRGB->clearFlags(WIDGET_ENABLED);
myCloneBad->clearFlags(WIDGET_ENABLED);
myCloneCustom->clearFlags(WIDGET_ENABLED);
//////////////////////////
#ifndef WINDOWED_SUPPORT #ifndef WINDOWED_SUPPORT
myFullscreenCheckbox->clearFlags(WIDGET_ENABLED); myFullscreenCheckbox->clearFlags(WIDGET_ENABLED);
myCenterCheckbox->clearFlags(WIDGET_ENABLED); myCenter->clearFlags(WIDGET_ENABLED);
#endif
#if !(defined(BSPF_WINDOWS) || defined(BSPF_UNIX))
myCenterCheckbox->clearFlags(WIDGET_ENABLED);
#endif #endif
} }
@ -394,80 +322,64 @@ VideoDialog::~VideoDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::loadConfig() void VideoDialog::loadConfig()
{ {
bool gl = (instance().frameBuffer().type() == kDoubleBuffer);
// Renderer settings // Renderer settings
myRenderer->setLabel(gl ? "OpenGL" : "Software"); myRenderer->setSelected(instance().settings().getString("video"), "default");
myRendererPopup->setSelected(
instance().settings().getString("video"), "soft");
// TIA Filter // TIA Filter
// These are dynamically loaded, since they depend on the size of // These are dynamically loaded, since they depend on the size of
// the desktop and which renderer we're using // the desktop and which renderer we're using
const VariantList& items = const VariantList& items = instance().frameBuffer().supportedTIAFilters();
instance().frameBuffer().supportedTIAFilters(gl ? "gl" : "soft"); myTIAFilter->addItems(items);
myTIAFilterPopup->addItems(items); myTIAFilter->setSelected(instance().settings().getString("tia.filter"),
myTIAFilterPopup->setSelected(instance().settings().getString("tia.filter"),
instance().desktopWidth() < 640 ? "zoom1x" : "zoom2x"); instance().desktopWidth() < 640 ? "zoom1x" : "zoom2x");
// TIA Palette // TIA Palette
myTIAPalettePopup->setSelected( myTIAPalette->setSelected(
instance().settings().getString("palette"), "standard"); instance().settings().getString("palette"), "standard");
// Fullscreen resolution // TIA interpolation
myFSResPopup->setSelected(
instance().settings().getString("fullres"), "auto");
// Wait between frames
myFrameTimingPopup->setSelected(
instance().settings().getString("timing"), "sleep");
// GL Filter setting
const string& tia_inter = instance().settings().getBool("tia.inter") ? const string& tia_inter = instance().settings().getBool("tia.inter") ?
"linear" : "nearest"; "linear" : "nearest";
myGLFilterPopup->setSelected(tia_inter, "nearest"); myTIAInterpolate->setSelected(tia_inter, "nearest");
myGLFilterPopup->setEnabled(gl);
// GL aspect ratio setting (NTSC and PAL) // Wait between frames
myNAspectRatioSlider->setValue(instance().settings().getInt("tia.aspectn")); myFrameTiming->setSelected(
myNAspectRatioSlider->setEnabled(gl); instance().settings().getString("timing"), "sleep");
// Aspect ratio setting (NTSC and PAL)
myNAspectRatio->setValue(instance().settings().getInt("tia.aspectn"));
myNAspectRatioLabel->setLabel(instance().settings().getString("tia.aspectn")); myNAspectRatioLabel->setLabel(instance().settings().getString("tia.aspectn"));
myNAspectRatioLabel->setEnabled(gl); myPAspectRatio->setValue(instance().settings().getInt("tia.aspectp"));
myPAspectRatioSlider->setValue(instance().settings().getInt("tia.aspectp"));
myPAspectRatioSlider->setEnabled(gl);
myPAspectRatioLabel->setLabel(instance().settings().getString("tia.aspectp")); myPAspectRatioLabel->setLabel(instance().settings().getString("tia.aspectp"));
myPAspectRatioLabel->setEnabled(gl);
// Framerate (0 or -1 means automatic framerate calculation) // Framerate (0 or -1 means automatic framerate calculation)
int rate = instance().settings().getInt("framerate"); int rate = instance().settings().getInt("framerate");
myFrameRateSlider->setValue(rate < 0 ? 0 : rate); myFrameRate->setValue(rate < 0 ? 0 : rate);
myFrameRateLabel->setLabel(rate <= 0 ? "Auto" : myFrameRateLabel->setLabel(rate <= 0 ? "Auto" :
instance().settings().getString("framerate")); instance().settings().getString("framerate"));
// Fullscreen // Fullscreen
const string& fullscreen = instance().settings().getString("fullscreen"); const string& fullscreen = instance().settings().getString("fullscreen");
myFullscreenPopup->setSelected(fullscreen, "0"); myFullscreen->setSelected(fullscreen, "0");
handleFullscreenChange(fullscreen == "0" || fullscreen == "1"); handleFullscreenChange(fullscreen == "0" || fullscreen == "1");
// PAL color-loss effect // PAL color-loss effect
myColorLossCheckbox->setState(instance().settings().getBool("colorloss")); myColorLoss->setState(instance().settings().getBool("colorloss"));
// GL stretch setting (GL mode only) // GL stretch setting (GL mode only)
myGLStretchCheckbox->setState(instance().settings().getBool("gl_fsscale")); myGLStretch->setState(instance().settings().getBool("gl_fsscale"));
myGLStretchCheckbox->setEnabled(gl);
// Use sync to vertical blank (GL mode only) // Use sync to vertical blank
myUseVSyncCheckbox->setState(instance().settings().getBool("vsync")); myUseVSync->setState(instance().settings().getBool("vsync"));
myUseVSyncCheckbox->setEnabled(gl);
// Show UI messages // Show UI messages
myUIMessagesCheckbox->setState(instance().settings().getBool("uimessages")); myUIMessages->setState(instance().settings().getBool("uimessages"));
// Center window // Center window
myCenterCheckbox->setState(instance().settings().getBool("center")); myCenter->setState(instance().settings().getBool("center"));
// Fast loading of Supercharger BIOS // Fast loading of Supercharger BIOS
myFastSCBiosCheckbox->setState(instance().settings().getBool("fastscbios")); myFastSCBios->setState(instance().settings().getBool("fastscbios"));
// TV Mode // TV Mode
myTVMode->setSelected( myTVMode->setSelected(
@ -491,34 +403,30 @@ void VideoDialog::saveConfig()
{ {
// Renderer setting // Renderer setting
instance().settings().setValue("video", instance().settings().setValue("video",
myRendererPopup->getSelectedTag().toString()); myRenderer->getSelectedTag().toString());
// TIA Filter // TIA Filter
instance().settings().setValue("tia.filter", instance().settings().setValue("tia.filter",
myTIAFilterPopup->getSelectedTag().toString()); myTIAFilter->getSelectedTag().toString());
// TIA Palette // TIA Palette
instance().settings().setValue("palette", instance().settings().setValue("palette",
myTIAPalettePopup->getSelectedTag().toString()); myTIAPalette->getSelectedTag().toString());
// Fullscreen resolution
instance().settings().setValue("fullres",
myFSResPopup->getSelectedTag().toString());
// Wait between frames // Wait between frames
instance().settings().setValue("timing", instance().settings().setValue("timing",
myFrameTimingPopup->getSelectedTag().toString()); myFrameTiming->getSelectedTag().toString());
// GL Filter setting // GL Filter setting
instance().settings().setValue("tia.inter", instance().settings().setValue("tia.inter",
myGLFilterPopup->getSelectedTag().toString() == "linear" ? true : false); myTIAInterpolate->getSelectedTag().toString() == "linear" ? true : false);
// GL aspect ratio setting (NTSC and PAL) // GL aspect ratio setting (NTSC and PAL)
instance().settings().setValue("tia.aspectn", myNAspectRatioLabel->getLabel()); instance().settings().setValue("tia.aspectn", myNAspectRatioLabel->getLabel());
instance().settings().setValue("tia.aspectp", myPAspectRatioLabel->getLabel()); instance().settings().setValue("tia.aspectp", myPAspectRatioLabel->getLabel());
// Framerate // Framerate
int i = myFrameRateSlider->getValue(); int i = myFrameRate->getValue();
instance().settings().setValue("framerate", i); instance().settings().setValue("framerate", i);
if(&instance().console()) if(&instance().console())
{ {
@ -529,27 +437,27 @@ void VideoDialog::saveConfig()
// Fullscreen // Fullscreen
instance().settings().setValue("fullscreen", instance().settings().setValue("fullscreen",
myFullscreenPopup->getSelectedTag().toString()); myFullscreen->getSelectedTag().toString());
// PAL color-loss effect // PAL color-loss effect
instance().settings().setValue("colorloss", myColorLossCheckbox->getState()); instance().settings().setValue("colorloss", myColorLoss->getState());
if(&instance().console()) if(&instance().console())
instance().console().toggleColorLoss(myColorLossCheckbox->getState()); instance().console().toggleColorLoss(myColorLoss->getState());
// GL stretch setting // GL stretch setting
instance().settings().setValue("gl_fsscale", myGLStretchCheckbox->getState()); instance().settings().setValue("gl_fsscale", myGLStretch->getState());
// Use sync to vertical blank (GL mode only) // Use sync to vertical blank (GL mode only)
instance().settings().setValue("vsync", myUseVSyncCheckbox->getState()); instance().settings().setValue("vsync", myUseVSync->getState());
// Show UI messages // Show UI messages
instance().settings().setValue("uimessages", myUIMessagesCheckbox->getState()); instance().settings().setValue("uimessages", myUIMessages->getState());
// Center window // Center window
instance().settings().setValue("center", myCenterCheckbox->getState()); instance().settings().setValue("center", myCenter->getState());
// Fast loading of Supercharger BIOS // Fast loading of Supercharger BIOS
instance().settings().setValue("fastscbios", myFastSCBiosCheckbox->getState()); instance().settings().setValue("fastscbios", myFastSCBios->getState());
// TV Mode // TV Mode
instance().settings().setValue("tv.filter", instance().settings().setValue("tv.filter",
@ -584,27 +492,26 @@ void VideoDialog::setDefaults()
{ {
case 0: // General case 0: // General
{ {
myRendererPopup->setSelected("soft", ""); myRenderer->setSelected("soft", "");
myTIAFilterPopup->setSelected( myTIAFilter->setSelected(
instance().desktopWidth() < 640 ? "zoom1x" : "zoom2x", ""); instance().desktopWidth() < 640 ? "zoom1x" : "zoom2x", "");
myTIAPalettePopup->setSelected("standard", ""); myTIAPalette->setSelected("standard", "");
myFSResPopup->setSelected("auto", ""); myFrameTiming->setSelected("sleep", "");
myFrameTimingPopup->setSelected("sleep", ""); myTIAInterpolate->setSelected("nearest", "");
myGLFilterPopup->setSelected("nearest", ""); myNAspectRatio->setValue(90);
myNAspectRatioSlider->setValue(90);
myNAspectRatioLabel->setLabel("90"); myNAspectRatioLabel->setLabel("90");
myPAspectRatioSlider->setValue(100); myPAspectRatio->setValue(100);
myPAspectRatioLabel->setLabel("100"); myPAspectRatioLabel->setLabel("100");
myFrameRateSlider->setValue(0); myFrameRate->setValue(0);
myFrameRateLabel->setLabel("Auto"); myFrameRateLabel->setLabel("Auto");
myFullscreenPopup->setSelected("0", ""); myFullscreen->setSelected("0", "");
myColorLossCheckbox->setState(true); myColorLoss->setState(true);
myGLStretchCheckbox->setState(true); myGLStretch->setState(true);
myUseVSyncCheckbox->setState(true); myUseVSync->setState(true);
myUIMessagesCheckbox->setState(true); myUIMessages->setState(true);
myCenterCheckbox->setState(false); myCenter->setState(false);
myFastSCBiosCheckbox->setState(false); myFastSCBios->setState(false);
break; break;
} }
@ -631,26 +538,14 @@ void VideoDialog::setDefaults()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::handleFullscreenChange(bool enable) void VideoDialog::handleFullscreenChange(bool enable)
{ {
#ifdef WINDOWED_SUPPORT //FIXME
myFSResPopup->setEnabled(enable);
_dirty = true;
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::handleTVModeChange(NTSCFilter::Preset preset) void VideoDialog::handleTVModeChange(NTSCFilter::Preset preset)
{ {
bool enable = true, scanenable = true; bool enable = preset == NTSCFilter::PRESET_CUSTOM;
if(!instance().frameBuffer().type() == kDoubleBuffer) bool scanenable = preset != NTSCFilter::PRESET_OFF;
{
enable = scanenable = false;
myTVMode->setEnabled(enable);
}
else
{
enable = preset == NTSCFilter::PRESET_CUSTOM;
scanenable = preset != NTSCFilter::PRESET_OFF;
}
myTVSharp->setEnabled(enable); myTVSharp->setEnabled(enable);
myTVSharpLabel->setEnabled(enable); myTVSharpLabel->setEnabled(enable);
@ -729,22 +624,22 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd,
break; break;
case kNAspectRatioChanged: case kNAspectRatioChanged:
myNAspectRatioLabel->setValue(myNAspectRatioSlider->getValue()); myNAspectRatioLabel->setValue(myNAspectRatio->getValue());
break; break;
case kPAspectRatioChanged: case kPAspectRatioChanged:
myPAspectRatioLabel->setValue(myPAspectRatioSlider->getValue()); myPAspectRatioLabel->setValue(myPAspectRatio->getValue());
break; break;
case kFrameRateChanged: case kFrameRateChanged:
if(myFrameRateSlider->getValue() == 0) if(myFrameRate->getValue() == 0)
myFrameRateLabel->setLabel("Auto"); myFrameRateLabel->setLabel("Auto");
else else
myFrameRateLabel->setValue(myFrameRateSlider->getValue()); myFrameRateLabel->setValue(myFrameRate->getValue());
break; break;
case kFullScrChanged: case kFullScrChanged:
handleFullscreenChange(myFullscreenPopup->getSelectedTag().toString() != "-1"); handleFullscreenChange(myFullscreen->getSelectedTag().toString() != "-1");
break; break;
case kTVModeChanged: case kTVModeChanged:

View File

@ -53,27 +53,25 @@ class VideoDialog : public Dialog
TabWidget* myTab; TabWidget* myTab;
// General options // General options
StaticTextWidget* myRenderer; PopUpWidget* myRenderer;
PopUpWidget* myRendererPopup; PopUpWidget* myTIAFilter;
PopUpWidget* myTIAFilterPopup; PopUpWidget* myTIAPalette;
PopUpWidget* myTIAPalettePopup; PopUpWidget* myFrameTiming;
PopUpWidget* myFSResPopup; PopUpWidget* myTIAInterpolate;
PopUpWidget* myFrameTimingPopup; SliderWidget* myNAspectRatio;
PopUpWidget* myGLFilterPopup;
SliderWidget* myNAspectRatioSlider;
StaticTextWidget* myNAspectRatioLabel; StaticTextWidget* myNAspectRatioLabel;
SliderWidget* myPAspectRatioSlider; SliderWidget* myPAspectRatio;
StaticTextWidget* myPAspectRatioLabel; StaticTextWidget* myPAspectRatioLabel;
SliderWidget* myFrameRateSlider; SliderWidget* myFrameRate;
StaticTextWidget* myFrameRateLabel; StaticTextWidget* myFrameRateLabel;
PopUpWidget* myFullscreenPopup; PopUpWidget* myFullscreen;
CheckboxWidget* myColorLossCheckbox; CheckboxWidget* myColorLoss;
CheckboxWidget* myGLStretchCheckbox; CheckboxWidget* myGLStretch;
CheckboxWidget* myUseVSyncCheckbox; CheckboxWidget* myUseVSync;
CheckboxWidget* myUIMessagesCheckbox; CheckboxWidget* myUIMessages;
CheckboxWidget* myCenterCheckbox; CheckboxWidget* myCenter;
CheckboxWidget* myFastSCBiosCheckbox; CheckboxWidget* myFastSCBios;
// TV effects adjustables (custom mode) // TV effects adjustables (custom mode)
PopUpWidget* myTVMode; PopUpWidget* myTVMode;