diff --git a/stella/docs/index.html b/stella/docs/index.html index ea3bfb08e..64581166b 100644 --- a/stella/docs/index.html +++ b/stella/docs/index.html @@ -604,15 +604,14 @@ GL_LINEAR introduces blurring. - +
-gl_fsmax <never|always|ui|tia>
OpenGL mode only. Stretch fullscreen image while in the given mode. diff --git a/stella/src/common/FrameBufferGL.cxx b/stella/src/common/FrameBufferGL.cxx index 553f6bf07..020784221 100644 --- a/stella/src/common/FrameBufferGL.cxx +++ b/stella/src/common/FrameBufferGL.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: FrameBufferGL.cxx,v 1.87 2007-06-20 16:33:22 stephena Exp $ +// $Id: FrameBufferGL.cxx,v 1.88 2007-08-21 17:58:25 stephena Exp $ //============================================================================ #ifdef DISPLAY_OPENGL @@ -89,7 +89,8 @@ FrameBufferGL::FrameBufferGL(OSystem* osystem) myTexture(NULL), myHaveTexRectEXT(false), myFilterParamName("GL_NEAREST"), - myScaleFactor(1.0), + myWidthScaleFactor(1.0), + myHeightScaleFactor(1.0), myDirtyFlag(true) { } @@ -240,6 +241,10 @@ string FrameBufferGL::about() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool FrameBufferGL::setVidMode(VideoMode mode) { + bool inUIMode = + myOSystem->eventHandler().state() == EventHandler::S_LAUNCHER || + myOSystem->eventHandler().state() == EventHandler::S_DEBUGGER; + myScreenDim.x = myScreenDim.y = 0; myScreenDim.w = mode.screen_w; myScreenDim.h = mode.screen_h; @@ -249,15 +254,16 @@ bool FrameBufferGL::setVidMode(VideoMode mode) myImageDim.w = mode.image_w; myImageDim.h = mode.image_h; - // Activate stretching if its been requested and it makes sense to do so - myScaleFactor = 1.0; + // Normally, we just scale to the given zoom level + myWidthScaleFactor = (float) mode.zoom; + myHeightScaleFactor = (float) mode.zoom; + + // Activate stretching if its been requested in fullscreen mode + float stretchFactor = 1.0; if(fullScreen() && (mode.image_w < mode.screen_w) && (mode.image_h < mode.screen_h)) { const string& gl_fsmax = myOSystem->settings().getString("gl_fsmax"); - bool inUIMode = - myOSystem->eventHandler().state() == EventHandler::S_LAUNCHER || - myOSystem->eventHandler().state() == EventHandler::S_DEBUGGER; // Only stretch in certain modes if((gl_fsmax == "always") || @@ -268,24 +274,34 @@ bool FrameBufferGL::setVidMode(VideoMode mode) float scaleY = float(myImageDim.h) / myScreenDim.h; if(scaleX > scaleY) - myScaleFactor = float(myScreenDim.w) / myImageDim.w; + stretchFactor = float(myScreenDim.w) / myImageDim.w; else - myScaleFactor = float(myScreenDim.h) / myImageDim.h; - - myImageDim.w = (Uint16) (myScaleFactor * myImageDim.w); - myImageDim.h = (Uint16) (myScaleFactor * myImageDim.h); - myImageDim.x = (myScreenDim.w - myImageDim.w) / 2; - myImageDim.y = (myScreenDim.h - myImageDim.h) / 2; + stretchFactor = float(myScreenDim.h) / myImageDim.h; } } + myWidthScaleFactor *= stretchFactor; + myHeightScaleFactor *= stretchFactor; - // Combine the zoom level and scaler into one quantity - myScaleFactor *= (float) mode.zoom; + // Activate aspect ratio correction in TIA mode + int iaspect = myOSystem->settings().getInt("gl_aspect"); + float aspectFactor = 1.0; + if(!inUIMode && iaspect < 100) + { + aspectFactor = float(iaspect) / 100.0; + myWidthScaleFactor *= aspectFactor; + } + + // Now re-calculate the dimensions + myImageDim.w = (Uint16) (stretchFactor * aspectFactor * myImageDim.w); + myImageDim.h = (Uint16) (stretchFactor * myImageDim.h); + if(!fullScreen()) myScreenDim.w = myImageDim.w; + myImageDim.x = (myScreenDim.w - myImageDim.w) / 2; + myImageDim.y = (myScreenDim.h - myImageDim.h) / 2; GLdouble orthoWidth = (GLdouble) - (myImageDim.w / myScaleFactor); + (myImageDim.w / myWidthScaleFactor); GLdouble orthoHeight = (GLdouble) - (myImageDim.h / myScaleFactor); + (myImageDim.h / myHeightScaleFactor); SDL_GL_SetAttribute( SDL_GL_RED_SIZE, myRGB[0] ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, myRGB[1] ); @@ -565,8 +581,8 @@ void FrameBufferGL::drawBitmap(uInt32* bitmap, Int32 tx, Int32 ty, void FrameBufferGL::translateCoords(Int32& x, Int32& y) { // Wow, what a mess :) - x = (Int32) ((x - myImageDim.x) / myScaleFactor); - y = (Int32) ((y - myImageDim.y) / myScaleFactor); + x = (Int32) ((x - myImageDim.x) / myWidthScaleFactor); + y = (Int32) ((y - myImageDim.y) / myHeightScaleFactor); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/common/FrameBufferGL.hxx b/stella/src/common/FrameBufferGL.hxx index 1f5537e65..7ed319c29 100644 --- a/stella/src/common/FrameBufferGL.hxx +++ b/stella/src/common/FrameBufferGL.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: FrameBufferGL.hxx,v 1.44 2007-06-20 16:33:22 stephena Exp $ +// $Id: FrameBufferGL.hxx,v 1.45 2007-08-21 17:58:25 stephena Exp $ //============================================================================ #ifndef FRAMEBUFFER_GL_HXX @@ -36,7 +36,7 @@ class GUI::Font; This class implements an SDL OpenGL framebuffer. @author Stephen Anthony - @version $Id: FrameBufferGL.hxx,v 1.44 2007-06-20 16:33:22 stephena Exp $ + @version $Id: FrameBufferGL.hxx,v 1.45 2007-08-21 17:58:25 stephena Exp $ */ class FrameBufferGL : public FrameBuffer { @@ -253,10 +253,10 @@ class FrameBufferGL : public FrameBuffer // The name of the texture filtering to use string myFilterParamName; - // The amount by which to scale the imagein fullscreen mode - float myScaleFactor; + // The amount by which to scale the image in each dimension in fullscreen mode + float myWidthScaleFactor, myHeightScaleFactor; - // TODO - will be removed when textured dirty rect support is added + // Indicates that the texture has been modified, and should be redrawn bool myDirtyFlag; // Indicates if the OpenGL functions have been properly loaded diff --git a/stella/src/common/Version.hxx b/stella/src/common/Version.hxx index 95fee38c7..d0352554e 100644 --- a/stella/src/common/Version.hxx +++ b/stella/src/common/Version.hxx @@ -13,13 +13,13 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Version.hxx,v 1.27 2007-08-17 16:12:50 stephena Exp $ +// $Id: Version.hxx,v 1.28 2007-08-21 17:58:25 stephena Exp $ //============================================================================ #ifndef VERSION_HXX #define VERSION_HXX -#define STELLA_BASE_VERSION "2.4" +#define STELLA_BASE_VERSION "2.4.1_cvs" #ifdef NIGHTLY_BUILD #define STELLA_VERSION STELLA_BASE_VERSION "pre-" NIGHTLY_BUILD diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index be564f47d..aa09e3f4d 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.123 2007-08-15 17:43:51 stephena Exp $ +// $Id: Settings.cxx,v 1.124 2007-08-21 17:58:25 stephena Exp $ //============================================================================ #include @@ -37,6 +37,7 @@ Settings::Settings(OSystem* osystem) setInternal("video", "soft"); setInternal("gl_filter", "nearest"); + setInternal("gl_aspect", "100"); setInternal("gl_fsmax", "never"); setInternal("gl_lib", "libGL.so"); setInternal("gl_vsync", "false"); @@ -203,6 +204,10 @@ void Settings::validate() if(s != "linear" && s != "nearest") setInternal("gl_filter", "nearest"); + i = getInt("gl_aspect"); + if(i < 50 || i > 100) + setInternal("gl_aspect", "100"); + s = getString("gl_fsmax"); if(s != "never" && s != "ui" && s != "tia" && s != "always") setInternal("gl_fsmax", "never"); @@ -264,6 +269,7 @@ void Settings::usage() << " -gl_filter Type is one of the following:\n" << " nearest Normal scaling (GL_NEAREST)\n" << " linear Blurred scaling (GL_LINEAR)\n" + << " -gl_aspect Scale the width by the given percentage\n" << " -gl_fsmax Enable synchronize to vertical blank interrupt\n" diff --git a/stella/src/gui/OptionsDialog.cxx b/stella/src/gui/OptionsDialog.cxx index 2114806cc..9305e750e 100644 --- a/stella/src/gui/OptionsDialog.cxx +++ b/stella/src/gui/OptionsDialog.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: OptionsDialog.cxx,v 1.57 2007-08-15 17:43:51 stephena Exp $ +// $Id: OptionsDialog.cxx,v 1.58 2007-08-21 17:58:25 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -107,7 +107,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent, int x = 0, y = 0, w, h; // Now create all the dialogs attached to each menu button - w = 230; h = 165; + w = 230; h = 185; myVideoDialog = new VideoDialog(myOSystem, parent, font, x, y, w, h); w = 200; h = 140; diff --git a/stella/src/gui/VideoDialog.cxx b/stella/src/gui/VideoDialog.cxx index 7794587ce..04669edf5 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.45 2007-08-05 15:34:26 stephena Exp $ +// $Id: VideoDialog.cxx,v 1.46 2007-08-21 17:58:25 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -115,6 +115,18 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, ypos + 1, 15, fontHeight, "", kTextAlignLeft); myTIAZoomLabel->setFlags(WIDGET_CLEARBG); + ypos += lineHeight + 4; + + // GL aspect ratio + myAspectRatioSlider = + new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight, + "GL Aspect: ", lwidth, kAspectRatioChanged); + myAspectRatioSlider->setMinValue(50); myAspectRatioSlider->setMaxValue(100); + wid.push_back(myAspectRatioSlider); + myAspectRatioLabel = + new StaticTextWidget(this, font, xpos + myAspectRatioSlider->getWidth() + 4, + ypos + 1, 15, fontHeight, "", kTextAlignLeft); + myAspectRatioLabel->setFlags(WIDGET_CLEARBG); // Move over to the next column xpos += 115; ypos = 10; @@ -186,6 +198,8 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, // Disable certain functions when we know they aren't present #ifndef DISPLAY_GL myFilterPopup->clearFlags(WIDGET_ENABLED); + myAspectRatioSlider->clearFlags(WIDGET_ENABLED); + myAspectRatioLabel->clearFlags(WIDGET_ENABLED); myFSStretchPopup->clearFlags(WIDGET_ENABLED); myUseVSyncCheckbox->clearFlags(WIDGET_ENABLED); #endif @@ -253,6 +267,12 @@ void VideoDialog::loadConfig() myTIAZoomSlider->setValue(i); myTIAZoomLabel->setLabel(s); + // GL aspect ratio setting + s = instance()->settings().getString("gl_aspect"); + i = instance()->settings().getInt("gl_aspect"); + myAspectRatioSlider->setValue(i); + myAspectRatioLabel->setLabel(s); + // FIXME - what to do with this?? myFrameRateSlider->setEnabled(false); @@ -324,6 +344,10 @@ void VideoDialog::saveConfig() s = myTIAZoomLabel->getLabel(); instance()->settings().setString("zoom_tia", s); + // GL aspect ratio setting + s = myAspectRatioLabel->getLabel(); + instance()->settings().setString("gl_aspect", s); + // Framerate FIXME - I haven't figured out what to do with this yet /* i = myFrameRateSlider->getValue(); @@ -363,6 +387,8 @@ void VideoDialog::setDefaults() myUIZoomLabel->setLabel("2"); myTIAZoomSlider->setValue(2); myTIAZoomLabel->setLabel("2"); + myAspectRatioSlider->setValue(100); + myAspectRatioLabel->setLabel("100"); // myFrameRateSlider->setValue(0); // myFrameRateLabel->setLabel("0"); @@ -385,7 +411,8 @@ void VideoDialog::handleRendererChange(int item) myFilterPopup->setEnabled(gl); myFSStretchPopup->setEnabled(gl); - myFSStretchPopup->setEnabled(gl); + myAspectRatioSlider->setEnabled(gl); + myAspectRatioLabel->setEnabled(gl); myUseVSyncCheckbox->setEnabled(gl); _dirty = true; @@ -434,6 +461,10 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd, myTIAZoomLabel->setValue(myTIAZoomSlider->getValue()); break; + case kAspectRatioChanged: + myAspectRatioLabel->setValue(myAspectRatioSlider->getValue()); + break; + case kFrameRateChanged: myFrameRateLabel->setValue(myFrameRateSlider->getValue()); break; diff --git a/stella/src/gui/VideoDialog.hxx b/stella/src/gui/VideoDialog.hxx index 583e18e47..1fb3249a1 100644 --- a/stella/src/gui/VideoDialog.hxx +++ b/stella/src/gui/VideoDialog.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: VideoDialog.hxx,v 1.21 2007-06-21 12:27:00 stephena Exp $ +// $Id: VideoDialog.hxx,v 1.22 2007-08-21 17:58:26 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -53,6 +53,8 @@ class VideoDialog : public Dialog PopUpWidget* myRendererPopup; PopUpWidget* myFilterPopup; PopUpWidget* myFSStretchPopup; + SliderWidget* myAspectRatioSlider; + StaticTextWidget* myAspectRatioLabel; PopUpWidget* myPalettePopup; PopUpWidget* myFSResPopup; SliderWidget* myUIZoomSlider; @@ -68,11 +70,12 @@ class VideoDialog : public Dialog CheckboxWidget* myCenterCheckbox; enum { - kRendererChanged = 'VDrd', - kUIZoomChanged = 'VDui', - kTIAZoomChanged = 'VDti', - kFrameRateChanged = 'VDfr', - kFullScrChanged = 'VDfs' + kRendererChanged = 'VDrd', + kAspectRatioChanged = 'VDar', + kUIZoomChanged = 'VDui', + kTIAZoomChanged = 'VDti', + kFrameRateChanged = 'VDfr', + kFullScrChanged = 'VDfs' }; };