mirror of https://github.com/stella-emu/stella.git
Added ability to dynamically switch between software and OpenGL rendering
modes while still in the emulation (without restarting the currently running ROM). Added the 'Alt g' key to do this, but it can also be activated from the VideoDialog menu. Except for the 'framerate' option, all video related changes can now be done dynamically from within Stella. They can still be specified on the commandline, but that's no longer required (the framerate option will be fixed shortly). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@401 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
56c69d428a
commit
b026a1e247
|
@ -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.19 2005-04-24 20:36:26 stephena Exp $
|
||||
// $Id: FrameBufferGL.cxx,v 1.20 2005-04-29 19:05:04 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -62,15 +62,6 @@ bool FrameBufferGL::initSubsystem()
|
|||
if(theAspectRatio <= 0.0)
|
||||
theAspectRatio = 1.0;
|
||||
|
||||
// Get the maximum size of a window for THIS screen
|
||||
theMaxZoomLevel = maxWindowSizeForScreen();
|
||||
|
||||
// Check to see if window size will fit in the screen
|
||||
if((uInt32)myOSystem->settings().getInt("zoom") > theMaxZoomLevel)
|
||||
theZoomLevel = theMaxZoomLevel;
|
||||
else
|
||||
theZoomLevel = myOSystem->settings().getInt("zoom");
|
||||
|
||||
// Set up the OpenGL attributes
|
||||
myDepth = SDL_GetVideoInfo()->vfmt->BitsPerPixel;
|
||||
switch(myDepth)
|
||||
|
@ -132,12 +123,11 @@ bool FrameBufferGL::initSubsystem()
|
|||
SDL_GL_GetAttribute( SDL_GL_ALPHA_SIZE, (int*)&myRGB[3] );
|
||||
|
||||
#ifndef TEXTURES_ARE_LOST
|
||||
// Create the texture surface and texture fonts
|
||||
// Create the texture surface
|
||||
createTextures();
|
||||
#endif
|
||||
|
||||
// Set up the palette *after* we know the color components
|
||||
// and the textures
|
||||
// Set up the palette *after* we know the color components and the textures
|
||||
setupPalette();
|
||||
|
||||
// Show some OpenGL info
|
||||
|
|
|
@ -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: FrameBufferSoft.cxx,v 1.18 2005-04-24 20:36:35 stephena Exp $
|
||||
// $Id: FrameBufferSoft.cxx,v 1.19 2005-04-29 19:05:04 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -55,15 +55,6 @@ bool FrameBufferSoft::initSubsystem()
|
|||
return false;
|
||||
}
|
||||
|
||||
// Get the maximum size of a window for the desktop
|
||||
theMaxZoomLevel = maxWindowSizeForScreen();
|
||||
|
||||
// Check to see if window size will fit in the screen
|
||||
if((uInt32)myOSystem->settings().getInt("zoom") > theMaxZoomLevel)
|
||||
theZoomLevel = theMaxZoomLevel;
|
||||
else
|
||||
theZoomLevel = myOSystem->settings().getInt("zoom");
|
||||
|
||||
// Create the screen
|
||||
if(!createScreen())
|
||||
return false;
|
||||
|
|
|
@ -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.31 2005-04-28 19:28:32 stephena Exp $
|
||||
// $Id: mainSDL.cxx,v 1.32 2005-04-29 19:05:05 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <fstream>
|
||||
|
@ -74,9 +74,6 @@ static OSystem* theOSystem = (OSystem*) NULL;
|
|||
// Pointer to the display object or the null pointer
|
||||
static EventHandler* theEventHandler = (EventHandler*) NULL;
|
||||
|
||||
// Pointer to the display object or the null pointer
|
||||
static FrameBuffer* theDisplay = (FrameBuffer*) NULL;
|
||||
|
||||
// Pointer to the sound object or the null pointer
|
||||
static Sound* theSound = (Sound*) NULL;
|
||||
|
||||
|
@ -301,9 +298,6 @@ void Cleanup()
|
|||
if(theSound)
|
||||
delete theSound;
|
||||
|
||||
if(theDisplay)
|
||||
delete theDisplay;
|
||||
|
||||
if(theEventHandler)
|
||||
delete theEventHandler;
|
||||
|
||||
|
@ -370,30 +364,8 @@ int main(int argc, char* argv[])
|
|||
// Request that the SDL window be centered, if possible
|
||||
putenv("SDL_VIDEO_CENTERED=1");
|
||||
|
||||
// Set the SDL_VIDEODRIVER environment variable, if possible
|
||||
if(theSettings->getString("video_driver") != "")
|
||||
{
|
||||
ostringstream buf;
|
||||
buf << "SDL_VIDEODRIVER=" << theSettings->getString("video_driver");
|
||||
putenv((char*) buf.str().c_str());
|
||||
|
||||
buf.str("");
|
||||
buf << "Video driver: " << theSettings->getString("video_driver");
|
||||
ShowInfo(buf.str());
|
||||
}
|
||||
|
||||
// Create an SDL window
|
||||
string videodriver = theSettings->getString("video");
|
||||
if(videodriver == "soft")
|
||||
theDisplay = new FrameBufferSoft(theOSystem);
|
||||
#ifdef DISPLAY_OPENGL
|
||||
else if(videodriver == "gl")
|
||||
theDisplay = new FrameBufferGL(theOSystem);
|
||||
#endif
|
||||
else // a driver that doesn't exist was requested, so use software mode
|
||||
theDisplay = new FrameBufferSoft(theOSystem);
|
||||
|
||||
if(!theDisplay)
|
||||
// Create the SDL framebuffer
|
||||
if(!theOSystem->createFrameBuffer())
|
||||
{
|
||||
cerr << "ERROR: Couldn't set up display.\n";
|
||||
Cleanup();
|
||||
|
|
|
@ -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: Console.cxx,v 1.46 2005-04-21 21:18:37 stephena Exp $
|
||||
// $Id: Console.cxx,v 1.47 2005-04-29 19:05:05 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -174,11 +174,7 @@ Console::Console(const uInt8* image, uInt32 size, OSystem* osystem)
|
|||
|
||||
// Initialize the framebuffer interface.
|
||||
// This must be done *after* a reset, since it needs updated values.
|
||||
ostringstream title;
|
||||
title << "Stella: \"" << myProperties.get("Cartridge.Name") << "\"";
|
||||
myOSystem->frameBuffer().initialize(title.str(),
|
||||
myMediaSource->width() << 1,
|
||||
myMediaSource->height());
|
||||
initializeVideo();
|
||||
|
||||
// Initialize the sound interface.
|
||||
uInt32 soundFrameRate = (myProperties.get("Display.Format") == "PAL") ? 50 : 60;
|
||||
|
@ -325,6 +321,15 @@ void Console::saveProperties(string filename, bool merge)
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Console::initializeVideo()
|
||||
{
|
||||
string title = "Stella: \"" + myProperties.get("Cartridge.Name") + "\"";
|
||||
myOSystem->frameBuffer().initialize(title,
|
||||
myMediaSource->width() << 1,
|
||||
myMediaSource->height());
|
||||
}
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Console::changeXStart(const uInt32 direction)
|
||||
|
|
|
@ -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: Console.hxx,v 1.26 2005-04-21 21:18:37 stephena Exp $
|
||||
// $Id: Console.hxx,v 1.27 2005-04-29 19:05:05 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef CONSOLE_HXX
|
||||
|
@ -37,7 +37,7 @@ class OSystem;
|
|||
This class represents the entire game console.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: Console.hxx,v 1.26 2005-04-21 21:18:37 stephena Exp $
|
||||
@version $Id: Console.hxx,v 1.27 2005-04-29 19:05:05 stephena Exp $
|
||||
*/
|
||||
class Console
|
||||
{
|
||||
|
@ -153,6 +153,11 @@ class Console
|
|||
*/
|
||||
void saveProperties(string filename, bool merge = false);
|
||||
|
||||
/**
|
||||
Initialize this video subsystem wrt this class.
|
||||
*/
|
||||
void initializeVideo();
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -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: EventHandler.cxx,v 1.44 2005-04-21 21:18:37 stephena Exp $
|
||||
// $Id: EventHandler.cxx,v 1.45 2005-04-29 19:05:05 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -149,6 +149,10 @@ void EventHandler::poll() // FIXME - add modifiers for OSX
|
|||
case SDLK_f:
|
||||
myOSystem->frameBuffer().toggleFilter();
|
||||
break;
|
||||
|
||||
case SDLK_g:
|
||||
myOSystem->toggleFrameBuffer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(mod & KMOD_CTRL && state)
|
||||
|
|
|
@ -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.cxx,v 1.27 2005-04-24 01:57:47 stephena Exp $
|
||||
// $Id: FrameBuffer.cxx,v 1.28 2005-04-29 19:05:05 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -26,7 +26,6 @@
|
|||
#include "Settings.hxx"
|
||||
#include "MediaSrc.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "FontData.hxx"
|
||||
#include "StellaFont.hxx"
|
||||
#include "GuiUtils.hxx"
|
||||
#include "Menu.hxx"
|
||||
|
@ -49,9 +48,6 @@ FrameBuffer::FrameBuffer(OSystem* osystem)
|
|||
myMenuRedraws(2),
|
||||
myNumRedraws(0)
|
||||
{
|
||||
// Add the framebuffer to the system
|
||||
myOSystem->attach(this);
|
||||
|
||||
// Fill the GUI colors array
|
||||
// The specific video subsystem will know what to do with it
|
||||
uInt8 colors[5][3] = {
|
||||
|
@ -67,20 +63,7 @@ FrameBuffer::FrameBuffer(OSystem* osystem)
|
|||
myGUIColors[i][j] = colors[i][j];
|
||||
|
||||
// Create a font to draw text
|
||||
const FontDesc desc = {
|
||||
"04b-16b-10",
|
||||
9,
|
||||
10,
|
||||
8,
|
||||
33,
|
||||
94,
|
||||
_font_bits,
|
||||
0, /* no encode table*/
|
||||
_sysfont_width,
|
||||
33,
|
||||
sizeof(_font_bits)/sizeof(uInt16)
|
||||
};
|
||||
myFont = new StellaFont(this, desc);
|
||||
myFont = new StellaFont(this);
|
||||
|
||||
myBaseDim.x = myBaseDim.y = myBaseDim.w = myBaseDim.h = 0;
|
||||
myImageDim = myScreenDim = myDesktopDim = myBaseDim;
|
||||
|
@ -110,39 +93,50 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height)
|
|||
if(SDL_Init(initflags) < 0)
|
||||
return;
|
||||
|
||||
// Calculate the desktop size
|
||||
myDesktopDim.w = myDesktopDim.h = 0;
|
||||
|
||||
// Get the system-specific WM information
|
||||
SDL_SysWMinfo myWMInfo;
|
||||
SDL_VERSION(&myWMInfo.version);
|
||||
if(SDL_GetWMInfo(&myWMInfo) > 0)
|
||||
{
|
||||
#if defined(UNIX)
|
||||
if(myWMInfo.subsystem == SDL_SYSWM_X11)
|
||||
{
|
||||
myWMInfo.info.x11.lock_func();
|
||||
myDesktopDim.w = DisplayWidth(myWMInfo.info.x11.display,
|
||||
DefaultScreen(myWMInfo.info.x11.display));
|
||||
myDesktopDim.h = DisplayHeight(myWMInfo.info.x11.display,
|
||||
DefaultScreen(myWMInfo.info.x11.display));
|
||||
myWMInfo.info.x11.unlock_func();
|
||||
}
|
||||
#elif defined(WIN32)
|
||||
myDesktopDim.w = (uInt16) GetSystemMetrics(SM_CXSCREEN);
|
||||
myDesktopDim.h = (uInt16) GetSystemMetrics(SM_CYSCREEN);
|
||||
#elif defined(MAC_OSX)
|
||||
// FIXME - add OSX Desktop code here (I don't think SDL supports it yet)
|
||||
#endif
|
||||
}
|
||||
setWindowIcon();
|
||||
}
|
||||
|
||||
// Calculate the desktop size
|
||||
myDesktopDim.w = myDesktopDim.h = 0;
|
||||
|
||||
// Get the system-specific WM information
|
||||
SDL_SysWMinfo myWMInfo;
|
||||
SDL_VERSION(&myWMInfo.version);
|
||||
if(SDL_GetWMInfo(&myWMInfo) > 0)
|
||||
{
|
||||
#if defined(UNIX)
|
||||
if(myWMInfo.subsystem == SDL_SYSWM_X11)
|
||||
{
|
||||
myWMInfo.info.x11.lock_func();
|
||||
myDesktopDim.w = DisplayWidth(myWMInfo.info.x11.display,
|
||||
DefaultScreen(myWMInfo.info.x11.display));
|
||||
myDesktopDim.h = DisplayHeight(myWMInfo.info.x11.display,
|
||||
DefaultScreen(myWMInfo.info.x11.display));
|
||||
myWMInfo.info.x11.unlock_func();
|
||||
}
|
||||
#elif defined(WIN32)
|
||||
myDesktopDim.w = (uInt16) GetSystemMetrics(SM_CXSCREEN);
|
||||
myDesktopDim.h = (uInt16) GetSystemMetrics(SM_CYSCREEN);
|
||||
#elif defined(MAC_OSX)
|
||||
// FIXME - add OSX Desktop code here (I don't think SDL supports it yet)
|
||||
#endif
|
||||
}
|
||||
|
||||
// Set fullscreen flag
|
||||
mySDLFlags = myOSystem->settings().getBool("fullscreen") ? SDL_FULLSCREEN : 0;
|
||||
|
||||
// Set window title
|
||||
setWindowTitle(title);
|
||||
|
||||
// Get the maximum size of a window for the current desktop
|
||||
theMaxZoomLevel = maxWindowSizeForScreen();
|
||||
|
||||
// Check to see if window size will fit in the screen
|
||||
if((uInt32)myOSystem->settings().getInt("zoom") > theMaxZoomLevel)
|
||||
theZoomLevel = theMaxZoomLevel;
|
||||
else
|
||||
theZoomLevel = myOSystem->settings().getInt("zoom");
|
||||
|
||||
// Initialize video subsystem
|
||||
initSubsystem();
|
||||
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-1999 by Bradford W. Mott
|
||||
// Copyright (c) 1995-2005 by Bradford W. Mott
|
||||
//
|
||||
// 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.6 2005-03-14 04:08:15 stephena Exp $
|
||||
// $Id: OSystem.cxx,v 1.7 2005-04-29 19:05:05 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -21,6 +21,11 @@
|
|||
#include <fstream>
|
||||
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "FrameBufferSoft.hxx"
|
||||
#ifdef DISPLAY_OPENGL
|
||||
#include "FrameBufferGL.hxx"
|
||||
#endif
|
||||
|
||||
#include "Sound.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "PropsSet.hxx"
|
||||
|
@ -32,7 +37,13 @@
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystem::OSystem()
|
||||
: myMenu(NULL)
|
||||
: myEventHandler(NULL),
|
||||
myFrameBuffer(NULL),
|
||||
mySound(NULL),
|
||||
mySettings(NULL),
|
||||
myPropSet(NULL),
|
||||
myConsole(NULL),
|
||||
myMenu(NULL)
|
||||
// myBrowser(NULL)
|
||||
{
|
||||
// Create gui-related classes
|
||||
|
@ -48,6 +59,9 @@ OSystem::~OSystem()
|
|||
|
||||
// Remove any game console that is currently attached
|
||||
detachConsole();
|
||||
|
||||
// OSystem takes responsibility for the framebuffer
|
||||
delete myFrameBuffer;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -80,6 +94,93 @@ void OSystem::setConfigFiles(const string& userconfig,
|
|||
myConfigInputFile = "";
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool OSystem::createFrameBuffer(bool showmessage)
|
||||
{
|
||||
// Set the SDL_VIDEODRIVER environment variable, if possible
|
||||
string videodriver = mySettings->getString("video_driver");
|
||||
if(videodriver != "")
|
||||
{
|
||||
string buf = "SDL_VIDEODRIVER=" + videodriver;
|
||||
putenv((char*) buf.c_str());
|
||||
|
||||
if(mySettings->getBool("showinfo"))
|
||||
{
|
||||
buf = "Video driver: " + videodriver;
|
||||
cout << buf << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the old framebuffer
|
||||
if(myFrameBuffer)
|
||||
{
|
||||
delete myFrameBuffer;
|
||||
myFrameBuffer = NULL;
|
||||
}
|
||||
|
||||
// And recreate a new one
|
||||
string video = mySettings->getString("video");
|
||||
if(video == "soft")
|
||||
myFrameBuffer = new FrameBufferSoft(this);
|
||||
#ifdef DISPLAY_OPENGL
|
||||
else if(video == "gl")
|
||||
myFrameBuffer = new FrameBufferGL(this);
|
||||
#endif
|
||||
else // a driver that doesn't exist was requested, so use software mode
|
||||
myFrameBuffer = new FrameBufferSoft(this);
|
||||
|
||||
if(!myFrameBuffer)
|
||||
return false;
|
||||
|
||||
// Re-initialize the framebuffer to current settings
|
||||
switch(myEventHandler->state())
|
||||
{
|
||||
case EventHandler::S_EMULATE:
|
||||
case EventHandler::S_MENU:
|
||||
myConsole->initializeVideo();
|
||||
if(showmessage)
|
||||
{
|
||||
if(video == "soft")
|
||||
myFrameBuffer->showMessage("Software mode");
|
||||
#ifdef DISPLAY_OPENGL
|
||||
else if(video == "gl")
|
||||
myFrameBuffer->showMessage("OpenGL mode");
|
||||
#endif
|
||||
else // a driver that doesn't exist was requested, so use software mode
|
||||
myFrameBuffer->showMessage("Software mode");
|
||||
}
|
||||
break; // S_EMULATE, S_MENU
|
||||
|
||||
case EventHandler::S_BROWSER:
|
||||
break; // S_BROWSER
|
||||
|
||||
case EventHandler::S_DEBUGGER:
|
||||
break;
|
||||
|
||||
case EventHandler::S_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystem::toggleFrameBuffer()
|
||||
{
|
||||
// First figure out which mode to switch to
|
||||
string video = mySettings->getString("video");
|
||||
if(video == "soft")
|
||||
video = "gl";
|
||||
else if(video == "gl")
|
||||
video = "soft";
|
||||
else // a driver that doesn't exist was requested, so use software mode
|
||||
video = "soft";
|
||||
|
||||
// Update the settings and create the framebuffer
|
||||
mySettings->setString("video", video);
|
||||
createFrameBuffer(true); // show onscreen message
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystem::OSystem(const OSystem& osystem)
|
||||
{
|
||||
|
|
|
@ -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.4 2005-03-10 22:59:40 stephena Exp $
|
||||
// $Id: OSystem.hxx,v 1.5 2005-04-29 19:05:05 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef OSYSTEM_HXX
|
||||
|
@ -37,7 +37,7 @@ class Browser;
|
|||
other objects belong.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: OSystem.hxx,v 1.4 2005-03-10 22:59:40 stephena Exp $
|
||||
@version $Id: OSystem.hxx,v 1.5 2005-04-29 19:05:05 stephena Exp $
|
||||
*/
|
||||
class OSystem
|
||||
{
|
||||
|
@ -232,6 +232,19 @@ class OSystem
|
|||
*/
|
||||
string configOutputFilename() { return myConfigOutputFile; }
|
||||
|
||||
/**
|
||||
Creates the various framebuffers/renderers available in this system
|
||||
(for now, that means either 'software' or 'opengl').
|
||||
|
||||
@return Success or failure of the framebuffer creation
|
||||
*/
|
||||
bool createFrameBuffer(bool showmessage = false);
|
||||
|
||||
/**
|
||||
Switches between software and OpenGL framebuffer modes.
|
||||
*/
|
||||
void toggleFrameBuffer();
|
||||
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// The following methods are system-specific and must be implemented
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: OptionsDialog.cxx,v 1.11 2005-04-28 19:28:33 stephena Exp $
|
||||
// $Id: OptionsDialog.cxx,v 1.12 2005-04-29 19:05:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -78,7 +78,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem)
|
|||
uInt16 x, y, w, h;
|
||||
|
||||
// Now create all the dialogs attached to each menu button
|
||||
w = 230; h = 150;
|
||||
w = 230; h = 130;
|
||||
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
|
||||
myVideoDialog = new VideoDialog(myOSystem, x, y, w, h);
|
||||
|
||||
|
|
|
@ -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: StellaFont.cxx,v 1.1 2005-03-13 03:38:40 stephena Exp $
|
||||
// $Id: StellaFont.cxx,v 1.2 2005-04-29 19:05:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -21,8 +21,30 @@
|
|||
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "GuiUtils.hxx"
|
||||
#include "FontData.hxx"
|
||||
#include "StellaFont.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
StellaFont::StellaFont(FrameBuffer* buffer)
|
||||
: myFrameBuffer(buffer)
|
||||
{
|
||||
const FontDesc desc = {
|
||||
"04b-16b-10",
|
||||
9,
|
||||
10,
|
||||
8,
|
||||
33,
|
||||
94,
|
||||
_font_bits,
|
||||
0, /* no encode table*/
|
||||
_sysfont_width,
|
||||
33,
|
||||
sizeof(_font_bits)/sizeof(uInt16)
|
||||
};
|
||||
|
||||
myFontDesc = desc;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Int32 StellaFont::getCharWidth(uInt8 chr) const
|
||||
{
|
||||
|
|
|
@ -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: StellaFont.hxx,v 1.1 2005-03-13 03:38:41 stephena Exp $
|
||||
// $Id: StellaFont.hxx,v 1.2 2005-04-29 19:05:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -54,8 +54,7 @@ struct FontDesc
|
|||
class StellaFont
|
||||
{
|
||||
public:
|
||||
StellaFont(FrameBuffer* buffer, const FontDesc& desc)
|
||||
: myFrameBuffer(buffer), myFontDesc(desc) {}
|
||||
StellaFont(FrameBuffer* buffer);
|
||||
|
||||
const FontDesc& desc() { return myFontDesc; }
|
||||
|
||||
|
|
|
@ -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.6 2005-04-28 19:28:33 stephena Exp $
|
||||
// $Id: VideoDialog.cxx,v 1.7 2005-04-29 19:05:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -50,7 +50,7 @@ VideoDialog::VideoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16
|
|||
|
||||
// Video driver (query OSystem for what's supported)
|
||||
myDriverPopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight,
|
||||
"(*)Driver: ", labelWidth);
|
||||
"Driver: ", labelWidth);
|
||||
// myDriverPopup->appendEntry("First one", 1);
|
||||
// myDriverPopup->appendEntry("Another one", 2);
|
||||
yoff += kVideoRowHeight + 4;
|
||||
|
@ -123,13 +123,6 @@ VideoDialog::VideoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16
|
|||
"Desktop Res in FS");
|
||||
yoff += kVideoRowHeight + 20;
|
||||
|
||||
// Add a short message about options that need a restart
|
||||
new StaticTextWidget(this, _w - 175, yoff, 170, kLineHeight,
|
||||
"* Note that these options take effect", kTextAlignLeft);
|
||||
yoff += kVideoRowHeight;
|
||||
new StaticTextWidget(this, _w - 175, yoff, 170, kLineHeight,
|
||||
"the next time you restart Stella.", kTextAlignLeft);
|
||||
|
||||
// Add Defaults, OK and Cancel buttons
|
||||
addButton( 10, _h - 24, "Defaults", kDefaultsCmd, 0);
|
||||
#ifndef MAC_OSX
|
||||
|
@ -176,12 +169,7 @@ void VideoDialog::loadConfig()
|
|||
// Aspect ratio - another huge hack
|
||||
s = instance()->settings().getString("gl_aspect");
|
||||
f = instance()->settings().getFloat("gl_aspect");
|
||||
if(f == -1.0)
|
||||
{
|
||||
f = 1.1;
|
||||
s = "1.1";
|
||||
}
|
||||
else if(f < 1.1)
|
||||
if(f < 1.1)
|
||||
{
|
||||
f = 1.1;
|
||||
s = "1.1";
|
||||
|
@ -231,30 +219,47 @@ void VideoDialog::saveConfig()
|
|||
{
|
||||
string s;
|
||||
uInt32 i;
|
||||
bool b;
|
||||
bool b, restart = false;
|
||||
|
||||
// Driver setting
|
||||
s = myDriverPopup->getSelectedString();
|
||||
instance()->settings().setString("video_driver", s);
|
||||
if(s != instance()->settings().getString("video_driver"))
|
||||
{
|
||||
instance()->settings().setString("video_driver", s);
|
||||
restart = true;
|
||||
}
|
||||
|
||||
// Renderer setting
|
||||
i = myRendererPopup->getSelectedTag();
|
||||
if(i == 1)
|
||||
instance()->settings().setString("video", "soft");
|
||||
s = "soft";
|
||||
else if(i == 2)
|
||||
instance()->settings().setString("video", "gl");
|
||||
s = "gl";
|
||||
if(s != instance()->settings().getString("video"))
|
||||
{
|
||||
instance()->settings().setString("video", s);
|
||||
restart = true;
|
||||
}
|
||||
|
||||
// Filter setting
|
||||
i = myFilterPopup->getSelectedTag();
|
||||
if(i == 1)
|
||||
instance()->settings().setString("gl_filter", "linear");
|
||||
s = "linear";
|
||||
else if(i == 2)
|
||||
instance()->settings().setString("gl_filter", "nearest");
|
||||
// FIXME - immediately change the filtering
|
||||
s = "nearest";
|
||||
if(s != instance()->settings().getString("gl_filter"))
|
||||
{
|
||||
instance()->settings().setString("gl_filter", s);
|
||||
restart = true;
|
||||
}
|
||||
|
||||
// Aspect ratio
|
||||
s = myAspectRatioLabel->getLabel();
|
||||
instance()->settings().setString("gl_aspect", s);
|
||||
if(s != instance()->settings().getString("gl_aspect"))
|
||||
{
|
||||
instance()->settings().setString("gl_aspect", s);
|
||||
restart = true;
|
||||
}
|
||||
|
||||
// Palette
|
||||
i = myPalettePopup->getSelectedTag();
|
||||
|
@ -265,7 +270,7 @@ void VideoDialog::saveConfig()
|
|||
else if(i == 3)
|
||||
instance()->settings().setString("palette", "z26");
|
||||
s = myPalettePopup->getSelectedString();
|
||||
instance()->settings().setString("palette", s); // FIXME - make this more efficient
|
||||
instance()->settings().setString("palette", s);
|
||||
instance()->console().togglePalette(s);
|
||||
|
||||
// Framerate
|
||||
|
@ -284,8 +289,17 @@ void VideoDialog::saveConfig()
|
|||
|
||||
// Use desktop resolution in fullscreen mode
|
||||
b = myUseDeskResCheckbox->getState();
|
||||
instance()->settings().setBool("gl_fsmax", b);
|
||||
// FIXME - immediately toggle gl_fsmax
|
||||
if(b != instance()->settings().getBool("gl_fsmax"))
|
||||
{
|
||||
instance()->settings().setBool("gl_fsmax", b);
|
||||
restart = true;
|
||||
}
|
||||
|
||||
// Finally, issue a complete framebuffer re-initialization
|
||||
// Not all options may require a full re-initialization, so we only
|
||||
// do it when necessary
|
||||
if(restart)
|
||||
instance()->createFrameBuffer();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
Loading…
Reference in New Issue