Added '-gl_aspectn' and 'gl_aspectp' commandline arguments (and

associated UI items) to set the aspect ratio to use in NTSC and PAL
modes.  This replaces the '-gl_aspect' setting.

Hold-select/reset/button0 now work from the UI.

Grabmouse can now be set in the UI.

Changed status of the fix for ATI/OpenGL/sound from fixed to workaround.
Sound will work for the first ROM, but not for subsequent ones.  This
improves on the previous behaviour, where sound didn't work at all.

Bumped version to 2.7.1.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1655 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2009-01-24 17:32:29 +00:00
parent 9d1020b79f
commit 5f595b60de
16 changed files with 169 additions and 112 deletions

View File

@ -14,10 +14,13 @@
2.7 to 2.7.1: (Jan. 26, 2009)
* Fixed issue with sound not working in OpenGL video mode in Windows with
ATI video hardware. Related to this, added '-audiofirst' commandline
argument, which initializes audio before video when emulating a ROM
(this is what was causing the sound to not work).
* Partial workaround for sound not working in OpenGL video mode in
Windows with ATI video hardware. Sound will now work for the first ROM
selected, but not for subsequent ones (you will have to quit and
restart Stella for sound to work again). Related to this, added
'-audiofirst' commandline argument, which initializes audio before video
when emulating a ROM. Further work is required to completely fix
this bug.
* Fixed bug where volume wasn't being saved in 'Audio Settings' when
started from the ROM launcher.
@ -36,6 +39,16 @@
now be changed with the '-eepromdir' commandline argument as well as
in the UI.
* Added '-gl_aspectn' and '-gl_aspectp' commandline arguments (and
associated UI items), which replace the previous '-gl_aspect' setting.
The aspect modes can now be set separately for NTSC and PAL mode.
* Fixed bug with hold-select/reset/button0 when overriding ROM properties;
the checkboxes in the UI weren't actually doing anything.
* The 'grabmouse' option is now configurable from the UI; previously
it was only accessible from the commandline or its shortcut key.
* Removed 'Emulation_HmoveBlanks' ROM property and associated UI item.
You can no longer optionally turn off HMOVE blanking; it is always
enabled when necessary.

View File

@ -36,6 +36,8 @@ Stephen Anthony at stephena@users.sourceforge.net.
directory named that way. Basically the same as is currently
done for ROMs.
(2) Add popup text widget to dynamically select the entries shown.
* More support for copy and paste.
* Fix PropSet to properly delete entries when 'Default' is pressed in

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@ -607,11 +607,12 @@
</tr>
<tr>
<td><pre>-gl_aspect &lt;number&gt;</pre></td>
<td><pre>-gl_aspectn &lt;number&gt;<br>-gl_aspectp &lt;number&gt;</pre></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
80 - 120; I find 85 - 90 gives the most authentic look.</td>
TIA image width in NTSC and PAL mode. Since many video modes do not
use square pixels, you can reduce width until the pixels appear square.
Allowable values are 80 - 120; I find 85 - 90 gives the most authentic
look for NTSC, and 105 - 110 for PAL.</td>
</tr>
<tr>
@ -1065,12 +1066,14 @@
<tr><td>FS Res</td><td>resolution for fullscreen mode</td><td>-fullres</td></tr>
<tr><td>Timing (*)</td><td>how to wait between frames (requires restart)</td><td>-timing</td></tr>
<tr><td>GL Filter</td><td>OpenGL filter mode</td><td>-gl_filter</td></tr>
<tr><td>GL Aspect</td><td>OpenGL width of window</td><td>-gl_aspect</td></tr>
<tr><td>GL Aspect (N)</td><td>OpenGL width of TIA image in NTSC mode</td><td>-gl_aspectn</td></tr>
<tr><td>GL Aspect (P)</td><td>OpenGL width of TIA image in PAL mode</td><td>-gl_aspectp</td></tr>
<tr><td>Framerate</td><td>frames per second in emulation mode</td><td>-framerate</td></tr>
<tr><td>Fullscreen mode</td><td>self-explanatory</td><td>-fullscreen</td></tr>
<tr><td>PAL color-loss</td><td>use PAL color-loss effect</td><td>-colorloss</td></tr>
<tr><td>GL FS Stretch</td><td>stretch fullscreen OpenGL in emulation mode</td><td>-gl_fsmax</td></tr>
<tr><td>GL VSync</td><td>enable OpenGL vertical synchronization</td><td>-gl_vsync</td></tr>
<tr><td>Grab mouse</td><td>keep mouse in SDL window</td><td>-grabmouse</td></tr>
<tr><td>Center window (*)</td><td>attempt to center SDL window (requires restart)</td><td>-center</td></tr>
</table>
</td>

View File

@ -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.135 2009-01-22 00:49:32 stephena Exp $
// $Id: FrameBufferGL.cxx,v 1.136 2009-01-24 17:32:29 stephena Exp $
//============================================================================
#ifdef DISPLAY_OPENGL
@ -221,8 +221,9 @@ bool FrameBufferGL::setVidMode(VideoMode& mode)
// Aspect ratio and fullscreen stretching only applies to the TIA
if(!inUIMode)
{
// Aspect ratio
int aspect = myOSystem->settings().getInt("gl_aspect");
// Aspect ratio (depends on whether NTSC or PAL is detected)
int aspect = myOSystem->settings().getInt(
myOSystem->console().getFramerate() > 55.0 ? "gl_aspectn" : "gl_aspectp");
if(aspect != 100)
mode.image_w = (uInt16)(float(mode.image_w * aspect) / 100.0);

View File

@ -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.46 2009-01-19 16:52:32 stephena Exp $
// $Id: Version.hxx,v 1.47 2009-01-24 17:32:29 stephena Exp $
//============================================================================
#ifndef VERSION_HXX
#define VERSION_HXX
#define STELLA_BASE_VERSION "2.7.1_cvs"
#define STELLA_BASE_VERSION "2.7.1"
#ifdef NIGHTLY_BUILD
#define STELLA_VERSION STELLA_BASE_VERSION "pre-" NIGHTLY_BUILD

View File

@ -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: mainSDL.cxx,v 1.86 2009-01-11 19:10:40 stephena Exp $
// $Id: mainSDL.cxx,v 1.87 2009-01-24 17:32:29 stephena Exp $
//============================================================================
#include <SDL.h>
@ -62,13 +62,15 @@
OSystem* theOSystem = (OSystem*) NULL;
// Does general Cleanup in case any operation failed (or at end of program)
void Cleanup()
int Cleanup()
{
if(theOSystem)
delete theOSystem;
if(SDL_WasInit(SDL_INIT_VIDEO) & SDL_INIT_VIDEO)
SDL_Quit();
return 0;
}
@ -108,7 +110,11 @@ int main(int argc, char* argv[])
// Create the full OSystem after the settings, since settings are
// probably needed for defaults
theOSystem->create();
if(!theOSystem->create())
{
cout << "ERROR: Couldn't create OSystem" << endl;
return Cleanup();
}
// Check to see if the user requested info about a specific ROM,
// or the list of internal ROMs
@ -116,8 +122,7 @@ int main(int argc, char* argv[])
if(theOSystem->settings().getBool("listrominfo"))
{
theOSystem->propSet().print();
Cleanup();
return 0;
return Cleanup();
}
else if(theOSystem->settings().getBool("rominfo"))
{
@ -126,14 +131,12 @@ int main(int argc, char* argv[])
else
cout << "ERROR: ROM doesn't exist" << endl;
Cleanup();
return 0;
return Cleanup();
}
else if(theOSystem->settings().getBool("help"))
{
theOSystem->settings().usage();
Cleanup();
return 0;
return Cleanup();
}
// Request that the SDL window be centered, if possible
@ -154,14 +157,11 @@ int main(int argc, char* argv[])
// the ROM actually exists, use it to create a new console.
// If not, use the built-in ROM launcher. In this case, we enter 'launcher'
// mode and let the main event loop take care of opening a new console/ROM.
FilesystemNode node(romfile);
if(argc == 1 || romfile == "" || !romnode.exists())
{
if(!theOSystem->createLauncher())
{
Cleanup();
return 0;
return Cleanup();
}
}
else if(theOSystem->createConsole(romfile))
@ -170,21 +170,10 @@ int main(int argc, char* argv[])
{
for(int i = 0; i < 30; ++i) theOSystem->frameBuffer().update();
theOSystem->eventHandler().takeSnapshot();
Cleanup();
return 0;
return Cleanup();
}
if(theOSystem->settings().getBool("holdreset"))
theOSystem->eventHandler().handleEvent(Event::ConsoleReset, 1);
if(theOSystem->settings().getBool("holdselect"))
theOSystem->eventHandler().handleEvent(Event::ConsoleSelect, 1);
if(theOSystem->settings().getBool("holdbutton0"))
theOSystem->eventHandler().handleEvent(Event::JoystickZeroFire1, 1);
#ifdef DEBUGGER_SUPPORT
// Set up any breakpoint that was on the command line
// (and remove the key from the settings, so they won't get set again)
const string& initBreak = theOSystem->settings().getString("break");
@ -201,10 +190,7 @@ int main(int argc, char* argv[])
#endif
}
else
{
Cleanup();
return 0;
}
return Cleanup();
// Swallow any spurious events in the queue
// These are normally caused by joystick/mouse jitter
@ -215,6 +201,5 @@ int main(int argc, char* argv[])
theOSystem->mainLoop();
// Cleanup time ...
Cleanup();
return 0;
return Cleanup();
}

View File

@ -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.116 2009-01-19 16:52:32 stephena Exp $
// $Id: FrameBuffer.hxx,v 1.117 2009-01-24 17:32:29 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_HXX
@ -91,7 +91,7 @@ enum {
into FBSurfaces), are in turn drawn here as well.
@author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.116 2009-01-19 16:52:32 stephena Exp $
@version $Id: FrameBuffer.hxx,v 1.117 2009-01-24 17:32:29 stephena Exp $
*/
class FrameBuffer
{
@ -192,7 +192,7 @@ class FrameBuffer
/**
Toggles between fullscreen and window mode.
Grabmouse activated when in fullscreen mode.
Grabmouse activated when in fullscreen mode.
*/
void toggleFullscreen();
@ -563,7 +563,7 @@ class FrameBuffer
FrameBuffer type.
@author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.116 2009-01-19 16:52:32 stephena Exp $
@version $Id: FrameBuffer.hxx,v 1.117 2009-01-24 17:32:29 stephena Exp $
*/
// Text alignment modes for drawString()
enum TextAlignment {

View File

@ -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: OSystem.cxx,v 1.153 2009-01-22 00:49:32 stephena Exp $
// $Id: OSystem.cxx,v 1.154 2009-01-24 17:32:29 stephena Exp $
//============================================================================
#include <cassert>
@ -180,7 +180,8 @@ bool OSystem::create()
// Get relevant information about the video hardware
// This must be done before any graphics context is created, since
// it may be needed to initialize the size of graphical objects
queryVideoHardware();
if(!queryVideoHardware())
return false;
////////////////////////////////////////////////////////////////////
// Create fonts to draw text
@ -491,6 +492,15 @@ bool OSystem::createConsole(const string& romfile, const string& md5sum)
retval = false;
}
// Also check if certain virtual buttons should be held down
// These must be checked each time a new console is being created
if(mySettings->getBool("holdreset"))
myEventHandler->handleEvent(Event::ConsoleReset, 1);
if(mySettings->getBool("holdselect"))
myEventHandler->handleEvent(Event::ConsoleSelect, 1);
if(mySettings->getBool("holdbutton0"))
myEventHandler->handleEvent(Event::JoystickZeroFire1, 1);
return retval;
}
@ -852,12 +862,12 @@ void OSystem::mainLoop()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::queryVideoHardware()
bool OSystem::queryVideoHardware()
{
// Go ahead and open the video hardware; we're going to need it eventually
if(SDL_WasInit(SDL_INIT_VIDEO) == 0)
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
return;
return false;
// First get the maximum windowed desktop resolution
const SDL_VideoInfo* info = SDL_GetVideoInfo();
@ -893,6 +903,8 @@ void OSystem::queryVideoHardware()
myResolutions.insert_at(0, r); // insert in opposite (of descending) order
}
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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: OSystem.hxx,v 1.78 2009-01-21 12:03:17 stephena Exp $
// $Id: OSystem.hxx,v 1.79 2009-01-24 17:32:29 stephena Exp $
//============================================================================
#ifndef OSYSTEM_HXX
@ -56,7 +56,7 @@ typedef Common::Array<Resolution> ResolutionList;
other objects belong.
@author Stephen Anthony
@version $Id: OSystem.hxx,v 1.78 2009-01-21 12:03:17 stephena Exp $
@version $Id: OSystem.hxx,v 1.79 2009-01-24 17:32:29 stephena Exp $
*/
class OSystem
{
@ -422,7 +422,7 @@ class OSystem
/**
Query the OSystem video hardware for resolution information.
*/
virtual void queryVideoHardware();
virtual bool queryVideoHardware();
/**
Set the base directory for all Stella files (these files may be

View File

@ -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.162 2009-01-22 00:49:32 stephena Exp $
// $Id: Settings.cxx,v 1.163 2009-01-24 17:32:29 stephena Exp $
//============================================================================
#include <cassert>
@ -40,7 +40,8 @@ Settings::Settings(OSystem* osystem)
// OpenGL specific options
setInternal("gl_filter", "nearest");
setInternal("gl_aspect", "100");
setInternal("gl_aspectn", "100");
setInternal("gl_aspectp", "100");
setInternal("gl_fsmax", "false");
setInternal("gl_lib", "libGL.so");
setInternal("gl_vsync", "false");
@ -228,9 +229,13 @@ void Settings::validate()
if(s != "linear" && s != "nearest")
setInternal("gl_filter", "nearest");
i = getInt("gl_aspect");
i = getInt("gl_aspectn");
if(i < 80 || i > 120)
setInternal("gl_aspect", "100");
setInternal("gl_aspectn", "100");
i = getInt("gl_aspectp");
if(i < 80 || i > 120)
setInternal("gl_aspectp", "100");
#endif
#ifdef SOUND_SUPPORT
@ -294,7 +299,8 @@ 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_aspectn <number> Scale the TIA width by the given percentage in NTSC mode\n"
<< " -gl_aspectp <number> Scale the TIA width by the given percentage in PAL mode\n"
<< " -gl_fsmax <1|0> Stretch GL image in fullscreen emulation mode\n"
<< " -gl_vsync <1|0> Enable synchronize to vertical blank interrupt\n"
<< " -gl_texrect <1|0> Enable GL_TEXTURE_RECTANGLE extension\n"

View File

@ -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: LauncherDialog.cxx,v 1.102 2009-01-16 14:57:52 stephena Exp $
// $Id: LauncherDialog.cxx,v 1.103 2009-01-24 17:32:29 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -63,9 +63,9 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
{
const GUI::Font& font = instance().launcherFont();
const int fontHeight = font.getFontHeight();
const int bwidth = (_w - 2 * 10 - 8 * (4 - 1)) / 4;
const int bheight = font.getLineHeight() + 4;
const int fontHeight = font.getFontHeight(),
bwidth = (_w - 2 * 10 - 8 * (4 - 1)) / 4,
bheight = font.getLineHeight() + 4;
int xpos = 0, ypos = 0, lwidth = 0;
WidgetArray wid;

View File

@ -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: LauncherDialog.hxx,v 1.40 2009-01-05 19:44:29 stephena Exp $
// $Id: LauncherDialog.hxx,v 1.41 2009-01-24 17:32:29 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -34,6 +34,7 @@ class GlobalPropsDialog;
class LauncherFilterDialog;
class OSystem;
class Properties;
class EditTextWidget;
class RomInfoWidget;
class StaticTextWidget;
class StringListWidget;
@ -89,6 +90,7 @@ class LauncherDialog : public Dialog
StaticTextWidget* myDirLabel;
StaticTextWidget* myDir;
StaticTextWidget* myRomCount;
EditTextWidget* myFilename;
GameList* myGameList;
OptionsDialog* myOptions;

View File

@ -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: ListWidget.cxx,v 1.54 2009-01-05 22:05:35 stephena Exp $
// $Id: ListWidget.cxx,v 1.55 2009-01-24 17:32:29 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -208,17 +208,6 @@ int ListWidget::findItem(int x, int y) const
return (y - 1) / _fontHeight + _currentPos;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static bool matchingCharsIgnoringCase(string s, string pattern)
{
// Make the strings uppercase so we can compare them
transform(s.begin(), s.end(), s.begin(), (int(*)(int)) toupper);
transform(pattern.begin(), pattern.end(), pattern.begin(), (int(*)(int)) toupper);
// Make sure that if the pattern is found, it occurs at the start of 's'
return (s.find(pattern, 0) == string::size_type(0));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ListWidget::handleKeyDown(int ascii, int keycode, int modifiers)
{
@ -250,8 +239,8 @@ bool ListWidget::handleKeyDown(int ascii, int keycode, int modifiers)
int newSelectedItem = 0;
for (StringList::const_iterator i = _list.begin(); i != _list.end(); ++i)
{
const bool match = matchingCharsIgnoringCase(*i, _quickSelectStr);
if (match)
if(BSPF_strncasecmp((*i).c_str(), _quickSelectStr.c_str(),
_quickSelectStr.length()) == 0)
{
_selectedItem = newSelectedItem;
break;

View File

@ -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.65 2009-01-22 00:49:32 stephena Exp $
// $Id: VideoDialog.cxx,v 1.66 2009-01-24 17:32:29 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -47,15 +47,15 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
buttonWidth = font.getStringWidth("Defaults") + 20,
buttonHeight = font.getLineHeight() + 4;
int xpos, ypos;
int lwidth = font.getStringWidth("Dirty Rects: "),
int lwidth = font.getStringWidth("GL Aspect (P): "),
pwidth = font.getStringWidth("1920x1200"),
fwidth = font.getStringWidth("Renderer: ");
WidgetArray wid;
StringMap items;
// Set real dimensions
_w = 46 * fontWidth + 10;
_h = 12 * (lineHeight + 4) + 10;
_w = 48 * fontWidth + 10;
_h = 13 * (lineHeight + 4) + 10;
xpos = 5; ypos = 10;
@ -122,16 +122,28 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
wid.push_back(myGLFilterPopup);
ypos += lineHeight + 4;
// GL aspect ratio
myAspectRatioSlider =
// GL aspect ratio (NTSC mode)
myNAspectRatioSlider =
new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight,
"GL Aspect: ", lwidth, kAspectRatioChanged);
myAspectRatioSlider->setMinValue(80); myAspectRatioSlider->setMaxValue(120);
wid.push_back(myAspectRatioSlider);
myAspectRatioLabel =
new StaticTextWidget(this, font, xpos + myAspectRatioSlider->getWidth() + 4,
"GL Aspect (N): ", lwidth, kNAspectRatioChanged);
myNAspectRatioSlider->setMinValue(80); myNAspectRatioSlider->setMaxValue(120);
wid.push_back(myNAspectRatioSlider);
myNAspectRatioLabel =
new StaticTextWidget(this, font, xpos + myNAspectRatioSlider->getWidth() + 4,
ypos + 1, fontWidth * 3, fontHeight, "", kTextAlignLeft);
myAspectRatioLabel->setFlags(WIDGET_CLEARBG);
myNAspectRatioLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + 4;
// GL aspect ratio (PAL mode)
myPAspectRatioSlider =
new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight,
"GL Aspect (P): ", lwidth, kPAspectRatioChanged);
myPAspectRatioSlider->setMinValue(80); myPAspectRatioSlider->setMaxValue(120);
wid.push_back(myPAspectRatioSlider);
myPAspectRatioLabel =
new StaticTextWidget(this, font, xpos + myPAspectRatioSlider->getWidth() + 4,
ypos + 1, fontWidth * 3, fontHeight, "", kTextAlignLeft);
myPAspectRatioLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + 4;
// Framerate
@ -146,7 +158,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
myFrameRateLabel->setFlags(WIDGET_CLEARBG);
// Move over to the next column
xpos += myAspectRatioSlider->getWidth() + myAspectRatioLabel->getWidth();
xpos += myNAspectRatioSlider->getWidth() + myNAspectRatioLabel->getWidth();
ypos = 10;
// Fullscreen
@ -173,6 +185,12 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
wid.push_back(myUseVSyncCheckbox);
ypos += lineHeight + 4;
// Grab mouse (in windowed mode)
myGrabmouseCheckbox = new CheckboxWidget(this, font, xpos, ypos,
"Grab mouse");
wid.push_back(myGrabmouseCheckbox);
ypos += lineHeight + 4;
// Center window (in windowed mode)
myCenterCheckbox = new CheckboxWidget(this, font, xpos, ypos,
"Center window (*)");
@ -197,13 +215,16 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
// Disable certain functions when we know they aren't present
#ifndef DISPLAY_GL
myGLFilterPopup->clearFlags(WIDGET_ENABLED);
myAspectRatioSlider->clearFlags(WIDGET_ENABLED);
myAspectRatioLabel->clearFlags(WIDGET_ENABLED);
myNAspectRatioSlider->clearFlags(WIDGET_ENABLED);
myNAspectRatioLabel->clearFlags(WIDGET_ENABLED);
myPAspectRatioSlider->clearFlags(WIDGET_ENABLED);
myPAspectRatioLabel->clearFlags(WIDGET_ENABLED);
myGLStretchCheckbox->clearFlags(WIDGET_ENABLED);
myUseVSyncCheckbox->clearFlags(WIDGET_ENABLED);
#endif
#ifndef WINDOWED_SUPPORT
myFullscreenCheckbox->clearFlags(WIDGET_ENABLED);
myGrabmouseCheckbox->clearFlags(WIDGET_ENABLED);
myCenterCheckbox->clearFlags(WIDGET_ENABLED);
#endif
}
@ -249,11 +270,15 @@ void VideoDialog::loadConfig()
instance().settings().getString("gl_filter"), "nearest");
myGLFilterPopup->setEnabled(gl);
// GL aspect ratio setting
myAspectRatioSlider->setValue(instance().settings().getInt("gl_aspect"));
myAspectRatioSlider->setEnabled(gl);
myAspectRatioLabel->setLabel(instance().settings().getString("gl_aspect"));
myAspectRatioLabel->setEnabled(gl);
// GL aspect ratio setting (NTSC and PAL)
myNAspectRatioSlider->setValue(instance().settings().getInt("gl_aspectn"));
myNAspectRatioSlider->setEnabled(gl);
myNAspectRatioLabel->setLabel(instance().settings().getString("gl_aspectn"));
myNAspectRatioLabel->setEnabled(gl);
myPAspectRatioSlider->setValue(instance().settings().getInt("gl_aspectp"));
myPAspectRatioSlider->setEnabled(gl);
myPAspectRatioLabel->setLabel(instance().settings().getString("gl_aspectp"));
myPAspectRatioLabel->setEnabled(gl);
// Framerate (0 or -1 means disabled)
int rate = instance().settings().getInt("framerate");
@ -276,6 +301,9 @@ void VideoDialog::loadConfig()
myUseVSyncCheckbox->setState(instance().settings().getBool("gl_vsync"));
myUseVSyncCheckbox->setEnabled(gl);
// Grab mouse
myGrabmouseCheckbox->setState(instance().settings().getBool("grabmouse"));
// Center window
myCenterCheckbox->setState(instance().settings().getBool("center"));
}
@ -301,8 +329,9 @@ void VideoDialog::saveConfig()
// GL Filter setting
instance().settings().setString("gl_filter", myGLFilterPopup->getSelectedTag());
// GL aspect ratio setting
instance().settings().setString("gl_aspect", myAspectRatioLabel->getLabel());
// GL aspect ratio setting (NTSC and PAL)
instance().settings().setString("gl_aspectn", myNAspectRatioLabel->getLabel());
instance().settings().setString("gl_aspectp", myPAspectRatioLabel->getLabel());
// Framerate
int i = myFrameRateSlider->getValue();
@ -326,6 +355,10 @@ void VideoDialog::saveConfig()
// Use sync to vertical blank (GL mode only)
instance().settings().setBool("gl_vsync", myUseVSyncCheckbox->getState());
// Grab mouse
instance().settings().setBool("grabmouse", myGrabmouseCheckbox->getState());
instance().frameBuffer().setCursorState();
// Center window
instance().settings().setBool("center", myCenterCheckbox->getState());
@ -343,8 +376,10 @@ void VideoDialog::setDefaults()
myFSResPopup->setSelected("auto", "");
myFrameTimingPopup->setSelected("sleep", "");
myGLFilterPopup->setSelected("nearest", "");
myAspectRatioSlider->setValue(100);
myAspectRatioLabel->setLabel("100");
myNAspectRatioSlider->setValue(100);
myNAspectRatioLabel->setLabel("100");
myPAspectRatioSlider->setValue(100);
myPAspectRatioLabel->setLabel("100");
myFrameRateSlider->setValue(0);
myFrameRateLabel->setLabel("0");
@ -352,6 +387,7 @@ void VideoDialog::setDefaults()
myColorLossCheckbox->setState(false);
myGLStretchCheckbox->setState(false);
myUseVSyncCheckbox->setState(true);
myGrabmouseCheckbox->setState(false);
myCenterCheckbox->setState(true);
// Make sure that mutually-exclusive items are not enabled at the same time
@ -387,8 +423,12 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd,
setDefaults();
break;
case kAspectRatioChanged:
myAspectRatioLabel->setValue(myAspectRatioSlider->getValue());
case kNAspectRatioChanged:
myNAspectRatioLabel->setValue(myNAspectRatioSlider->getValue());
break;
case kPAspectRatioChanged:
myPAspectRatioLabel->setValue(myPAspectRatioSlider->getValue());
break;
case kFrameRateChanged:

View File

@ -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.29 2009-01-06 23:02:18 stephena Exp $
// $Id: VideoDialog.hxx,v 1.30 2009-01-24 17:32:29 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -56,8 +56,10 @@ class VideoDialog : public Dialog
PopUpWidget* myFSResPopup;
PopUpWidget* myFrameTimingPopup;
PopUpWidget* myGLFilterPopup;
SliderWidget* myAspectRatioSlider;
StaticTextWidget* myAspectRatioLabel;
SliderWidget* myNAspectRatioSlider;
StaticTextWidget* myNAspectRatioLabel;
SliderWidget* myPAspectRatioSlider;
StaticTextWidget* myPAspectRatioLabel;
SliderWidget* myFrameRateSlider;
StaticTextWidget* myFrameRateLabel;
@ -66,11 +68,13 @@ class VideoDialog : public Dialog
CheckboxWidget* myGLStretchCheckbox;
CheckboxWidget* myUseVSyncCheckbox;
CheckboxWidget* myCenterCheckbox;
CheckboxWidget* myGrabmouseCheckbox;
enum {
kAspectRatioChanged = 'VDar',
kFrameRateChanged = 'VDfr',
kFullScrChanged = 'VDfs'
kNAspectRatioChanged = 'VDan',
kPAspectRatioChanged = 'VDap',
kFrameRateChanged = 'VDfr',
kFullScrChanged = 'VDfs'
};
};