diff --git a/docs/index.html b/docs/index.html
index 8eef38706..00118c262 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1751,12 +1751,6 @@
Enable fullscreen mode. |
-
- FIXSDL-fullres <auto|WxH> |
- Use the given resolution in fullscreen mode. If 'auto', let Stella decide
- which resolution to use. |
-
-
-center <1|0> |
Centers game window (if possible). |
@@ -1822,9 +1816,9 @@
- -tia.filter <filter> |
- Use the specified filter while in TIA/emulation mode. Currently,
- this can be zoomZx, where Z={2..10}. |
+ -tia.zoom <zoom> |
+ Use the specified zoom level (integer) while in TIA/emulation mode.
+ |
@@ -2373,9 +2367,8 @@
Item | Brief description | For more information, see CommandLine |
Renderer (*) | use specified rendering mode (requires restart) | -video |
- TIA Filter | filter for emulation mode | -tia.filter |
+ TIA Zoom | filter for emulation mode | -tia.zoom |
TIA Palette | palette for emulation mode | -palette |
- Fullscrn Res | resolution for fullscreen mode | -fullres |
Timing (*) | how to wait between frames (requires restart) | -timing |
GL Filter | OpenGL filter mode | -gl_filter |
Aspect (N) | Width of TIA image in NTSC mode | -tia.aspectn |
diff --git a/src/common/FrameBufferSDL2.cxx b/src/common/FrameBufferSDL2.cxx
index 9dcf1227d..57e5b21cd 100644
--- a/src/common/FrameBufferSDL2.cxx
+++ b/src/common/FrameBufferSDL2.cxx
@@ -102,7 +102,8 @@ void FrameBufferSDL2::queryHardware(uInt32& w, uInt32& h, VariantList& renderers
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool FrameBufferSDL2::setVideoMode(const string& title, VideoMode& mode, bool full)
+bool FrameBufferSDL2::setVideoMode(const string& title, const VideoMode& mode,
+ bool full)
{
// If not initialized by this point, then immediately fail
if(SDL_WasInit(SDL_INIT_VIDEO) == 0)
@@ -114,61 +115,7 @@ bool FrameBufferSDL2::setVideoMode(const string& title, VideoMode& mode, bool fu
// Grab the initial height before it's updated below
// We need it for the creating the TIA surface
- uInt32 baseHeight = mode.image_h / mode.gfxmode.zoom;
-
- // Aspect ratio and fullscreen stretching only applies to the TIA
- if(inTIAMode)
- {
- // Aspect ratio (depends on whether NTSC or PAL is detected)
- // Not available in 'small' resolutions
- if(myOSystem->desktopWidth() >= 640)
- {
- const string& frate = myOSystem->console().about().InitialFrameRate;
- int aspect =
- myOSystem->settings().getInt(frate == "60" ? "tia.aspectn" : "tia.aspectp");
- mode.image_w = (uInt16)(float(mode.image_w * aspect) / 100.0);
- }
-
- // Fullscreen mode stretching
- if(fullScreen() &&
- (mode.image_w < mode.screen_w) && (mode.image_h < mode.screen_h))
- {
- float stretchFactor = 1.0;
- float scaleX = float(mode.image_w) / mode.screen_w;
- float scaleY = float(mode.image_h) / mode.screen_h;
-
- // Scale to actual or integral factors
- if(myOSystem->settings().getBool("gl_fsscale"))
- {
- // Scale to full (non-integral) available space
- if(scaleX > scaleY)
- stretchFactor = float(mode.screen_w) / mode.image_w;
- else
- stretchFactor = float(mode.screen_h) / mode.image_h;
- }
- else
- {
- // Only scale to an integral amount
- if(scaleX > scaleY)
- {
- int bw = mode.image_w / mode.gfxmode.zoom;
- stretchFactor = float(int(mode.screen_w / bw) * bw) / mode.image_w;
- }
- else
- {
- int bh = mode.image_h / mode.gfxmode.zoom;
- stretchFactor = float(int(mode.screen_h / bh) * bh) / mode.image_h;
- }
- }
- mode.image_w = (Uint16) (stretchFactor * mode.image_w);
- mode.image_h = (Uint16) (stretchFactor * mode.image_h);
- }
- }
-
- // Now re-calculate the dimensions
- if(!fullScreen()) mode.screen_w = mode.image_w;
- mode.image_x = (mode.screen_w - mode.image_w) >> 1;
- mode.image_y = (mode.screen_h - mode.image_h) >> 1;
+ uInt32 baseHeight = mode.image.height() / mode.zoom;
// (Re)create window and renderer
if(myRenderer)
@@ -186,7 +133,7 @@ bool FrameBufferSDL2::setVideoMode(const string& title, VideoMode& mode, bool fu
int pos = myOSystem->settings().getBool("center")
? SDL_WINDOWPOS_CENTERED : SDL_WINDOWPOS_UNDEFINED;
myWindow = SDL_CreateWindow(title.c_str(),
- pos, pos, mode.image_w, mode.image_h,
+ pos, pos, mode.image.width(), mode.image.height(),
0);
if(myWindow == NULL)
{
@@ -230,8 +177,8 @@ bool FrameBufferSDL2::setVideoMode(const string& title, VideoMode& mode, bool fu
if(!myTiaSurface)
myTiaSurface = new FBSurfaceTIA(*this);
- myTiaSurface->updateCoords(baseHeight, mode.image_x, mode.image_y,
- mode.image_w, mode.image_h);
+ myTiaSurface->updateCoords(baseHeight, mode.image.x(), mode.image.y(),
+ mode.image.width(), mode.image.height());
myTiaSurface->enableScanlines(ntscEnabled());
myTiaSurface->setTexInterpolation(myOSystem->settings().getBool("tia.inter"));
@@ -288,17 +235,22 @@ void FrameBufferSDL2::grabMouse(bool grab)
//FIXSDL SDL_WM_GrabInput(grab ? SDL_GRAB_ON : SDL_GRAB_OFF);
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void FrameBufferSDL2::enableFullscreen(bool enable)
+{
+ uInt32 flags = enable ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0;
+ if(SDL_SetWindowFullscreen(myWindow, flags))
+ myOSystem->settings().setValue("fullscreen", enable);
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferSDL2::fullScreen() const
{
-#if 0//FIXSDL
#ifdef WINDOWED_SUPPORT
- return myWindowFlags & SDL_FULLSCREEN;
+ return SDL_GetWindowFlags(myWindow) & SDL_WINDOW_FULLSCREEN_DESKTOP;
#else
return true;
#endif
-#endif
-return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/common/FrameBufferSDL2.hxx b/src/common/FrameBufferSDL2.hxx
index 8ecfaa79d..73616c639 100644
--- a/src/common/FrameBufferSDL2.hxx
+++ b/src/common/FrameBufferSDL2.hxx
@@ -150,7 +150,12 @@ class FrameBufferSDL2 : public FrameBuffer
@return False on any errors, else true
*/
- bool setVideoMode(const string& title, VideoMode& mode, bool full);
+ bool setVideoMode(const string& title, const VideoMode& mode, bool full);
+
+ /**
+ Enables/disables fullscreen mode.
+ */
+ void enableFullscreen(bool enable);
/**
This method is called to invalidate the contents of the entire
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index d49d8d494..8c20bb2ab 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -89,16 +89,9 @@ bool FrameBuffer::initialize()
myDesktopWidth = s.w;
myDesktopHeight = s.h;
}
-
- // Various parts of the codebase assume a minimum screen size of 320x240
- myDesktopWidth = BSPF_max(myDesktopWidth, 320u);
- myDesktopHeight = BSPF_max(myDesktopHeight, 240u);
- if(!(myDesktopWidth >= 320 && myDesktopHeight >= 240))
- {
- myOSystem->logMessage("ERROR: video init failed, "
- "window 320x240 or larger required", 0);
- return false;
- }
+ // Various parts of the codebase assume a minimum screen size
+ myDesktopWidth = BSPF_max(myDesktopWidth, (uInt32)kFBMinW);
+ myDesktopHeight = BSPF_max(myDesktopHeight, (uInt32)kFBMinH);
////////////////////////////////////////////////////////////////////
// Create fonts to draw text
@@ -110,7 +103,8 @@ bool FrameBuffer::initialize()
// We can probably add ifdefs to take care of corner cases,
// but that means we've failed to abstract it enough ...
////////////////////////////////////////////////////////////////////
- bool smallScreen = myDesktopWidth < 640 || myDesktopHeight < 480;
+ bool smallScreen = myDesktopWidth < (uInt32)kFBMinW ||
+ myDesktopHeight < (uInt32)kFBMinH;
// This font is used in a variety of situations when a really small
// font is needed; we let the specific widget/dialog decide when to
@@ -141,6 +135,19 @@ bool FrameBuffer::initialize()
else
myLauncherFont = new GUI::Font(GUI::stellaDesc);
+ // Determine possible TIA windowed zoom levels
+ uInt32 maxZoom = maxWindowSizeForScreen((uInt32)kTIAMinW, (uInt32)kTIAMinH,
+ myDesktopWidth, myDesktopHeight);
+
+ // Figure our the smallest zoom level we can use
+ uInt32 firstZoom = smallScreen ? 1 : 2;
+ for(uInt32 zoom = firstZoom; zoom <= maxZoom; ++zoom)
+ {
+ ostringstream desc;
+ desc << "Zoom " << zoom << "x";
+ myTIAZoomLevels.push_back(desc.str(), zoom);
+ }
+
return true;
}
@@ -162,12 +169,13 @@ FBInitStatus FrameBuffer::createDisplay(const string& title,
bool useFullscreen = false;
#ifdef WINDOWED_SUPPORT
- // We assume that a desktop size of at least 640x480 means that we're
- // running on a 'large' system, and the window size requirements can
- // be relaxed
+ // We assume that a desktop of at least minimum acceptable size means that
+ // we're running on a 'large' system, and the window size requirements
+ // can be relaxed
// Otherwise, we treat the system as if WINDOWED_SUPPORT is not defined
- if(myOSystem->desktopWidth() < 640 && myOSystem->desktopHeight() < 480 &&
- (myOSystem->desktopWidth() < width || myOSystem->desktopHeight() < height))
+ if(myOSystem->desktopWidth() < (uInt32)kFBMinW &&
+ myOSystem->desktopHeight() < (uInt32)kFBMinH &&
+ (myOSystem->desktopWidth() < width || myOSystem->desktopHeight() < height))
return kFailTooLarge;
if(myOSystem->settings().getString("fullscreen") == "1")
@@ -192,22 +200,15 @@ FBInitStatus FrameBuffer::createDisplay(const string& title,
// Initialize video subsystem (make sure we get a valid mode)
string pre_about = about();
- VideoMode mode = getSavedVidMode();
- if(width <= mode.screen_w && height <= mode.screen_h)
+ const VideoMode& mode = getSavedVidMode(useFullscreen);
+ myImageRect = mode.image;
+ myScreenSize = mode.screen;
+ if(width <= myScreenSize.w && height <= myScreenSize.h)
{
if(setVideoMode(title, mode, useFullscreen))
{
- myImageRect.setWidth(mode.image_w);
- myImageRect.setHeight(mode.image_h);
- myImageRect.moveTo(mode.image_x, mode.image_y);
-
- myScreenRect.setWidth(mode.screen_w);
- myScreenRect.setHeight(mode.screen_h);
-
// Did we get the requested fullscreen state?
- const string& fullscreen = myOSystem->settings().getString("fullscreen");
- if(fullscreen != "-1")
- myOSystem->settings().setValue("fullscreen", fullScreen() ? "1" : "0");
+ myOSystem->settings().setValue("fullscreen", fullScreen());
setCursorState();
}
else
@@ -234,7 +235,7 @@ FBInitStatus FrameBuffer::createDisplay(const string& title,
}
if(myMsg.surface == NULL)
{
- uInt32 surfaceID = allocateSurface(640, font().getFontHeight()+10);
+ uInt32 surfaceID = allocateSurface((uInt32)kFBMinW, font().getFontHeight()+10);
myMsg.surface = surface(surfaceID);
}
@@ -743,15 +744,14 @@ void FrameBuffer::stateChanged(EventHandler::State state)
myRedrawEntireFrame = true;
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::toggleFullscreen()
-{
- setFullscreen(!fullScreen());
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::setFullscreen(bool enable)
{
+cerr << "setFullscreen: " << enable << endl;
+enableFullscreen(enable);
+
+
+
#if 0 //FIXSDL
#ifdef WINDOWED_SUPPORT
// '-1' means fullscreen mode is completely disabled
@@ -769,9 +769,16 @@ void FrameBuffer::setFullscreen(bool enable)
#endif
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void FrameBuffer::toggleFullscreen()
+{
+ setFullscreen(!fullScreen());
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBuffer::changeVidMode(int direction)
{
+cerr << "changeVidMode: " << direction << endl;
#if 0 //FIXSDL
EventHandler::State state = myOSystem->eventHandler().state();
bool inUIMode = (state == EventHandler::S_DEBUGGER ||
@@ -862,28 +869,6 @@ uInt8 FrameBuffer::getPhosphor(uInt8 c1, uInt8 c2) const
return ((c1 - c2) * myPhosphorBlend)/100 + c2;
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-const VariantList& FrameBuffer::supportedTIAFilters()
-{
- uInt32 max_zoom = maxWindowSizeForScreen(320, 210,
- myOSystem->desktopWidth(), myOSystem->desktopHeight());
-
- uInt32 firstmode = 1;
- if(myOSystem->desktopWidth() < 640 || myOSystem->desktopHeight() < 480)
- firstmode = 0;
-
- myTIAFilters.clear();
- for(uInt32 i = firstmode; i < GFX_NumModes; ++i)
- {
- if(ourGraphicsModes[i].zoom <= max_zoom)
- {
- myTIAFilters.push_back(ourGraphicsModes[i].description,
- ourGraphicsModes[i].name);
- }
- }
- return myTIAFilters;
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 FrameBuffer::maxWindowSizeForScreen(uInt32 baseWidth, uInt32 baseHeight,
uInt32 screenWidth, uInt32 screenHeight)
@@ -906,101 +891,74 @@ uInt32 FrameBuffer::maxWindowSizeForScreen(uInt32 baseWidth, uInt32 baseHeight,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
{
- // Modelists are different depending on what state we're in
- EventHandler::State state = myOSystem->eventHandler().state();
- bool inUIMode = (state == EventHandler::S_DEBUGGER ||
- state == EventHandler::S_LAUNCHER);
-
myWindowedModeList.clear();
myFullscreenModeList.clear();
- // In UI/windowed mode, there's only one valid video mode we can use
- // We don't use maxWindowSizeForScreen here, since UI mode has to open its
- // window at the requested size
- if(inUIMode)
- {
- VideoMode m;
- m.image_x = m.image_y = 0;
- m.image_w = m.screen_w = baseWidth;
- m.image_h = m.screen_h = baseHeight;
- m.gfxmode = ourGraphicsModes[0]; // this should be zoom1x
+ // Check if zooming is allowed for this state (currently only allowed
+ // for TIA screens)
+ EventHandler::State state = myOSystem->eventHandler().state();
+ bool tiaMode = (state != EventHandler::S_DEBUGGER &&
+ state != EventHandler::S_LAUNCHER);
- addVidMode(m);
- }
- else
+ // TIA mode allows zooming at integral factors in windowed modes,
+ // and also non-integral factors in fullscreen mode
+ if(tiaMode)
{
- // Scan list of filters, adding only those which are appropriate
- // for the given dimensions
- uInt32 max_zoom = maxWindowSizeForScreen(baseWidth, baseHeight,
- myOSystem->desktopWidth(), myOSystem->desktopHeight());
+ // TIA windowed modes
+ uInt32 maxZoom = maxWindowSizeForScreen(baseWidth, baseHeight,
+ myDesktopWidth, myDesktopHeight);
+
+ // Aspect ratio
+ bool ntsc = myOSystem->console().about().InitialFrameRate == "60";
+ uInt32 aspect = myOSystem->settings().getInt(ntsc ?
+ "tia.aspectn" : "tia.aspectp");
// Figure our the smallest zoom level we can use
- uInt32 firstmode = 1;
- if(myOSystem->desktopWidth() < 640 || myOSystem->desktopHeight() < 480)
- firstmode = 0;
-
- for(uInt32 i = firstmode; i < GFX_NumModes; ++i)
+ uInt32 firstZoom = 2;
+ if(myDesktopWidth < 640 || myDesktopHeight < 480)
+ firstZoom = 1;
+ for(uInt32 zoom = firstZoom; zoom <= maxZoom; ++zoom)
{
- uInt32 zoom = ourGraphicsModes[i].zoom;
- if(zoom <= max_zoom)
- {
- VideoMode m;
- m.image_x = m.image_y = 0;
- m.image_w = m.screen_w = baseWidth * zoom;
- m.image_h = m.screen_h = baseHeight * zoom;
- m.gfxmode = ourGraphicsModes[i];
-
- addVidMode(m);
- }
+ ostringstream desc;
+ desc << "Zoom " << zoom << "x";
+
+ VideoMode mode(baseWidth*zoom, baseHeight*zoom,
+ baseWidth*zoom, baseHeight*zoom, false, zoom, desc.str());
+ mode.applyAspectCorrection(aspect);
+ myWindowedModeList.add(mode);
}
+
+ // TIA fullscreen mode
+ // GUI::Size screen(myDesktopWidth, myDesktopHeight);
+ myFullscreenModeList.add(
+ VideoMode(baseWidth, baseHeight, myDesktopWidth, myDesktopHeight, true)
+ );
+
}
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::addVidMode(VideoMode& mode)
-{
- // The are minimum size requirements on a screen, no matter is in fullscreen
- // or windowed mode
- // Various part of the UI system depend on having at least 320x240 pixels
- // available, so we must enforce it here
-
- // Windowed modes can be sized exactly as required, since there's normally
- // no restriction on window size (between the minimum and maximum size)
- mode.screen_w = BSPF_max(mode.screen_w, 320u);
- mode.screen_h = BSPF_max(mode.screen_h, 240u);
- mode.image_x = (mode.screen_w - mode.image_w) >> 1;
- 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
- // we want, so we need to calculate image offsets
- for(uInt32 i = 0; i < myResolutions.size(); ++i)
+ else // UI mode
{
- if(mode.screen_w <= myResolutions[i].width &&
- mode.screen_h <= myResolutions[i].height)
- {
- // Auto-calculate 'smart' centering; platform-specific framebuffers are
- // free to ignore or augment it
- mode.screen_w = BSPF_max(myResolutions[i].width, 320u);
- mode.screen_h = BSPF_max(myResolutions[i].height, 240u);
- mode.image_x = (mode.screen_w - mode.image_w) >> 1;
- mode.image_y = (mode.screen_h - mode.image_h) >> 1;
- break;
- }
+ // Windowed and fullscreen mode differ only in screen size
+ myWindowedModeList.add(
+ VideoMode(baseWidth, baseHeight, baseWidth, baseHeight, false)
+ );
+ myFullscreenModeList.add(
+ VideoMode(baseWidth, baseHeight, myDesktopWidth, myDesktopHeight, true)
+ );
}
-#endif
- myFullscreenModeList.add(mode);
+
+cerr << "Windowed modes:\n" << myWindowedModeList << endl
+ << "Fullscreen modes:\n" << myFullscreenModeList << endl
+ << endl;
+
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-FrameBuffer::VideoMode FrameBuffer::getSavedVidMode()
+const FrameBuffer::VideoMode& FrameBuffer::getSavedVidMode(bool fullscreen)
{
+cerr << "getSavedVidMode(full=" << fullscreen << ")\n";
EventHandler::State state = myOSystem->eventHandler().state();
- if(fullScreen())
+ if(fullscreen)
myCurrentModeList = &myFullscreenModeList;
else
myCurrentModeList = &myWindowedModeList;
@@ -1009,18 +967,108 @@ FrameBuffer::VideoMode FrameBuffer::getSavedVidMode()
// UI modes (launcher and debugger) have only one supported resolution
// so the 'current' one is the only valid one
if(state == EventHandler::S_DEBUGGER || state == EventHandler::S_LAUNCHER)
+ myCurrentModeList->setZoom(1);
+ else
+ myCurrentModeList->setZoom(myOSystem->settings().getInt("tia.zoom"));
+
+ return myCurrentModeList->current();
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+//
+// VideoMode implementation
+//
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+FrameBuffer::VideoMode::VideoMode()
+ : fullscreen(false),
+ zoom(1),
+ description("")
+{
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+FrameBuffer::VideoMode::VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
+ bool full, uInt32 z, const string& desc)
+ : fullscreen(full),
+ zoom(z),
+ description(desc)
+{
+ sw = BSPF_max(sw, (uInt32)FrameBuffer::kTIAMinW);
+ sh = BSPF_max(sh, (uInt32)FrameBuffer::kTIAMinH);
+ iw = BSPF_min(iw, sw);
+ ih = BSPF_min(ih, sh);
+ int ix = (sw - iw) >> 1;
+ int iy = (sh - ih) >> 1;
+ image = GUI::Rect(ix, iy, ix+iw, iy+ih);
+ screen = GUI::Size(sw, sh);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void FrameBuffer::VideoMode::applyAspectCorrection(uInt32 aspect, uInt32 stretch)
+{
+ // Width is modified by aspect ratio; other factors may be applied below
+ uInt32 iw = (uInt32)(float(image.width() * aspect) / 100.0);
+ uInt32 ih = image.height();
+
+ if(stretch)
{
- myCurrentModeList->setByGfxMode(GFX_Zoom1x);
+#if 0
+ // Fullscreen mode stretching
+ if(fullScreen() &&
+ (mode.image_w < mode.screen_w) && (mode.image_h < mode.screen_h))
+ {
+ float stretchFactor = 1.0;
+ float scaleX = float(mode.image_w) / mode.screen_w;
+ float scaleY = float(mode.image_h) / mode.screen_h;
+
+ // Scale to actual or integral factors
+ if(myOSystem->settings().getBool("gl_fsscale"))
+ {
+ // Scale to full (non-integral) available space
+ if(scaleX > scaleY)
+ stretchFactor = float(mode.screen_w) / mode.image_w;
+ else
+ stretchFactor = float(mode.screen_h) / mode.image_h;
+ }
+ else
+ {
+ // Only scale to an integral amount
+ if(scaleX > scaleY)
+ {
+ int bw = mode.image_w / mode.gfxmode.zoom;
+ stretchFactor = float(int(mode.screen_w / bw) * bw) / mode.image_w;
+ }
+ else
+ {
+ int bh = mode.image_h / mode.gfxmode.zoom;
+ stretchFactor = float(int(mode.screen_h / bh) * bh) / mode.image_h;
+ }
+ }
+ mode.image_w = (Uint16) (stretchFactor * mode.image_w);
+ mode.image_h = (Uint16) (stretchFactor * mode.image_h);
+ }
+#endif
}
else
{
- const string& name = myOSystem->settings().getString("tia.filter");
- myCurrentModeList->setByGfxMode(name);
+ // In non-stretch mode, the screen size changes to match the image width
+ // Height is never modified in this mode
+ screen.w = iw;
}
- return myCurrentModeList->current(myOSystem->settings(), fullScreen());
+ // Now re-calculate the dimensions
+ iw = BSPF_min(iw, (uInt32)screen.w);
+ ih = BSPF_min(ih, (uInt32)screen.h);
+
+ image.moveTo((screen.w - iw) >> 1, (screen.h - ih) >> 1);
+ image.setWidth(iw);
+ image.setHeight(ih);
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+//
+// VideoModeList implementation
+//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBuffer::VideoModeList::VideoModeList()
: myIdx(-1)
@@ -1034,7 +1082,7 @@ FrameBuffer::VideoModeList::~VideoModeList()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::VideoModeList::add(VideoMode mode)
+void FrameBuffer::VideoModeList::add(const VideoMode& mode)
{
myModeList.push_back(mode);
}
@@ -1065,32 +1113,8 @@ void FrameBuffer::VideoModeList::previous()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-const FrameBuffer::VideoMode FrameBuffer::
- VideoModeList::current(const Settings& settings, bool isFullscreen) const
+const FrameBuffer::VideoMode& FrameBuffer::VideoModeList::current() 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(isFullscreen && !BSPF_equalsIgnoreCase(settings.getString("fullres"), "auto"))
- {
- // Only use 'fullres' if it's *bigger* than the requested mode
- const GUI::Size& s = settings.getSize("fullres");
-
- if(s.w != -1 && s.h != -1 && (uInt32)s.w >= myModeList[myIdx].screen_w &&
- (uInt32)s.h >= myModeList[myIdx].screen_h)
- {
- VideoMode mode = myModeList[myIdx];
- mode.screen_w = s.w;
- mode.screen_h = s.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];
}
@@ -1101,116 +1125,23 @@ void FrameBuffer::VideoModeList::next()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::VideoModeList::setByGfxMode(GfxID id)
+void FrameBuffer::VideoModeList::setZoom(uInt32 zoom)
{
- // First we determine which graphics mode is being requested
- bool found = false;
- GraphicsMode gfxmode;
- for(uInt32 i = 0; i < GFX_NumModes; ++i)
+ for(uInt32 i = 0; i < myModeList.size(); ++i)
{
- if(ourGraphicsModes[i].type == id)
- {
- gfxmode = ourGraphicsModes[i];
- found = true;
- break;
- }
- }
- if(!found) gfxmode = ourGraphicsModes[0];
-
- // Now we scan the list for the applicable video mode
- set(gfxmode);
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::VideoModeList::setByGfxMode(const string& name)
-{
- // First we determine which graphics mode is being requested
- bool found = false;
- GraphicsMode gfxmode;
- for(uInt32 i = 0; i < GFX_NumModes; ++i)
- {
- if(BSPF_equalsIgnoreCase(ourGraphicsModes[i].name, name) ||
- BSPF_equalsIgnoreCase(ourGraphicsModes[i].description, name))
- {
- gfxmode = ourGraphicsModes[i];
- found = true;
- break;
- }
- }
- if(!found) gfxmode = ourGraphicsModes[0];
-
- // Now we scan the list for the applicable video mode
- set(gfxmode);
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::VideoModeList::set(const GraphicsMode& gfxmode)
-{
- // Attempt to point the current mode to the one given
- myIdx = -1;
-
- // First search for the given gfx id
- for(unsigned int i = 0; i < myModeList.size(); ++i)
- {
- if(myModeList[i].gfxmode.type == gfxmode.type)
+ if(myModeList[i].zoom == zoom)
{
myIdx = i;
return;
}
}
-
- // If we get here, then the gfx type couldn't be found, so we search
- // for the first mode with the same zoomlevel (making sure that the
- // requested mode can fit inside the current screen)
- if(gfxmode.zoom > myModeList[myModeList.size()-1].gfxmode.zoom)
- {
- myIdx = myModeList.size()-1;
- return;
- }
- else
- {
- for(unsigned int i = 0; i < myModeList.size(); ++i)
- {
- if(myModeList[i].gfxmode.zoom == gfxmode.zoom)
- {
- myIdx = i;
- return;
- }
- }
- }
-
- // Finally, just pick the lowest video mode
myIdx = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::VideoModeList::print()
-{
- cerr << "VideoModeList: " << endl << endl;
- for(Common::Array::const_iterator i = myModeList.begin();
- i != myModeList.end(); ++i)
- {
- cerr << " Mode " << i << endl;
- print(*i);
- }
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::VideoModeList::print(const VideoMode& mode)
-{
- cerr << " screen w = " << mode.screen_w << endl
- << " screen h = " << mode.screen_h << endl
- << " image x = " << mode.image_x << endl
- << " image y = " << mode.image_y << endl
- << " image w = " << mode.image_w << endl
- << " image h = " << mode.image_h << endl
- << " gfx id = " << mode.gfxmode.type << endl
- << " gfx name = " << mode.gfxmode.name << endl
- << " gfx desc = " << mode.gfxmode.description << endl
- << " gfx zoom = " << mode.gfxmode.zoom << endl
- << endl;
-}
-
+//
+// FBSurface implementation
+//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurface::box(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
uInt32 colorA, uInt32 colorB)
@@ -1338,20 +1269,6 @@ void FBSurface::drawString(const GUI::Font& font, const string& s,
}
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-FrameBuffer::GraphicsMode FrameBuffer::ourGraphicsModes[GFX_NumModes] = {
- { 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 }
-};
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*
Palette is defined as follows:
diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx
index 4d9107e31..3b2a7dbe9 100644
--- a/src/emucore/FrameBuffer.hxx
+++ b/src/emucore/FrameBuffer.hxx
@@ -29,7 +29,6 @@ class Settings;
namespace GUI {
class Font;
- struct Rect;
}
#include "EventHandler.hxx"
@@ -101,6 +100,11 @@ enum {
class FrameBuffer
{
public:
+ enum {
+ kTIAMinW = 320u, kTIAMinH = 210u,
+ kFBMinW = 640u, kFBMinH = 480u
+ };
+
/**
Creates a new Frame Buffer
*/
@@ -193,7 +197,7 @@ class FrameBuffer
This is the entire area containing the framebuffer image as well as any
'unusable' area.
*/
- const GUI::Rect& screenRect() const { return myScreenRect; }
+ const GUI::Size& screenSize() const { return myScreenSize; }
/**
Get the maximum dimensions of a window for the framebuffer hardware.
@@ -222,20 +226,16 @@ class FrameBuffer
*/
void refresh();
- /**
- Toggles between fullscreen and window mode.
- Grabmouse activated when in fullscreen mode.
- */
- void toggleFullscreen();
-
/**
Enables/disables fullscreen mode.
- Grabmouse activated when in fullscreen mode.
-
- @param enable Set the fullscreen mode to this value
*/
void setFullscreen(bool enable);
+ /**
+ Toggles between fullscreen and window mode.
+ */
+ void toggleFullscreen();
+
/**
This method is called when the user wants to switch to the next available
video mode (functionality depends on fullscreen or windowed mode).
@@ -260,9 +260,9 @@ class FrameBuffer
void toggleGrabMouse();
/**
- Get the supported TIA filters for the framebuffer.
+ Get the supported TIA zoom levels (windowed mode) for the framebuffer.
*/
- const VariantList& supportedTIAFilters();
+ const VariantList& supportedTIAZoomLevels() { return myTIAZoomLevels; }
/**
Get the TIA pixel associated with the given TIA buffer index,
@@ -375,47 +375,35 @@ class FrameBuffer
virtual void scanline(uInt32 row, uInt8* data) const = 0;
protected:
- // Different types of graphic filters to apply to the TIA image
- enum GfxID {
- GFX_Zoom1x,
- GFX_Zoom2x,
- GFX_Zoom3x,
- GFX_Zoom4x,
- GFX_Zoom5x,
- GFX_Zoom6x,
- GFX_Zoom7x,
- GFX_Zoom8x,
- GFX_Zoom9x,
- GFX_Zoom10x,
- GFX_NumModes
- };
-
- struct GraphicsMode {
- GfxID type;
- const char* name;
- const char* description;
- uInt32 zoom;
- };
-
// Contains all relevant info for the dimensions of a video screen
// Also takes care of the case when the image should be 'centered'
- // within the given screen
- // image_XXX are the image offsets into the screen
- // screen_XXX are the dimensions of the screen itself
- // Also contains relevant info for the graphics mode/filter to use
- // when rendering the image
- struct VideoMode {
- uInt32 image_x, image_y, image_w, image_h;
- uInt32 screen_w, screen_h;
- GraphicsMode gfxmode;
+ // within the given screen:
+ // 'image' is the image dimensions into the screen
+ // 'screen' are the dimensions of the screen itself
+ class VideoMode {
+ friend class FrameBuffer;
+ public:
+ GUI::Rect image;
+ GUI::Size screen;
+ bool fullscreen;
+ uInt32 zoom;
+ string description;
+
+ public:
+ VideoMode();
+ VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, bool full,
+ uInt32 z = 1, const string& desc = "");
+
friend ostream& operator<<(ostream& os, const VideoMode& vm)
{
- os << "image_x=" << vm.image_x << " image_y=" << vm.image_y
- << " image_w=" << vm.image_w << " image_h=" << vm.image_h << endl
- << "screen_w=" << vm.screen_w << " screen_h=" << vm.screen_h;
+ os << "image=" << vm.image << " screen=" << vm.screen << endl
+ << "desc=" << vm.description << " zoom=" << vm.zoom;
return os;
}
+
+ private:
+ void applyAspectCorrection(uInt32 aspect, uInt32 stretch = false);
};
/**
@@ -434,7 +422,14 @@ class FrameBuffer
@return False on any errors, else true
*/
- virtual bool setVideoMode(const string& title, VideoMode& mode, bool full) = 0;
+ virtual bool setVideoMode(const string& title, const VideoMode& mode, bool full) = 0;
+
+ /**
+ Enables/disables fullscreen mode.
+
+ @param enable Set the fullscreen mode to this value
+ */
+ virtual void enableFullscreen(bool enable) = 0;
/**
This method is called to invalidate the contents of the entire
@@ -515,8 +510,8 @@ class FrameBuffer
Uint32 myDefPalette[256+kNumColors];
Uint32 myAvgPalette[256][256];
- // Names of the TIA filters that can be used for this framebuffer
- VariantList myTIAFilters;
+ // Names of the TIA zoom levels that can be used for this framebuffer
+ VariantList myTIAZoomLevels;
private:
/**
@@ -531,25 +526,26 @@ class FrameBuffer
uInt32 maxWindowSizeForScreen(uInt32 baseWidth, uInt32 baseHeight,
uInt32 screenWidth, uInt32 screenHeight);
+ /**
+ Determine all supported (windowed) TIA zoom levels for the current
+ framebuffer. This will take into account any aspect ratio correction.
+ */
+ void setTIAZoomLevels(uInt32 basewidth, uInt32 baseheight);
+
/**
Set all possible video modes (both windowed and fullscreen) available for
this framebuffer based on given image dimensions and maximum window size.
*/
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.
- @return A valid VideoMode for this framebuffer
+ @param full Whether to use a windowed or fullscreen mode
+ @return A valid VideoMode for this framebuffer
*/
- VideoMode getSavedVidMode();
+ const VideoMode& getSavedVidMode(bool fullscreen);
/**
Set up the user interface palette for a screen of any depth > 8.
@@ -566,24 +562,25 @@ class FrameBuffer
VideoModeList();
~VideoModeList();
- void add(VideoMode mode);
+ void add(const VideoMode& mode);
void clear();
bool isEmpty() const;
uInt32 size() const;
void previous();
- const FrameBuffer::VideoMode current(const Settings& settings,
- bool isFullscreen) const;
+ const FrameBuffer::VideoMode& current() const;
void next();
- void setByGfxMode(GfxID id);
- void setByGfxMode(const string& name);
- void print();
- static void print(const VideoMode& mode);
+ void setZoom(uInt32 zoom);
- private:
- void set(const GraphicsMode& gfxmode);
+ friend ostream& operator<<(ostream& os, const VideoModeList& l)
+ {
+ for(Common::Array::const_iterator i = l.myModeList.begin();
+ i != l.myModeList.end(); ++i)
+ os << "-----\n" << *i << endl << "-----\n";
+ return os;
+ }
private:
Common::Array myModeList;
@@ -602,7 +599,7 @@ class FrameBuffer
GUI::Rect myImageRect;
// Dimensions of the main window (not always the same as the image)
- GUI::Rect myScreenRect;
+ GUI::Size myScreenSize;
// Maximum dimensions of the desktop area
uInt32 myDesktopWidth, myDesktopHeight;
@@ -644,9 +641,6 @@ class FrameBuffer
// Holds a reference to all the surfaces that have been created
map mySurfaceList;
- // Holds static strings for the remap menu (emulation and menu events)
- static GraphicsMode ourGraphicsModes[GFX_NumModes];
-
// Holds UI palette data
static uInt32 ourGUIColors[kNumColors-256];
};
diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx
index a6393bfd2..e204ae606 100644
--- a/src/emucore/Settings.cxx
+++ b/src/emucore/Settings.cxx
@@ -40,8 +40,7 @@ Settings::Settings(OSystem* osystem)
// Video-related options
setInternal("video", "");
setInternal("vsync", "true");
- setInternal("fullscreen", "0");
- setInternal("fullres", "auto");
+ setInternal("fullscreen", "false");
setInternal("center", "false");
setInternal("grabmouse", "true");
setInternal("palette", "standard");
@@ -50,7 +49,7 @@ Settings::Settings(OSystem* osystem)
setInternal("uimessages", "true");
// TIA specific options
- setInternal("tia.filter", "zoom2x");
+ setInternal("tia.zoom", "2");
setInternal("tia.inter", "false");
setInternal("tia.aspectn", "90");
setInternal("tia.aspectp", "100");
@@ -351,7 +350,6 @@ void Settings::usage()
<< endl
<< " -vsync <1|0> Enable 'synchronize to vertical blank interrupt'\n"
<< " -fullscreen <1|0> Enable fullscreen mode\n"
- << "FIXSDL -fullres The resolution to use in fullscreen mode\n"
<< " -center <1|0> Centers game window (if possible)\n"
<< " -palette Set the volume (0 - 100)\n"
<< endl
#endif
- << " -tia.filter Use the specified filter for TIA image\n"
+ << " -tia.zoom Use the specified zoom level (windowed mode) for TIA image\n"
<< " -tia.inter <1|0> Enable interpolated (smooth) scaling for TIA image\n"
<< " -tia.aspectn Scale the TIA width by the given percentage in NTSC mode\n"
<< " -tia.aspectp Scale the TIA width by the given percentage in PAL mode\n"
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 9a5e9bf21..b0c13d923 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -119,9 +119,9 @@ void Dialog::center()
{
if(_surface)
{
- const GUI::Rect& screen = instance().frameBuffer().screenRect();
- uInt32 x = (screen.width() - getWidth()) >> 1;
- uInt32 y = (screen.height() - getHeight()) >> 1;
+ const GUI::Size& screen = instance().frameBuffer().screenSize();
+ uInt32 x = (screen.w - getWidth()) >> 1;
+ uInt32 y = (screen.h - getHeight()) >> 1;
_surface->setPos(x, y);
}
}
diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx
index 72d0516d6..9d0e38e99 100644
--- a/src/gui/DialogContainer.cxx
+++ b/src/gui/DialogContainer.cxx
@@ -114,8 +114,8 @@ void DialogContainer::draw(bool full)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DialogContainer::addDialog(Dialog* d)
{
- const GUI::Rect& screen = myOSystem->frameBuffer().screenRect();
- assert(d->getWidth() <= screen.width() && d->getHeight() <= screen.height());
+ const GUI::Size& screen = myOSystem->frameBuffer().screenSize();
+ assert(d->getWidth() <= screen.w && d->getHeight() <= screen.h);
myDialogStack.push(d);
}
diff --git a/src/gui/Rect.hxx b/src/gui/Rect.hxx
index b9fc348c5..b81ed0133 100644
--- a/src/gui/Rect.hxx
+++ b/src/gui/Rect.hxx
@@ -108,6 +108,7 @@ struct Rect
Rect() : top(0), left(0), bottom(0), right(0) {}
Rect(int w, int h) : top(0), left(0), bottom(h), right(w) {}
+ Rect(const Point& p, int w, int h) : top(p.y), left(p.x), bottom(h), right(w) {}
Rect(int x1, int y1, int x2, int y2) : top(y1), left(x1), bottom(y2), right(x2)
{
assert(isValidRect());
@@ -121,7 +122,7 @@ struct Rect
int height() const { return bottom - top; }
Size size() const { return Size(width(), height()); }
- void setWidth(int aWidth) { right = left + aWidth; }
+ void setWidth(int aWidth) { right = left + aWidth; }
void setHeight(int aHeight) { bottom = top + aHeight; }
void setSize(const Size& size) { setWidth(size.w); setHeight(size.h); }
@@ -210,7 +211,7 @@ struct Rect
}
friend ostream& operator<<(ostream& os, const Rect& r) {
- os << "Point: " << r.point() << ", Size: " << r.size();
+ os << r.point() << "," << r.size();
return os;
}
};
diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx
index c7fa88272..e0449a112 100644
--- a/src/gui/VideoDialog.cxx
+++ b/src/gui/VideoDialog.cxx
@@ -76,9 +76,9 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
// TIA filters (will be dynamically filled later)
items.clear();
- myTIAFilter = new PopUpWidget(myTab, font, xpos, ypos, pwidth,
- lineHeight, items, "TIA Filter: ", lwidth);
- wid.push_back(myTIAFilter);
+ myTIAZoom = new PopUpWidget(myTab, font, xpos, ypos, pwidth,
+ lineHeight, items, "TIA Zoom: ", lwidth);
+ wid.push_back(myTIAZoom);
ypos += lineHeight + 4;
// TIA Palette
@@ -109,7 +109,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
wid.push_back(myFrameTiming);
ypos += lineHeight + 4;
- // GL aspect ratio (NTSC mode)
+ // Aspect ratio (NTSC mode)
myNAspectRatio =
new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"NTSC Aspect: ", lwidth, kNAspectRatioChanged);
@@ -121,7 +121,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
myNAspectRatioLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + 4;
- // GL aspect ratio (PAL mode)
+ // Aspect ratio (PAL mode)
myPAspectRatio =
new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"PAL Aspect: ", lwidth, kPAspectRatioChanged);
@@ -157,24 +157,16 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
ypos = 10;
// Fullscreen
- items.clear();
- items.push_back("On", "1");
- items.push_back("Off", "0");
- items.push_back("Never", "-1");
- lwidth = font.getStringWidth("Fullscreen: ");
- pwidth = font.getStringWidth("Never"),
- myFullscreen =
- new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
- items, "Fullscreen: ", lwidth, kFullScrChanged);
+ myFullscreen = new CheckboxWidget(myTab, font, xpos, ypos, "Fullscreen");
wid.push_back(myFullscreen);
ypos += lineHeight + 4;
- // GL FS stretch
- myGLStretch = new CheckboxWidget(myTab, font, xpos, ypos, "GL FS Stretch");
- wid.push_back(myGLStretch);
+ // FS stretch
+ myUseStretch = new CheckboxWidget(myTab, font, xpos, ypos, "FS Stretch");
+ wid.push_back(myUseStretch);
ypos += lineHeight + 4;
- // Use sync to vblank in OpenGL
+ // Use sync to vblank
myUseVSync = new CheckboxWidget(myTab, font, xpos, ypos, "VSync");
wid.push_back(myUseVSync);
ypos += lineHeight + 4;
@@ -328,10 +320,10 @@ void VideoDialog::loadConfig()
// 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();
- myTIAFilter->addItems(items);
- myTIAFilter->setSelected(instance().settings().getString("tia.filter"),
- instance().desktopWidth() < 640 ? "zoom1x" : "zoom2x");
+ const VariantList& items = instance().frameBuffer().supportedTIAZoomLevels();
+ myTIAZoom->addItems(items);
+ myTIAZoom->setSelected(instance().settings().getString("tia.zoom"),
+ instance().desktopWidth() < 640 ? "1" : "2");
// TIA Palette
myTIAPalette->setSelected(
@@ -359,19 +351,17 @@ void VideoDialog::loadConfig()
instance().settings().getString("framerate"));
// Fullscreen
- const string& fullscreen = instance().settings().getString("fullscreen");
- myFullscreen->setSelected(fullscreen, "0");
- handleFullscreenChange(fullscreen == "0" || fullscreen == "1");
+ myFullscreen->setState(instance().settings().getBool("fullscreen"));
- // PAL color-loss effect
- myColorLoss->setState(instance().settings().getBool("colorloss"));
-
- // GL stretch setting (GL mode only)
- myGLStretch->setState(instance().settings().getBool("gl_fsscale"));
+ // Fullscreen stretch setting
+ myUseStretch->setState(instance().settings().getBool("tia.fs_stretch"));
// Use sync to vertical blank
myUseVSync->setState(instance().settings().getBool("vsync"));
+ // PAL color-loss effect
+ myColorLoss->setState(instance().settings().getBool("colorloss"));
+
// Show UI messages
myUIMessages->setState(instance().settings().getBool("uimessages"));
@@ -406,8 +396,8 @@ void VideoDialog::saveConfig()
myRenderer->getSelectedTag().toString());
// TIA Filter
- instance().settings().setValue("tia.filter",
- myTIAFilter->getSelectedTag().toString());
+ instance().settings().setValue("tia.zoom",
+ myTIAZoom->getSelectedTag().toString());
// TIA Palette
instance().settings().setValue("palette",
@@ -417,11 +407,11 @@ void VideoDialog::saveConfig()
instance().settings().setValue("timing",
myFrameTiming->getSelectedTag().toString());
- // GL Filter setting
+ // TIA interpolation
instance().settings().setValue("tia.inter",
myTIAInterpolate->getSelectedTag().toString() == "linear" ? true : false);
- // GL aspect ratio setting (NTSC and PAL)
+ // Aspect ratio setting (NTSC and PAL)
instance().settings().setValue("tia.aspectn", myNAspectRatioLabel->getLabel());
instance().settings().setValue("tia.aspectp", myPAspectRatioLabel->getLabel());
@@ -436,18 +426,17 @@ void VideoDialog::saveConfig()
}
// Fullscreen
- instance().settings().setValue("fullscreen",
- myFullscreen->getSelectedTag().toString());
+ instance().settings().setValue("fullscreen", myFullscreen->getState());
// PAL color-loss effect
instance().settings().setValue("colorloss", myColorLoss->getState());
if(&instance().console())
instance().console().toggleColorLoss(myColorLoss->getState());
- // GL stretch setting
- instance().settings().setValue("gl_fsscale", myGLStretch->getState());
+ // Fullscreen stretch setting
+ instance().settings().setValue("tia,fs_stretch", myUseStretch->getState());
- // Use sync to vertical blank (GL mode only)
+ // Use sync to vertical blank
instance().settings().setValue("vsync", myUseVSync->getState());
// Show UI messages
@@ -493,8 +482,8 @@ void VideoDialog::setDefaults()
case 0: // General
{
myRenderer->setSelected("soft", "");
- myTIAFilter->setSelected(
- instance().desktopWidth() < 640 ? "zoom1x" : "zoom2x", "");
+ myTIAZoom->setSelected(
+ instance().desktopWidth() < 640 ? "1" : "2", "");
myTIAPalette->setSelected("standard", "");
myFrameTiming->setSelected("sleep", "");
myTIAInterpolate->setSelected("nearest", "");
@@ -505,10 +494,10 @@ void VideoDialog::setDefaults()
myFrameRate->setValue(0);
myFrameRateLabel->setLabel("Auto");
- myFullscreen->setSelected("0", "");
- myColorLoss->setState(true);
- myGLStretch->setState(true);
+ myFullscreen->setState(false);
+ myUseStretch->setState(true);
myUseVSync->setState(true);
+ myColorLoss->setState(true);
myUIMessages->setState(true);
myCenter->setState(false);
myFastSCBios->setState(false);
@@ -525,7 +514,6 @@ void VideoDialog::setDefaults()
myTVScanInterpolate->setState(true);
// Make sure that mutually-exclusive items are not enabled at the same time
- handleFullscreenChange(true);
handleTVModeChange(NTSCFilter::PRESET_OFF);
loadTVAdjustables(NTSCFilter::PRESET_CUSTOM);
break;
@@ -535,12 +523,6 @@ void VideoDialog::setDefaults()
_dirty = true;
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void VideoDialog::handleFullscreenChange(bool enable)
-{
-//FIXME
-}
-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::handleTVModeChange(NTSCFilter::Preset preset)
{
@@ -638,10 +620,6 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd,
myFrameRateLabel->setValue(myFrameRate->getValue());
break;
- case kFullScrChanged:
- handleFullscreenChange(myFullscreen->getSelectedTag().toString() != "-1");
- break;
-
case kTVModeChanged:
handleTVModeChange((NTSCFilter::Preset)myTVMode->getSelectedTag().toInt());
diff --git a/src/gui/VideoDialog.hxx b/src/gui/VideoDialog.hxx
index 50eb7f31b..b2db539ff 100644
--- a/src/gui/VideoDialog.hxx
+++ b/src/gui/VideoDialog.hxx
@@ -54,7 +54,7 @@ class VideoDialog : public Dialog
// General options
PopUpWidget* myRenderer;
- PopUpWidget* myTIAFilter;
+ PopUpWidget* myTIAZoom;
PopUpWidget* myTIAPalette;
PopUpWidget* myFrameTiming;
PopUpWidget* myTIAInterpolate;
@@ -65,10 +65,10 @@ class VideoDialog : public Dialog
SliderWidget* myFrameRate;
StaticTextWidget* myFrameRateLabel;
- PopUpWidget* myFullscreen;
- CheckboxWidget* myColorLoss;
- CheckboxWidget* myGLStretch;
+ CheckboxWidget* myFullscreen;
+ CheckboxWidget* myUseStretch;
CheckboxWidget* myUseVSync;
+ CheckboxWidget* myColorLoss;
CheckboxWidget* myUIMessages;
CheckboxWidget* myCenter;
CheckboxWidget* myFastSCBios;
@@ -113,7 +113,6 @@ class VideoDialog : public Dialog
kNAspectRatioChanged = 'VDan',
kPAspectRatioChanged = 'VDap',
kFrameRateChanged = 'VDfr',
- kFullScrChanged = 'VDfs',
kTVModeChanged = 'VDtv',
kTVSharpChanged = 'TVsh',