mirror of https://github.com/stella-emu/stella.git
Re-added OpenGL aspect ratio setting; it ended up being much easier to do
than I thought. Bumped version number to 2.4.1_cvs. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1356 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
664c6de88c
commit
88e76cfd6e
|
@ -604,15 +604,14 @@
|
|||
GL_LINEAR introduces blurring.</td>
|
||||
</tr>
|
||||
|
||||
<!--
|
||||
<tr>
|
||||
<td><pre>-gl_aspect <number></pre></td>
|
||||
<td>OpenGL mode only. Specify the aspect ratio of the window. Normal
|
||||
TV mode would be 4:3, so you would specify 1.3333. But since
|
||||
many video modes do not use square pixels, you may have to try
|
||||
different values. I find 1.6 or 1.7 gives the most authentic look.</td>
|
||||
<td>OpenGL mode only. Specify the amount (as a percentage) to scale the
|
||||
image width. Since many video modes do not use square pixels, you can
|
||||
reduce width until the pixels appear square. Allowable values are
|
||||
50 - 100; I find 85 - 90 gives the most authentic look.</td>
|
||||
</tr>
|
||||
-->
|
||||
|
||||
<tr>
|
||||
<td><pre>-gl_fsmax <never|always|ui|tia></pre></td>
|
||||
<td>OpenGL mode only. Stretch fullscreen image while in the given mode.</td>
|
||||
|
|
|
@ -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;
|
||||
stretchFactor = float(myScreenDim.h) / myImageDim.h;
|
||||
}
|
||||
}
|
||||
myWidthScaleFactor *= stretchFactor;
|
||||
myHeightScaleFactor *= stretchFactor;
|
||||
|
||||
myImageDim.w = (Uint16) (myScaleFactor * myImageDim.w);
|
||||
myImageDim.h = (Uint16) (myScaleFactor * myImageDim.h);
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
// Combine the zoom level and scaler into one quantity
|
||||
myScaleFactor *= (float) mode.zoom;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <cassert>
|
||||
|
@ -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> Type is one of the following:\n"
|
||||
<< " nearest Normal scaling (GL_NEAREST)\n"
|
||||
<< " linear Blurred scaling (GL_LINEAR)\n"
|
||||
<< " -gl_aspect <number> Scale the width by the given percentage\n"
|
||||
<< " -gl_fsmax <never|always| Stretch GL image in fullscreen mode\n"
|
||||
<< " ui|tia\n"
|
||||
<< " -gl_vsync <1|0> Enable synchronize to vertical blank interrupt\n"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
@ -69,6 +71,7 @@ class VideoDialog : public Dialog
|
|||
|
||||
enum {
|
||||
kRendererChanged = 'VDrd',
|
||||
kAspectRatioChanged = 'VDar',
|
||||
kUIZoomChanged = 'VDui',
|
||||
kTIAZoomChanged = 'VDti',
|
||||
kFrameRateChanged = 'VDfr',
|
||||
|
|
Loading…
Reference in New Issue