stella/src/emucore/OSystem.hxx

666 lines
18 KiB
C++
Raw Normal View History

//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2012 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#ifndef OSYSTEM_HXX
#define OSYSTEM_HXX
class Cartridge;
class CheatManager;
class CommandMenu;
class Console;
class Debugger;
class Launcher;
class Menu;
class Properties;
class PropertiesSet;
class SerialPort;
class Settings;
class Sound;
class StateManager;
class VideoDialog;
namespace GUI {
class Font;
}
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for those systems which don't actually have a windowing environment. When this is set, toggling from fullscreen will not be possible, and certain window-related UI functions will not be accessible. Completely revamped video subsystem. Windowed and fullscreen modes are now dealt with separately. Windows can be zoomed using the 'zoom_ui' and 'zoom_tia' arguments. Fullscreen modes are now set by resolution, not zoom, so you can specify to always use a certain fullscreen resolution, and the images will be scaled appropriately. This also fixes the fullscreen issues on widescreen monitors; just select a widescreen video mode, and the aspect ratio will always be correct. Removed dirty-rect support for software rendering of the TIA image, as it ended up being slower than just updating the entire image. For those resolutions where it will start to slow down (1024x768 or higher), one should be using OpenGL. Fixed issue in Windows when returning from fullscreen mode made the window constantly 'shrink' in size. It was related to auto-detecting the desktop resolution, which is really the job of SDL. As such, all further releases of Stella will require SDL 1.2.10, which includes this auto-detection code internally. Made ROM launcher resizable, configurable in sizes from 320x240 to 800x600. Updated the UIDialog to change these quantities from the UI (Stella will need to be restarted for it to take effect). Removed aspect ratio support, since it was causing problems, and the new fullscreen mode work has made it obsolete. i *may* consider it again in the future, if there's sufficient demand. Added 'fullres' commandline argument, used to set the fullscreen resolution. Added 'launcherres' commandline argument, used to set the ROM launcher resolution. This replaces 'launchersize' argument, which has been removed. Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia', respectively. Their function remains the same. Changed meaning of 'gl_fsmax' argument to specify what modes to use fullscreen OpenGL scaling (previously, this was a boolean, and didn't consider different modes). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
#include "Array.hxx"
#include "FrameBuffer.hxx"
#include "bspf.hxx"
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for those systems which don't actually have a windowing environment. When this is set, toggling from fullscreen will not be possible, and certain window-related UI functions will not be accessible. Completely revamped video subsystem. Windowed and fullscreen modes are now dealt with separately. Windows can be zoomed using the 'zoom_ui' and 'zoom_tia' arguments. Fullscreen modes are now set by resolution, not zoom, so you can specify to always use a certain fullscreen resolution, and the images will be scaled appropriately. This also fixes the fullscreen issues on widescreen monitors; just select a widescreen video mode, and the aspect ratio will always be correct. Removed dirty-rect support for software rendering of the TIA image, as it ended up being slower than just updating the entire image. For those resolutions where it will start to slow down (1024x768 or higher), one should be using OpenGL. Fixed issue in Windows when returning from fullscreen mode made the window constantly 'shrink' in size. It was related to auto-detecting the desktop resolution, which is really the job of SDL. As such, all further releases of Stella will require SDL 1.2.10, which includes this auto-detection code internally. Made ROM launcher resizable, configurable in sizes from 320x240 to 800x600. Updated the UIDialog to change these quantities from the UI (Stella will need to be restarted for it to take effect). Removed aspect ratio support, since it was causing problems, and the new fullscreen mode work has made it obsolete. i *may* consider it again in the future, if there's sufficient demand. Added 'fullres' commandline argument, used to set the fullscreen resolution. Added 'launcherres' commandline argument, used to set the ROM launcher resolution. This replaces 'launchersize' argument, which has been removed. Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia', respectively. Their function remains the same. Changed meaning of 'gl_fsmax' argument to specify what modes to use fullscreen OpenGL scaling (previously, this was a boolean, and didn't consider different modes). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
struct Resolution {
uInt32 width;
uInt32 height;
string name;
};
typedef Common::Array<Resolution> ResolutionList;
/**
This class provides an interface for accessing operating system specific
functions. It also comprises an overall parent object, to which all the
other objects belong.
@author Stephen Anthony
@version $Id$
*/
class OSystem
{
friend class EventHandler;
friend class VideoDialog;
public:
/**
Create a new OSystem abstract class
*/
OSystem();
/**
Destructor
*/
virtual ~OSystem();
/**
Create all child objects which belong to this OSystem
*/
virtual bool create();
public:
/**
Adds the specified settings object to the system.
@param settings The settings object to add
*/
void attach(Settings* settings) { mySettings = settings; }
/**
Get the event handler of the system
@return The event handler
*/
EventHandler& eventHandler() const { return *myEventHandler; }
/**
Get the frame buffer of the system
@return The frame buffer
*/
FrameBuffer& frameBuffer() const { return *myFrameBuffer; }
/**
Get the sound object of the system
@return The sound object
*/
Sound& sound() const { return *mySound; }
/**
Get the settings object of the system
@return The settings object
*/
Settings& settings() const { return *mySettings; }
/**
Get the set of game properties for the system
@return The properties set object
*/
PropertiesSet& propSet() const { return *myPropSet; }
/**
Get the console of the system.
@return The console object
*/
Console& console() const { return *myConsole; }
/**
Get the serial port of the system.
@return The serial port object
*/
SerialPort& serialPort() const { return *mySerialPort; }
/**
Get the settings menu of the system.
@return The settings menu object
*/
Menu& menu() const { return *myMenu; }
/**
Get the command menu of the system.
@return The command menu object
*/
CommandMenu& commandMenu() const { return *myCommandMenu; }
/**
Get the ROM launcher of the system.
@return The launcher object
*/
Launcher& launcher() const { return *myLauncher; }
/**
Get the state manager of the system.
@return The statemanager object
*/
StateManager& state() const { return *myStateManager; }
#ifdef DEBUGGER_SUPPORT
/**
Get the ROM debugger of the system.
@return The debugger object
*/
Debugger& debugger() const { return *myDebugger; }
#endif
#ifdef CHEATCODE_SUPPORT
/**
Get the cheat manager of the system.
@return The cheatmanager object
*/
CheatManager& cheat() const { return *myCheatManager; }
#endif
/**
Get the font object of the system
@return The font reference
*/
const GUI::Font& font() const { return *myFont; }
/**
Get the info font object of the system
@return The font reference
*/
const GUI::Font& infoFont() const { return *myInfoFont; }
/**
Get the small font object of the system
@return The font reference
*/
const GUI::Font& smallFont() const { return *mySmallFont; }
/**
Get the launcher font object of the system
@return The font reference
*/
const GUI::Font& launcherFont() const { return *myLauncherFont; }
/**
Get the console font object of the system
@return The console font reference
*/
const GUI::Font& consoleFont() const { return *myConsoleFont; }
/**
Set the framerate for the video system. It's placed in this class since
the mainLoop() method is defined here.
@param framerate The video framerate to use
*/
virtual void setFramerate(float framerate);
/**
Set all config file paths for the OSystem.
*/
void setConfigPaths();
/**
Set the user-interface palette which is specified in current settings.
*/
void setUIPalette();
/**
Get the current framerate for the video system.
@return The video framerate currently in use
*/
float frameRate() const { return myDisplayFrameRate; }
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for those systems which don't actually have a windowing environment. When this is set, toggling from fullscreen will not be possible, and certain window-related UI functions will not be accessible. Completely revamped video subsystem. Windowed and fullscreen modes are now dealt with separately. Windows can be zoomed using the 'zoom_ui' and 'zoom_tia' arguments. Fullscreen modes are now set by resolution, not zoom, so you can specify to always use a certain fullscreen resolution, and the images will be scaled appropriately. This also fixes the fullscreen issues on widescreen monitors; just select a widescreen video mode, and the aspect ratio will always be correct. Removed dirty-rect support for software rendering of the TIA image, as it ended up being slower than just updating the entire image. For those resolutions where it will start to slow down (1024x768 or higher), one should be using OpenGL. Fixed issue in Windows when returning from fullscreen mode made the window constantly 'shrink' in size. It was related to auto-detecting the desktop resolution, which is really the job of SDL. As such, all further releases of Stella will require SDL 1.2.10, which includes this auto-detection code internally. Made ROM launcher resizable, configurable in sizes from 320x240 to 800x600. Updated the UIDialog to change these quantities from the UI (Stella will need to be restarted for it to take effect). Removed aspect ratio support, since it was causing problems, and the new fullscreen mode work has made it obsolete. i *may* consider it again in the future, if there's sufficient demand. Added 'fullres' commandline argument, used to set the fullscreen resolution. Added 'launcherres' commandline argument, used to set the ROM launcher resolution. This replaces 'launchersize' argument, which has been removed. Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia', respectively. Their function remains the same. Changed meaning of 'gl_fsmax' argument to specify what modes to use fullscreen OpenGL scaling (previously, this was a boolean, and didn't consider different modes). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
/**
Get the maximum dimensions of a window for the video hardware.
*/
uInt32 desktopWidth() const { return myDesktopWidth; }
uInt32 desktopHeight() const { return myDesktopHeight; }
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for those systems which don't actually have a windowing environment. When this is set, toggling from fullscreen will not be possible, and certain window-related UI functions will not be accessible. Completely revamped video subsystem. Windowed and fullscreen modes are now dealt with separately. Windows can be zoomed using the 'zoom_ui' and 'zoom_tia' arguments. Fullscreen modes are now set by resolution, not zoom, so you can specify to always use a certain fullscreen resolution, and the images will be scaled appropriately. This also fixes the fullscreen issues on widescreen monitors; just select a widescreen video mode, and the aspect ratio will always be correct. Removed dirty-rect support for software rendering of the TIA image, as it ended up being slower than just updating the entire image. For those resolutions where it will start to slow down (1024x768 or higher), one should be using OpenGL. Fixed issue in Windows when returning from fullscreen mode made the window constantly 'shrink' in size. It was related to auto-detecting the desktop resolution, which is really the job of SDL. As such, all further releases of Stella will require SDL 1.2.10, which includes this auto-detection code internally. Made ROM launcher resizable, configurable in sizes from 320x240 to 800x600. Updated the UIDialog to change these quantities from the UI (Stella will need to be restarted for it to take effect). Removed aspect ratio support, since it was causing problems, and the new fullscreen mode work has made it obsolete. i *may* consider it again in the future, if there's sufficient demand. Added 'fullres' commandline argument, used to set the fullscreen resolution. Added 'launcherres' commandline argument, used to set the ROM launcher resolution. This replaces 'launchersize' argument, which has been removed. Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia', respectively. Their function remains the same. Changed meaning of 'gl_fsmax' argument to specify what modes to use fullscreen OpenGL scaling (previously, this was a boolean, and didn't consider different modes). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
/**
Get the supported fullscreen resolutions for the video hardware.
@return An array of supported resolutions
*/
const ResolutionList& supportedResolutions() const { return myResolutions; }
/**
Return the default full/complete directory name for storing data.
*/
const string& baseDir() const { return myBaseDir; }
/**
Return the full/complete directory name for storing state files.
*/
const string& stateDir() const { return myStateDir; }
/**
Return the full/complete directory name for storing PNG snapshots.
*/
const string& snapshotDir() const { return mySnapshotDir; }
/**
Return the full/complete directory name for storing EEPROM files.
*/
const string& eepromDir() const { return myEEPROMDir; }
/**
Return the full/complete directory name for storing Distella cfg files.
*/
const string& cfgDir() const { return myCfgDir; }
/**
This method should be called to get the full path of the cheat file.
@return String representing the full path of the cheat filename.
*/
const string& cheatFile() const { return myCheatFile; }
/**
This method should be called to get the full path of the config file.
@return String representing the full path of the config filename.
*/
const string& configFile() const { return myConfigFile; }
/**
This method should be called to get the full path of the
(optional) palette file.
@return String representing the full path of the properties filename.
*/
const string& paletteFile() const { return myPaletteFile; }
/**
This method should be called to get the full path of the
properties file (stella.pro).
@return String representing the full path of the properties filename.
*/
const string& propertiesFile() const { return myPropertiesFile; }
/**
This method should be called to get the full path of the currently
loaded ROM.
@return String representing the full path of the ROM file.
*/
const string& romFile() const { return myRomFile; }
/**
Creates a new game console from the specified romfile, and correctly
initializes the system state to start emulation of the Console.
@param romfile The full pathname of the ROM to use
@param md5 The MD5sum of the ROM
@return True on successful creation, otherwise false
*/
bool createConsole(const string& romfile = "", const string& md5 = "");
/**
Deletes the currently defined console, if it exists.
Also prints some statistics (fps, total frames, etc).
*/
void deleteConsole();
/**
Creates a new ROM launcher, to select a new ROM to emulate.
@param startdir The directory to use when opening the launcher;
if blank, use 'romdir' setting.
@return True on successful creation, otherwise false
*/
bool createLauncher(const string& startdir = "");
/**
Gets all possible info about the ROM by creating a temporary
Console object and querying it.
@param romfile The full pathname of the ROM to use
@return Some information about this ROM
*/
string getROMInfo(const string& romfile);
/**
The features which are conditionally compiled into Stella.
@return The supported features
*/
const string& features() const { return myFeatures; }
/**
The build information for Stella (SDL version, architecture, etc).
@return The build info
*/
const string& buildInfo() const { return myBuildInfo; }
/**
Calculate the MD5sum of the given file.
@param filename Filename of potential ROM file
*/
string MD5FromFile(const string& filename);
/**
Issue a quit event to the OSystem.
*/
void quit() { myQuitLoop = true; }
/**
Append a message to the internal log.
@param message The message to be appended
@param level If 0, always output the message, only append when
level is less than or equal to that in 'loglevel'
*/
void logMessage(const string& message, uInt8 level);
/**
Get the system messages logged up to this point.
@return The list of log messages
*/
const string& logMessages() const { return myLogMessages; }
public:
//////////////////////////////////////////////////////////////////////
// The following methods are system-specific and can be overrided in
// derived classes. Otherwise, the base methods will be used.
//////////////////////////////////////////////////////////////////////
/**
This method returns number of ticks in microseconds since some
pre-defined time in the past. *NOTE*: it is necessary that this
pre-defined time exists between runs of the application, and must
be (relatively) unique. For example, the time since the system
started running is not a good choice, since it can be duplicated.
The current implementation uses time since the UNIX epoch.
@return Current time in microseconds.
*/
virtual uInt64 getTicks() const;
/**
This method runs the main loop. Since different platforms
may use different timing methods and/or algorithms, this method can
be overrided. However, the port then takes all responsibility for
running the emulation and taking care of timing.
*/
virtual void mainLoop();
/**
This method determines the default mapping of joystick actions to
Stella events for a specific system/platform.
@param event The event which to (re)set (Event::NoType resets all)
@param mode The mode for which the defaults are set
*/
virtual void setDefaultJoymap(Event::Type event, EventMode mode);
/**
This method creates events from platform-specific hardware.
*/
virtual void pollEvent();
/**
Informs the OSystem of a change in EventHandler state.
*/
virtual void stateChanged(EventHandler::State state);
/**
Returns the default path for the snapshot directory.
Since this varies greatly among different systems and is the one
directory that most end-users care about (vs. config file stuff
that usually isn't user-modifiable), we create a special method
for it.
*/
virtual string defaultSnapDir() { return "~"; }
/**
Set the position of the application window, generally using
platform-specific code. Note that this method is only ever
called for windowed mode, so no provisions need be made
for fullscreen mode.
*/
virtual void setAppWindowPos(int x, int y, int w, int h) { };
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for those systems which don't actually have a windowing environment. When this is set, toggling from fullscreen will not be possible, and certain window-related UI functions will not be accessible. Completely revamped video subsystem. Windowed and fullscreen modes are now dealt with separately. Windows can be zoomed using the 'zoom_ui' and 'zoom_tia' arguments. Fullscreen modes are now set by resolution, not zoom, so you can specify to always use a certain fullscreen resolution, and the images will be scaled appropriately. This also fixes the fullscreen issues on widescreen monitors; just select a widescreen video mode, and the aspect ratio will always be correct. Removed dirty-rect support for software rendering of the TIA image, as it ended up being slower than just updating the entire image. For those resolutions where it will start to slow down (1024x768 or higher), one should be using OpenGL. Fixed issue in Windows when returning from fullscreen mode made the window constantly 'shrink' in size. It was related to auto-detecting the desktop resolution, which is really the job of SDL. As such, all further releases of Stella will require SDL 1.2.10, which includes this auto-detection code internally. Made ROM launcher resizable, configurable in sizes from 320x240 to 800x600. Updated the UIDialog to change these quantities from the UI (Stella will need to be restarted for it to take effect). Removed aspect ratio support, since it was causing problems, and the new fullscreen mode work has made it obsolete. i *may* consider it again in the future, if there's sufficient demand. Added 'fullres' commandline argument, used to set the fullscreen resolution. Added 'launcherres' commandline argument, used to set the ROM launcher resolution. This replaces 'launchersize' argument, which has been removed. Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia', respectively. Their function remains the same. Changed meaning of 'gl_fsmax' argument to specify what modes to use fullscreen OpenGL scaling (previously, this was a boolean, and didn't consider different modes). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
protected:
/**
Query the OSystem video hardware for resolution information.
*/
virtual bool queryVideoHardware();
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for those systems which don't actually have a windowing environment. When this is set, toggling from fullscreen will not be possible, and certain window-related UI functions will not be accessible. Completely revamped video subsystem. Windowed and fullscreen modes are now dealt with separately. Windows can be zoomed using the 'zoom_ui' and 'zoom_tia' arguments. Fullscreen modes are now set by resolution, not zoom, so you can specify to always use a certain fullscreen resolution, and the images will be scaled appropriately. This also fixes the fullscreen issues on widescreen monitors; just select a widescreen video mode, and the aspect ratio will always be correct. Removed dirty-rect support for software rendering of the TIA image, as it ended up being slower than just updating the entire image. For those resolutions where it will start to slow down (1024x768 or higher), one should be using OpenGL. Fixed issue in Windows when returning from fullscreen mode made the window constantly 'shrink' in size. It was related to auto-detecting the desktop resolution, which is really the job of SDL. As such, all further releases of Stella will require SDL 1.2.10, which includes this auto-detection code internally. Made ROM launcher resizable, configurable in sizes from 320x240 to 800x600. Updated the UIDialog to change these quantities from the UI (Stella will need to be restarted for it to take effect). Removed aspect ratio support, since it was causing problems, and the new fullscreen mode work has made it obsolete. i *may* consider it again in the future, if there's sufficient demand. Added 'fullres' commandline argument, used to set the fullscreen resolution. Added 'launcherres' commandline argument, used to set the ROM launcher resolution. This replaces 'launchersize' argument, which has been removed. Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia', respectively. Their function remains the same. Changed meaning of 'gl_fsmax' argument to specify what modes to use fullscreen OpenGL scaling (previously, this was a boolean, and didn't consider different modes). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
/**
Set the base directory for all Stella files (these files may be
located in other places through settings).
*/
void setBaseDir(const string& basedir);
/**
Set the locations of config file
*/
void setConfigFile(const string& file);
protected:
// Pointer to the EventHandler object
EventHandler* myEventHandler;
// Pointer to the FrameBuffer object
FrameBuffer* myFrameBuffer;
// Pointer to the Sound object
Sound* mySound;
// Pointer to the Settings object
Settings* mySettings;
// Pointer to the PropertiesSet object
PropertiesSet* myPropSet;
// Pointer to the (currently defined) Console object
Console* myConsole;
// Pointer to the serial port object
SerialPort* mySerialPort;
// Pointer to the Menu object
Menu* myMenu;
// Pointer to the CommandMenu object
CommandMenu* myCommandMenu;
// Pointer to the Launcher object
Launcher* myLauncher;
// Pointer to the Debugger object
Debugger* myDebugger;
// Pointer to the CheatManager object
CheatManager* myCheatManager;
// Pointer to the StateManager object
StateManager* myStateManager;
// The list of log messages
string myLogMessages;
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for those systems which don't actually have a windowing environment. When this is set, toggling from fullscreen will not be possible, and certain window-related UI functions will not be accessible. Completely revamped video subsystem. Windowed and fullscreen modes are now dealt with separately. Windows can be zoomed using the 'zoom_ui' and 'zoom_tia' arguments. Fullscreen modes are now set by resolution, not zoom, so you can specify to always use a certain fullscreen resolution, and the images will be scaled appropriately. This also fixes the fullscreen issues on widescreen monitors; just select a widescreen video mode, and the aspect ratio will always be correct. Removed dirty-rect support for software rendering of the TIA image, as it ended up being slower than just updating the entire image. For those resolutions where it will start to slow down (1024x768 or higher), one should be using OpenGL. Fixed issue in Windows when returning from fullscreen mode made the window constantly 'shrink' in size. It was related to auto-detecting the desktop resolution, which is really the job of SDL. As such, all further releases of Stella will require SDL 1.2.10, which includes this auto-detection code internally. Made ROM launcher resizable, configurable in sizes from 320x240 to 800x600. Updated the UIDialog to change these quantities from the UI (Stella will need to be restarted for it to take effect). Removed aspect ratio support, since it was causing problems, and the new fullscreen mode work has made it obsolete. i *may* consider it again in the future, if there's sufficient demand. Added 'fullres' commandline argument, used to set the fullscreen resolution. Added 'launcherres' commandline argument, used to set the ROM launcher resolution. This replaces 'launchersize' argument, which has been removed. Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia', respectively. Their function remains the same. Changed meaning of 'gl_fsmax' argument to specify what modes to use fullscreen OpenGL scaling (previously, this was a boolean, and didn't consider different modes). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
// Maximum dimensions of the desktop area
uInt32 myDesktopWidth, myDesktopHeight;
// Supported fullscreen resolutions
ResolutionList myResolutions;
// Number of times per second to iterate through the main loop
float myDisplayFrameRate;
// Time per frame for a video update, based on the current framerate
uInt32 myTimePerFrame;
// The time (in milliseconds) from the UNIX epoch when the application starts
uInt32 myMillisAtStart;
// Indicates whether to stop the main loop
bool myQuitLoop;
private:
OK, some huge changes across the board, so lets see if I get it all: After much request, added ability to access the settings menu from the ROM browser dialog. This menu now contains almost all items that can be selected in Stella, and can be accessed in-game as before. Completely removed pause functionality from the core code. It made sense back when Stella was a single-mode program: there were two modes; emulation and pause. Now that there are other event modes, the EventHandler state machine is getting too complicated. If you want to pause, you can simply enter one of the in-game menus. Related to this, when the app is minimized, Stella enters the menu dialog state. Previously, minimizing the app caused a pause, but since there was no onscreen feedback, many people assumed the app locked up. Added centering to all Dialog boxes, which is done dynamically, as they're placed on the dialog stack to be drawn to the screen. Cleaned up the API of Console/FrameBuffer/OSystem classes wrt to palettes and timing. Parts of each were being done in different classes; now it should be more consistent. Started infrastructure for user-selectable UI palettes. For now, there's no way to change it in the GUI, and it defaults to the normal palette. Eventually, there will be several choices selectable from an in-game menu. Removed '-channels' commandline argument, since that feature can be set from the ROM properties. Added '128' to the choices for fragment size in AudioDialog. Tweaked the OpenGL dynamic loading code to test both the given GL lib, and if that fails to use auto-detection. It seems in the OSX port, the first approach works for some people, and not the other (and vice-versa), git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1255 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-12-30 22:26:29 +00:00
enum { kNumUIPalettes = 2 };
string myBaseDir;
string myStateDir;
string mySnapshotDir;
string myEEPROMDir;
string myCfgDir;
string myCheatFile;
string myConfigFile;
string myPaletteFile;
string myPropertiesFile;
string myRomFile;
string myRomMD5;
string myFeatures;
string myBuildInfo;
// The font object to use for the normal in-game GUI
GUI::Font* myFont;
// The info font object to use for the normal in-game GUI
GUI::Font* myInfoFont;
// The font object to use when space is very limited
GUI::Font* mySmallFont;
// The font object to use for the ROM launcher
GUI::Font* myLauncherFont;
// The font object to use for the console/debugger
GUI::Font* myConsoleFont;
// Indicates whether the main processing loop should proceed
struct TimingInfo {
uInt64 start;
uInt64 current;
uInt64 virt;
uInt64 totalTime;
uInt64 totalFrames;
};
TimingInfo myTimingInfo;
OK, some huge changes across the board, so lets see if I get it all: After much request, added ability to access the settings menu from the ROM browser dialog. This menu now contains almost all items that can be selected in Stella, and can be accessed in-game as before. Completely removed pause functionality from the core code. It made sense back when Stella was a single-mode program: there were two modes; emulation and pause. Now that there are other event modes, the EventHandler state machine is getting too complicated. If you want to pause, you can simply enter one of the in-game menus. Related to this, when the app is minimized, Stella enters the menu dialog state. Previously, minimizing the app caused a pause, but since there was no onscreen feedback, many people assumed the app locked up. Added centering to all Dialog boxes, which is done dynamically, as they're placed on the dialog stack to be drawn to the screen. Cleaned up the API of Console/FrameBuffer/OSystem classes wrt to palettes and timing. Parts of each were being done in different classes; now it should be more consistent. Started infrastructure for user-selectable UI palettes. For now, there's no way to change it in the GUI, and it defaults to the normal palette. Eventually, there will be several choices selectable from an in-game menu. Removed '-channels' commandline argument, since that feature can be set from the ROM properties. Added '128' to the choices for fragment size in AudioDialog. Tweaked the OpenGL dynamic loading code to test both the given GL lib, and if that fails to use auto-detection. It seems in the OSX port, the first approach works for some people, and not the other (and vice-versa), git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1255 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-12-30 22:26:29 +00:00
// Table of RGB values for GUI elements
static uInt32 ourGUIColors[kNumUIPalettes][kNumColors-256];
OK, some huge changes across the board, so lets see if I get it all: After much request, added ability to access the settings menu from the ROM browser dialog. This menu now contains almost all items that can be selected in Stella, and can be accessed in-game as before. Completely removed pause functionality from the core code. It made sense back when Stella was a single-mode program: there were two modes; emulation and pause. Now that there are other event modes, the EventHandler state machine is getting too complicated. If you want to pause, you can simply enter one of the in-game menus. Related to this, when the app is minimized, Stella enters the menu dialog state. Previously, minimizing the app caused a pause, but since there was no onscreen feedback, many people assumed the app locked up. Added centering to all Dialog boxes, which is done dynamically, as they're placed on the dialog stack to be drawn to the screen. Cleaned up the API of Console/FrameBuffer/OSystem classes wrt to palettes and timing. Parts of each were being done in different classes; now it should be more consistent. Started infrastructure for user-selectable UI palettes. For now, there's no way to change it in the GUI, and it defaults to the normal palette. Eventually, there will be several choices selectable from an in-game menu. Removed '-channels' commandline argument, since that feature can be set from the ROM properties. Added '128' to the choices for fragment size in AudioDialog. Tweaked the OpenGL dynamic loading code to test both the given GL lib, and if that fails to use auto-detection. It seems in the OSX port, the first approach works for some people, and not the other (and vice-versa), git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1255 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-12-30 22:26:29 +00:00
private:
/**
Creates the various framebuffers/renderers available in this system
(for now, that means either 'software' or 'opengl'). Note that
it will only create one type per run of Stella.
@return Success or failure of the framebuffer creation
Note that if OpenGL mode fails because OpenGL is not
available, rendering will attempt to fall back to
software mode
*/
FBInitStatus createFrameBuffer();
/**
Creates the various sound devices available in this system
(for now, that means either 'SDL' or 'Null').
*/
void createSound();
/**
Creates an actual Console object based on the given info.
@param romfile The full pathname of the ROM to use
@param md5 The MD5sum of the ROM
@param type The bankswitch type of the ROM
@param id The additional id (if any) used by the ROM
@return The actual Console object, otherwise NULL
(calling method is responsible for deleting it)
*/
Console* openConsole(const string& romfile, string& md5, string& type, string& id);
/**
Open the given ROM and return an array containing its contents.
Also, the properties database is updated with a valid ROM name
for this ROM (if necessary).
@param rom The absolute pathname of the ROM file
@param md5 The md5 calculated from the ROM file
(will be recalculated if necessary)
@param size The amount of data read into the image array
@return Pointer to the array, with size >=0 indicating valid data
(calling method is responsible for deleting it)
*/
uInt8* openROM(string rom, string& md5, uInt32& size);
/**
Gets all possible info about the given console.
@param console The console to use
@return Some information about this console
*/
string getROMInfo(const Console* console);
/**
Initializes the timing so that the mainloop is reset to its
initial values.
*/
void resetLoopTiming();
/**
Validate the directory name, and create it if necessary.
Also, update the settings with the new name. For now, validation
means that the path must always end with the appropriate separator.
@param path The actual path being accessed and created
@param setting The setting corresponding to the path being considered
@param defaultpath The default path to use if the settings don't exist
*/
void validatePath(string& path, const string& setting,
const string& defaultpath);
// Copy constructor isn't supported by this class so make it private
OSystem(const OSystem&);
// Assignment operator isn't supported by this class so make it private
OSystem& operator = (const OSystem&);
};
#endif