Reworked 'fullres' argument to also accept the 'auto' option. In this case,

fullscreen resolutions will be automatically chosen based on the required
size for the window.  The image will be centered and keep the same aspect
ratio, however, so operation will still work correctly on widescreen
monitors.  'Auto' will be the new default.  Otherwise, if a specific
resolution is requested, Stella will try to accomodate it *only* if it fits
into the resolution; otherwise the smallest resolution that fits will be
used.

Removed 'zoom_ui' and 'zoom_tia'.  The UI can now only be at 1x mode.

Aded 'tia_filter' commandline argument, which specifies to the filter
to use when rendering the tia image.  For now, these accept 'zoom1x',
'zoom2x'..., up to 'zoom10x', and duplicate previous behaviour.  Eventually,
Scalexx and HQxx filters may be added.  Still TODO is add this to the UI.

First pass at making the standard build use a minimum of zoom2x for the TIA,
so the UI can be larger and use a better looking font.  There's still work
to do in this area, especially for those ports with limited hardware that
support zoom1x only.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1544 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-07-22 14:54:39 +00:00
parent 4a7f31b0dc
commit b1ac5bd951
7 changed files with 200 additions and 208 deletions

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: EventHandler.cxx,v 1.227 2008-06-19 12:01:30 stephena Exp $ // $Id: EventHandler.cxx,v 1.228 2008-07-22 14:54:38 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -357,6 +357,14 @@ void EventHandler::poll(uInt32 time)
{ {
myOSystem->frameBuffer().toggleFullscreen(); myOSystem->frameBuffer().toggleFullscreen();
} }
else if(key == SDLK_EQUALS)
{
myOSystem->frameBuffer().changeVidMode(+1);
}
else if(key == SDLK_MINUS)
{
myOSystem->frameBuffer().changeVidMode(-1);
}
else else
#endif #endif
// These only work when in emulation mode // These only work when in emulation mode
@ -364,15 +372,6 @@ void EventHandler::poll(uInt32 time)
{ {
switch(int(key)) switch(int(key))
{ {
#ifndef MAC_OSX
case SDLK_EQUALS:
myOSystem->frameBuffer().changeVidMode(+1);
break;
case SDLK_MINUS:
myOSystem->frameBuffer().changeVidMode(-1);
break;
#endif
case SDLK_LEFTBRACKET: case SDLK_LEFTBRACKET:
myOSystem->sound().adjustVolume(-1); myOSystem->sound().adjustVolume(-1);
break; break;
@ -484,6 +483,14 @@ void EventHandler::poll(uInt32 time)
case SDLK_RETURN: case SDLK_RETURN:
myOSystem->frameBuffer().toggleFullscreen(); myOSystem->frameBuffer().toggleFullscreen();
break; break;
case SDLK_EQUALS:
myOSystem->frameBuffer().changeVidMode(+1);
break;
case SDLK_MINUS:
myOSystem->frameBuffer().changeVidMode(-1);
break;
#endif #endif
} }
@ -498,14 +505,6 @@ void EventHandler::poll(uInt32 time)
case SDLK_SLASH: case SDLK_SLASH:
handleMacOSXKeypress(int(key)); handleMacOSXKeypress(int(key));
break; break;
case SDLK_EQUALS:
myOSystem->frameBuffer().changeVidMode(+1);
break;
case SDLK_MINUS:
myOSystem->frameBuffer().changeVidMode(-1);
break;
#endif #endif
case SDLK_0: // Ctrl-0 sets the mouse to paddle 0 case SDLK_0: // Ctrl-0 sets the mouse to paddle 0
setPaddleMode(0, true); setPaddleMode(0, true);

View File

@ -13,9 +13,10 @@
// 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.cxx,v 1.135 2008-07-04 14:27:17 stephena Exp $ // $Id: FrameBuffer.cxx,v 1.136 2008-07-22 14:54:39 stephena Exp $
//============================================================================ //============================================================================
#include <algorithm>
#include <sstream> #include <sstream>
#include "bspf.hxx" #include "bspf.hxx"
@ -454,40 +455,41 @@ bool FrameBuffer::changeVidMode(int direction)
bool inUIMode = (state == EventHandler::S_DEBUGGER || bool inUIMode = (state == EventHandler::S_DEBUGGER ||
state == EventHandler::S_LAUNCHER); state == EventHandler::S_LAUNCHER);
// Ignore any attempts to change video size while in UI mode
if(inUIMode && direction != 0)
return false;
// Only save mode changes in TIA mode with a valid selector // Only save mode changes in TIA mode with a valid selector
bool saveModeChange = !inUIMode && (direction == -1 || direction == +1); bool saveModeChange = !inUIMode && (direction == -1 || direction == +1);
if(!inUIMode)
{
if(direction == +1) if(direction == +1)
myCurrentModeList->next(); myCurrentModeList->next();
else if(direction == -1) else if(direction == -1)
myCurrentModeList->previous(); myCurrentModeList->previous();
}
VideoMode video = myCurrentModeList->current(); VideoMode vidmode = myCurrentModeList->current(myOSystem->settings());
if(setVidMode(video)) if(setVidMode(vidmode))
{ {
myImageRect.setWidth(video.image_w); myImageRect.setWidth(vidmode.image_w);
myImageRect.setHeight(video.image_h); myImageRect.setHeight(vidmode.image_h);
myImageRect.moveTo(video.image_x, video.image_y); myImageRect.moveTo(vidmode.image_x, vidmode.image_y);
myScreenRect.setWidth(video.screen_w); myScreenRect.setWidth(vidmode.screen_w);
myScreenRect.setHeight(video.screen_h); myScreenRect.setHeight(vidmode.screen_h);
if(!inUIMode)
{
myOSystem->eventHandler().handleResizeEvent();
myOSystem->eventHandler().refreshDisplay(true);
setCursorState();
showMessage(vidmode.gfxmode.description);
}
if(saveModeChange)
myOSystem->settings().setString("tia_filter", vidmode.gfxmode.name);
} }
else else
return false; return false;
myOSystem->eventHandler().handleResizeEvent();
myOSystem->eventHandler().refreshDisplay(true);
setCursorState();
showMessage(video.gfxmode.description);
if(!inUIMode && saveModeChange)
{
// FIXME - adapt to scaler infrastructure
// myOSystem->settings().setInt("zoom_tia", newmode.zoom);
}
return true; return true;
/* /*
cerr << "New mode:" << endl cerr << "New mode:" << endl
@ -563,7 +565,7 @@ void FrameBuffer::setWindowIcon()
uInt32 rgba[256], icon[32 * 32]; uInt32 rgba[256], icon[32 * 32];
uInt8 mask[32][4]; uInt8 mask[32][4];
sscanf(stella_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes); sscanf(stella_icon[0], "%u %u %u %u", &w, &h, &ncols, &nbytes);
if((w != 32) || (h != 32) || (ncols > 255) || (nbytes > 1)) if((w != 32) || (h != 32) || (ncols > 255) || (nbytes > 1))
{ {
cerr << "ERROR: Couldn't load the icon.\n"; cerr << "ERROR: Couldn't load the icon.\n";
@ -622,6 +624,26 @@ uInt8 FrameBuffer::getPhosphor(uInt8 c1, uInt8 c2)
return ((c1 - c2) * myPhosphorBlend)/100 + c2; return ((c1 - c2) * myPhosphorBlend)/100 + c2;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const StringList& FrameBuffer::supportedTIAFilters(const string& type)
{
myTIAFilters.clear();
#ifdef SMALL_SCREEN
uInt32 firstmode = 0;
#else
uInt32 firstmode = 1;
#endif
for(uInt32 i = firstmode; i < GFX_NumModes; ++i)
{
// For now, just include all filters
// This will change once OpenGL-only filters are added
myTIAFilters.push_back(ourGraphicsModes[i].description);
cerr << ourGraphicsModes[i].description << endl;
}
return myTIAFilters;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 FrameBuffer::maxWindowSizeForScreen(uInt32 baseWidth, uInt32 baseHeight, uInt32 FrameBuffer::maxWindowSizeForScreen(uInt32 baseWidth, uInt32 baseHeight,
uInt32 screenWidth, uInt32 screenHeight) uInt32 screenWidth, uInt32 screenHeight)
@ -649,10 +671,8 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
bool inUIMode = (state == EventHandler::S_DEBUGGER || bool inUIMode = (state == EventHandler::S_DEBUGGER ||
state == EventHandler::S_LAUNCHER); state == EventHandler::S_LAUNCHER);
// First we look at windowed modes
// These can be sized exactly as required, since there's normally no
// restriction on window size (up the maximum size)
myWindowedModeList.clear(); myWindowedModeList.clear();
myFullscreenModeList.clear();
// In UI/windowed mode, there's only one valid video mode we can use // In UI/windowed mode, there's only one valid video mode we can use
if(inUIMode) if(inUIMode)
@ -663,7 +683,7 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
m.image_h = m.screen_h = baseHeight; m.image_h = m.screen_h = baseHeight;
m.gfxmode = ourGraphicsModes[0]; // this should be zoom1x m.gfxmode = ourGraphicsModes[0]; // this should be zoom1x
myWindowedModeList.add(m); addVidMode(m);
} }
else else
{ {
@ -671,7 +691,12 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
// for the given dimensions // for the given dimensions
uInt32 max_zoom = maxWindowSizeForScreen(baseWidth, baseHeight, uInt32 max_zoom = maxWindowSizeForScreen(baseWidth, baseHeight,
myOSystem->desktopWidth(), myOSystem->desktopHeight()); myOSystem->desktopWidth(), myOSystem->desktopHeight());
for(unsigned int i = 0; i < GFX_NumModes; ++i) #ifdef SMALL_SCREEN
uInt32 firstmode = 0;
#else
uInt32 firstmode = 1;
#endif
for(uInt32 i = firstmode; i < GFX_NumModes; ++i)
{ {
uInt32 zoom = ourGraphicsModes[i].zoom; uInt32 zoom = ourGraphicsModes[i].zoom;
if(zoom <= max_zoom) if(zoom <= max_zoom)
@ -682,77 +707,38 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
m.image_h = m.screen_h = baseHeight * zoom; m.image_h = m.screen_h = baseHeight * zoom;
m.gfxmode = ourGraphicsModes[i]; m.gfxmode = ourGraphicsModes[i];
myWindowedModeList.add(m); addVidMode(m);
} }
} }
} }
}
#if 0 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Now consider the fullscreen modes void FrameBuffer::addVidMode(VideoMode& mode)
// There are often stricter requirements on these, and they're normally {
// different depending on the OSystem in use // Windowed modes can be sized exactly as required, since there's normally
// no restriction on window size (up the maximum size)
myWindowedModeList.add(mode);
// There are often stricter requirements on fullscreen modes, and they're
// normally different depending on the OSystem in use
// As well, we usually can't get fullscreen modes in the exact size // As well, we usually can't get fullscreen modes in the exact size
// we want, so we need to calculate image offsets // we want, so we need to calculate image offsets
myFullscreenModeList.clear();
if(inUIMode)
{
// FIXME - document this
if(0)// use exact dimensions)
{
VideoMode m;
m.image_w = m.screen_w = baseWidth;
m.image_h = m.screen_h = baseHeight;
m.zoom = 1;
myFullscreenModeList.add(m);
}
else // use dimensions as defined in 'fullres'
{
int w = -1, h = -1;
myOSystem->settings().getSize("fullres", w, h);
if(w < 0 || h < 0)
{
w = myOSystem->desktopWidth();
h = myOSystem->desktopHeight();
}
VideoMode m;
m.screen_w = w;
m.screen_h = h;
m.zoom = 1;
// Auto-calculate 'smart' centering; platform-specific framebuffers are
// free to ignore or augment it
m.image_w = baseWidth;
m.image_h = baseHeight;
m.image_x = (m.screen_w - m.image_w) / 2;
m.image_y = (m.screen_h - m.image_h) / 2;
myFullscreenModeList.add(m);
}
}
else
{
const ResolutionList& res = myOSystem->supportedResolutions(); const ResolutionList& res = myOSystem->supportedResolutions();
for(unsigned int i = 0; i < res.size(); ++i) for(uInt32 i = 0; i < res.size(); ++i)
{
if(mode.screen_w <= res[i].width && mode.screen_h <= res[i].height)
{ {
VideoMode m;
m.screen_w = res[i].width;
m.screen_h = res[i].height;
m.zoom = maxWindowSizeForScreen(baseWidth, baseHeight, m.screen_w, m.screen_h);
m.name = res[i].name;
// Auto-calculate 'smart' centering; platform-specific framebuffers are // Auto-calculate 'smart' centering; platform-specific framebuffers are
// free to ignore or augment it // free to ignore or augment it
m.image_w = baseWidth * m.zoom; mode.screen_w = res[i].width;
m.image_h = baseHeight * m.zoom; mode.screen_h = res[i].height;
m.image_x = (m.screen_w - m.image_w) / 2; mode.image_x = (mode.screen_w - mode.image_w) >> 1;
m.image_y = (m.screen_h - m.image_h) / 2; mode.image_y = (mode.screen_h - mode.image_h) >> 1;
break;
myFullscreenModeList.add(m);
} }
} }
#endif myFullscreenModeList.add(mode);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -765,8 +751,6 @@ FrameBuffer::VideoMode FrameBuffer::getSavedVidMode()
else else
myCurrentModeList = &myWindowedModeList; myCurrentModeList = &myWindowedModeList;
myCurrentModeList->print();
// Now select the best resolution depending on the state // Now select the best resolution depending on the state
// UI modes (launcher and debugger) have only one supported resolution // UI modes (launcher and debugger) have only one supported resolution
// so the 'current' one is the only valid one // so the 'current' one is the only valid one
@ -780,15 +764,7 @@ myCurrentModeList->print();
myCurrentModeList->setByGfxMode(name); myCurrentModeList->setByGfxMode(name);
} }
// Check if 'auto-size' is enabled for fullscreen modes return myCurrentModeList->current(myOSystem->settings());
if(myOSystem->settings().getBool("fullscreen"))
{
VideoMode mode = myCurrentModeList->current();
// FIXME - add centering
return mode;
}
else
return myCurrentModeList->current();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -828,24 +804,48 @@ uInt32 FrameBuffer::VideoModeList::size() const
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FrameBuffer::VideoMode& FrameBuffer::VideoModeList::previous() void FrameBuffer::VideoModeList::previous()
{ {
--myIdx; --myIdx;
if(myIdx < 0) myIdx = myModeList.size() - 1; if(myIdx < 0) myIdx = myModeList.size() - 1;
return current();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FrameBuffer::VideoMode& FrameBuffer::VideoModeList::current() const const FrameBuffer::VideoMode FrameBuffer::
VideoModeList::current(const Settings& settings) const
{ {
// Fullscreen modes are related to the 'fullres' setting
// If it's 'auto', we just use the mode as already previously defined
// If it's not 'auto', attempt to fit the mode into the resolution
// specified by 'fullres' (if possible)
if(settings.getBool("fullscreen") &&
BSPF_tolower(settings.getString("fullres")) != "auto")
{
// Only use 'fullres' if it's *bigger* than the requested mode
int w, h;
settings.getSize("fullres", w, h);
if(w != -1 && h != -1 && (uInt32)w > myModeList[myIdx].screen_w &&
(uInt32)h > myModeList[myIdx].screen_h)
{
VideoMode mode = myModeList[myIdx];
mode.screen_w = w;
mode.screen_h = h;
mode.image_x = (mode.screen_w - mode.image_w) >> 1;
mode.image_y = (mode.screen_h - mode.image_h) >> 1;
return mode;
}
}
// Otherwise, we just use the mode has it was defined in ::addVidMode()
return myModeList[myIdx]; return myModeList[myIdx];
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FrameBuffer::VideoMode& FrameBuffer::VideoModeList::next() void FrameBuffer::VideoModeList::next()
{ {
myIdx = (myIdx + 1) % myModeList.size(); myIdx = (myIdx + 1) % myModeList.size();
return current();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -877,7 +877,8 @@ void FrameBuffer::VideoModeList::setByGfxMode(const string& name)
GraphicsMode gfxmode; GraphicsMode gfxmode;
for(uInt32 i = 0; i < GFX_NumModes; ++i) for(uInt32 i = 0; i < GFX_NumModes; ++i)
{ {
if(ourGraphicsModes[i].name == name) if(ourGraphicsModes[i].name == BSPF_tolower(name) ||
ourGraphicsModes[i].description == BSPF_tolower(name))
{ {
gfxmode = ourGraphicsModes[i]; gfxmode = ourGraphicsModes[i];
found = true; found = true;
@ -890,30 +891,6 @@ void FrameBuffer::VideoModeList::setByGfxMode(const string& name)
set(gfxmode); set(gfxmode);
} }
#if 0
// Find the largest resolution able to hold the given bounds
myIdx = myModeList.size() - 1;
for(unsigned int i = 0; i < myModeList.size(); ++i)
{
if(width <= myModeList[i].screen_w && height <= myModeList[i].screen_h)
{
myIdx = i;
break;
}
}
// Find the largest zoom within the given bounds
myIdx = 0;
for(unsigned int i = myModeList.size() - 1; i; --i)
{
if(myModeList[i].zoom <= zoom)
{
myIdx = i;
break;
}
}
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::VideoModeList::set(const GraphicsMode& gfxmode) void FrameBuffer::VideoModeList::set(const GraphicsMode& gfxmode)
{ {

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.100 2008-07-04 14:27:17 stephena Exp $ // $Id: FrameBuffer.hxx,v 1.101 2008-07-22 14:54:39 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_HXX #ifndef FRAMEBUFFER_HXX
@ -31,7 +31,7 @@ namespace GUI {
} }
#include "EventHandler.hxx" #include "EventHandler.hxx"
//#include "VideoModeList.hxx" #include "Settings.hxx"
#include "Rect.hxx" #include "Rect.hxx"
#include "bspf.hxx" #include "bspf.hxx"
@ -90,7 +90,7 @@ enum {
turn drawn here as well. turn drawn here as well.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.100 2008-07-04 14:27:17 stephena Exp $ @version $Id: FrameBuffer.hxx,v 1.101 2008-07-22 14:54:39 stephena Exp $
*/ */
class FrameBuffer class FrameBuffer
{ {
@ -220,6 +220,11 @@ class FrameBuffer
*/ */
void setWindowTitle(const string& title); void setWindowTitle(const string& title);
/**
Get the supported TIA filters for the given framebuffer type.
*/
const StringList& supportedTIAFilters(const string& type);
/** /**
Set up the TIA/emulation palette for a screen of any depth > 8. Set up the TIA/emulation palette for a screen of any depth > 8.
@ -376,6 +381,9 @@ class FrameBuffer
Uint32 myDefPalette[256+kNumColors]; Uint32 myDefPalette[256+kNumColors];
Uint32 myAvgPalette[256][256]; Uint32 myAvgPalette[256][256];
// Names of the TIA filters that can be used for this framebuffer
StringList myTIAFilters;
private: private:
/** /**
Set the icon for the main SDL window. Set the icon for the main SDL window.
@ -410,6 +418,12 @@ class FrameBuffer
*/ */
void setAvailableVidModes(uInt32 basewidth, uInt32 baseheight); void setAvailableVidModes(uInt32 basewidth, uInt32 baseheight);
/**
Adds the given video mode to both windowed and fullscreen lists.
In the case of fullscreen, we make sure a valid resolution exists.
*/
void addVidMode(VideoMode& mode);
/** /**
Returns an appropriate video mode based on the current eventhandler Returns an appropriate video mode based on the current eventhandler
state, taking into account the maximum size of the window. state, taking into account the maximum size of the window.
@ -434,9 +448,9 @@ class FrameBuffer
bool isEmpty() const; bool isEmpty() const;
uInt32 size() const; uInt32 size() const;
const FrameBuffer::VideoMode& previous(); void previous();
const FrameBuffer::VideoMode& current() const; const FrameBuffer::VideoMode current(const Settings& settings) const;
const FrameBuffer::VideoMode& next(); void next();
void setByGfxMode(GfxID id); void setByGfxMode(GfxID id);
void setByGfxMode(const string& name); void setByGfxMode(const string& name);
@ -496,7 +510,7 @@ class FrameBuffer
FrameBuffer type. FrameBuffer type.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.100 2008-07-04 14:27:17 stephena Exp $ @version $Id: FrameBuffer.hxx,v 1.101 2008-07-22 14:54:39 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: Settings.cxx,v 1.148 2008-05-30 19:07:55 stephena Exp $ // $Id: Settings.cxx,v 1.149 2008-07-22 14:54:39 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -47,10 +47,9 @@ Settings::Settings(OSystem* osystem)
setInternal("gl_texrect", "false"); setInternal("gl_texrect", "false");
// Framebuffer-related options // Framebuffer-related options
setInternal("zoom_ui", "2"); setInternal("tia_filter", "zoom2x");
setInternal("zoom_tia", "2");
setInternal("fullscreen", "false"); setInternal("fullscreen", "false");
setInternal("fullres", ""); setInternal("fullres", "auto");
setInternal("center", "true"); setInternal("center", "true");
setInternal("grabmouse", "false"); setInternal("grabmouse", "false");
setInternal("palette", "standard"); setInternal("palette", "standard");
@ -245,14 +244,6 @@ void Settings::validate()
setInternal("tiafreq", "31400"); setInternal("tiafreq", "31400");
#endif #endif
i = getInt("zoom_ui");
if(i < 1 || i > 10)
setInternal("zoom_ui", "2");
i = getInt("zoom_tia");
if(i < 1 || i > 10)
setInternal("zoom_tia", "2");
i = getInt("joydeadzone"); i = getInt("joydeadzone");
if(i < 0) if(i < 0)
setInternal("joydeadzone", "0"); setInternal("joydeadzone", "0");
@ -302,10 +293,9 @@ void Settings::usage()
<< " -gl_texrect <1|0> Enable GL_TEXTURE_RECTANGLE extension\n" << " -gl_texrect <1|0> Enable GL_TEXTURE_RECTANGLE extension\n"
<< endl << endl
#endif #endif
<< " -zoom_tia <zoom> Use the specified zoom level in emulation mode\n" << " -tia_filter <filter> Use the specified filter in emulation mode\n"
<< " -zoom_ui <zoom> Use the specified zoom level in non-emulation mode (ROM browser/debugger)\n"
<< " -fullscreen <1|0> Play the game in fullscreen mode\n" << " -fullscreen <1|0> Play the game in fullscreen mode\n"
<< " -fullres <WxH> The resolution to use in fullscreen mode\n" << " -fullres <auto|WxH> The resolution to use in fullscreen mode\n"
<< " -center <1|0> Centers game window (if possible)\n" << " -center <1|0> Centers game window (if possible)\n"
<< " -grabmouse <1|0> Keeps the mouse in the game window\n" << " -grabmouse <1|0> Keeps the mouse in the game window\n"
<< " -palette <standard| Use the specified color palette\n" << " -palette <standard| Use the specified color palette\n"
@ -481,11 +471,12 @@ void Settings::setString(const string& key, const string& value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Settings::getSize(const string& key, int& x, int& y) const void Settings::getSize(const string& key, int& x, int& y) const
{ {
char c;
string size = getString(key); string size = getString(key);
replace(size.begin(), size.end(), 'x', ' ');
istringstream buf(size); istringstream buf(size);
buf >> x; buf >> x >> c >> y;
buf >> y; if(c != 'x')
x = y = -1;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: bspf.hxx,v 1.18 2007-09-03 18:37:22 stephena Exp $ // $Id: bspf.hxx,v 1.19 2008-07-22 14:54:39 stephena Exp $
//============================================================================ //============================================================================
#ifndef BSPF_HXX #ifndef BSPF_HXX
@ -24,7 +24,7 @@
that need to be defined for different operating systems. that need to be defined for different operating systems.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: bspf.hxx,v 1.18 2007-09-03 18:37:22 stephena Exp $ @version $Id: bspf.hxx,v 1.19 2008-07-22 14:54:39 stephena Exp $
*/ */
// Types for 8-bit signed and unsigned integers // Types for 8-bit signed and unsigned integers
@ -87,6 +87,12 @@ template<typename T> inline void BSPF_swap(T &a, T &b) { T tmp = a; a = b; b = t
template<typename T> inline T BSPF_abs (T x) { return (x>=0) ? x : -x; } template<typename T> inline T BSPF_abs (T x) { return (x>=0) ? x : -x; }
template<typename T> inline T BSPF_min (T a, T b) { return (a<b) ? a : b; } template<typename T> inline T BSPF_min (T a, T b) { return (a<b) ? a : b; }
template<typename T> inline T BSPF_max (T a, T b) { return (a>b) ? a : b; } template<typename T> inline T BSPF_max (T a, T b) { return (a>b) ? a : b; }
inline string BSPF_tolower(const string& s)
{
string t = s;
transform(t.begin(), t.end(), t.begin(), (int(*)(int)) tolower);
return t;
}
static const string EmptyString(""); static const string EmptyString("");

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: Launcher.cxx,v 1.24 2008-06-19 12:01:31 stephena Exp $ // $Id: Launcher.cxx,v 1.25 2008-07-22 14:54:39 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -28,11 +28,19 @@ class Properties;
#include "bspf.hxx" #include "bspf.hxx"
#include "Launcher.hxx" #include "Launcher.hxx"
#ifdef SMALL_SCREEN
#define MIN_WIDTH 320
#define MIN_HEIGHT 240
#else
#define MIN_WIDTH 640
#define MIN_HEIGHT 480
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Launcher::Launcher(OSystem* osystem) Launcher::Launcher(OSystem* osystem)
: DialogContainer(osystem), : DialogContainer(osystem),
myWidth(640), myWidth(MIN_WIDTH),
myHeight(480) myHeight(MIN_HEIGHT)
{ {
int w, h; int w, h;
myOSystem->settings().getSize("launcherres", w, h); myOSystem->settings().getSize("launcherres", w, h);
@ -40,9 +48,9 @@ Launcher::Launcher(OSystem* osystem)
myHeight = BSPF_max(h, 0); myHeight = BSPF_max(h, 0);
// Error check the resolution // Error check the resolution
myWidth = BSPF_max(myWidth, 640u); myWidth = BSPF_max(myWidth, (uInt32)MIN_WIDTH);
myWidth = BSPF_min(myWidth, osystem->desktopWidth()); myWidth = BSPF_min(myWidth, osystem->desktopWidth());
myHeight = BSPF_max(myHeight, 480u); myHeight = BSPF_max(myHeight, (uInt32)MIN_HEIGHT);
myHeight = BSPF_min(myHeight, osystem->desktopHeight()); myHeight = BSPF_min(myHeight, osystem->desktopHeight());
myOSystem->settings().setSize("launcherres", myWidth, myHeight); myOSystem->settings().setSize("launcherres", myWidth, myHeight);

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.52 2008-06-20 12:19:42 stephena Exp $ // $Id: VideoDialog.cxx,v 1.53 2008-07-22 14:54:39 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
@ -101,6 +101,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
// Fullscreen resolution // Fullscreen resolution
items.clear(); items.clear();
items.push_back("Auto");
for(uInt32 i = 0; i < instance().supportedResolutions().size(); ++i) for(uInt32 i = 0; i < instance().supportedResolutions().size(); ++i)
items.push_back(instance().supportedResolutions()[i].name); items.push_back(instance().supportedResolutions()[i].name);
myFSResPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, myFSResPopup = new PopUpWidget(this, font, xpos, ypos, pwidth,
@ -108,6 +109,18 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
wid.push_back(myFSResPopup); wid.push_back(myFSResPopup);
ypos += lineHeight + 4; ypos += lineHeight + 4;
#if 0
// Available TIA filters
items.clear();
for(uInt32 i = 0; i < instance().frameBuffer().supportedTIAFilters().size(); ++i)
items.push_back(instance().supportedResolutions()[i].name);
myFSResPopup = new PopUpWidget(this, font, xpos, ypos, pwidth,
lineHeight, items, "FS Res: ", lwidth);
wid.push_back(myFSResPopup);
ypos += lineHeight + 4;
#endif
#if 0
// Available UI zoom levels // Available UI zoom levels
myUIZoomSlider = new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight, myUIZoomSlider = new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight,
"UI Zoom: ", lwidth, kUIZoomChanged); "UI Zoom: ", lwidth, kUIZoomChanged);
@ -118,6 +131,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
ypos + 1, fontWidth * 2, fontHeight, "", kTextAlignLeft); ypos + 1, fontWidth * 2, fontHeight, "", kTextAlignLeft);
myUIZoomLabel->setFlags(WIDGET_CLEARBG); myUIZoomLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + 4; ypos += lineHeight + 4;
#endif
// Available TIA zoom levels // Available TIA zoom levels
myTIAZoomSlider = new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight, myTIAZoomSlider = new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight,
@ -205,8 +219,6 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
myUseVSyncCheckbox->clearFlags(WIDGET_ENABLED); myUseVSyncCheckbox->clearFlags(WIDGET_ENABLED);
#endif #endif
#ifndef WINDOWED_SUPPORT #ifndef WINDOWED_SUPPORT
myUIZoomSlider->clearFlags(WIDGET_ENABLED);
myUIZoomLabel->clearFlags(WIDGET_ENABLED);
myTIAZoomSlider->clearFlags(WIDGET_ENABLED); myTIAZoomSlider->clearFlags(WIDGET_ENABLED);
myTIAZoomLabel->clearFlags(WIDGET_ENABLED); myTIAZoomLabel->clearFlags(WIDGET_ENABLED);
myFullscreenCheckbox->clearFlags(WIDGET_ENABLED); myFullscreenCheckbox->clearFlags(WIDGET_ENABLED);
@ -227,19 +239,19 @@ void VideoDialog::loadConfig()
int i; int i;
// Renderer setting // Renderer setting
s = instance().settings().getString("video"); s = BSPF_tolower(instance().settings().getString("video"));
myRendererPopup->clearSelection(); myRendererPopup->clearSelection();
if(s == "soft") myRendererPopup->setSelected(0); if(s == "soft") myRendererPopup->setSelected(0);
else if(s == "gl") myRendererPopup->setSelected(1); else if(s == "gl") myRendererPopup->setSelected(1);
// Filter setting // Filter setting
s = instance().settings().getString("gl_filter"); s = BSPF_tolower(instance().settings().getString("gl_filter"));
myFilterPopup->clearSelection(); myFilterPopup->clearSelection();
if(s == "linear") myFilterPopup->setSelected(0); if(s == "linear") myFilterPopup->setSelected(0);
else if(s == "nearest") myFilterPopup->setSelected(1); else if(s == "nearest") myFilterPopup->setSelected(1);
// GL stretch setting // GL stretch setting
s = instance().settings().getString("gl_fsmax"); s = BSPF_tolower(instance().settings().getString("gl_fsmax"));
myFSStretchPopup->clearSelection(); myFSStretchPopup->clearSelection();
if(s == "never") myFSStretchPopup->setSelected(0); if(s == "never") myFSStretchPopup->setSelected(0);
else if(s == "ui") myFSStretchPopup->setSelected(1); else if(s == "ui") myFSStretchPopup->setSelected(1);
@ -247,30 +259,27 @@ void VideoDialog::loadConfig()
else if(s == "always") myFSStretchPopup->setSelected(3); else if(s == "always") myFSStretchPopup->setSelected(3);
// Palette // Palette
s = instance().settings().getString("palette"); s = BSPF_tolower(instance().settings().getString("palette"));
myPalettePopup->clearSelection(); myPalettePopup->clearSelection();
if(s == "standard") myPalettePopup->setSelected(0); if(s == "standard") myPalettePopup->setSelected(0);
else if(s == "z26") myPalettePopup->setSelected(1); else if(s == "z26") myPalettePopup->setSelected(1);
else if(s == "user") myPalettePopup->setSelected(2); else if(s == "user") myPalettePopup->setSelected(2);
// Fullscreen resolution // Fullscreen resolution
s = instance().settings().getString("fullres"); s = BSPF_tolower(instance().settings().getString("fullres"));
myFSResPopup->clearSelection(); myFSResPopup->clearSelection();
myFSResPopup->setSelected(s); if(s == "auto") myFSResPopup->setSelected(0);
else myFSResPopup->setSelected(s);
if(myFSResPopup->getSelected() < 0) if(myFSResPopup->getSelected() < 0)
myFSResPopup->setSelectedMax(); myFSResPopup->setSelectedMax();
// UI zoom level /*
s = instance().settings().getString("zoom_ui");
i = instance().settings().getInt("zoom_ui");
myUIZoomSlider->setValue(i);
myUIZoomLabel->setLabel(s);
// TIA zoom level // TIA zoom level
s = instance().settings().getString("zoom_tia"); s = instance().settings().getString("zoom_tia");
i = instance().settings().getInt("zoom_tia"); i = instance().settings().getInt("zoom_tia");
myTIAZoomSlider->setValue(i); myTIAZoomSlider->setValue(i);
myTIAZoomLabel->setLabel(s); myTIAZoomLabel->setLabel(s);
*/
// GL aspect ratio setting // GL aspect ratio setting
s = instance().settings().getString("gl_aspect"); s = instance().settings().getString("gl_aspect");
@ -344,10 +353,6 @@ void VideoDialog::saveConfig()
s = myFSResPopup->getSelectedString(); s = myFSResPopup->getSelectedString();
instance().settings().setString("fullres", s); instance().settings().setString("fullres", s);
// UI Scaler
s = myUIZoomLabel->getLabel();
instance().settings().setString("zoom_ui", s);
// TIA Scaler // TIA Scaler
s = myTIAZoomLabel->getLabel(); s = myTIAZoomLabel->getLabel();
instance().settings().setString("zoom_tia", s); instance().settings().setString("zoom_tia", s);
@ -394,8 +399,6 @@ void VideoDialog::setDefaults()
myFSStretchPopup->setSelected(0); myFSStretchPopup->setSelected(0);
myPalettePopup->setSelected(0); myPalettePopup->setSelected(0);
myFSResPopup->setSelectedMax(); myFSResPopup->setSelectedMax();
myUIZoomSlider->setValue(2);
myUIZoomLabel->setLabel("2");
myTIAZoomSlider->setValue(2); myTIAZoomSlider->setValue(2);
myTIAZoomLabel->setLabel("2"); myTIAZoomLabel->setLabel("2");
myAspectRatioSlider->setValue(100); myAspectRatioSlider->setValue(100);
@ -436,8 +439,6 @@ void VideoDialog::handleFullscreenChange(bool enable)
#ifdef WINDOWED_SUPPORT #ifdef WINDOWED_SUPPORT
myFSResPopup->setEnabled(enable); myFSResPopup->setEnabled(enable);
myUIZoomSlider->setEnabled(!enable);
myUIZoomLabel->setEnabled(!enable);
myTIAZoomSlider->setEnabled(!enable); myTIAZoomSlider->setEnabled(!enable);
myTIAZoomLabel->setEnabled(!enable); myTIAZoomLabel->setEnabled(!enable);
@ -464,10 +465,6 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd,
handleRendererChange(data); handleRendererChange(data);
break; break;
case kUIZoomChanged:
myUIZoomLabel->setValue(myUIZoomSlider->getValue());
break;
case kTIAZoomChanged: case kTIAZoomChanged:
myTIAZoomLabel->setValue(myTIAZoomSlider->getValue()); myTIAZoomLabel->setValue(myTIAZoomSlider->getValue());
break; break;