diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index 91fdc3a43..d222171a3 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.cxx @@ -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: EventHandler.cxx,v 1.227 2008-06-19 12:01:30 stephena Exp $ +// $Id: EventHandler.cxx,v 1.228 2008-07-22 14:54:38 stephena Exp $ //============================================================================ #include @@ -357,6 +357,14 @@ void EventHandler::poll(uInt32 time) { myOSystem->frameBuffer().toggleFullscreen(); } + else if(key == SDLK_EQUALS) + { + myOSystem->frameBuffer().changeVidMode(+1); + } + else if(key == SDLK_MINUS) + { + myOSystem->frameBuffer().changeVidMode(-1); + } else #endif // These only work when in emulation mode @@ -364,15 +372,6 @@ void EventHandler::poll(uInt32 time) { switch(int(key)) { - #ifndef MAC_OSX - case SDLK_EQUALS: - myOSystem->frameBuffer().changeVidMode(+1); - break; - - case SDLK_MINUS: - myOSystem->frameBuffer().changeVidMode(-1); - break; - #endif case SDLK_LEFTBRACKET: myOSystem->sound().adjustVolume(-1); break; @@ -484,6 +483,14 @@ void EventHandler::poll(uInt32 time) case SDLK_RETURN: myOSystem->frameBuffer().toggleFullscreen(); break; + + case SDLK_EQUALS: + myOSystem->frameBuffer().changeVidMode(+1); + break; + + case SDLK_MINUS: + myOSystem->frameBuffer().changeVidMode(-1); + break; #endif } @@ -498,14 +505,6 @@ void EventHandler::poll(uInt32 time) case SDLK_SLASH: handleMacOSXKeypress(int(key)); break; - - case SDLK_EQUALS: - myOSystem->frameBuffer().changeVidMode(+1); - break; - - case SDLK_MINUS: - myOSystem->frameBuffer().changeVidMode(-1); - break; #endif case SDLK_0: // Ctrl-0 sets the mouse to paddle 0 setPaddleMode(0, true); diff --git a/stella/src/emucore/FrameBuffer.cxx b/stella/src/emucore/FrameBuffer.cxx index 1bacfc06d..8538c7bdf 100644 --- a/stella/src/emucore/FrameBuffer.cxx +++ b/stella/src/emucore/FrameBuffer.cxx @@ -13,9 +13,10 @@ // 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.135 2008-07-04 14:27:17 stephena Exp $ +// $Id: FrameBuffer.cxx,v 1.136 2008-07-22 14:54:39 stephena Exp $ //============================================================================ +#include #include #include "bspf.hxx" @@ -454,40 +455,41 @@ bool FrameBuffer::changeVidMode(int direction) bool inUIMode = (state == EventHandler::S_DEBUGGER || state == EventHandler::S_LAUNCHER); + // Ignore any attempts to change video size while in UI mode + if(inUIMode && direction != 0) + return false; + // Only save mode changes in TIA mode with a valid selector bool saveModeChange = !inUIMode && (direction == -1 || direction == +1); - if(!inUIMode) - { - if(direction == +1) - myCurrentModeList->next(); - else if(direction == -1) - myCurrentModeList->previous(); - } + if(direction == +1) + myCurrentModeList->next(); + else if(direction == -1) + myCurrentModeList->previous(); - VideoMode video = myCurrentModeList->current(); - if(setVidMode(video)) + VideoMode vidmode = myCurrentModeList->current(myOSystem->settings()); + if(setVidMode(vidmode)) { - myImageRect.setWidth(video.image_w); - myImageRect.setHeight(video.image_h); - myImageRect.moveTo(video.image_x, video.image_y); + myImageRect.setWidth(vidmode.image_w); + myImageRect.setHeight(vidmode.image_h); + myImageRect.moveTo(vidmode.image_x, vidmode.image_y); - myScreenRect.setWidth(video.screen_w); - myScreenRect.setHeight(video.screen_h); + myScreenRect.setWidth(vidmode.screen_w); + myScreenRect.setHeight(vidmode.screen_h); + + if(!inUIMode) + { + myOSystem->eventHandler().handleResizeEvent(); + myOSystem->eventHandler().refreshDisplay(true); + setCursorState(); + showMessage(vidmode.gfxmode.description); + } + if(saveModeChange) + myOSystem->settings().setString("tia_filter", vidmode.gfxmode.name); } else return false; - myOSystem->eventHandler().handleResizeEvent(); - myOSystem->eventHandler().refreshDisplay(true); - setCursorState(); - showMessage(video.gfxmode.description); - - if(!inUIMode && saveModeChange) - { - // FIXME - adapt to scaler infrastructure -// myOSystem->settings().setInt("zoom_tia", newmode.zoom); - } return true; /* cerr << "New mode:" << endl @@ -563,7 +565,7 @@ void FrameBuffer::setWindowIcon() uInt32 rgba[256], icon[32 * 32]; uInt8 mask[32][4]; - sscanf(stella_icon[0], "%d %d %d %d", &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)) { cerr << "ERROR: Couldn't load the icon.\n"; @@ -622,6 +624,26 @@ uInt8 FrameBuffer::getPhosphor(uInt8 c1, uInt8 c2) return ((c1 - c2) * myPhosphorBlend)/100 + c2; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +const StringList& FrameBuffer::supportedTIAFilters(const string& type) +{ + myTIAFilters.clear(); + +#ifdef SMALL_SCREEN + uInt32 firstmode = 0; +#else + uInt32 firstmode = 1; +#endif + for(uInt32 i = firstmode; i < GFX_NumModes; ++i) + { + // For now, just include all filters + // This will change once OpenGL-only filters are added + myTIAFilters.push_back(ourGraphicsModes[i].description); + cerr << ourGraphicsModes[i].description << endl; + } + return myTIAFilters; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt32 FrameBuffer::maxWindowSizeForScreen(uInt32 baseWidth, uInt32 baseHeight, uInt32 screenWidth, uInt32 screenHeight) @@ -649,10 +671,8 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight) bool inUIMode = (state == EventHandler::S_DEBUGGER || state == EventHandler::S_LAUNCHER); - // First we look at windowed modes - // These can be sized exactly as required, since there's normally no - // restriction on window size (up the maximum size) myWindowedModeList.clear(); + myFullscreenModeList.clear(); // In UI/windowed mode, there's only one valid video mode we can use if(inUIMode) @@ -663,7 +683,7 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight) m.image_h = m.screen_h = baseHeight; m.gfxmode = ourGraphicsModes[0]; // this should be zoom1x - myWindowedModeList.add(m); + addVidMode(m); } else { @@ -671,7 +691,12 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight) // for the given dimensions uInt32 max_zoom = maxWindowSizeForScreen(baseWidth, baseHeight, myOSystem->desktopWidth(), myOSystem->desktopHeight()); - for(unsigned int i = 0; i < GFX_NumModes; ++i) + #ifdef SMALL_SCREEN + uInt32 firstmode = 0; + #else + uInt32 firstmode = 1; + #endif + for(uInt32 i = firstmode; i < GFX_NumModes; ++i) { uInt32 zoom = ourGraphicsModes[i].zoom; if(zoom <= max_zoom) @@ -682,77 +707,38 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight) m.image_h = m.screen_h = baseHeight * zoom; m.gfxmode = ourGraphicsModes[i]; - myWindowedModeList.add(m); + addVidMode(m); } } } +} -#if 0 - // Now consider the fullscreen modes - // There are often stricter requirements on these, and they're normally - // different depending on the OSystem in use +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void FrameBuffer::addVidMode(VideoMode& mode) +{ + // Windowed modes can be sized exactly as required, since there's normally + // no restriction on window size (up the maximum size) + myWindowedModeList.add(mode); + + // 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 // we want, so we need to calculate image offsets - myFullscreenModeList.clear(); - if(inUIMode) + const ResolutionList& res = myOSystem->supportedResolutions(); + for(uInt32 i = 0; i < res.size(); ++i) { - // FIXME - document this - if(0)// use exact dimensions) + if(mode.screen_w <= res[i].width && mode.screen_h <= res[i].height) { - VideoMode m; - m.image_w = m.screen_w = baseWidth; - m.image_h = m.screen_h = baseHeight; - m.zoom = 1; - - myFullscreenModeList.add(m); - } - else // use dimensions as defined in 'fullres' - { - int w = -1, h = -1; - myOSystem->settings().getSize("fullres", w, h); - if(w < 0 || h < 0) - { - w = myOSystem->desktopWidth(); - h = myOSystem->desktopHeight(); - } - - VideoMode m; - m.screen_w = w; - m.screen_h = h; - m.zoom = 1; - // Auto-calculate 'smart' centering; platform-specific framebuffers are // free to ignore or augment it - m.image_w = baseWidth; - m.image_h = baseHeight; - m.image_x = (m.screen_w - m.image_w) / 2; - m.image_y = (m.screen_h - m.image_h) / 2; - - myFullscreenModeList.add(m); + mode.screen_w = res[i].width; + mode.screen_h = res[i].height; + mode.image_x = (mode.screen_w - mode.image_w) >> 1; + mode.image_y = (mode.screen_h - mode.image_h) >> 1; + break; } } - else - { - const ResolutionList& res = myOSystem->supportedResolutions(); - for(unsigned int i = 0; i < res.size(); ++i) - { - VideoMode m; - m.screen_w = res[i].width; - m.screen_h = res[i].height; - m.zoom = maxWindowSizeForScreen(baseWidth, baseHeight, m.screen_w, m.screen_h); - m.name = res[i].name; - - // Auto-calculate 'smart' centering; platform-specific framebuffers are - // free to ignore or augment it - m.image_w = baseWidth * m.zoom; - m.image_h = baseHeight * m.zoom; - m.image_x = (m.screen_w - m.image_w) / 2; - m.image_y = (m.screen_h - m.image_h) / 2; - - myFullscreenModeList.add(m); - } - } -#endif + myFullscreenModeList.add(mode); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -765,8 +751,6 @@ FrameBuffer::VideoMode FrameBuffer::getSavedVidMode() else myCurrentModeList = &myWindowedModeList; -myCurrentModeList->print(); - // Now select the best resolution depending on the state // UI modes (launcher and debugger) have only one supported resolution // so the 'current' one is the only valid one @@ -780,15 +764,7 @@ myCurrentModeList->print(); myCurrentModeList->setByGfxMode(name); } - // Check if 'auto-size' is enabled for fullscreen modes - if(myOSystem->settings().getBool("fullscreen")) - { - VideoMode mode = myCurrentModeList->current(); - // FIXME - add centering - return mode; - } - else - return myCurrentModeList->current(); + return myCurrentModeList->current(myOSystem->settings()); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -828,24 +804,48 @@ uInt32 FrameBuffer::VideoModeList::size() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const FrameBuffer::VideoMode& FrameBuffer::VideoModeList::previous() +void FrameBuffer::VideoModeList::previous() { --myIdx; if(myIdx < 0) myIdx = myModeList.size() - 1; - return current(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const FrameBuffer::VideoMode& FrameBuffer::VideoModeList::current() const +const FrameBuffer::VideoMode FrameBuffer:: + VideoModeList::current(const Settings& settings) const { + // Fullscreen modes are related to the 'fullres' setting + // If it's 'auto', we just use the mode as already previously defined + // If it's not 'auto', attempt to fit the mode into the resolution + // specified by 'fullres' (if possible) + if(settings.getBool("fullscreen") && + BSPF_tolower(settings.getString("fullres")) != "auto") + { + // Only use 'fullres' if it's *bigger* than the requested mode + int w, h; + settings.getSize("fullres", w, h); + + if(w != -1 && h != -1 && (uInt32)w > myModeList[myIdx].screen_w && + (uInt32)h > myModeList[myIdx].screen_h) + { + VideoMode mode = myModeList[myIdx]; + mode.screen_w = w; + mode.screen_h = h; + mode.image_x = (mode.screen_w - mode.image_w) >> 1; + mode.image_y = (mode.screen_h - mode.image_h) >> 1; + + return mode; + } + } + + // Otherwise, we just use the mode has it was defined in ::addVidMode() return myModeList[myIdx]; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const FrameBuffer::VideoMode& FrameBuffer::VideoModeList::next() +void FrameBuffer::VideoModeList::next() { myIdx = (myIdx + 1) % myModeList.size(); - return current(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -877,7 +877,8 @@ void FrameBuffer::VideoModeList::setByGfxMode(const string& name) GraphicsMode gfxmode; for(uInt32 i = 0; i < GFX_NumModes; ++i) { - if(ourGraphicsModes[i].name == name) + if(ourGraphicsModes[i].name == BSPF_tolower(name) || + ourGraphicsModes[i].description == BSPF_tolower(name)) { gfxmode = ourGraphicsModes[i]; found = true; @@ -890,30 +891,6 @@ void FrameBuffer::VideoModeList::setByGfxMode(const string& name) set(gfxmode); } -#if 0 - // Find the largest resolution able to hold the given bounds - myIdx = myModeList.size() - 1; - for(unsigned int i = 0; i < myModeList.size(); ++i) - { - if(width <= myModeList[i].screen_w && height <= myModeList[i].screen_h) - { - myIdx = i; - break; - } - } - - // Find the largest zoom within the given bounds - myIdx = 0; - for(unsigned int i = myModeList.size() - 1; i; --i) - { - if(myModeList[i].zoom <= zoom) - { - myIdx = i; - break; - } - } -#endif - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FrameBuffer::VideoModeList::set(const GraphicsMode& gfxmode) { diff --git a/stella/src/emucore/FrameBuffer.hxx b/stella/src/emucore/FrameBuffer.hxx index c0d01b23b..638b8ba2c 100644 --- a/stella/src/emucore/FrameBuffer.hxx +++ b/stella/src/emucore/FrameBuffer.hxx @@ -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.100 2008-07-04 14:27:17 stephena Exp $ +// $Id: FrameBuffer.hxx,v 1.101 2008-07-22 14:54:39 stephena Exp $ //============================================================================ #ifndef FRAMEBUFFER_HXX @@ -31,7 +31,7 @@ namespace GUI { } #include "EventHandler.hxx" -//#include "VideoModeList.hxx" +#include "Settings.hxx" #include "Rect.hxx" #include "bspf.hxx" @@ -90,7 +90,7 @@ enum { turn drawn here as well. @author Stephen Anthony - @version $Id: FrameBuffer.hxx,v 1.100 2008-07-04 14:27:17 stephena Exp $ + @version $Id: FrameBuffer.hxx,v 1.101 2008-07-22 14:54:39 stephena Exp $ */ class FrameBuffer { @@ -220,6 +220,11 @@ class FrameBuffer */ void setWindowTitle(const string& title); + /** + Get the supported TIA filters for the given framebuffer type. + */ + const StringList& supportedTIAFilters(const string& type); + /** Set up the TIA/emulation palette for a screen of any depth > 8. @@ -376,6 +381,9 @@ class FrameBuffer Uint32 myDefPalette[256+kNumColors]; Uint32 myAvgPalette[256][256]; + // Names of the TIA filters that can be used for this framebuffer + StringList myTIAFilters; + private: /** Set the icon for the main SDL window. @@ -410,6 +418,12 @@ class FrameBuffer */ void setAvailableVidModes(uInt32 basewidth, uInt32 baseheight); + /** + Adds the given video mode to both windowed and fullscreen lists. + In the case of fullscreen, we make sure a valid resolution exists. + */ + void addVidMode(VideoMode& mode); + /** Returns an appropriate video mode based on the current eventhandler state, taking into account the maximum size of the window. @@ -434,9 +448,9 @@ class FrameBuffer bool isEmpty() const; uInt32 size() const; - const FrameBuffer::VideoMode& previous(); - const FrameBuffer::VideoMode& current() const; - const FrameBuffer::VideoMode& next(); + void previous(); + const FrameBuffer::VideoMode current(const Settings& settings) const; + void next(); void setByGfxMode(GfxID id); void setByGfxMode(const string& name); @@ -496,7 +510,7 @@ class FrameBuffer FrameBuffer type. @author Stephen Anthony - @version $Id: FrameBuffer.hxx,v 1.100 2008-07-04 14:27:17 stephena Exp $ + @version $Id: FrameBuffer.hxx,v 1.101 2008-07-22 14:54:39 stephena Exp $ */ // Text alignment modes for drawString() enum TextAlignment { diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index e5c774130..ec72556cf 100644 --- a/stella/src/emucore/Settings.cxx +++ b/stella/src/emucore/Settings.cxx @@ -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.148 2008-05-30 19:07:55 stephena Exp $ +// $Id: Settings.cxx,v 1.149 2008-07-22 14:54:39 stephena Exp $ //============================================================================ #include @@ -47,10 +47,9 @@ Settings::Settings(OSystem* osystem) setInternal("gl_texrect", "false"); // Framebuffer-related options - setInternal("zoom_ui", "2"); - setInternal("zoom_tia", "2"); + setInternal("tia_filter", "zoom2x"); setInternal("fullscreen", "false"); - setInternal("fullres", ""); + setInternal("fullres", "auto"); setInternal("center", "true"); setInternal("grabmouse", "false"); setInternal("palette", "standard"); @@ -245,14 +244,6 @@ void Settings::validate() setInternal("tiafreq", "31400"); #endif - i = getInt("zoom_ui"); - if(i < 1 || i > 10) - setInternal("zoom_ui", "2"); - - i = getInt("zoom_tia"); - if(i < 1 || i > 10) - setInternal("zoom_tia", "2"); - i = getInt("joydeadzone"); if(i < 0) setInternal("joydeadzone", "0"); @@ -302,10 +293,9 @@ void Settings::usage() << " -gl_texrect <1|0> Enable GL_TEXTURE_RECTANGLE extension\n" << endl #endif - << " -zoom_tia Use the specified zoom level in emulation mode\n" - << " -zoom_ui Use the specified zoom level in non-emulation mode (ROM browser/debugger)\n" + << " -tia_filter Use the specified filter in emulation mode\n" << " -fullscreen <1|0> Play the game in fullscreen mode\n" - << " -fullres The resolution to use in fullscreen mode\n" + << " -fullres The resolution to use in fullscreen mode\n" << " -center <1|0> Centers game window (if possible)\n" << " -grabmouse <1|0> Keeps the mouse in the game window\n" << " -palette > x; - buf >> y; + buf >> x >> c >> y; + if(c != 'x') + x = y = -1; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/m6502/src/bspf/src/bspf.hxx b/stella/src/emucore/m6502/src/bspf/src/bspf.hxx index 959f486ce..f8f53f617 100644 --- a/stella/src/emucore/m6502/src/bspf/src/bspf.hxx +++ b/stella/src/emucore/m6502/src/bspf/src/bspf.hxx @@ -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: bspf.hxx,v 1.18 2007-09-03 18:37:22 stephena Exp $ +// $Id: bspf.hxx,v 1.19 2008-07-22 14:54:39 stephena Exp $ //============================================================================ #ifndef BSPF_HXX @@ -24,7 +24,7 @@ that need to be defined for different operating systems. @author Bradford W. Mott - @version $Id: bspf.hxx,v 1.18 2007-09-03 18:37:22 stephena Exp $ + @version $Id: bspf.hxx,v 1.19 2008-07-22 14:54:39 stephena Exp $ */ // Types for 8-bit signed and unsigned integers @@ -87,6 +87,12 @@ template inline void BSPF_swap(T &a, T &b) { T tmp = a; a = b; b = t template inline T BSPF_abs (T x) { return (x>=0) ? x : -x; } template inline T BSPF_min (T a, T b) { return (a inline T BSPF_max (T a, T b) { return (a>b) ? a : b; } +inline string BSPF_tolower(const string& s) +{ + string t = s; + transform(t.begin(), t.end(), t.begin(), (int(*)(int)) tolower); + return t; +} static const string EmptyString(""); diff --git a/stella/src/gui/Launcher.cxx b/stella/src/gui/Launcher.cxx index d92314c79..ee6dac662 100644 --- a/stella/src/gui/Launcher.cxx +++ b/stella/src/gui/Launcher.cxx @@ -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: Launcher.cxx,v 1.24 2008-06-19 12:01:31 stephena Exp $ +// $Id: Launcher.cxx,v 1.25 2008-07-22 14:54:39 stephena Exp $ //============================================================================ #include @@ -28,11 +28,19 @@ class Properties; #include "bspf.hxx" #include "Launcher.hxx" +#ifdef SMALL_SCREEN + #define MIN_WIDTH 320 + #define MIN_HEIGHT 240 +#else + #define MIN_WIDTH 640 + #define MIN_HEIGHT 480 +#endif + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Launcher::Launcher(OSystem* osystem) : DialogContainer(osystem), - myWidth(640), - myHeight(480) + myWidth(MIN_WIDTH), + myHeight(MIN_HEIGHT) { int w, h; myOSystem->settings().getSize("launcherres", w, h); @@ -40,9 +48,9 @@ Launcher::Launcher(OSystem* osystem) myHeight = BSPF_max(h, 0); // Error check the resolution - myWidth = BSPF_max(myWidth, 640u); + myWidth = BSPF_max(myWidth, (uInt32)MIN_WIDTH); myWidth = BSPF_min(myWidth, osystem->desktopWidth()); - myHeight = BSPF_max(myHeight, 480u); + myHeight = BSPF_max(myHeight, (uInt32)MIN_HEIGHT); myHeight = BSPF_min(myHeight, osystem->desktopHeight()); myOSystem->settings().setSize("launcherres", myWidth, myHeight); diff --git a/stella/src/gui/VideoDialog.cxx b/stella/src/gui/VideoDialog.cxx index ec59cccd0..9eeaafacc 100644 --- a/stella/src/gui/VideoDialog.cxx +++ b/stella/src/gui/VideoDialog.cxx @@ -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.cxx,v 1.52 2008-06-20 12:19:42 stephena Exp $ +// $Id: VideoDialog.cxx,v 1.53 2008-07-22 14:54:39 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -101,6 +101,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, // Fullscreen resolution items.clear(); + items.push_back("Auto"); for(uInt32 i = 0; i < instance().supportedResolutions().size(); ++i) items.push_back(instance().supportedResolutions()[i].name); myFSResPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, @@ -108,6 +109,18 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, wid.push_back(myFSResPopup); ypos += lineHeight + 4; +#if 0 + // Available TIA filters + items.clear(); + for(uInt32 i = 0; i < instance().frameBuffer().supportedTIAFilters().size(); ++i) + items.push_back(instance().supportedResolutions()[i].name); + myFSResPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, + lineHeight, items, "FS Res: ", lwidth); + wid.push_back(myFSResPopup); + ypos += lineHeight + 4; +#endif + +#if 0 // Available UI zoom levels myUIZoomSlider = new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight, "UI Zoom: ", lwidth, kUIZoomChanged); @@ -118,6 +131,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, ypos + 1, fontWidth * 2, fontHeight, "", kTextAlignLeft); myUIZoomLabel->setFlags(WIDGET_CLEARBG); ypos += lineHeight + 4; +#endif // Available TIA zoom levels myTIAZoomSlider = new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight, @@ -205,8 +219,6 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, myUseVSyncCheckbox->clearFlags(WIDGET_ENABLED); #endif #ifndef WINDOWED_SUPPORT - myUIZoomSlider->clearFlags(WIDGET_ENABLED); - myUIZoomLabel->clearFlags(WIDGET_ENABLED); myTIAZoomSlider->clearFlags(WIDGET_ENABLED); myTIAZoomLabel->clearFlags(WIDGET_ENABLED); myFullscreenCheckbox->clearFlags(WIDGET_ENABLED); @@ -227,19 +239,19 @@ void VideoDialog::loadConfig() int i; // Renderer setting - s = instance().settings().getString("video"); + s = BSPF_tolower(instance().settings().getString("video")); myRendererPopup->clearSelection(); if(s == "soft") myRendererPopup->setSelected(0); else if(s == "gl") myRendererPopup->setSelected(1); // Filter setting - s = instance().settings().getString("gl_filter"); + s = BSPF_tolower(instance().settings().getString("gl_filter")); myFilterPopup->clearSelection(); if(s == "linear") myFilterPopup->setSelected(0); else if(s == "nearest") myFilterPopup->setSelected(1); // GL stretch setting - s = instance().settings().getString("gl_fsmax"); + s = BSPF_tolower(instance().settings().getString("gl_fsmax")); myFSStretchPopup->clearSelection(); if(s == "never") myFSStretchPopup->setSelected(0); else if(s == "ui") myFSStretchPopup->setSelected(1); @@ -247,30 +259,27 @@ void VideoDialog::loadConfig() else if(s == "always") myFSStretchPopup->setSelected(3); // Palette - s = instance().settings().getString("palette"); + s = BSPF_tolower(instance().settings().getString("palette")); myPalettePopup->clearSelection(); if(s == "standard") myPalettePopup->setSelected(0); else if(s == "z26") myPalettePopup->setSelected(1); else if(s == "user") myPalettePopup->setSelected(2); // Fullscreen resolution - s = instance().settings().getString("fullres"); + s = BSPF_tolower(instance().settings().getString("fullres")); myFSResPopup->clearSelection(); - myFSResPopup->setSelected(s); + if(s == "auto") myFSResPopup->setSelected(0); + else myFSResPopup->setSelected(s); if(myFSResPopup->getSelected() < 0) myFSResPopup->setSelectedMax(); - // UI zoom level - s = instance().settings().getString("zoom_ui"); - i = instance().settings().getInt("zoom_ui"); - myUIZoomSlider->setValue(i); - myUIZoomLabel->setLabel(s); - +/* // TIA zoom level s = instance().settings().getString("zoom_tia"); i = instance().settings().getInt("zoom_tia"); myTIAZoomSlider->setValue(i); myTIAZoomLabel->setLabel(s); +*/ // GL aspect ratio setting s = instance().settings().getString("gl_aspect"); @@ -344,10 +353,6 @@ void VideoDialog::saveConfig() s = myFSResPopup->getSelectedString(); instance().settings().setString("fullres", s); - // UI Scaler - s = myUIZoomLabel->getLabel(); - instance().settings().setString("zoom_ui", s); - // TIA Scaler s = myTIAZoomLabel->getLabel(); instance().settings().setString("zoom_tia", s); @@ -394,8 +399,6 @@ void VideoDialog::setDefaults() myFSStretchPopup->setSelected(0); myPalettePopup->setSelected(0); myFSResPopup->setSelectedMax(); - myUIZoomSlider->setValue(2); - myUIZoomLabel->setLabel("2"); myTIAZoomSlider->setValue(2); myTIAZoomLabel->setLabel("2"); myAspectRatioSlider->setValue(100); @@ -436,8 +439,6 @@ void VideoDialog::handleFullscreenChange(bool enable) #ifdef WINDOWED_SUPPORT myFSResPopup->setEnabled(enable); - myUIZoomSlider->setEnabled(!enable); - myUIZoomLabel->setEnabled(!enable); myTIAZoomSlider->setEnabled(!enable); myTIAZoomLabel->setEnabled(!enable); @@ -464,10 +465,6 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd, handleRendererChange(data); break; - case kUIZoomChanged: - myUIZoomLabel->setValue(myUIZoomSlider->getValue()); - break; - case kTIAZoomChanged: myTIAZoomLabel->setValue(myTIAZoomSlider->getValue()); break;