From 9da99f56d2c11d3da1549f874d980ffafe7f8b87 Mon Sep 17 00:00:00 2001 From: stephena Date: Fri, 7 Mar 2014 22:12:39 +0000 Subject: [PATCH] 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 --- src/common/FrameBufferSDL2.cxx | 36 ++-- src/common/FrameBufferSDL2.hxx | 4 +- src/common/Version.hxx | 2 +- src/emucore/FrameBuffer.cxx | 36 ++-- src/emucore/FrameBuffer.hxx | 27 +-- src/gui/PopUpWidget.hxx | 2 +- src/gui/VideoDialog.cxx | 329 +++++++++++---------------------- src/gui/VideoDialog.hxx | 32 ++-- 8 files changed, 173 insertions(+), 295 deletions(-) diff --git a/src/common/FrameBufferSDL2.cxx b/src/common/FrameBufferSDL2.cxx index cbb54404c..413ecd262 100644 --- a/src/common/FrameBufferSDL2.cxx +++ b/src/common/FrameBufferSDL2.cxx @@ -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 SDL_DisplayMode desktop; @@ -89,7 +89,15 @@ bool FrameBufferSDL2::queryHardware(uInt32& w, uInt32& h, ResolutionList& res) w = desktop.w; 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; if(myOSystem->settings().getBool("vsync")) 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); if(myWindow == NULL) { @@ -197,6 +209,9 @@ bool FrameBufferSDL2::setVideoMode(const string& title, VideoMode& mode, bool fu myOSystem->logMessage(msg, 0); 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 // Other surfaces (such as the ones used for dialogs) are allocated @@ -283,14 +298,12 @@ return false; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FrameBufferSDL2::setWindowIcon() { -#if 0 //FIXSDL #if !defined(BSPF_MAC_OSX) && !defined(BSPF_UNIX) #include "stella.xpm" // The Stella icon // Set the window icon uInt32 w, h, ncols, nbytes; uInt32 rgba[256], icon[32 * 32]; - uInt8 mask[32][4]; sscanf(stella_icon[0], "%u %u %u %u", &w, &h, &ncols, &nbytes); if((w != 32) || (h != 32) || (ncols > 255) || (nbytes > 1)) @@ -323,24 +336,11 @@ void FrameBufferSDL2::setWindowIcon() 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, 32 * 4, 0xFF0000, 0x00FF00, 0x0000FF, 0xFF000000); - SDL_WM_SetIcon(surface, (unsigned char *) mask); + SDL_SetWindowIcon(myWindow, surface); SDL_FreeSurface(surface); #endif -#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/common/FrameBufferSDL2.hxx b/src/common/FrameBufferSDL2.hxx index 7cfce2eaa..9633333b7 100644 --- a/src/common/FrameBufferSDL2.hxx +++ b/src/common/FrameBufferSDL2.hxx @@ -137,10 +137,8 @@ class FrameBufferSDL2 : public FrameBuffer /** This method is called to query and initialize the video hardware 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 diff --git a/src/common/Version.hxx b/src/common/Version.hxx index d2adcff5b..528249612 100644 --- a/src/common/Version.hxx +++ b/src/common/Version.hxx @@ -22,7 +22,7 @@ #include -#define STELLA_VERSION "3.9.101_svn" +#define STELLA_VERSION "3.9.102_svn" #define STELLA_BUILD atoi("$Rev$" + 6) #endif diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index ee242433c..e7ee17693 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -78,9 +78,8 @@ FrameBuffer::~FrameBuffer(void) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool FrameBuffer::initialize() { - // Get desktop resolution information - if(!queryHardware(myDesktopWidth, myDesktopHeight, myResolutions)) - return false; + // Get desktop resolution and supported renderers + queryHardware(myDesktopWidth, myDesktopHeight, myRenderers); // Check the 'maxres' setting, which is an undocumented developer feature // 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. if(myInitializedCount == 1) { - myOSystem->logMessage(about(), 1); setUIPalette(); setWindowIcon(); } + myOSystem->logMessage(about(), 1); 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, myOSystem->desktopWidth(), myOSystem->desktopHeight()); - uInt8 mask = (type == "soft" ? 0x1 : 0x2); uInt32 firstmode = 1; if(myOSystem->desktopWidth() < 640 || myOSystem->desktopHeight() < 480) @@ -886,9 +884,7 @@ const VariantList& FrameBuffer::supportedTIAFilters(const string& type) myTIAFilters.clear(); for(uInt32 i = firstmode; i < GFX_NumModes; ++i) { - // For now, just include all filters - // This will change once OpenGL-only filters are added - if((ourGraphicsModes[i].avail & mask) && ourGraphicsModes[i].zoom <= max_zoom) + if(ourGraphicsModes[i].zoom <= max_zoom) { myTIAFilters.push_back(ourGraphicsModes[i].description, ourGraphicsModes[i].name); @@ -985,6 +981,7 @@ void FrameBuffer::addVidMode(VideoMode& mode) mode.image_y = (mode.screen_h - mode.image_h) >> 1; myWindowedModeList.add(mode); +#if 0 //FIXSDL // There are often stricter requirements on fullscreen modes, and they're // normally different depending on the OSystem in use // As well, we usually can't get fullscreen modes in the exact size @@ -1003,6 +1000,7 @@ void FrameBuffer::addVidMode(VideoMode& mode) break; } } +#endif myFullscreenModeList.add(mode); } @@ -1351,16 +1349,16 @@ void FBSurface::drawString(const GUI::Font& font, const string& s, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FrameBuffer::GraphicsMode FrameBuffer::ourGraphicsModes[GFX_NumModes] = { - { GFX_Zoom1x, "zoom1x", "Zoom 1x", 1, 0x3 }, - { GFX_Zoom2x, "zoom2x", "Zoom 2x", 2, 0x3 }, - { GFX_Zoom3x, "zoom3x", "Zoom 3x", 3, 0x3 }, - { GFX_Zoom4x, "zoom4x", "Zoom 4x", 4, 0x3 }, - { GFX_Zoom5x, "zoom5x", "Zoom 5x", 5, 0x3 }, - { GFX_Zoom6x, "zoom6x", "Zoom 6x", 6, 0x3 }, - { GFX_Zoom7x, "zoom7x", "Zoom 7x", 7, 0x3 }, - { GFX_Zoom8x, "zoom8x", "Zoom 8x", 8, 0x3 }, - { GFX_Zoom9x, "zoom9x", "Zoom 9x", 9, 0x3 }, - { GFX_Zoom10x, "zoom10x", "Zoom 10x", 10, 0x3 } + { GFX_Zoom1x, "zoom1x", "Zoom 1x", 1 }, + { GFX_Zoom2x, "zoom2x", "Zoom 2x", 2 }, + { GFX_Zoom3x, "zoom3x", "Zoom 3x", 3 }, + { GFX_Zoom4x, "zoom4x", "Zoom 4x", 4 }, + { GFX_Zoom5x, "zoom5x", "Zoom 5x", 5 }, + { GFX_Zoom6x, "zoom6x", "Zoom 6x", 6 }, + { GFX_Zoom7x, "zoom7x", "Zoom 7x", 7 }, + { GFX_Zoom8x, "zoom8x", "Zoom 8x", 8 }, + { GFX_Zoom9x, "zoom9x", "Zoom 9x", 9 }, + { GFX_Zoom10x, "zoom10x", "Zoom 10x", 10 } }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx index 61117585c..0522915f7 100644 --- a/src/emucore/FrameBuffer.hxx +++ b/src/emucore/FrameBuffer.hxx @@ -98,14 +98,6 @@ enum { kNumColors }; -// Fullscreen resolutions supported by the underlying hardware -struct Resolution { - uInt32 width; - uInt32 height; - string name; -}; -typedef Common::Array ResolutionList; - /** This class encapsulates all video buffers and is the basis for the video @@ -222,11 +214,11 @@ class FrameBuffer 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 @@ -280,9 +272,9 @@ class FrameBuffer 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, @@ -415,7 +407,6 @@ class FrameBuffer const char* name; const char* description; uInt32 zoom; - uInt8 avail; // 0x1 bit -> software, 0x2 bit -> opengl }; // 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 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 @@ -630,8 +619,8 @@ class FrameBuffer // Maximum dimensions of the desktop area uInt32 myDesktopWidth, myDesktopHeight; - // Supported fullscreen resolutions - ResolutionList myResolutions; + // Supported renderers + VariantList myRenderers; // The font object to use for the normal in-game GUI GUI::Font* myFont; diff --git a/src/gui/PopUpWidget.hxx b/src/gui/PopUpWidget.hxx index 9ccf5f234..5be522917 100644 --- a/src/gui/PopUpWidget.hxx +++ b/src/gui/PopUpWidget.hxx @@ -47,10 +47,10 @@ class PopUpWidget : public Widget, public CommandSender ~PopUpWidget(); /** Add the given items to the widget. */ + void addItems(const VariantList& items) { myMenu->addItems(items); } /** Various selection methods passed directly to the underlying menu See ContextMenu.hxx for more information. */ - void addItems(const VariantList& items) { myMenu->addItems(items); } void setSelected(const Variant& tag, const Variant& def = EmptyVariant) { myMenu->setSelected(tag, def); } diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx index 3ec372695..c7fa88272 100644 --- a/src/gui/VideoDialog.cxx +++ b/src/gui/VideoDialog.cxx @@ -48,9 +48,8 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, buttonWidth = font.getStringWidth("Defaults") + 20, buttonHeight = font.getLineHeight() + 4; int xpos, ypos, tabID; - int lwidth = font.getStringWidth("GL Aspect (P): "), - pwidth = font.getStringWidth("1920x1200"), - fwidth = font.getStringWidth("Renderer: "); + int lwidth = font.getStringWidth("NTSC Aspect: "), + pwidth = font.getStringWidth("XXXXxXXXX"); WidgetArray wid; VariantList items; @@ -69,27 +68,17 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, tabID = myTab->addTab(" General "); // Video renderer - new StaticTextWidget(myTab, font, xpos + (lwidth-fwidth), ypos, fwidth, - fontHeight, "Renderer:", kTextAlignLeft); - myRenderer = new StaticTextWidget(myTab, font, xpos+lwidth, ypos, - fwidth, fontHeight, "", kTextAlignLeft); - 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); + myRenderer = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, + instance().frameBuffer().supportedRenderers(), + "Renderer: ", lwidth); + wid.push_back(myRenderer); ypos += lineHeight + 4; // TIA filters (will be dynamically filled later) items.clear(); - myTIAFilterPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, - lineHeight, items, "TIA Filter: ", lwidth); - wid.push_back(myTIAFilterPopup); + myTIAFilter = new PopUpWidget(myTab, font, xpos, ypos, pwidth, + lineHeight, items, "TIA Filter: ", lwidth); + wid.push_back(myTIAFilter); ypos += lineHeight + 4; // TIA Palette @@ -97,72 +86,62 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, items.push_back("Standard", "standard"); items.push_back("Z26", "z26"); items.push_back("User", "user"); - myTIAPalettePopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, - lineHeight, items, "TIA Palette: ", lwidth); - wid.push_back(myTIAPalettePopup); + myTIAPalette = new PopUpWidget(myTab, font, xpos, ypos, pwidth, + lineHeight, items, "TIA Palette: ", lwidth); + wid.push_back(myTIAPalette); ypos += lineHeight + 4; - // Fullscreen resolution + // TIA interpolation items.clear(); - items.push_back("Auto", "auto"); - for(uInt32 i = 0; i < instance().frameBuffer().supportedResolutions().size(); ++i) - items.push_back(instance().frameBuffer().supportedResolutions()[i].name); - myFSResPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, - lineHeight, items, "Fullscrn Res: ", lwidth); - wid.push_back(myFSResPopup); + items.push_back("Linear", "linear"); + items.push_back("Nearest", "nearest"); + myTIAInterpolate = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, + items, "TIA Inter: ", lwidth); + wid.push_back(myTIAInterpolate); ypos += lineHeight + 4; // Timing to use between frames items.clear(); items.push_back("Sleep", "sleep"); items.push_back("Busy-wait", "busy"); - myFrameTimingPopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, - items, "Timing (*): ", lwidth); - wid.push_back(myFrameTimingPopup); - 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); + myFrameTiming = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, + items, "Timing (*): ", lwidth); + wid.push_back(myFrameTiming); ypos += lineHeight + 4; // GL aspect ratio (NTSC mode) - myNAspectRatioSlider = + myNAspectRatio = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight, - "GL Aspect (N): ", lwidth, kNAspectRatioChanged); - myNAspectRatioSlider->setMinValue(80); myNAspectRatioSlider->setMaxValue(120); - wid.push_back(myNAspectRatioSlider); + "NTSC Aspect: ", lwidth, kNAspectRatioChanged); + myNAspectRatio->setMinValue(80); myNAspectRatio->setMaxValue(120); + wid.push_back(myNAspectRatio); myNAspectRatioLabel = - new StaticTextWidget(myTab, font, xpos + myNAspectRatioSlider->getWidth() + 4, + new StaticTextWidget(myTab, font, xpos + myNAspectRatio->getWidth() + 4, ypos + 1, fontWidth * 3, fontHeight, "", kTextAlignLeft); myNAspectRatioLabel->setFlags(WIDGET_CLEARBG); ypos += lineHeight + 4; // GL aspect ratio (PAL mode) - myPAspectRatioSlider = + myPAspectRatio = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight, - "GL Aspect (P): ", lwidth, kPAspectRatioChanged); - myPAspectRatioSlider->setMinValue(80); myPAspectRatioSlider->setMaxValue(120); - wid.push_back(myPAspectRatioSlider); + "PAL Aspect: ", lwidth, kPAspectRatioChanged); + myPAspectRatio->setMinValue(80); myPAspectRatio->setMaxValue(120); + wid.push_back(myPAspectRatio); myPAspectRatioLabel = - new StaticTextWidget(myTab, font, xpos + myPAspectRatioSlider->getWidth() + 4, + new StaticTextWidget(myTab, font, xpos + myPAspectRatio->getWidth() + 4, ypos + 1, fontWidth * 3, fontHeight, "", kTextAlignLeft); myPAspectRatioLabel->setFlags(WIDGET_CLEARBG); ypos += lineHeight + 4; // Framerate - myFrameRateSlider = + myFrameRate = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight, "Framerate: ", lwidth, kFrameRateChanged); - myFrameRateSlider->setMinValue(0); myFrameRateSlider->setMaxValue(300); - myFrameRateSlider->setStepValue(10); - wid.push_back(myFrameRateSlider); + myFrameRate->setMinValue(0); myFrameRate->setMaxValue(300); + myFrameRate->setStepValue(10); + wid.push_back(myFrameRate); myFrameRateLabel = - new StaticTextWidget(myTab, font, xpos + myFrameRateSlider->getWidth() + 4, + new StaticTextWidget(myTab, font, xpos + myFrameRate->getWidth() + 4, ypos + 1, fontWidth * 4, fontHeight, "", kTextAlignLeft); myFrameRateLabel->setFlags(WIDGET_CLEARBG); @@ -174,7 +153,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, "(*) Requires application restart", kTextAlignLeft); // Move over to the next column - xpos += myNAspectRatioSlider->getWidth() + myNAspectRatioLabel->getWidth() + 14; + xpos += myNAspectRatio->getWidth() + myNAspectRatioLabel->getWidth() + 30; ypos = 10; // Fullscreen @@ -184,49 +163,43 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, items.push_back("Never", "-1"); lwidth = font.getStringWidth("Fullscreen: "); pwidth = font.getStringWidth("Never"), - myFullscreenPopup = + myFullscreen = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items, "Fullscreen: ", lwidth, kFullScrChanged); - wid.push_back(myFullscreenPopup); + wid.push_back(myFullscreen); ypos += lineHeight + 4; // GL FS stretch - myGLStretchCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, - "GL FS Stretch"); - wid.push_back(myGLStretchCheckbox); + myGLStretch = new CheckboxWidget(myTab, font, xpos, ypos, "GL FS Stretch"); + wid.push_back(myGLStretch); ypos += lineHeight + 4; // Use sync to vblank in OpenGL - myUseVSyncCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, - "GL VSync"); - wid.push_back(myUseVSyncCheckbox); + myUseVSync = new CheckboxWidget(myTab, font, xpos, ypos, "VSync"); + wid.push_back(myUseVSync); ypos += lineHeight + 4; ypos += lineHeight; // PAL color-loss effect - myColorLossCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, - "PAL color-loss"); - wid.push_back(myColorLossCheckbox); + myColorLoss = new CheckboxWidget(myTab, font, xpos, ypos, "PAL color-loss"); + wid.push_back(myColorLoss); ypos += lineHeight + 4; // Skip progress load bars for SuperCharger ROMs // Doesn't really belong here, but I couldn't find a better place for it - myFastSCBiosCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, - "Fast SC/AR BIOS"); - wid.push_back(myFastSCBiosCheckbox); + myFastSCBios = new CheckboxWidget(myTab, font, xpos, ypos, "Fast SC/AR BIOS"); + wid.push_back(myFastSCBios); ypos += lineHeight + 4; // Show UI messages onscreen - myUIMessagesCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, - "Show UI messages"); - wid.push_back(myUIMessagesCheckbox); + myUIMessages = new CheckboxWidget(myTab, font, xpos, ypos, "Show UI messages"); + wid.push_back(myUIMessages); ypos += lineHeight + 4; // Center window (in windowed mode) - myCenterCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, - "Center window"); - wid.push_back(myCenterCheckbox); + myCenter = new CheckboxWidget(myTab, font, xpos, ypos, "Center window"); + wid.push_back(myCenter); ypos += lineHeight + 4; // Add items for tab 0 @@ -335,54 +308,9 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, addBGroupToFocusList(wid); // 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 myFullscreenCheckbox->clearFlags(WIDGET_ENABLED); - myCenterCheckbox->clearFlags(WIDGET_ENABLED); -#endif -#if !(defined(BSPF_WINDOWS) || defined(BSPF_UNIX)) - myCenterCheckbox->clearFlags(WIDGET_ENABLED); + myCenter->clearFlags(WIDGET_ENABLED); #endif } @@ -394,80 +322,64 @@ VideoDialog::~VideoDialog() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void VideoDialog::loadConfig() { - bool gl = (instance().frameBuffer().type() == kDoubleBuffer); - // Renderer settings - myRenderer->setLabel(gl ? "OpenGL" : "Software"); - myRendererPopup->setSelected( - instance().settings().getString("video"), "soft"); + myRenderer->setSelected(instance().settings().getString("video"), "default"); // TIA Filter // These are dynamically loaded, since they depend on the size of // the desktop and which renderer we're using - const VariantList& items = - instance().frameBuffer().supportedTIAFilters(gl ? "gl" : "soft"); - myTIAFilterPopup->addItems(items); - myTIAFilterPopup->setSelected(instance().settings().getString("tia.filter"), + const VariantList& items = instance().frameBuffer().supportedTIAFilters(); + myTIAFilter->addItems(items); + myTIAFilter->setSelected(instance().settings().getString("tia.filter"), instance().desktopWidth() < 640 ? "zoom1x" : "zoom2x"); // TIA Palette - myTIAPalettePopup->setSelected( + myTIAPalette->setSelected( instance().settings().getString("palette"), "standard"); - // Fullscreen resolution - myFSResPopup->setSelected( - instance().settings().getString("fullres"), "auto"); - - // Wait between frames - myFrameTimingPopup->setSelected( - instance().settings().getString("timing"), "sleep"); - - // GL Filter setting + // TIA interpolation const string& tia_inter = instance().settings().getBool("tia.inter") ? "linear" : "nearest"; - myGLFilterPopup->setSelected(tia_inter, "nearest"); - myGLFilterPopup->setEnabled(gl); + myTIAInterpolate->setSelected(tia_inter, "nearest"); - // GL aspect ratio setting (NTSC and PAL) - myNAspectRatioSlider->setValue(instance().settings().getInt("tia.aspectn")); - myNAspectRatioSlider->setEnabled(gl); + // Wait between frames + myFrameTiming->setSelected( + 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->setEnabled(gl); - myPAspectRatioSlider->setValue(instance().settings().getInt("tia.aspectp")); - myPAspectRatioSlider->setEnabled(gl); + myPAspectRatio->setValue(instance().settings().getInt("tia.aspectp")); myPAspectRatioLabel->setLabel(instance().settings().getString("tia.aspectp")); - myPAspectRatioLabel->setEnabled(gl); // Framerate (0 or -1 means automatic framerate calculation) int rate = instance().settings().getInt("framerate"); - myFrameRateSlider->setValue(rate < 0 ? 0 : rate); + myFrameRate->setValue(rate < 0 ? 0 : rate); myFrameRateLabel->setLabel(rate <= 0 ? "Auto" : instance().settings().getString("framerate")); // Fullscreen const string& fullscreen = instance().settings().getString("fullscreen"); - myFullscreenPopup->setSelected(fullscreen, "0"); + myFullscreen->setSelected(fullscreen, "0"); handleFullscreenChange(fullscreen == "0" || fullscreen == "1"); // PAL color-loss effect - myColorLossCheckbox->setState(instance().settings().getBool("colorloss")); + myColorLoss->setState(instance().settings().getBool("colorloss")); // GL stretch setting (GL mode only) - myGLStretchCheckbox->setState(instance().settings().getBool("gl_fsscale")); - myGLStretchCheckbox->setEnabled(gl); + myGLStretch->setState(instance().settings().getBool("gl_fsscale")); - // Use sync to vertical blank (GL mode only) - myUseVSyncCheckbox->setState(instance().settings().getBool("vsync")); - myUseVSyncCheckbox->setEnabled(gl); + // Use sync to vertical blank + myUseVSync->setState(instance().settings().getBool("vsync")); // Show UI messages - myUIMessagesCheckbox->setState(instance().settings().getBool("uimessages")); + myUIMessages->setState(instance().settings().getBool("uimessages")); // Center window - myCenterCheckbox->setState(instance().settings().getBool("center")); + myCenter->setState(instance().settings().getBool("center")); // Fast loading of Supercharger BIOS - myFastSCBiosCheckbox->setState(instance().settings().getBool("fastscbios")); + myFastSCBios->setState(instance().settings().getBool("fastscbios")); // TV Mode myTVMode->setSelected( @@ -491,34 +403,30 @@ void VideoDialog::saveConfig() { // Renderer setting instance().settings().setValue("video", - myRendererPopup->getSelectedTag().toString()); + myRenderer->getSelectedTag().toString()); // TIA Filter instance().settings().setValue("tia.filter", - myTIAFilterPopup->getSelectedTag().toString()); + myTIAFilter->getSelectedTag().toString()); // TIA Palette instance().settings().setValue("palette", - myTIAPalettePopup->getSelectedTag().toString()); - - // Fullscreen resolution - instance().settings().setValue("fullres", - myFSResPopup->getSelectedTag().toString()); + myTIAPalette->getSelectedTag().toString()); // Wait between frames instance().settings().setValue("timing", - myFrameTimingPopup->getSelectedTag().toString()); + myFrameTiming->getSelectedTag().toString()); // GL Filter setting instance().settings().setValue("tia.inter", - myGLFilterPopup->getSelectedTag().toString() == "linear" ? true : false); + myTIAInterpolate->getSelectedTag().toString() == "linear" ? true : false); // GL aspect ratio setting (NTSC and PAL) instance().settings().setValue("tia.aspectn", myNAspectRatioLabel->getLabel()); instance().settings().setValue("tia.aspectp", myPAspectRatioLabel->getLabel()); // Framerate - int i = myFrameRateSlider->getValue(); + int i = myFrameRate->getValue(); instance().settings().setValue("framerate", i); if(&instance().console()) { @@ -529,27 +437,27 @@ void VideoDialog::saveConfig() // Fullscreen instance().settings().setValue("fullscreen", - myFullscreenPopup->getSelectedTag().toString()); + myFullscreen->getSelectedTag().toString()); // PAL color-loss effect - instance().settings().setValue("colorloss", myColorLossCheckbox->getState()); + instance().settings().setValue("colorloss", myColorLoss->getState()); if(&instance().console()) - instance().console().toggleColorLoss(myColorLossCheckbox->getState()); + instance().console().toggleColorLoss(myColorLoss->getState()); // 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) - instance().settings().setValue("vsync", myUseVSyncCheckbox->getState()); + instance().settings().setValue("vsync", myUseVSync->getState()); // Show UI messages - instance().settings().setValue("uimessages", myUIMessagesCheckbox->getState()); + instance().settings().setValue("uimessages", myUIMessages->getState()); // Center window - instance().settings().setValue("center", myCenterCheckbox->getState()); + instance().settings().setValue("center", myCenter->getState()); // Fast loading of Supercharger BIOS - instance().settings().setValue("fastscbios", myFastSCBiosCheckbox->getState()); + instance().settings().setValue("fastscbios", myFastSCBios->getState()); // TV Mode instance().settings().setValue("tv.filter", @@ -584,27 +492,26 @@ void VideoDialog::setDefaults() { case 0: // General { - myRendererPopup->setSelected("soft", ""); - myTIAFilterPopup->setSelected( + myRenderer->setSelected("soft", ""); + myTIAFilter->setSelected( instance().desktopWidth() < 640 ? "zoom1x" : "zoom2x", ""); - myTIAPalettePopup->setSelected("standard", ""); - myFSResPopup->setSelected("auto", ""); - myFrameTimingPopup->setSelected("sleep", ""); - myGLFilterPopup->setSelected("nearest", ""); - myNAspectRatioSlider->setValue(90); + myTIAPalette->setSelected("standard", ""); + myFrameTiming->setSelected("sleep", ""); + myTIAInterpolate->setSelected("nearest", ""); + myNAspectRatio->setValue(90); myNAspectRatioLabel->setLabel("90"); - myPAspectRatioSlider->setValue(100); + myPAspectRatio->setValue(100); myPAspectRatioLabel->setLabel("100"); - myFrameRateSlider->setValue(0); + myFrameRate->setValue(0); myFrameRateLabel->setLabel("Auto"); - myFullscreenPopup->setSelected("0", ""); - myColorLossCheckbox->setState(true); - myGLStretchCheckbox->setState(true); - myUseVSyncCheckbox->setState(true); - myUIMessagesCheckbox->setState(true); - myCenterCheckbox->setState(false); - myFastSCBiosCheckbox->setState(false); + myFullscreen->setSelected("0", ""); + myColorLoss->setState(true); + myGLStretch->setState(true); + myUseVSync->setState(true); + myUIMessages->setState(true); + myCenter->setState(false); + myFastSCBios->setState(false); break; } @@ -631,26 +538,14 @@ void VideoDialog::setDefaults() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void VideoDialog::handleFullscreenChange(bool enable) { -#ifdef WINDOWED_SUPPORT - myFSResPopup->setEnabled(enable); - _dirty = true; -#endif +//FIXME } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void VideoDialog::handleTVModeChange(NTSCFilter::Preset preset) { - bool enable = true, scanenable = true; - if(!instance().frameBuffer().type() == kDoubleBuffer) - { - enable = scanenable = false; - myTVMode->setEnabled(enable); - } - else - { - enable = preset == NTSCFilter::PRESET_CUSTOM; - scanenable = preset != NTSCFilter::PRESET_OFF; - } + bool enable = preset == NTSCFilter::PRESET_CUSTOM; + bool scanenable = preset != NTSCFilter::PRESET_OFF; myTVSharp->setEnabled(enable); myTVSharpLabel->setEnabled(enable); @@ -729,22 +624,22 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd, break; case kNAspectRatioChanged: - myNAspectRatioLabel->setValue(myNAspectRatioSlider->getValue()); + myNAspectRatioLabel->setValue(myNAspectRatio->getValue()); break; case kPAspectRatioChanged: - myPAspectRatioLabel->setValue(myPAspectRatioSlider->getValue()); + myPAspectRatioLabel->setValue(myPAspectRatio->getValue()); break; case kFrameRateChanged: - if(myFrameRateSlider->getValue() == 0) + if(myFrameRate->getValue() == 0) myFrameRateLabel->setLabel("Auto"); else - myFrameRateLabel->setValue(myFrameRateSlider->getValue()); + myFrameRateLabel->setValue(myFrameRate->getValue()); break; case kFullScrChanged: - handleFullscreenChange(myFullscreenPopup->getSelectedTag().toString() != "-1"); + handleFullscreenChange(myFullscreen->getSelectedTag().toString() != "-1"); break; case kTVModeChanged: diff --git a/src/gui/VideoDialog.hxx b/src/gui/VideoDialog.hxx index 4ff754bfd..50eb7f31b 100644 --- a/src/gui/VideoDialog.hxx +++ b/src/gui/VideoDialog.hxx @@ -53,27 +53,25 @@ class VideoDialog : public Dialog TabWidget* myTab; // General options - StaticTextWidget* myRenderer; - PopUpWidget* myRendererPopup; - PopUpWidget* myTIAFilterPopup; - PopUpWidget* myTIAPalettePopup; - PopUpWidget* myFSResPopup; - PopUpWidget* myFrameTimingPopup; - PopUpWidget* myGLFilterPopup; - SliderWidget* myNAspectRatioSlider; + PopUpWidget* myRenderer; + PopUpWidget* myTIAFilter; + PopUpWidget* myTIAPalette; + PopUpWidget* myFrameTiming; + PopUpWidget* myTIAInterpolate; + SliderWidget* myNAspectRatio; StaticTextWidget* myNAspectRatioLabel; - SliderWidget* myPAspectRatioSlider; + SliderWidget* myPAspectRatio; StaticTextWidget* myPAspectRatioLabel; - SliderWidget* myFrameRateSlider; + SliderWidget* myFrameRate; StaticTextWidget* myFrameRateLabel; - PopUpWidget* myFullscreenPopup; - CheckboxWidget* myColorLossCheckbox; - CheckboxWidget* myGLStretchCheckbox; - CheckboxWidget* myUseVSyncCheckbox; - CheckboxWidget* myUIMessagesCheckbox; - CheckboxWidget* myCenterCheckbox; - CheckboxWidget* myFastSCBiosCheckbox; + PopUpWidget* myFullscreen; + CheckboxWidget* myColorLoss; + CheckboxWidget* myGLStretch; + CheckboxWidget* myUseVSync; + CheckboxWidget* myUIMessages; + CheckboxWidget* myCenter; + CheckboxWidget* myFastSCBios; // TV effects adjustables (custom mode) PopUpWidget* myTVMode;