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) 2.7 to 2.7.1: (Jan. 26, 2009)
* Fixed issue with sound not working in OpenGL video mode in Windows with * Partial workaround for sound not working in OpenGL video mode in
ATI video hardware. Related to this, added '-audiofirst' commandline Windows with ATI video hardware. Sound will now work for the first ROM
argument, which initializes audio before video when emulating a ROM selected, but not for subsequent ones (you will have to quit and
(this is what was causing the sound to not work). 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 * Fixed bug where volume wasn't being saved in 'Audio Settings' when
started from the ROM launcher. started from the ROM launcher.
@ -36,6 +39,16 @@
now be changed with the '-eepromdir' commandline argument as well as now be changed with the '-eepromdir' commandline argument as well as
in the UI. 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. * Removed 'Emulation_HmoveBlanks' ROM property and associated UI item.
You can no longer optionally turn off HMOVE blanking; it is always You can no longer optionally turn off HMOVE blanking; it is always
enabled when necessary. 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 directory named that way. Basically the same as is currently
done for ROMs. done for ROMs.
(2) Add popup text widget to dynamically select the entries shown.
* More support for copy and paste. * More support for copy and paste.
* Fix PropSet to properly delete entries when 'Default' is pressed in * 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>
<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 <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 TIA image width in NTSC and PAL mode. Since many video modes do not
reduce width until the pixels appear square. Allowable values are use square pixels, you can reduce width until the pixels appear square.
80 - 120; I find 85 - 90 gives the most authentic look.</td> Allowable values are 80 - 120; I find 85 - 90 gives the most authentic
look for NTSC, and 105 - 110 for PAL.</td>
</tr> </tr>
<tr> <tr>
@ -1065,12 +1066,14 @@
<tr><td>FS Res</td><td>resolution for fullscreen mode</td><td>-fullres</td></tr> <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>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 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>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>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>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 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>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> <tr><td>Center window (*)</td><td>attempt to center SDL window (requires restart)</td><td>-center</td></tr>
</table> </table>
</td> </td>

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 #ifdef DISPLAY_OPENGL
@ -221,8 +221,9 @@ bool FrameBufferGL::setVidMode(VideoMode& mode)
// Aspect ratio and fullscreen stretching only applies to the TIA // Aspect ratio and fullscreen stretching only applies to the TIA
if(!inUIMode) if(!inUIMode)
{ {
// Aspect ratio // Aspect ratio (depends on whether NTSC or PAL is detected)
int aspect = myOSystem->settings().getInt("gl_aspect"); int aspect = myOSystem->settings().getInt(
myOSystem->console().getFramerate() > 55.0 ? "gl_aspectn" : "gl_aspectp");
if(aspect != 100) if(aspect != 100)
mode.image_w = (uInt16)(float(mode.image_w * aspect) / 100.0); 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 // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 #ifndef VERSION_HXX
#define VERSION_HXX #define VERSION_HXX
#define STELLA_BASE_VERSION "2.7.1_cvs" #define STELLA_BASE_VERSION "2.7.1"
#ifdef NIGHTLY_BUILD #ifdef NIGHTLY_BUILD
#define STELLA_VERSION STELLA_BASE_VERSION "pre-" 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 // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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> #include <SDL.h>
@ -62,13 +62,15 @@
OSystem* theOSystem = (OSystem*) NULL; OSystem* theOSystem = (OSystem*) NULL;
// Does general Cleanup in case any operation failed (or at end of program) // Does general Cleanup in case any operation failed (or at end of program)
void Cleanup() int Cleanup()
{ {
if(theOSystem) if(theOSystem)
delete theOSystem; delete theOSystem;
if(SDL_WasInit(SDL_INIT_VIDEO) & SDL_INIT_VIDEO) if(SDL_WasInit(SDL_INIT_VIDEO) & SDL_INIT_VIDEO)
SDL_Quit(); SDL_Quit();
return 0;
} }
@ -108,7 +110,11 @@ int main(int argc, char* argv[])
// Create the full OSystem after the settings, since settings are // Create the full OSystem after the settings, since settings are
// probably needed for defaults // 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, // Check to see if the user requested info about a specific ROM,
// or the list of internal ROMs // or the list of internal ROMs
@ -116,8 +122,7 @@ int main(int argc, char* argv[])
if(theOSystem->settings().getBool("listrominfo")) if(theOSystem->settings().getBool("listrominfo"))
{ {
theOSystem->propSet().print(); theOSystem->propSet().print();
Cleanup(); return Cleanup();
return 0;
} }
else if(theOSystem->settings().getBool("rominfo")) else if(theOSystem->settings().getBool("rominfo"))
{ {
@ -126,14 +131,12 @@ int main(int argc, char* argv[])
else else
cout << "ERROR: ROM doesn't exist" << endl; cout << "ERROR: ROM doesn't exist" << endl;
Cleanup(); return Cleanup();
return 0;
} }
else if(theOSystem->settings().getBool("help")) else if(theOSystem->settings().getBool("help"))
{ {
theOSystem->settings().usage(); theOSystem->settings().usage();
Cleanup(); return Cleanup();
return 0;
} }
// Request that the SDL window be centered, if possible // 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. // 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' // 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. // 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(argc == 1 || romfile == "" || !romnode.exists())
{ {
if(!theOSystem->createLauncher()) if(!theOSystem->createLauncher())
{ {
Cleanup(); return Cleanup();
return 0;
} }
} }
else if(theOSystem->createConsole(romfile)) 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(); for(int i = 0; i < 30; ++i) theOSystem->frameBuffer().update();
theOSystem->eventHandler().takeSnapshot(); theOSystem->eventHandler().takeSnapshot();
Cleanup(); return Cleanup();
return 0;
} }
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 #ifdef DEBUGGER_SUPPORT
// Set up any breakpoint that was on the command line // Set up any breakpoint that was on the command line
// (and remove the key from the settings, so they won't get set again) // (and remove the key from the settings, so they won't get set again)
const string& initBreak = theOSystem->settings().getString("break"); const string& initBreak = theOSystem->settings().getString("break");
@ -201,10 +190,7 @@ int main(int argc, char* argv[])
#endif #endif
} }
else else
{ return Cleanup();
Cleanup();
return 0;
}
// Swallow any spurious events in the queue // Swallow any spurious events in the queue
// These are normally caused by joystick/mouse jitter // These are normally caused by joystick/mouse jitter
@ -215,6 +201,5 @@ int main(int argc, char* argv[])
theOSystem->mainLoop(); theOSystem->mainLoop();
// Cleanup time ... // Cleanup time ...
Cleanup(); return Cleanup();
return 0;
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 #ifndef FRAMEBUFFER_HXX
@ -91,7 +91,7 @@ enum {
into FBSurfaces), are in turn drawn here as well. into FBSurfaces), are in turn drawn here as well.
@author Stephen Anthony @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 class FrameBuffer
{ {
@ -192,7 +192,7 @@ class FrameBuffer
/** /**
Toggles between fullscreen and window mode. Toggles between fullscreen and window mode.
Grabmouse activated when in fullscreen mode. Grabmouse activated when in fullscreen mode.
*/ */
void toggleFullscreen(); void toggleFullscreen();
@ -563,7 +563,7 @@ class FrameBuffer
FrameBuffer type. FrameBuffer type.
@author Stephen Anthony @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() // Text alignment modes for drawString()
enum TextAlignment { enum TextAlignment {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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> #include <cassert>
@ -180,7 +180,8 @@ bool OSystem::create()
// Get relevant information about the video hardware // Get relevant information about the video hardware
// This must be done before any graphics context is created, since // This must be done before any graphics context is created, since
// it may be needed to initialize the size of graphical objects // it may be needed to initialize the size of graphical objects
queryVideoHardware(); if(!queryVideoHardware())
return false;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Create fonts to draw text // Create fonts to draw text
@ -491,6 +492,15 @@ bool OSystem::createConsole(const string& romfile, const string& md5sum)
retval = false; 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; 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 // Go ahead and open the video hardware; we're going to need it eventually
if(SDL_WasInit(SDL_INIT_VIDEO) == 0) if(SDL_WasInit(SDL_INIT_VIDEO) == 0)
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
return; return false;
// First get the maximum windowed desktop resolution // First get the maximum windowed desktop resolution
const SDL_VideoInfo* info = SDL_GetVideoInfo(); const SDL_VideoInfo* info = SDL_GetVideoInfo();
@ -893,6 +903,8 @@ void OSystem::queryVideoHardware()
myResolutions.insert_at(0, r); // insert in opposite (of descending) order 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 // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 #ifndef OSYSTEM_HXX
@ -56,7 +56,7 @@ typedef Common::Array<Resolution> ResolutionList;
other objects belong. other objects belong.
@author Stephen Anthony @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 class OSystem
{ {
@ -422,7 +422,7 @@ class OSystem
/** /**
Query the OSystem video hardware for resolution information. 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 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 // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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> #include <cassert>
@ -40,7 +40,8 @@ Settings::Settings(OSystem* osystem)
// OpenGL specific options // OpenGL specific options
setInternal("gl_filter", "nearest"); setInternal("gl_filter", "nearest");
setInternal("gl_aspect", "100"); setInternal("gl_aspectn", "100");
setInternal("gl_aspectp", "100");
setInternal("gl_fsmax", "false"); setInternal("gl_fsmax", "false");
setInternal("gl_lib", "libGL.so"); setInternal("gl_lib", "libGL.so");
setInternal("gl_vsync", "false"); setInternal("gl_vsync", "false");
@ -228,9 +229,13 @@ void Settings::validate()
if(s != "linear" && s != "nearest") if(s != "linear" && s != "nearest")
setInternal("gl_filter", "nearest"); setInternal("gl_filter", "nearest");
i = getInt("gl_aspect"); i = getInt("gl_aspectn");
if(i < 80 || i > 120) 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 #endif
#ifdef SOUND_SUPPORT #ifdef SOUND_SUPPORT
@ -294,7 +299,8 @@ void Settings::usage()
<< " -gl_filter <type> Type is one of the following:\n" << " -gl_filter <type> Type is one of the following:\n"
<< " nearest Normal scaling (GL_NEAREST)\n" << " nearest Normal scaling (GL_NEAREST)\n"
<< " linear Blurred scaling (GL_LINEAR)\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_fsmax <1|0> Stretch GL image in fullscreen emulation mode\n"
<< " -gl_vsync <1|0> Enable synchronize to vertical blank interrupt\n" << " -gl_vsync <1|0> Enable synchronize to vertical blank interrupt\n"
<< " -gl_texrect <1|0> Enable GL_TEXTURE_RECTANGLE extension\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 // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -63,9 +63,9 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
{ {
const GUI::Font& font = instance().launcherFont(); const GUI::Font& font = instance().launcherFont();
const int fontHeight = font.getFontHeight(); const int fontHeight = font.getFontHeight(),
const int bwidth = (_w - 2 * 10 - 8 * (4 - 1)) / 4; bwidth = (_w - 2 * 10 - 8 * (4 - 1)) / 4,
const int bheight = font.getLineHeight() + 4; bheight = font.getLineHeight() + 4;
int xpos = 0, ypos = 0, lwidth = 0; int xpos = 0, ypos = 0, lwidth = 0;
WidgetArray wid; WidgetArray wid;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -34,6 +34,7 @@ class GlobalPropsDialog;
class LauncherFilterDialog; class LauncherFilterDialog;
class OSystem; class OSystem;
class Properties; class Properties;
class EditTextWidget;
class RomInfoWidget; class RomInfoWidget;
class StaticTextWidget; class StaticTextWidget;
class StringListWidget; class StringListWidget;
@ -89,6 +90,7 @@ class LauncherDialog : public Dialog
StaticTextWidget* myDirLabel; StaticTextWidget* myDirLabel;
StaticTextWidget* myDir; StaticTextWidget* myDir;
StaticTextWidget* myRomCount; StaticTextWidget* myRomCount;
EditTextWidget* myFilename;
GameList* myGameList; GameList* myGameList;
OptionsDialog* myOptions; OptionsDialog* myOptions;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -208,17 +208,6 @@ int ListWidget::findItem(int x, int y) const
return (y - 1) / _fontHeight + _currentPos; 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) 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; int newSelectedItem = 0;
for (StringList::const_iterator i = _list.begin(); i != _list.end(); ++i) for (StringList::const_iterator i = _list.begin(); i != _list.end(); ++i)
{ {
const bool match = matchingCharsIgnoringCase(*i, _quickSelectStr); if(BSPF_strncasecmp((*i).c_str(), _quickSelectStr.c_str(),
if (match) _quickSelectStr.length()) == 0)
{ {
_selectedItem = newSelectedItem; _selectedItem = newSelectedItem;
break; break;

View File

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

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // 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 // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -56,8 +56,10 @@ class VideoDialog : public Dialog
PopUpWidget* myFSResPopup; PopUpWidget* myFSResPopup;
PopUpWidget* myFrameTimingPopup; PopUpWidget* myFrameTimingPopup;
PopUpWidget* myGLFilterPopup; PopUpWidget* myGLFilterPopup;
SliderWidget* myAspectRatioSlider; SliderWidget* myNAspectRatioSlider;
StaticTextWidget* myAspectRatioLabel; StaticTextWidget* myNAspectRatioLabel;
SliderWidget* myPAspectRatioSlider;
StaticTextWidget* myPAspectRatioLabel;
SliderWidget* myFrameRateSlider; SliderWidget* myFrameRateSlider;
StaticTextWidget* myFrameRateLabel; StaticTextWidget* myFrameRateLabel;
@ -66,11 +68,13 @@ class VideoDialog : public Dialog
CheckboxWidget* myGLStretchCheckbox; CheckboxWidget* myGLStretchCheckbox;
CheckboxWidget* myUseVSyncCheckbox; CheckboxWidget* myUseVSyncCheckbox;
CheckboxWidget* myCenterCheckbox; CheckboxWidget* myCenterCheckbox;
CheckboxWidget* myGrabmouseCheckbox;
enum { enum {
kAspectRatioChanged = 'VDar', kNAspectRatioChanged = 'VDan',
kFrameRateChanged = 'VDfr', kPAspectRatioChanged = 'VDap',
kFullScrChanged = 'VDfs' kFrameRateChanged = 'VDfr',
kFullScrChanged = 'VDfs'
}; };
}; };