And so it begins ...

A major restructuring of the framebuffer code, which will eventually
result in an internal GUI and ROM browser ALA ScummVM.

The codebase is severely broken ATM.  It compiles, but that's about it.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@366 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-02-21 02:23:57 +00:00
parent 267afcca06
commit 94d59674ad
27 changed files with 1264 additions and 1150 deletions

View File

@ -13,7 +13,7 @@
## See the file "license" for information on usage and redistribution of
## this file, and for a DISCLAIMER OF ALL WARRANTIES.
##
## $Id: makefile,v 1.58 2005-01-03 19:16:55 stephena Exp $
## $Id: makefile,v 1.59 2005-02-21 02:23:47 stephena Exp $
##============================================================================
##============================================================================
@ -41,7 +41,7 @@ OPTIMIZATIONS =
### to build on SMP (or distcc-based) machines
### change to number of CPU's you have
# NUMBER_CPU = 3
NUMBER_CPU = 1
##============================================================================
## All done, type make to get a list of frontends
@ -53,7 +53,7 @@ LD = g++
LDFLAGS = `sdl-config --cflags`
LDLIBS = `sdl-config --libs`
OBJECTS = mainSDL.o SoundSDL.o FrameBufferSDL.o FrameBufferSoft.o
OBJECTS = mainSDL.o SoundSDL.o FrameBufferSoft.o
OPTIONS =
EXE_NAME =
SMP =
@ -116,7 +116,7 @@ linux:
$(MAKE) $(SMP) stella \
EXE_NAME="stella" \
OPTIONS="$(OPTIONS) -DBSPF_UNIX -DUNIX -DHAVE_GETTIMEOFDAY" \
OBJS="$(OBJECTS) SettingsUNIX.o"
OBJS="$(OBJECTS) SettingsUNIX.o OSystemUNIX.o"
linux-gl:
$(MAKE) $(SMP) stella \
@ -124,20 +124,20 @@ linux-gl:
LDFLAGS="$(LDFLAGS) -L/usr/X11R6/lib" \
LDLIBS="$(LDLIBS) -lGL" \
OPTIONS="$(OPTIONS) -DBSPF_UNIX -DUNIX -DHAVE_GETTIMEOFDAY -DDISPLAY_OPENGL" \
OBJS="$(OBJECTS) FrameBufferGL.o SettingsUNIX.o"
OBJS="$(OBJECTS) FrameBufferGL.o SettingsUNIX.o OSystemUNIX.o"
win32:
$(MAKE) $(SMP) stella \
EXE_NAME="stella.exe" \
OPTIONS="$(OPTIONS) -DBSPF_WIN32 -DWIN32" \
OBJS="$(OBJECTS) SettingsWin32.o"
OBJS="$(OBJECTS) SettingsWin32.o OSystemWin32.o"
win32-gl:
$(MAKE) $(SMP) stella \
EXE_NAME="stella.exe" \
LDLIBS="$(LDLIBS) -lopengl32" \
OPTIONS="$(OPTIONS) -DBSPF_WIN32 -DWIN32 -DDISPLAY_OPENGL -DTEXTURES_ARE_LOST" \
OBJS="$(OBJECTS) FrameBufferGL.o SettingsWin32.o"
OBJS="$(OBJECTS) FrameBufferGL.o SettingsWin32.o OSystemWin32.o"
###############################################################################
@ -152,6 +152,7 @@ CORE_OBJS = Booster.o Cart.o Cart2K.o Cart3F.o Cart4K.o CartAR.o CartDPC.o \
Event.o Joystick.o Keyboard.o M6532.o MD5.o MediaSrc.o Paddles.o \
Props.o PropsSet.o Random.o Sound.o Switches.o Settings.o TIA.o \
Serializer.o Deserializer.o TIASound.o EventHandler.o FrameBuffer.o \
OSystem.o \
$(M6502_OBJS)
stella: $(CORE_OBJS) $(OBJS)
@ -177,7 +178,7 @@ Event.o: $(CORE)/Event.cxx $(CORE)/Event.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Event.cxx
EventHandler.o: $(CORE)/EventHandler.cxx $(CORE)/EventHandler.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/EventHandler.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/EventHandler.cxx
Control.o: $(CORE)/Control.cxx $(CORE)/Control.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Control.cxx
@ -264,7 +265,7 @@ TIASound.o: $(CORE)/TIASound.c $(CORE)/TIASound.h
$(CXX) -c -DWIN32 $(FLAGS) $(OPTIONS) $(CORE)/TIASound.c
Console.o: $(CORE)/Console.cxx $(CORE)/Console.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Console.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/Console.cxx
MD5.o: $(CORE)/MD5.cxx $(CORE)/MD5.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/MD5.cxx
@ -273,7 +274,7 @@ MediaSrc.o: $(CORE)/MediaSrc.cxx $(CORE)/MediaSrc.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/MediaSrc.cxx
FrameBuffer.o: $(CORE)/FrameBuffer.cxx $(CORE)/FrameBuffer.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/FrameBuffer.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/FrameBuffer.cxx
PropsSet.o: $(CORE)/PropsSet.cxx $(CORE)/PropsSet.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/PropsSet.cxx
@ -299,21 +300,27 @@ Deserializer.o: $(CORE)/Deserializer.cxx $(CORE)/Deserializer.hxx
Settings.o: $(CORE)/Settings.cxx $(CORE)/Settings.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/Settings.cxx
OSystem.o: $(CORE)/OSystem.cxx $(CORE)/OSystem.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/OSystem.cxx
SettingsUNIX.o: $(SRC)/unix/SettingsUNIX.cxx $(SRC)/unix/SettingsUNIX.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(SRC)/unix/SettingsUNIX.cxx
OSystemUNIX.o: $(SRC)/unix/OSystemUNIX.cxx $(SRC)/unix/OSystemUNIX.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(SRC)/unix/OSystemUNIX.cxx
SettingsWin32.o: $(SRC)/win32/SettingsWin32.cxx $(SRC)/win32/SettingsWin32.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(SRC)/win32/SettingsWin32.cxx
OSystemWin32.o: $(SRC)/win32/OSystemWin32.cxx $(SRC)/win32/OSystemWin32.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(SRC)/win32/OSystemWin32.cxx
SoundSDL.o: $(COMMON)/SoundSDL.cxx $(COMMON)/SoundSDL.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(COMMON)/SoundSDL.cxx
mainSDL.o: $(COMMON)/mainSDL.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(COMMON)/mainSDL.cxx
FrameBufferSDL.o: $(COMMON)/FrameBufferSDL.cxx $(COMMON)/FrameBufferSDL.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(COMMON)/FrameBufferSDL.cxx
FrameBufferSoft.o: $(COMMON)/FrameBufferSoft.cxx $(COMMON)/FrameBufferSoft.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(COMMON)/FrameBufferSoft.cxx

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferGL.cxx,v 1.12 2005-02-18 23:33:32 markgrebe Exp $
// $Id: FrameBufferGL.cxx,v 1.13 2005-02-21 02:23:48 stephena Exp $
//============================================================================
#include <SDL.h>
@ -48,60 +48,7 @@ FrameBufferGL::~FrameBufferGL()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferGL::createScreen()
{
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, myRGB[0] );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, myRGB[1] );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, myRGB[2] );
SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, myRGB[3] );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
uInt32 screenWidth = 0;
uInt32 screenHeight = 0;
GLdouble orthoWidth = 0.0;
GLdouble orthoHeight = 0.0;
// Get the screen coordinates
viewport(&screenWidth, &screenHeight, &orthoWidth, &orthoHeight);
myScreen = SDL_SetVideoMode(screenWidth, screenHeight, 0, mySDLFlags);
if(myScreen == NULL)
{
cerr << "ERROR: Unable to open SDL window: " << SDL_GetError() << endl;
return false;
}
glPushAttrib(GL_ENABLE_BIT);
// Center the screen horizontally and vertically
glViewport(myDimensions.x, myDimensions.y, myDimensions.w, myDimensions.h);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0.0, orthoWidth, orthoHeight, 0.0, 0.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
#ifdef TEXTURES_ARE_LOST
createTextures();
#endif
// Make sure any old parts of the screen are erased
// Do it for both buffers!
glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapBuffers();
glClear(GL_COLOR_BUFFER_BIT);
theRedrawEntireFrameIndicator = true;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferGL::init()
bool FrameBufferGL::initSubsystem()
{
// Get the desired width and height of the display
myWidth = myMediaSource->width() << 1;
@ -244,6 +191,59 @@ bool FrameBufferGL::init()
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferGL::createScreen()
{
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, myRGB[0] );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, myRGB[1] );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, myRGB[2] );
SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, myRGB[3] );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
uInt32 screenWidth = 0;
uInt32 screenHeight = 0;
GLdouble orthoWidth = 0.0;
GLdouble orthoHeight = 0.0;
// Get the screen coordinates
viewport(&screenWidth, &screenHeight, &orthoWidth, &orthoHeight);
myScreen = SDL_SetVideoMode(screenWidth, screenHeight, 0, mySDLFlags);
if(myScreen == NULL)
{
cerr << "ERROR: Unable to open SDL window: " << SDL_GetError() << endl;
return false;
}
glPushAttrib(GL_ENABLE_BIT);
// Center the screen horizontally and vertically
glViewport(myDimensions.x, myDimensions.y, myDimensions.w, myDimensions.h);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0.0, orthoWidth, orthoHeight, 0.0, 0.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
#ifdef TEXTURES_ARE_LOST
createTextures();
#endif
// Make sure any old parts of the screen are erased
// Do it for both buffers!
glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapBuffers();
glClear(GL_COLOR_BUFFER_BIT);
theRedrawEntireFrameIndicator = true;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::drawMediaSource()
{
@ -296,18 +296,6 @@ void FrameBufferGL::drawMediaSource()
theRedrawEntireFrameIndicator = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::preFrameUpdate()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::postFrameUpdate()
{
// Now show all changes made to the textures
SDL_GL_SwapBuffers();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::drawBoundedBox(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
{
@ -349,6 +337,18 @@ void FrameBufferGL::drawChar(uInt32 x, uInt32 y, uInt32 c)
glEnd();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::preFrameUpdate()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::postFrameUpdate()
{
// Now show all changes made to the textures
SDL_GL_SwapBuffers();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::scanline(uInt32 row, uInt8* data)
{

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferGL.hxx,v 1.6 2005-02-13 19:17:01 stephena Exp $
// $Id: FrameBufferGL.hxx,v 1.7 2005-02-21 02:23:48 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_GL_HXX
@ -23,24 +23,21 @@
#include <SDL_opengl.h>
#include <SDL_syswm.h>
#include "FrameBuffer.hxx"
#include "FrameBufferSDL.hxx"
#include "bspf.hxx"
#include "FrameBuffer.hxx"
class Console;
class MediaSource;
/**
This class implements an SDL OpenGL framebuffer.
@author Stephen Anthony
@version $Id: FrameBufferGL.hxx,v 1.6 2005-02-13 19:17:01 stephena Exp $
@version $Id: FrameBufferGL.hxx,v 1.7 2005-02-21 02:23:48 stephena Exp $
*/
class FrameBufferGL : public FrameBufferSDL
class FrameBufferGL : public FrameBuffer
{
public:
/**
Creates a new SDL OpenGL framebuffer
Creates a new OpenGL framebuffer
*/
FrameBufferGL();
@ -56,7 +53,7 @@ class FrameBufferGL : public FrameBufferSDL
void toggleFilter();
//////////////////////////////////////////////////////////////////////
// The following methods are derived from FrameBufferSDL.hxx
// The following methods are derived from FrameBuffer.hxx
//////////////////////////////////////////////////////////////////////
/**
This routine is called whenever the screen needs to be recreated.
@ -82,15 +79,11 @@ class FrameBufferGL : public FrameBufferSDL
*/
virtual void scanline(uInt32 row, uInt8* data);
//////////////////////////////////////////////////////////////////////
// The following methods are derived from FrameBuffer.hxx
//////////////////////////////////////////////////////////////////////
/**
This routine should be called once the console is created to setup
the video system for us to use. Return false if any operation fails,
otherwise return true.
This routine should be called to setup the video system for us to use.
Return false if any operation fails, otherwise return true.
*/
virtual bool init();
virtual bool initSubsystem();
/**
This routine should be called anytime the MediaSource needs to be redrawn

View File

@ -1,309 +0,0 @@
//============================================================================
//
// 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-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: FrameBufferSDL.cxx,v 1.4 2005-02-13 19:17:02 stephena Exp $
//============================================================================
#include <SDL.h>
#include <SDL_syswm.h>
#include <sstream>
#include "Console.hxx"
#include "FrameBuffer.hxx"
#include "FrameBufferSDL.hxx"
#include "MediaSrc.hxx"
#include "Settings.hxx"
#include "stella.xpm" // The Stella icon
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBufferSDL::FrameBufferSDL()
: myWMAvailable(false),
theZoomLevel(1),
theMaxZoomLevel(1),
theAspectRatio(1.0),
myPauseStatus(false)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBufferSDL::~FrameBufferSDL()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::pauseEvent(bool status)
{
myPauseStatus = status;
setupPalette();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::setupPalette()
{
// Shade the palette to 75% normal value in pause mode
float shade = 1.0;
if(myPauseStatus)
shade = 0.75;
const uInt32* gamePalette = myMediaSource->palette();
for(uInt32 i = 0; i < 256; ++i)
{
Uint8 r, g, b;
r = (Uint8) (((gamePalette[i] & 0x00ff0000) >> 16) * shade);
g = (Uint8) (((gamePalette[i] & 0x0000ff00) >> 8) * shade);
b = (Uint8) ((gamePalette[i] & 0x000000ff) * shade);
myPalette[i] = mapRGB(r, g, b);
}
theRedrawEntireFrameIndicator = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::toggleFullscreen()
{
bool isFullscreen = !myConsole->settings().getBool("fullscreen");
// Update the settings
myConsole->settings().setBool("fullscreen", isFullscreen);
if(isFullscreen)
mySDLFlags |= SDL_FULLSCREEN;
else
mySDLFlags &= ~SDL_FULLSCREEN;
if(!createScreen())
return;
if(isFullscreen) // now in fullscreen mode
{
grabMouse(true);
showCursor(false);
}
else // now in windowed mode
{
grabMouse(myConsole->settings().getBool("grabmouse"));
showCursor(!myConsole->settings().getBool("hidecursor"));
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::resize(int mode)
{
// reset size to that given in properties
// this is a special case of allowing a resize while in fullscreen mode
if(mode == 0)
{
myWidth = myMediaSource->width() << 1;
myHeight = myMediaSource->height();
}
else if(mode == 1) // increase size
{
if(myConsole->settings().getBool("fullscreen"))
return;
if(theZoomLevel == theMaxZoomLevel)
theZoomLevel = 1;
else
theZoomLevel++;
}
else if(mode == -1) // decrease size
{
if(myConsole->settings().getBool("fullscreen"))
return;
if(theZoomLevel == 1)
theZoomLevel = theMaxZoomLevel;
else
theZoomLevel--;
}
if(!createScreen())
return;
// Update the settings
myConsole->settings().setInt("zoom", theZoomLevel);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::showCursor(bool show)
{
if(show)
SDL_ShowCursor(SDL_ENABLE);
else
SDL_ShowCursor(SDL_DISABLE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::grabMouse(bool grab)
{
if(grab)
SDL_WM_GrabInput(SDL_GRAB_ON);
else
SDL_WM_GrabInput(SDL_GRAB_OFF);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferSDL::fullScreen()
{
return myConsole->settings().getBool("fullscreen");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 FrameBufferSDL::maxWindowSizeForScreen()
{
uInt32 sWidth = screenWidth();
uInt32 sHeight = screenHeight();
uInt32 multiplier = sWidth / myWidth;
// If screenwidth or height could not be found, use default zoom value
if(sWidth == 0 || sHeight == 0)
return 4;
bool found = false;
while(!found && (multiplier > 0))
{
// Figure out the desired size of the window
uInt32 width = (uInt32) (myWidth * multiplier * theAspectRatio);
uInt32 height = myHeight * multiplier;
if((width < sWidth) && (height < sHeight))
found = true;
else
multiplier--;
}
if(found)
return multiplier;
else
return 1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 FrameBufferSDL::screenWidth()
{
uInt32 width = 0;
if(myWMAvailable)
{
#if defined(UNIX)
if(myWMInfo.subsystem == SDL_SYSWM_X11)
{
myWMInfo.info.x11.lock_func();
width = DisplayWidth(myWMInfo.info.x11.display,
DefaultScreen(myWMInfo.info.x11.display));
myWMInfo.info.x11.unlock_func();
}
#elif defined(WIN32)
width = (uInt32) GetSystemMetrics(SM_CXSCREEN);
#elif defined(MAC_OSX)
// FIXME - add OSX Desktop code here (I don't think SDL supports it yet)
#endif
}
return width;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 FrameBufferSDL::screenHeight()
{
uInt32 height = 0;
if(myWMAvailable)
{
#if defined(UNIX)
if(myWMInfo.subsystem == SDL_SYSWM_X11)
{
myWMInfo.info.x11.lock_func();
height = DisplayHeight(myWMInfo.info.x11.display,
DefaultScreen(myWMInfo.info.x11.display));
myWMInfo.info.x11.unlock_func();
}
#elif defined(WIN32)
height = (uInt32) GetSystemMetrics(SM_CYSCREEN);
#elif defined(MAC_OSX)
// FIXME - add OSX Desktop code here (I don't think SDL supports it yet)
#endif
}
return height;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::setWindowAttributes()
{
// Set the window title
ostringstream name;
name << "Stella: \"" << myConsole->properties().get("Cartridge.Name") << "\"";
SDL_WM_SetCaption(name.str().c_str(), "stella");
#ifndef MAC_OSX
// Set the window icon
uInt32 w, h, ncols, nbytes;
uInt32 rgba[256], icon[32 * 32];
uInt8 mask[32][4];
sscanf(stella_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes);
if((w != 32) || (h != 32) || (ncols > 255) || (nbytes > 1))
{
cerr << "ERROR: Couldn't load the icon.\n";
return;
}
for(uInt32 i = 0; i < ncols; i++)
{
unsigned char code;
char color[32];
uInt32 col;
sscanf(stella_icon[1 + i], "%c c %s", &code, color);
if(!strcmp(color, "None"))
col = 0x00000000;
else if(!strcmp(color, "black"))
col = 0xFF000000;
else if (color[0] == '#')
{
sscanf(color + 1, "%06x", &col);
col |= 0xFF000000;
}
else
{
cerr << "ERROR: Couldn't load the icon.\n";
return;
}
rgba[code] = col;
}
memset(mask, 0, sizeof(mask));
for(h = 0; h < 32; h++)
{
const char* line = stella_icon[1 + ncols + h];
for(w = 0; w < 32; w++)
{
icon[w + 32 * h] = rgba[(int)line[w]];
if(rgba[(int)line[w]] & 0xFF000000)
mask[h][w >> 3] |= 1 << (7 - (w & 0x07));
}
}
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(icon, 32, 32, 32,
32 * 4, 0xFF0000, 0x00FF00, 0x0000FF, 0xFF000000);
SDL_WM_SetIcon(surface, (unsigned char *) mask);
SDL_FreeSurface(surface);
#endif
}

View File

@ -1,186 +0,0 @@
//============================================================================
//
// 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-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: FrameBufferSDL.hxx,v 1.5 2005-02-13 19:17:02 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_SDL_HXX
#define FRAMEBUFFER_SDL_HXX
#include <SDL.h>
#include <SDL_syswm.h>
#include "FrameBuffer.hxx"
#include "Settings.hxx"
#include "bspf.hxx"
/**
This class is a base class for the SDL framebuffer and is derived from
the core FrameBuffer class.
It defines all common code shared between the software
and OpenGL video modes, as well as required methods defined in
the core FrameBuffer.
@author Stephen Anthony
@version $Id: FrameBufferSDL.hxx,v 1.5 2005-02-13 19:17:02 stephena Exp $
*/
class FrameBufferSDL : public FrameBuffer
{
public:
/**
Creates a new SDL framebuffer
*/
FrameBufferSDL();
/**
Destructor
*/
virtual ~FrameBufferSDL();
/**
Toggles between fullscreen and window mode. Grabmouse and hidecursor
activated when in fullscreen mode.
*/
void toggleFullscreen();
/**
This routine is called when the user wants to resize the window.
A '1' argument indicates that the window should increase in size, while '-1'
indicates that the windows should decrease in size. A '0' indicates that
the window should be sized according to the current properties.
Can't resize in fullscreen mode. Will only resize up to the maximum size
of the screen.
*/
void resize(int mode);
/**
Shows or hides the cursor based on the given boolean value.
*/
void showCursor(bool show);
/**
Grabs or ungrabs the mouse based on the given boolean value.
*/
void grabMouse(bool grab);
/**
Answers if the display is currently in fullscreen mode.
*/
bool fullScreen();
/**
Answers the current zoom level of the SDL
*/
uInt32 zoomLevel() { return theZoomLevel; }
/**
Calculate the maximum window size that the current screen can hold.
Only works in X11 for now. If not running under X11, always return 4.
*/
uInt32 maxWindowSizeForScreen();
/**
This routine is called to get the width of the onscreen image.
*/
uInt32 imageWidth() { return myDimensions.w; }
/**
This routine is called to get the height of the onscreen image.
*/
uInt32 imageHeight() { return myDimensions.h; }
/**
This routine is called to get the width of the system desktop.
*/
uInt32 screenWidth();
/**
This routine is called to get the height of the system desktop.
*/
uInt32 screenHeight();
/**
Set the title and icon for the main SDL window.
*/
void setWindowAttributes();
/**
Set up the palette for a screen of any depth > 8.
*/
void setupPalette();
//////////////////////////////////////////////////////////////////////
// The following methods are derived from FrameBuffer.hxx
//////////////////////////////////////////////////////////////////////
/**
This routine is called when the emulation has been paused.
@param status Toggle pause based on status
*/
void pauseEvent(bool status);
//////////////////////////////////////////////////////////////////////
// The following methods must be defined in child classes
//////////////////////////////////////////////////////////////////////
/**
This routine is called whenever the screen needs to be recreated.
It updates the global screen variable.
*/
virtual bool createScreen() = 0;
/**
This routine is called to map a given r,g,b triple to the screen palette.
@param r The red component of the color.
@param g The green component of the color.
@param b The blue component of the color.
*/
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b) = 0;
protected:
// The SDL video buffer
SDL_Surface* myScreen;
// SDL initialization flags
uInt32 mySDLFlags;
// SDL palette
Uint32 myPalette[256];
// Used to get window-manager specifics
SDL_SysWMinfo myWMInfo;
// Indicates the width/height and origin x/y of the onscreen image
// (these may be different than the screen/window dimensions)
SDL_Rect myDimensions;
// Indicates if the system-specific WM information is available
bool myWMAvailable;
// Indicates the current zoom level of the SDL screen
uInt32 theZoomLevel;
// Indicates the maximum zoom of the SDL screen
uInt32 theMaxZoomLevel;
// The aspect ratio of the window
float theAspectRatio;
// Indicates whether the emulation has paused
bool myPauseStatus;
};
#endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferSoft.cxx,v 1.6 2005-02-13 19:17:02 stephena Exp $
// $Id: FrameBufferSoft.cxx,v 1.7 2005-02-21 02:23:48 stephena Exp $
//============================================================================
#include <SDL.h>
@ -22,13 +22,14 @@
#include "Console.hxx"
#include "FrameBuffer.hxx"
#include "FrameBufferSDL.hxx"
#include "FrameBufferSoft.hxx"
#include "MediaSrc.hxx"
#include "Settings.hxx"
#include "OSystem.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBufferSoft::FrameBufferSoft()
: FrameBuffer()
{
}
@ -39,6 +40,43 @@ FrameBufferSoft::~FrameBufferSoft()
delete myRectList;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferSoft::initSubsystem()
{
mySDLFlags |= SDL_SWSURFACE;
// Set up the rectangle list to be used in the dirty update
myRectList = new RectList();
if(!myRectList)
{
cerr << "ERROR: Unable to get memory for SDL rects" << endl;
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");
// Set the window title and icon
setWindowAttributes();
// Create the screen
if(!createScreen())
return false;
setupPalette();
// Show some info
if(myOSystem->settings().getBool("showinfo"))
cout << "Video rendering: Software mode" << endl << endl;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferSoft::createScreen()
{
@ -57,82 +95,17 @@ bool FrameBufferSoft::createScreen()
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferSoft::init()
{
// Get the desired width and height of the display
myWidth = myMediaSource->width() << 1;
myHeight = myMediaSource->height();
// Now create the software SDL screen
Uint32 initflags = SDL_INIT_VIDEO | SDL_INIT_TIMER;
if(SDL_Init(initflags) < 0)
return false;
// Get the system-specific WM information
SDL_VERSION(&myWMInfo.version);
if(SDL_GetWMInfo(&myWMInfo) > 0)
myWMAvailable = true;
// 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)myConsole->settings().getInt("zoom") > theMaxZoomLevel)
theZoomLevel = theMaxZoomLevel;
else
theZoomLevel = myConsole->settings().getInt("zoom");
mySDLFlags = SDL_SWSURFACE;
mySDLFlags |= myConsole->settings().getBool("fullscreen") ? SDL_FULLSCREEN : 0;
// Set up the rectangle list to be used in the dirty update
myRectList = new RectList();
if(!myRectList)
{
cerr << "ERROR: Unable to get memory for SDL rects" << endl;
return false;
}
// Set the window title and icon
setWindowAttributes();
// Create the screen
if(!createScreen())
return false;
setupPalette();
// Make sure that theUseFullScreenFlag sets up fullscreen mode correctly
if(myConsole->settings().getBool("fullscreen"))
{
grabMouse(true);
showCursor(false);
}
else
{
// Keep mouse in game window if grabmouse is selected
grabMouse(myConsole->settings().getBool("grabmouse"));
// Show or hide the cursor depending on the 'hidecursor' argument
showCursor(!myConsole->settings().getBool("hidecursor"));
}
// Show some info
if(myConsole->settings().getBool("showinfo"))
cout << "Video rendering: Software mode" << endl << endl;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSoft::drawMediaSource()
{
uInt8* currentFrame = myMediaSource->currentFrameBuffer();
uInt8* previousFrame = myMediaSource->previousFrameBuffer();
MediaSource& mediasrc = myOSystem->console().mediaSource();
uInt8* currentFrame = mediasrc.currentFrameBuffer();
uInt8* previousFrame = mediasrc.previousFrameBuffer();
uInt16 screenMultiple = (uInt16) theZoomLevel;
uInt32 width = myMediaSource->width();
uInt32 height = myMediaSource->height();
uInt32 width = mediasrc.width();
uInt32 height = mediasrc.height();
struct Rectangle
{
@ -277,20 +250,6 @@ void FrameBufferSoft::drawMediaSource()
theRedrawEntireFrameIndicator = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSoft::preFrameUpdate()
{
// Start a new rectlist on each display update
myRectList->start();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSoft::postFrameUpdate()
{
// Now update all the rectangles at once
SDL_UpdateRects(myScreen, myRectList->numRects(), myRectList->rects());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSoft::drawBoundedBox(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
{
@ -384,6 +343,20 @@ void FrameBufferSoft::drawChar(uInt32 xorig, uInt32 yorig, uInt32 c)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSoft::preFrameUpdate()
{
// Start a new rectlist on each display update
myRectList->start();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSoft::postFrameUpdate()
{
// Now update all the rectangles at once
SDL_UpdateRects(myScreen, myRectList->numRects(), myRectList->rects());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSoft::scanline(uInt32 row, uInt8* data)
{

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferSoft.hxx,v 1.4 2005-02-13 19:17:02 stephena Exp $
// $Id: FrameBufferSoft.hxx,v 1.5 2005-02-21 02:23:48 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_SOFT_HXX
@ -22,12 +22,9 @@
#include <SDL.h>
#include <SDL_syswm.h>
#include "FrameBuffer.hxx"
#include "FrameBufferSDL.hxx"
#include "bspf.hxx"
#include "FrameBuffer.hxx"
class Console;
class MediaSource;
class RectList;
@ -35,13 +32,13 @@ class RectList;
This class implements an SDL software framebuffer.
@author Stephen Anthony
@version $Id: FrameBufferSoft.hxx,v 1.4 2005-02-13 19:17:02 stephena Exp $
@version $Id: FrameBufferSoft.hxx,v 1.5 2005-02-21 02:23:48 stephena Exp $
*/
class FrameBufferSoft : public FrameBufferSDL
class FrameBufferSoft : public FrameBuffer
{
public:
/**
Creates a new SDL software framebuffer
Creates a new software framebuffer
*/
FrameBufferSoft();
@ -51,8 +48,14 @@ class FrameBufferSoft : public FrameBufferSDL
virtual ~FrameBufferSoft();
//////////////////////////////////////////////////////////////////////
// The following methods are derived from FrameBufferSDL.hxx
// The following methods are derived from FrameBuffer.hxx
//////////////////////////////////////////////////////////////////////
/**
This routine is called to initialize software video mode.
Return false if any operation fails, otherwise return true.
*/
virtual bool initSubsystem();
/**
This routine is called whenever the screen needs to be recreated.
It updates the global screen variable.
@ -69,24 +72,6 @@ class FrameBufferSoft : public FrameBufferSDL
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b)
{ return SDL_MapRGB(myScreen->format, r, g, b); }
/**
This routine is called to get the specified scanline data.
@param row The row we are looking for
@param data The actual pixel data (in bytes)
*/
virtual void scanline(uInt32 row, uInt8* data);
//////////////////////////////////////////////////////////////////////
// The following methods are derived from FrameBuffer.hxx
//////////////////////////////////////////////////////////////////////
/**
This routine should be called once the console is created to setup
the video system for us to use. Return false if any operation fails,
otherwise return true.
*/
virtual bool init();
/**
This routine should be called anytime the MediaSource needs to be redrawn
to the screen.
@ -132,14 +117,19 @@ class FrameBufferSoft : public FrameBufferSDL
*/
virtual void postFrameUpdate();
/**
This routine is called to get the specified scanline data.
@param row The row we are looking for
@param data The actual pixel data (in bytes)
*/
virtual void scanline(uInt32 row, uInt8* data);
private:
// Used in the dirty update of the SDL surface
RectList* myRectList;
};
/**
*/
class RectList
{
public:

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SoundSDL.cxx,v 1.8 2005-02-13 19:17:02 stephena Exp $
// $Id: SoundSDL.cxx,v 1.9 2005-02-21 02:23:48 stephena Exp $
//============================================================================
#include <sstream>
@ -22,12 +22,13 @@
#include <SDL.h>
#include "TIASound.h"
#include "Console.hxx"
#include "FrameBuffer.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include "Settings.hxx"
#include "System.hxx"
#include "OSystem.hxx"
#include "SoundSDL.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -181,8 +182,8 @@ void SoundSDL::adjustVolume(Int8 direction)
message = "Volume set to ";
message += strval.str();
myConsole->frameBuffer().showMessage(message);
myConsole->settings().setInt("volume", percent);
myOSystem->frameBuffer().showMessage(message);
myOSystem->settings().setInt("volume", percent);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -196,7 +197,7 @@ void SoundSDL::set(uInt16 addr, uInt8 value, Int32 cycle)
(1193191.66666667));
// Now, adjust the time based on the frame rate the user has selected
delta = delta * (myDisplayFrameRate / (double)myConsole->frameRate());
delta = delta * (myDisplayFrameRate / 60.0);//FIXME (double)myOSystem->console().frameRate());
RegWrite info;
info.addr = addr;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: mainSDL.cxx,v 1.20 2005-02-13 19:17:02 stephena Exp $
// $Id: mainSDL.cxx,v 1.21 2005-02-21 02:23:48 stephena Exp $
//============================================================================
#include <fstream>
@ -36,12 +36,12 @@
#include "StellaEvent.hxx"
#include "EventHandler.hxx"
#include "FrameBuffer.hxx"
#include "FrameBufferSDL.hxx"
#include "FrameBufferSoft.hxx"
#include "PropsSet.hxx"
#include "Sound.hxx"
#include "SoundSDL.hxx"
#include "Settings.hxx"
#include "OSystem.hxx"
#ifdef DISPLAY_OPENGL
#include "FrameBufferGL.hxx"
@ -52,8 +52,10 @@
#if defined(UNIX)
#include "SettingsUNIX.hxx"
#include "OSystemUNIX.hxx"
#elif defined(WIN32)
#include "SettingsWin32.hxx"
#include "OSystemWin32.hxx"
#else
#error Unsupported platform!
#endif
@ -116,11 +118,11 @@ static Event::Type Paddle_Button[4] = {
Event::PaddleTwoFire, Event::PaddleThreeFire
};
// Pointer to the console object or the null pointer
static Console* theConsole = (Console*) NULL;
// Pointer to the main parent osystem object or the null pointer
static OSystem* theOSystem = (OSystem*) NULL;
// Pointer to the display object or the null pointer
static FrameBufferSDL* theDisplay = (FrameBufferSDL*) NULL;
static FrameBuffer* theDisplay = (FrameBuffer*) NULL;
// Pointer to the sound object or the null pointer
static Sound* theSound = (Sound*) NULL;
@ -445,22 +447,22 @@ void HandleEvents()
#endif
#ifdef DEVELOPER_SUPPORT
case SDLK_END: // Alt-End increases XStart
theConsole->changeXStart(1);
theOSystem->console().changeXStart(1);
theDisplay->resize(0);
break;
case SDLK_HOME: // Alt-Home decreases XStart
theConsole->changeXStart(0);
theOSystem->console().changeXStart(0);
theDisplay->resize(0);
break;
case SDLK_PAGEUP: // Alt-PageUp increases YStart
theConsole->changeYStart(1);
theOSystem->console().changeYStart(1);
theDisplay->resize(0);
break;
case SDLK_PAGEDOWN: // Alt-PageDown decreases YStart
theConsole->changeYStart(0);
theOSystem->console().changeYStart(0);
theDisplay->resize(0);
break;
}
@ -491,12 +493,12 @@ void HandleEvents()
break;
case SDLK_f: // Ctrl-f toggles NTSC/PAL mode
theConsole->toggleFormat();
theOSystem->console().toggleFormat();
theDisplay->setupPalette();
break;
case SDLK_p: // Ctrl-p toggles different palettes
theConsole->togglePalette();
theOSystem->console().togglePalette();
theDisplay->setupPalette();
break;
@ -518,34 +520,34 @@ void HandleEvents()
#ifdef DEVELOPER_SUPPORT
case SDLK_END: // Ctrl-End increases Width
theConsole->changeWidth(1);
theOSystem->console().changeWidth(1);
theDisplay->resize(0);
break;
case SDLK_HOME: // Ctrl-Home decreases Width
theConsole->changeWidth(0);
theOSystem->console().changeWidth(0);
theDisplay->resize(0);
break;
case SDLK_PAGEUP: // Ctrl-PageUp increases Height
theConsole->changeHeight(1);
theOSystem->console().changeHeight(1);
theDisplay->resize(0);
break;
case SDLK_PAGEDOWN: // Ctrl-PageDown decreases Height
theConsole->changeHeight(0);
theOSystem->console().changeHeight(0);
theDisplay->resize(0);
break;
#endif
case SDLK_s: // Ctrl-s saves properties to a file
// Attempt to merge with propertiesSet
if(theConsole->settings().getBool("mergeprops"))
theConsole->saveProperties(theSettings->propertiesOutputFilename(), true);
if(theSettings->getBool("mergeprops"))
theOSystem->console().saveProperties(theSettings->propertiesOutputFilename(), true);
else // Save to file in home directory
{
string newPropertiesFile = theConsole->settings().baseDir() + "/" + \
theConsole->properties().get("Cartridge.Name") + ".pro";
theConsole->saveProperties(newPropertiesFile);
string newPropertiesFile = theSettings->baseDir() + "/" + \
theOSystem->console().properties().get("Cartridge.Name") + ".pro";
theOSystem->console().saveProperties(newPropertiesFile);
}
break;
}
@ -554,7 +556,7 @@ void HandleEvents()
// check all the other keys
for(uInt32 i = 0; i < sizeof(keyList) / sizeof(KeyList); ++i)
if(keyList[i].scanCode == key)
theConsole->eventHandler().sendKeyEvent(keyList[i].keyCode, state);
theOSystem->eventHandler().sendKeyEvent(keyList[i].keyCode, state);
break; // SDL_KEYUP, SDL_KEYDOWN
}
@ -580,7 +582,7 @@ void HandleEvents()
Int32 resistance = (Int32)(1000000.0 * (width - mouseX) / width);
theConsole->eventHandler().sendEvent(Paddle_Resistance[thePaddleMode], resistance);
theOSystem->eventHandler().sendEvent(Paddle_Resistance[thePaddleMode], resistance);
break; // SDL_MOUSEMOTION
}
@ -590,7 +592,7 @@ void HandleEvents()
{
Int32 value = event.button.type == SDL_MOUSEBUTTONDOWN ? 1 : 0;
theConsole->eventHandler().sendEvent(Paddle_Button[thePaddleMode], value);
theOSystem->eventHandler().sendEvent(Paddle_Button[thePaddleMode], value);
break; // SDL_MOUSEBUTTONUP, SDL_MOUSEBUTTONDOWN
}
@ -599,8 +601,8 @@ void HandleEvents()
{
if((event.active.state & SDL_APPACTIVE) && (event.active.gain == 0))
{
if(!theConsole->eventHandler().doPause())
theConsole->eventHandler().sendEvent(Event::Pause, 1);
if(!theOSystem->eventHandler().doPause())
theOSystem->eventHandler().sendEvent(Event::Pause, 1);
}
break; // SDL_ACTIVEEVENT
@ -608,7 +610,7 @@ void HandleEvents()
case SDL_QUIT:
{
theConsole->eventHandler().sendEvent(Event::Quit, 1);
theOSystem->eventHandler().sendEvent(Event::Quit, 1);
break; // SDL_QUIT
}
@ -656,7 +658,7 @@ void HandleEvents()
code = joyButtonList[event.jbutton.button];
state = event.jbutton.state == SDL_PRESSED ? 1 : 0;
theConsole->eventHandler().sendJoyEvent(stick, code, state);
theOSystem->eventHandler().sendJoyEvent(stick, code, state);
break;
case SDL_JOYAXISMOTION:
@ -665,16 +667,16 @@ void HandleEvents()
if(axis == 0) // x-axis
{
theConsole->eventHandler().sendJoyEvent(stick, StellaEvent::JAXIS_LEFT,
theOSystem->eventHandler().sendJoyEvent(stick, StellaEvent::JAXIS_LEFT,
(value < -16384) ? 1 : 0);
theConsole->eventHandler().sendJoyEvent(stick, StellaEvent::JAXIS_RIGHT,
theOSystem->eventHandler().sendJoyEvent(stick, StellaEvent::JAXIS_RIGHT,
(value > 16384) ? 1 : 0);
}
else if(axis == 1) // y-axis
{
theConsole->eventHandler().sendJoyEvent(stick, StellaEvent::JAXIS_UP,
theOSystem->eventHandler().sendJoyEvent(stick, StellaEvent::JAXIS_UP,
(value < -16384) ? 1 : 0);
theConsole->eventHandler().sendJoyEvent(stick, StellaEvent::JAXIS_DOWN,
theOSystem->eventHandler().sendJoyEvent(stick, StellaEvent::JAXIS_DOWN,
(value > 16384) ? 1 : 0);
}
break;
@ -695,23 +697,23 @@ void HandleEvents()
{
if(type == JT_STELLADAPTOR_1)
{
theConsole->eventHandler().sendEvent(Event::JoystickZeroFire, state);
theConsole->eventHandler().sendEvent(Event::DrivingZeroFire, state);
theConsole->eventHandler().sendEvent(Event::PaddleZeroFire, state);
theOSystem->eventHandler().sendEvent(Event::JoystickZeroFire, state);
theOSystem->eventHandler().sendEvent(Event::DrivingZeroFire, state);
theOSystem->eventHandler().sendEvent(Event::PaddleZeroFire, state);
}
else
{
theConsole->eventHandler().sendEvent(Event::JoystickOneFire, state);
theConsole->eventHandler().sendEvent(Event::DrivingOneFire, state);
theConsole->eventHandler().sendEvent(Event::PaddleTwoFire, state);
theOSystem->eventHandler().sendEvent(Event::JoystickOneFire, state);
theOSystem->eventHandler().sendEvent(Event::DrivingOneFire, state);
theOSystem->eventHandler().sendEvent(Event::PaddleTwoFire, state);
}
}
else if(button == 1)
{
if(type == JT_STELLADAPTOR_1)
theConsole->eventHandler().sendEvent(Event::PaddleOneFire, state);
theOSystem->eventHandler().sendEvent(Event::PaddleOneFire, state);
else
theConsole->eventHandler().sendEvent(Event::PaddleThreeFire, state);
theOSystem->eventHandler().sendEvent(Event::PaddleThreeFire, state);
}
break;
@ -720,26 +722,26 @@ void HandleEvents()
value = event.jaxis.value;
// Send axis events for the joysticks
theConsole->eventHandler().sendEvent(SA_Axis[type-2][axis][0],
theOSystem->eventHandler().sendEvent(SA_Axis[type-2][axis][0],
(value < -16384) ? 1 : 0);
theConsole->eventHandler().sendEvent(SA_Axis[type-2][axis][1],
theOSystem->eventHandler().sendEvent(SA_Axis[type-2][axis][1],
(value > 16384) ? 1 : 0);
// Send axis events for the paddles
resistance = (Int32) (1000000.0 * (32767 - value) / 65534);
theConsole->eventHandler().sendEvent(SA_Axis[type-2][axis][2], resistance);
theOSystem->eventHandler().sendEvent(SA_Axis[type-2][axis][2], resistance);
// Send events for the driving controllers
if(axis == 1)
{
if(value <= -16384-4096)
theConsole->eventHandler().sendEvent(SA_DrivingValue[type-2],2);
theOSystem->eventHandler().sendEvent(SA_DrivingValue[type-2],2);
else if(value > 16384+4096)
theConsole->eventHandler().sendEvent(SA_DrivingValue[type-2],1);
theOSystem->eventHandler().sendEvent(SA_DrivingValue[type-2],1);
else if(value >= 16384-4096)
theConsole->eventHandler().sendEvent(SA_DrivingValue[type-2],0);
theOSystem->eventHandler().sendEvent(SA_DrivingValue[type-2],0);
else
theConsole->eventHandler().sendEvent(SA_DrivingValue[type-2],3);
theOSystem->eventHandler().sendEvent(SA_DrivingValue[type-2],3);
}
break;
}
@ -802,9 +804,9 @@ void Cleanup()
}
#endif
if(theSettings)
delete theSettings;
if(theOSystem)
delete theOSystem;
/*
if(theConsole)
delete theConsole;
@ -813,7 +815,7 @@ void Cleanup()
if(theDisplay)
delete theDisplay;
*/
if(SDL_WasInit(SDL_INIT_VIDEO) & SDL_INIT_VIDEO)
SDL_Quit();
}
@ -822,6 +824,8 @@ void Cleanup()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int main(int argc, char* argv[])
{
uInt8* image = NULL;
#if defined(UNIX)
theSettings = new SettingsUNIX();
#elif defined(WIN32)
@ -877,23 +881,6 @@ int main(int argc, char* argv[])
ShowInfo(buf.str());
}
// Get a pointer to the file which contains the cartridge ROM
const char* file = argv[argc - 1];
// Open the cartridge image and read it in
ifstream in(file, ios_base::binary);
if(!in)
{
cerr << "ERROR: Couldn't open " << file << "..." << endl;
Cleanup();
return 0;
}
uInt8* image = new uInt8[512 * 1024];
in.read((char*)image, 512 * 1024);
uInt32 size = in.gcount();
in.close();
// Create an SDL window
string videodriver = theSettings->getString("video");
if(videodriver == "soft")
@ -940,12 +927,38 @@ int main(int argc, char* argv[])
ShowInfo("Sound disabled");
}
// Create the parent OSystem object
#if defined(UNIX)
theOSystem = new OSystemUNIX(*theDisplay, *theSound, *theSettings, propertiesSet);
#elif defined(WIN32)
theSettings = new SettingsWin32();
#else
#error Unsupported platform!
#endif
// Get a pointer to the file which contains the cartridge ROM
const char* file = argv[argc - 1];
// Open the cartridge image and read it in
ifstream in(file, ios_base::binary);
if(!in)
{
cerr << "ERROR: Couldn't open " << file << "..." << endl;
Cleanup();
return 0;
}
image = new uInt8[512 * 1024];
in.read((char*)image, 512 * 1024);
uInt32 size = in.gcount();
in.close();
// Get just the filename of the file containing the ROM image
const char* filename = (!strrchr(file, '/')) ? file : strrchr(file, '/') + 1;
// Create the 2600 game console
theConsole = new Console(image, size, filename, *theSettings, propertiesSet,
*theDisplay, *theSound);
// theConsole = new Console(image, size, filename, *theSettings, propertiesSet,
// *theDisplay, *theSound);
// Free the image since we don't need it any longer
delete[] image;
@ -981,14 +994,14 @@ int main(int argc, char* argv[])
for(;;)
{
// Exit if the user wants to quit
if(theConsole->eventHandler().doQuit())
if(theOSystem->eventHandler().doQuit())
{
break;
}
startTime = GetTicks();
HandleEvents();
theConsole->update();
theOSystem->frameBuffer().update();
// Now, waste time if we need to so that we are at the desired frame rate
for(;;)
@ -1017,14 +1030,14 @@ int main(int argc, char* argv[])
for(;;)
{
// Exit if the user wants to quit
if(theConsole->eventHandler().doQuit())
if(theOSystem->eventHandler().doQuit())
{
break;
}
startTime = GetTicks();
HandleEvents();
theConsole->update();
theOSystem->frameBuffer().update();
currentTime = GetTicks();
virtualTime += timePerFrame;
@ -1048,9 +1061,9 @@ int main(int argc, char* argv[])
cout << numberOfFrames << " total frames drawn\n";
cout << framesPerSecond << " frames/second\n";
cout << endl;
cout << "Cartridge Name: " << theConsole->properties().get("Cartridge.Name");
cout << "Cartridge Name: " << theOSystem->console().properties().get("Cartridge.Name");
cout << endl;
cout << "Cartridge MD5: " << theConsole->properties().get("Cartridge.MD5");
cout << "Cartridge MD5: " << theOSystem->console().properties().get("Cartridge.MD5");
cout << endl << endl;
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Console.cxx,v 1.38 2004-08-12 23:54:36 stephena Exp $
// $Id: Console.cxx,v 1.39 2005-02-21 02:23:49 stephena Exp $
//============================================================================
#include <assert.h>
@ -44,6 +44,7 @@
#include "System.hxx"
#include "TIA.hxx"
#include "FrameBuffer.hxx"
#include "OSystem.hxx"
#ifdef SNAPSHOT_SUPPORT
#include "Snapshot.hxx"
@ -51,12 +52,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Console::Console(const uInt8* image, uInt32 size, const char* filename,
Settings& settings, PropertiesSet& propertiesSet,
FrameBuffer& framebuffer, Sound& sound)
: mySettings(settings),
myPropSet(propertiesSet),
myFrameBuffer(framebuffer),
mySound(sound)
OSystem& osystem)
: myOSystem(osystem)
{
myControllers[0] = 0;
myControllers[1] = 0;
@ -65,21 +62,21 @@ Console::Console(const uInt8* image, uInt32 size, const char* filename,
mySystem = 0;
myEvent = 0;
// Create an event handler which will collect and dispatch events
myEventHandler = new EventHandler(this);
myEvent = myEventHandler->event();
// Add the current console to the system
myOSystem.addConsole(this);
// Attach the event subsystem to the current console
myEvent = myOSystem.eventHandler().event();
// Get the MD5 message-digest for the ROM image
string md5 = MD5(image, size);
// Search for the properties based on MD5
myPropSet.getMD5(md5, myProperties);
myOSystem.propSet().getMD5(md5, myProperties);
// Make sure the MD5 value of the cartridge is set in the properties
if(myProperties.get("Cartridge.MD5") == "")
{
myProperties.set("Cartridge.MD5", md5);
}
// Setup the controllers based on properties
string left = myProperties.get("Controller.Left");
@ -146,7 +143,7 @@ Console::Console(const uInt8* image, uInt32 size, const char* filename,
}
M6532* m6532 = new M6532(*this);
TIA* tia = new TIA(*this, mySound);
TIA* tia = new TIA(myOSystem);
Cartridge* cartridge = Cartridge::create(image, size, myProperties);
mySystem->attach(m6502);
@ -163,30 +160,32 @@ Console::Console(const uInt8* image, uInt32 size, const char* filename,
// Set the correct framerate based on the format of the ROM
// This can be overridden by the '-framerate' option
myFrameRate = 60;
if(mySettings.getInt("framerate") > 0)
myFrameRate = mySettings.getInt("framerate");
if(myOSystem.settings().getInt("framerate") > 0)
myFrameRate = myOSystem.settings().getInt("framerate");
// else if(myProperties.get("Display.Format") == "NTSC")
// myFrameRate = 60;
// else if(myProperties.get("Display.Format") == "PAL")
// myFrameRate = 50;
// mySettings.setInt("framerate", myFrameRate, false);
mySettings.setInt("framerate", myFrameRate);
myOSystem.settings().setInt("framerate", myFrameRate);
// Initialize the framebuffer interface.
// This must be done *after* a reset, since it needs updated values.
myFrameBuffer.initDisplay(this, myMediaSource);
ostringstream title;
title << "Stella: \"" << myProperties.get("Cartridge.Name") << "\"";
myOSystem.frameBuffer().initialize(&myOSystem,
title.str(),
myMediaSource->width() << 1,
myMediaSource->height());
// Initialize the sound interface.
uInt32 soundFrameRate = (myProperties.get("Display.Format") == "PAL") ? 50 : 60;
mySound.init(this, myMediaSource, mySystem, soundFrameRate);
myOSystem.sound().initialize(&myOSystem, mySystem, soundFrameRate);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Console::Console(const Console& console)
: mySettings(console.mySettings),
myPropSet(console.myPropSet),
myFrameBuffer(console.myFrameBuffer),
mySound(console.mySound)
: myOSystem(console.myOSystem)
{
// TODO: Write this method
assert(false);
@ -199,13 +198,6 @@ Console::~Console()
delete mySwitches;
delete myControllers[0];
delete myControllers[1];
delete myEventHandler;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::update()
{
myFrameBuffer.update();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -214,30 +206,6 @@ const Properties& Console::properties() const
return myProperties;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Settings& Console::settings() const
{
return mySettings;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBuffer& Console::frameBuffer() const
{
return myFrameBuffer;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 Console::frameRate() const
{
return myFrameRate;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sound& Console::sound() const
{
return mySound;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Console& Console::operator = (const Console&)
{
@ -256,40 +224,40 @@ void Console::toggleFormat()
{
myProperties.set("Display.Format", "PAL");
mySystem->reset();
myFrameBuffer.showMessage("PAL Mode");
myOSystem.frameBuffer().showMessage("PAL Mode");
}
else if(format == "PAL")
{
myProperties.set("Display.Format", "NTSC");
mySystem->reset();
myFrameBuffer.showMessage("NTSC Mode");
myOSystem.frameBuffer().showMessage("NTSC Mode");
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::togglePalette()
{
string type = mySettings.getString("palette");
string type = myOSystem.settings().getString("palette");
if(type == "standard") // switch to original
{
myFrameBuffer.showMessage("Original Stella colors");
mySettings.setString("palette", "original");
myOSystem.frameBuffer().showMessage("Original Stella colors");
myOSystem.settings().setString("palette", "original");
}
else if(type == "original") // switch to z26
{
myFrameBuffer.showMessage("Z26 colors");
mySettings.setString("palette", "z26");
myOSystem.frameBuffer().showMessage("Z26 colors");
myOSystem.settings().setString("palette", "z26");
}
else if(type == "z26") // switch to standard
{
myFrameBuffer.showMessage("Standard Stella colors");
mySettings.setString("palette", "standard");
myOSystem.frameBuffer().showMessage("Standard Stella colors");
myOSystem.settings().setString("palette", "standard");
}
else // switch to standard mode if we get this far
{
myFrameBuffer.showMessage("Standard Stella colors");
mySettings.setString("palette", "standard");
myOSystem.frameBuffer().showMessage("Standard Stella colors");
myOSystem.settings().setString("palette", "standard");
}
}
@ -299,10 +267,10 @@ void Console::saveProperties(string filename, bool merge)
// Merge the current properties into the PropertiesSet file
if(merge)
{
if(myPropSet.merge(myProperties, filename))
myFrameBuffer.showMessage("Properties merged");
if(myOSystem.propSet().merge(myProperties, filename))
myOSystem.frameBuffer().showMessage("Properties merged");
else
myFrameBuffer.showMessage("Properties not merged");
myOSystem.frameBuffer().showMessage("Properties not merged");
}
else // Save to the specified file directly
{
@ -312,11 +280,11 @@ void Console::saveProperties(string filename, bool merge)
{
myProperties.save(out);
out.close();
myFrameBuffer.showMessage("Properties saved");
myOSystem.frameBuffer().showMessage("Properties saved");
}
else
{
myFrameBuffer.showMessage("Properties not saved");
myOSystem.frameBuffer().showMessage("Properties not saved");
}
}
}
@ -335,12 +303,12 @@ void Console::changeXStart(const uInt32 direction)
xstart += 4;
if(xstart > 80)
{
myFrameBuffer.showMessage("XStart at maximum");
myOSystem.frameBuffer().showMessage("XStart at maximum");
return;
}
else if((width + xstart) > 160)
{
myFrameBuffer.showMessage("XStart no effect");
myOSystem.frameBuffer().showMessage("XStart no effect");
return;
}
}
@ -349,7 +317,7 @@ void Console::changeXStart(const uInt32 direction)
xstart -= 4;
if(xstart < 0)
{
myFrameBuffer.showMessage("XStart at minimum");
myOSystem.frameBuffer().showMessage("XStart at minimum");
return;
}
}
@ -360,7 +328,7 @@ void Console::changeXStart(const uInt32 direction)
message = "XStart ";
message += strval.str();
myFrameBuffer.showMessage(message);
myOSystem.frameBuffer().showMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -375,7 +343,7 @@ void Console::changeYStart(const uInt32 direction)
ystart++;
if(ystart > 64)
{
myFrameBuffer.showMessage("YStart at maximum");
myOSystem.frameBuffer().showMessage("YStart at maximum");
return;
}
}
@ -384,7 +352,7 @@ void Console::changeYStart(const uInt32 direction)
ystart--;
if(ystart < 0)
{
myFrameBuffer.showMessage("YStart at minimum");
myOSystem.frameBuffer().showMessage("YStart at minimum");
return;
}
}
@ -395,7 +363,7 @@ void Console::changeYStart(const uInt32 direction)
message = "YStart ";
message += strval.str();
myFrameBuffer.showMessage(message);
myOSystem.frameBuffer().showMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -411,12 +379,12 @@ void Console::changeWidth(const uInt32 direction)
width += 4;
if((width > 160) || ((width % 4) != 0))
{
myFrameBuffer.showMessage("Width at maximum");
myOSystem.frameBuffer().showMessage("Width at maximum");
return;
}
else if((width + xstart) > 160)
{
myFrameBuffer.showMessage("Width no effect");
myOSystem.frameBuffer().showMessage("Width no effect");
return;
}
}
@ -425,7 +393,7 @@ void Console::changeWidth(const uInt32 direction)
width -= 4;
if(width < 80)
{
myFrameBuffer.showMessage("Width at minimum");
myOSystem.frameBuffer().showMessage("Width at minimum");
return;
}
}
@ -436,7 +404,7 @@ void Console::changeWidth(const uInt32 direction)
message = "Width ";
message += strval.str();
myFrameBuffer.showMessage(message);
myOSystem.frameBuffer().showMessage(message);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -451,7 +419,7 @@ void Console::changeHeight(const uInt32 direction)
height++;
if(height > 256)
{
myFrameBuffer.showMessage("Height at maximum");
myOSystem.frameBuffer().showMessage("Height at maximum");
return;
}
}
@ -460,7 +428,7 @@ void Console::changeHeight(const uInt32 direction)
height--;
if(height < 100)
{
myFrameBuffer.showMessage("Height at minimum");
myOSystem.frameBuffer().showMessage("Height at minimum");
return;
}
}
@ -471,6 +439,6 @@ void Console::changeHeight(const uInt32 direction)
message = "Height ";
message += strval.str();
myFrameBuffer.showMessage(message);
myOSystem.frameBuffer().showMessage(message);
}
#endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Console.hxx,v 1.22 2004-07-10 13:20:35 stephena Exp $
// $Id: Console.hxx,v 1.23 2005-02-21 02:23:49 stephena Exp $
//============================================================================
#ifndef CONSOLE_HXX
@ -22,44 +22,36 @@
class Console;
class Controller;
class Event;
class EventHandler;
class MediaSource;
class PropertiesSet;
class Settings;
class Sound;
class Switches;
class System;
class FrameBuffer;
class OSystem;
#include "bspf.hxx"
#include "Control.hxx"
#include "Props.hxx"
/**
This class represents the entire game console.
@author Bradford W. Mott
@version $Id: Console.hxx,v 1.22 2004-07-10 13:20:35 stephena Exp $
@version $Id: Console.hxx,v 1.23 2005-02-21 02:23:49 stephena Exp $
*/
class Console
{
public:
/**
Create a new console for emulating the specified game using the
given event object and game profiles.
given game image and operating system.
@param image The ROM image of the game to emulate
@param size The size of the ROM image
@param filename The name of the file that contained the ROM image
@param settings The settings object to use
@param profiles The game profiles object to use
@param framebuffer The framebuffer object to use
@param sound The sound object to use
@param osystem The OSystem object to use
*/
Console(const uInt8* image, uInt32 size, const char* filename,
Settings& settings, PropertiesSet& propertiesSet,
FrameBuffer& framebuffer, Sound& sound);
OSystem& osystem);
/**
Create a new console object by copying another one
@ -74,12 +66,6 @@ class Console
virtual ~Console();
public:
/**
Updates the console by one frame. Each frontend should
call this method 'framerate' times per second.
*/
void update();
/**
Get the controller plugged into the specified jack
@ -90,6 +76,13 @@ class Console
return (jack == Controller::Left) ? *myControllers[0] : *myControllers[1];
}
/**
Get the MediaSource for this console
@return The mediasource
*/
MediaSource& mediaSource() const { return *myMediaSource; }
/**
Get the properties being used by the game
@ -97,61 +90,24 @@ class Console
*/
const Properties& properties() const;
/**
Get the settings of the console
@return The settings for this console
*/
Settings& settings() const;
/**
Get the frame buffer of the console
@return The frame buffer
*/
FrameBuffer& frameBuffer() const;
/**
Get the frame rate for the emulation
*/
uInt32 frameRate() const;
/**
Get the sound object of the console
@return The sound object for this console
*/
Sound& sound() const;
/**
Get the console switches
@return The console switches
*/
Switches& switches() const
{
return *mySwitches;
}
Switches& switches() const { return *mySwitches; }
/**
Get the 6502 based system used by the console to emulate the game
@return The 6502 based system
*/
System& system() const
{
return *mySystem;
}
/**
Get the event handler of the console
@return The event handler
*/
EventHandler& eventHandler() const
{
return *myEventHandler;
}
System& system() const { return *mySystem; }
public:
/**
@ -221,6 +177,9 @@ class Console
#endif
private:
// Reference to the osystem object
OSystem& myOSystem;
// Pointers to the left and right controllers
Controller* myControllers[2];
@ -239,22 +198,8 @@ class Console
// Pointer to the 6502 based system being emulated
System* mySystem;
// Reference to the Settings object
Settings& mySettings;
// Reference to the PropertiesSet object
PropertiesSet& myPropSet;
// Reference to the FrameBuffer object
FrameBuffer& myFrameBuffer;
// Reference to the Sound object
Sound& mySound;
// Frame rate being used by the emulator
uInt32 myFrameRate;
// Pointer to the EventHandler object
EventHandler* myEventHandler;
};
#endif

View File

@ -13,13 +13,12 @@
// 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.30 2005-02-18 21:26:31 stephena Exp $
// $Id: EventHandler.cxx,v 1.31 2005-02-21 02:23:49 stephena Exp $
//============================================================================
#include <algorithm>
#include <sstream>
#include "Console.hxx"
#include "Event.hxx"
#include "EventHandler.hxx"
#include "Settings.hxx"
@ -27,6 +26,7 @@
#include "System.hxx"
#include "FrameBuffer.hxx"
#include "Sound.hxx"
#include "OSystem.hxx"
#include "bspf.hxx"
#ifdef SNAPSHOT_SUPPORT
@ -34,8 +34,8 @@
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandler::EventHandler(Console* console)
: myConsole(console),
EventHandler::EventHandler(OSystem& osystem)
: myOSystem(osystem),
myCurrentState(0),
myPauseStatus(false),
myQuitStatus(false),
@ -90,14 +90,14 @@ void EventHandler::sendKeyEvent(StellaEvent::KeyCode key, Int32 state)
if(myRemapEnabledFlag && key == StellaEvent::KCODE_TAB && state == 1 && !myPauseStatus)
{
myMenuStatus = !myMenuStatus;
myConsole->frameBuffer().showMenu(myMenuStatus);
myConsole->sound().mute(myMenuStatus);
myOSystem.frameBuffer().showMenu(myMenuStatus);
myOSystem.sound().mute(myMenuStatus);
return;
}
// Determine where the event should be sent
if(myMenuStatus)
myConsole->frameBuffer().sendKeyEvent(key, state);
myOSystem.frameBuffer().sendKeyEvent(key, state);
else
sendEvent(myKeyTable[key], state);
}
@ -108,7 +108,7 @@ void EventHandler::sendJoyEvent(StellaEvent::JoyStick stick,
{
// Determine where the event should be sent
if(myMenuStatus)
myConsole->frameBuffer().sendJoyEvent(stick, code, state);
myOSystem.frameBuffer().sendJoyEvent(stick, code, state);
else
sendEvent(myJoyTable[stick*StellaEvent::LastJCODE + code], state);
}
@ -147,19 +147,19 @@ void EventHandler::sendEvent(Event::Type event, Int32 state)
else if(event == Event::Pause)
{
myPauseStatus = !myPauseStatus;
myConsole->frameBuffer().pause(myPauseStatus);
myConsole->sound().mute(myPauseStatus);
myOSystem.frameBuffer().pause(myPauseStatus);
myOSystem.sound().mute(myPauseStatus);
return;
}
else if(event == Event::Quit)
{
myQuitStatus = !myQuitStatus;
myConsole->settings().saveConfig();
myOSystem.settings().saveConfig();
return;
}
if(ourMessageTable[event] != "")
myConsole->frameBuffer().showMessage(ourMessageTable[event]);
myOSystem.frameBuffer().showMessage(ourMessageTable[event]);
}
// Otherwise, pass it to the emulation core
@ -171,7 +171,7 @@ void EventHandler::setKeymap()
{
// Since istringstream swallows whitespace, we have to make the
// delimiters be spaces
string list = myConsole->settings().getString("keymap");
string list = myOSystem.settings().getString("keymap");
replace(list.begin(), list.end(), ':', ' ');
if(isValidList(list, StellaEvent::LastKCODE))
@ -195,7 +195,7 @@ void EventHandler::setJoymap()
{
// Since istringstream swallows whitespace, we have to make the
// delimiters be spaces
string list = myConsole->settings().getString("joymap");
string list = myOSystem.settings().getString("joymap");
replace(list.begin(), list.end(), ':', ' ');
if(isValidList(list, StellaEvent::LastJSTICK*StellaEvent::LastJCODE))
@ -339,9 +339,9 @@ bool EventHandler::isValidList(string list, uInt32 length)
void EventHandler::saveState()
{
// Do a state save using the System
string md5 = myConsole->properties().get("Cartridge.MD5");
string filename = myConsole->settings().stateFilename(md5, myCurrentState);
int result = myConsole->system().saveState(filename, md5);
string md5 = myOSystem.console().properties().get("Cartridge.MD5");
string filename = myOSystem.stateFilename(md5, myCurrentState);
int result = myOSystem.console().system().saveState(filename, md5);
// Print appropriate message
ostringstream buf;
@ -352,7 +352,7 @@ void EventHandler::saveState()
else if(result == 3)
buf << "Invalid state " << myCurrentState << " file";
myConsole->frameBuffer().showMessage(buf.str());
myOSystem.frameBuffer().showMessage(buf.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -367,16 +367,16 @@ void EventHandler::changeState()
ostringstream buf;
buf << "Changed to slot " << myCurrentState;
myConsole->frameBuffer().showMessage(buf.str());
myOSystem.frameBuffer().showMessage(buf.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::loadState()
{
// Do a state save using the System
string md5 = myConsole->properties().get("Cartridge.MD5");
string filename = myConsole->settings().stateFilename(md5, myCurrentState);
int result = myConsole->system().loadState(filename, md5);
string md5 = myOSystem.console().properties().get("Cartridge.MD5");
string filename = myOSystem.stateFilename(md5, myCurrentState);
int result = myOSystem.console().system().loadState(filename, md5);
// Print appropriate message
ostringstream buf;
@ -387,7 +387,7 @@ void EventHandler::loadState()
else if(result == 3)
buf << "Invalid state " << myCurrentState << " file";
myConsole->frameBuffer().showMessage(buf.str());
myOSystem.frameBuffer().showMessage(buf.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -396,28 +396,30 @@ void EventHandler::takeSnapshot()
#ifdef SNAPSHOT_SUPPORT
// Figure out the correct snapshot name
string filename;
string sspath = myConsole->settings().getString("ssdir");
string ssname = myConsole->settings().getString("ssname");
string sspath = myOSystem.settings().getString("ssdir");
string ssname = myOSystem.settings().getString("ssname");
if(ssname == "romname")
sspath = sspath + BSPF_PATH_SEPARATOR + myConsole->properties().get("Cartridge.Name");
sspath = sspath + BSPF_PATH_SEPARATOR +
myOSystem.console().properties().get("Cartridge.Name");
else if(ssname == "md5sum")
sspath = sspath + BSPF_PATH_SEPARATOR + myConsole->properties().get("Cartridge.MD5");
sspath = sspath + BSPF_PATH_SEPARATOR +
myOSystem.console().properties().get("Cartridge.MD5");
// Check whether we want multiple snapshots created
if(!myConsole->settings().getBool("sssingle"))
if(!myOSystem.settings().getBool("sssingle"))
{
// Determine if the file already exists, checking each successive filename
// until one doesn't exist
filename = sspath + ".png";
if(myConsole->settings().fileExists(filename))
if(myOSystem.fileExists(filename))
{
ostringstream buf;
for(uInt32 i = 1; ;++i)
{
buf.str("");
buf << sspath << "_" << i << ".png";
if(!myConsole->settings().fileExists(buf.str()))
if(!myOSystem.fileExists(buf.str()))
break;
}
filename = buf.str();
@ -427,11 +429,11 @@ void EventHandler::takeSnapshot()
filename = sspath + ".png";
// Now create a Snapshot object and save the PNG
myConsole->frameBuffer().refresh(true);
Snapshot snapshot(myConsole->frameBuffer());
myOSystem.frameBuffer().refresh(true);
Snapshot snapshot(myOSystem.frameBuffer());
string result = snapshot.savePNG(filename);
myConsole->frameBuffer().showMessage(result);
myOSystem.frameBuffer().showMessage(result);
#else
myConsole->frameBuffer().showMessage("Snapshots unsupported");
myOSystem.frameBuffer().showMessage("Snapshots unsupported");
#endif
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: EventHandler.hxx,v 1.14 2004-06-20 23:30:48 stephena Exp $
// $Id: EventHandler.hxx,v 1.15 2005-02-21 02:23:49 stephena Exp $
//============================================================================
#ifndef EVENTHANDLER_HXX
@ -24,7 +24,7 @@
#include "StellaEvent.hxx"
class Console;
class OSystem;
/**
This class takes care of event remapping and dispatching for the
@ -40,7 +40,7 @@ class Console;
mapping can take place.
@author Stephen Anthony
@version $Id: EventHandler.hxx,v 1.14 2004-06-20 23:30:48 stephena Exp $
@version $Id: EventHandler.hxx,v 1.15 2005-02-21 02:23:49 stephena Exp $
*/
class EventHandler
{
@ -48,7 +48,7 @@ class EventHandler
/**
Create a new event handler object
*/
EventHandler(Console* console);
EventHandler(OSystem& osystem);
/**
Destructor
@ -123,6 +123,9 @@ class EventHandler
void takeSnapshot();
private:
// Global Console object
OSystem& myOSystem;
// Array of key events
Event::Type myKeyTable[StellaEvent::LastKCODE];
@ -132,9 +135,6 @@ class EventHandler
// Array of messages for each Event
string ourMessageTable[Event::LastType];
// Global Console object
Console* myConsole;
// Global Event object
Event* myEvent;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBuffer.cxx,v 1.12 2004-07-28 23:54:39 stephena Exp $
// $Id: FrameBuffer.cxx,v 1.13 2005-02-21 02:23:49 stephena Exp $
//============================================================================
#include <sstream>
@ -26,6 +26,9 @@
#include "Settings.hxx"
#include "MediaSrc.hxx"
#include "FrameBuffer.hxx"
#include "OSystem.hxx"
#include "stella.xpm" // The Stella icon
// Eventually, these may become variables
#define FONTWIDTH 8
@ -45,13 +48,18 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBuffer::FrameBuffer()
: myConsole(0),
myMediaSource(0),
: myOSystem(0),
myWidth(0),
myHeight(0),
theRedrawEntireFrameIndicator(true),
myFGColor(10),
myBGColor(0),
myWMAvailable(false),
theZoomLevel(1),
theMaxZoomLevel(1),
theAspectRatio(1.0),
myFrameRate(0),
myPauseStatus(false),
myCurrentWidget(W_NONE),
@ -81,11 +89,47 @@ FrameBuffer::~FrameBuffer(void)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::initDisplay(Console* console, MediaSource* mediasrc)
void FrameBuffer::initialize(OSystem* osystem, const string title,
uInt32 width, uInt32 height)
{
myConsole = console;
myMediaSource = mediasrc;
myOSystem = osystem;
myWidth = width;
myHeight = height;
myFrameRate = myOSystem->settings().getInt("framerate");
// Now initialize the SDL screen
Uint32 initflags = SDL_INIT_VIDEO | SDL_INIT_TIMER;
if(SDL_Init(initflags) < 0)
return;
// Get the system-specific WM information
SDL_VERSION(&myWMInfo.version);
if(SDL_GetWMInfo(&myWMInfo) > 0)
myWMAvailable = true;
mySDLFlags = myOSystem->settings().getBool("fullscreen") ? SDL_FULLSCREEN : 0;
// Initialize video subsystem
initSubsystem();
// Make sure that theUseFullScreenFlag sets up fullscreen mode correctly
if(myOSystem->settings().getBool("fullscreen"))
{
grabMouse(true);
showCursor(false);
}
else
{
// Keep mouse in game window if grabmouse is selected
grabMouse(myOSystem->settings().getBool("grabmouse"));
// Show or hide the cursor depending on the 'hidecursor' argument
showCursor(!myOSystem->settings().getBool("hidecursor"));
}
/*
// Fill the properties info array with game information
ourPropertiesInfo[0] = myConsole->properties().get("Cartridge.Name");
ourPropertiesInfo[1] = "";
@ -101,14 +145,6 @@ void FrameBuffer::initDisplay(Console* console, MediaSource* mediasrc)
myConsole->eventHandler().getKeymapArray(&myKeyTable, &myKeyTableSize);
myConsole->eventHandler().getJoymapArray(&myJoyTable, &myJoyTableSize);
myFrameRate = myConsole->settings().getInt("framerate");
// Now initialize the derived class
init();
// The following has to be done after the initialization of the derived class,
// since we need the exact width and height of the display
// Determine the maximum number of characters that can be onscreen
myMaxColumns = myWidth / FONTWIDTH - 3;
myMaxRows = myHeight / LINEOFFSET - 2;
@ -137,6 +173,7 @@ void FrameBuffer::initDisplay(Console* console, MediaSource* mediasrc)
// Finally, load the remap menu with strings,
// clipping any strings which are wider than the display
loadRemapMenu();
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -154,7 +191,7 @@ void FrameBuffer::update()
{
// Draw changes to the mediasource
if(!myPauseStatus)
myMediaSource->update();
myOSystem->console().mediaSource().update();
// We always draw the screen, even if the core is paused
drawMediaSource();
@ -461,7 +498,7 @@ void FrameBuffer::pause(bool status)
// Now notify the child object, in case it wants to do something
// special when pause is received
pauseEvent(myPauseStatus);
//FIXME pauseEvent(myPauseStatus);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -638,12 +675,12 @@ void FrameBuffer::loadRemapMenu()
// Iterate through the keymap table and create a colon-separated list
for(uInt32 i = 0; i < StellaEvent::LastKCODE; ++i)
keybuf << myKeyTable[i] << ":";
myConsole->settings().setString("keymap", keybuf.str());
myOSystem->settings().setString("keymap", keybuf.str());
// Iterate through the joymap table and create a colon-separated list
for(uInt32 i = 0; i < StellaEvent::LastJSTICK*StellaEvent::LastJCODE; ++i)
joybuf << myJoyTable[i] << ":";
myConsole->settings().setString("joymap", joybuf.str());
myOSystem->settings().setString("joymap", joybuf.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -796,3 +833,261 @@ const char* FrameBuffer::ourEventName[StellaEvent::LastKCODE] = {
"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10",
"F11", "F12", "F13", "F14", "F15",
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::setupPalette()
{
// Shade the palette to 75% normal value in pause mode
float shade = 1.0;
if(myPauseStatus)
shade = 0.75;
const uInt32* gamePalette = myOSystem->console().mediaSource().palette();
for(uInt32 i = 0; i < 256; ++i)
{
Uint8 r, g, b;
r = (Uint8) (((gamePalette[i] & 0x00ff0000) >> 16) * shade);
g = (Uint8) (((gamePalette[i] & 0x0000ff00) >> 8) * shade);
b = (Uint8) ((gamePalette[i] & 0x000000ff) * shade);
myPalette[i] = mapRGB(r, g, b);
}
theRedrawEntireFrameIndicator = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::toggleFullscreen()
{
bool isFullscreen = !myOSystem->settings().getBool("fullscreen");
// Update the settings
myOSystem->settings().setBool("fullscreen", isFullscreen);
if(isFullscreen)
mySDLFlags |= SDL_FULLSCREEN;
else
mySDLFlags &= ~SDL_FULLSCREEN;
if(!createScreen())
return;
if(isFullscreen) // now in fullscreen mode
{
grabMouse(true);
showCursor(false);
}
else // now in windowed mode
{
grabMouse(myOSystem->settings().getBool("grabmouse"));
showCursor(!myOSystem->settings().getBool("hidecursor"));
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::resize(int mode)
{
// reset size to that given in properties
// this is a special case of allowing a resize while in fullscreen mode
if(mode == 0)
{
myWidth = 1;//FIXME myMediaSource->width() << 1;
myHeight = 1;//FIXME myMediaSource->height();
}
else if(mode == 1) // increase size
{
if(myOSystem->settings().getBool("fullscreen"))
return;
if(theZoomLevel == theMaxZoomLevel)
theZoomLevel = 1;
else
theZoomLevel++;
}
else if(mode == -1) // decrease size
{
if(myOSystem->settings().getBool("fullscreen"))
return;
if(theZoomLevel == 1)
theZoomLevel = theMaxZoomLevel;
else
theZoomLevel--;
}
if(!createScreen())
return;
// Update the settings
myOSystem->settings().setInt("zoom", theZoomLevel);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::showCursor(bool show)
{
if(show)
SDL_ShowCursor(SDL_ENABLE);
else
SDL_ShowCursor(SDL_DISABLE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::grabMouse(bool grab)
{
if(grab)
SDL_WM_GrabInput(SDL_GRAB_ON);
else
SDL_WM_GrabInput(SDL_GRAB_OFF);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBuffer::fullScreen()
{
return myOSystem->settings().getBool("fullscreen");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 FrameBuffer::maxWindowSizeForScreen()
{
uInt32 sWidth = screenWidth();
uInt32 sHeight = screenHeight();
uInt32 multiplier = sWidth / myWidth;
// If screenwidth or height could not be found, use default zoom value
if(sWidth == 0 || sHeight == 0)
return 4;
bool found = false;
while(!found && (multiplier > 0))
{
// Figure out the desired size of the window
uInt32 width = (uInt32) (myWidth * multiplier * theAspectRatio);
uInt32 height = myHeight * multiplier;
if((width < sWidth) && (height < sHeight))
found = true;
else
multiplier--;
}
if(found)
return multiplier;
else
return 1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 FrameBuffer::screenWidth()
{
uInt32 width = 0;
if(myWMAvailable)
{
#if defined(UNIX)
if(myWMInfo.subsystem == SDL_SYSWM_X11)
{
myWMInfo.info.x11.lock_func();
width = DisplayWidth(myWMInfo.info.x11.display,
DefaultScreen(myWMInfo.info.x11.display));
myWMInfo.info.x11.unlock_func();
}
#elif defined(WIN32)
width = (uInt32) GetSystemMetrics(SM_CXSCREEN);
#elif defined(MAC_OSX)
// FIXME - add OSX Desktop code here (I don't think SDL supports it yet)
#endif
}
return width;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 FrameBuffer::screenHeight()
{
uInt32 height = 0;
if(myWMAvailable)
{
#if defined(UNIX)
if(myWMInfo.subsystem == SDL_SYSWM_X11)
{
myWMInfo.info.x11.lock_func();
height = DisplayHeight(myWMInfo.info.x11.display,
DefaultScreen(myWMInfo.info.x11.display));
myWMInfo.info.x11.unlock_func();
}
#elif defined(WIN32)
height = (uInt32) GetSystemMetrics(SM_CYSCREEN);
#elif defined(MAC_OSX)
// FIXME - add OSX Desktop code here (I don't think SDL supports it yet)
#endif
}
return height;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::setWindowAttributes()
{
// Set the window title
ostringstream name;
name << "Stella: \"" << myOSystem->console().properties().get("Cartridge.Name") << "\"";
SDL_WM_SetCaption(name.str().c_str(), "stella");
#ifndef MAC_OSX
// Set the window icon
uInt32 w, h, ncols, nbytes;
uInt32 rgba[256], icon[32 * 32];
uInt8 mask[32][4];
sscanf(stella_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes);
if((w != 32) || (h != 32) || (ncols > 255) || (nbytes > 1))
{
cerr << "ERROR: Couldn't load the icon.\n";
return;
}
for(uInt32 i = 0; i < ncols; i++)
{
unsigned char code;
char color[32];
uInt32 col;
sscanf(stella_icon[1 + i], "%c c %s", &code, color);
if(!strcmp(color, "None"))
col = 0x00000000;
else if(!strcmp(color, "black"))
col = 0xFF000000;
else if (color[0] == '#')
{
sscanf(color + 1, "%06x", &col);
col |= 0xFF000000;
}
else
{
cerr << "ERROR: Couldn't load the icon.\n";
return;
}
rgba[code] = col;
}
memset(mask, 0, sizeof(mask));
for(h = 0; h < 32; h++)
{
const char* line = stella_icon[1 + ncols + h];
for(w = 0; w < 32; w++)
{
icon[w + 32 * h] = rgba[(int)line[w]];
if(rgba[(int)line[w]] & 0xFF000000)
mask[h][w >> 3] |= 1 << (7 - (w & 0x07));
}
}
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(icon, 32, 32, 32,
32 * 4, 0xFF0000, 0x00FF00, 0x0000FF, 0xFF000000);
SDL_WM_SetIcon(surface, (unsigned char *) mask);
SDL_FreeSurface(surface);
#endif
}

View File

@ -13,29 +13,33 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBuffer.hxx,v 1.13 2005-02-18 21:26:31 stephena Exp $
// $Id: FrameBuffer.hxx,v 1.14 2005-02-21 02:23:49 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_HXX
#define FRAMEBUFFER_HXX
#include <SDL.h>
#include <SDL_syswm.h>
#include "bspf.hxx"
#include "Event.hxx"
#include "MediaSrc.hxx"
#include "StellaEvent.hxx"
class Console;
class OSystem;
/**
This class encapsulates the MediaSource and is the basis for the video
display in Stella. All ports should derive from this class for
display in Stella. All graphics ports should derive from this class for
platform-specific video stuff.
This class also implements a MAME-like user interface where Stella settings
FIXME This class also implements a MAME-like user interface where Stella settings
can be changed.
@author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.13 2005-02-18 21:26:31 stephena Exp $
@version $Id: FrameBuffer.hxx,v 1.14 2005-02-21 02:23:49 stephena Exp $
*/
class FrameBuffer
{
@ -54,13 +58,16 @@ class FrameBuffer
Initializes the framebuffer display. This must be called before any
calls are made to derived methods.
@param console The console
@param mediasrc The mediasource
@param osystem The parent osystem
@param title The title of the window
@param width The width of the framebuffer
@param height The height of the framebuffer
*/
void initDisplay(Console* console, MediaSource* mediasrc);
void initialize(OSystem* osystem, const string title, uInt32 width, uInt32 height);
/**
Updates the display. Also draws any pending menus, etc.
Updates the display, which depending on the current mode could mean
drawing the mediasource, any pending menus, etc.
*/
void update();
@ -95,6 +102,29 @@ class FrameBuffer
*/
uInt32 height() { return myHeight; }
#if 0
FIXME
/**
This routine is called to get the width of the onscreen image.
*/
uInt32 imageWidth() { return myDimensions.w; }
/**
This routine is called to get the height of the onscreen image.
*/
uInt32 imageHeight() { return myDimensions.h; }
#endif
/**
This routine is called to get the width of the system desktop.
*/
uInt32 screenWidth();
/**
This routine is called to get the height of the system desktop.
*/
uInt32 screenHeight();
/**
Send a keyboard event to the user interface.
@ -135,18 +165,82 @@ class FrameBuffer
drawMediaSource();
}
/**
Toggles between fullscreen and window mode. Grabmouse and hidecursor
activated when in fullscreen mode.
*/
void toggleFullscreen();
/**
This routine is called when the user wants to resize the window.
A '1' argument indicates that the window should increase in size, while '-1'
indicates that the windows should decrease in size. A '0' indicates that
the window should be sized according to the current properties.
Can't resize in fullscreen mode. Will only resize up to the maximum size
of the screen.
*/
void resize(int mode);
/**
Shows or hides the cursor based on the given boolean value.
*/
void showCursor(bool show);
/**
Grabs or ungrabs the mouse based on the given boolean value.
*/
void grabMouse(bool grab);
/**
Answers if the display is currently in fullscreen mode.
*/
bool fullScreen();
/**
Answers the current zoom level of the SDL
*/
uInt32 zoomLevel() { return theZoomLevel; }
/**
Calculate the maximum window size that the current screen can hold.
Only works in X11 for now. If not running under X11, always return 4.
*/
uInt32 maxWindowSizeForScreen();
/**
Set the title and icon for the main SDL window.
*/
void setWindowAttributes();
/**
Set up the palette for a screen of any depth > 8.
*/
void setupPalette();
public:
//////////////////////////////////////////////////////////////////////
// The following methods are system-specific and must be implemented
// in derived classes.
//////////////////////////////////////////////////////////////////////
/**
This routine is called to initialize the subsystem-specific video mode.
*/
virtual bool initSubsystem() = 0;
/**
This routine should be called once the console is created to setup
the video system for us to use. Return false if any operation fails,
otherwise return true.
This routine is called whenever the screen needs to be recreated.
It updates the global screen variable.
*/
virtual bool init() = 0;
virtual bool createScreen() = 0;
/**
This routine is called to map a given r,g,b triple to the screen palette.
@param r The red component of the color.
@param g The green component of the color.
@param b The blue component of the color.
*/
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b) = 0;
/**
This routine should be called anytime the MediaSource needs to be redrawn
@ -193,24 +287,6 @@ class FrameBuffer
*/
virtual void postFrameUpdate() = 0;
/**
This routine is called when the emulation has received
a pause event.
@param status The received pause status
*/
virtual void pauseEvent(bool status) = 0;
/**
This routine is called to get the width of the onscreen image.
*/
virtual uInt32 imageWidth() = 0;
/**
This routine is called to get the height of the onscreen image.
*/
virtual uInt32 imageHeight() = 0;
/**
This routine is called to get the specified scanline data.
@ -219,12 +295,21 @@ class FrameBuffer
*/
virtual void scanline(uInt32 row, uInt8* data) = 0;
protected:
// The Console for the system
Console* myConsole;
#if 0
FIXME
/**
This routine is called when the emulation has received
a pause event.
// The Mediasource for the system
MediaSource* myMediaSource;
@param status The received pause status
*/
virtual void pauseEvent(bool status) = 0;
#endif
protected:
// The parent system for the framebuffer
OSystem* myOSystem;
// Bounds for the window frame
uInt32 myWidth, myHeight;
@ -238,6 +323,34 @@ class FrameBuffer
// Holds the foreground and background color table indices
uInt8 myFGColor, myBGColor;
// The SDL video buffer
SDL_Surface* myScreen;
// SDL initialization flags
uInt32 mySDLFlags;
// SDL palette
Uint32 myPalette[256];
// Used to get window-manager specifics
SDL_SysWMinfo myWMInfo;
// Indicates the width/height and origin x/y of the onscreen image
// (these may be different than the screen/window dimensions)
SDL_Rect myDimensions;
// Indicates if the system-specific WM information is available
bool myWMAvailable;
// Indicates the current zoom level of the SDL screen
uInt32 theZoomLevel;
// Indicates the maximum zoom of the SDL screen
uInt32 theMaxZoomLevel;
// The aspect ratio of the window
float theAspectRatio;
private:
// Enumeration representing the different types of user interface widgets
enum Widget { W_NONE, MAIN_MENU, REMAP_MENU, INFO_MENU };

View File

@ -0,0 +1,69 @@
//============================================================================
//
// 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-1999 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.1 2005-02-21 02:23:49 stephena Exp $
//============================================================================
#include <cassert>
#include <sstream>
#include <fstream>
#include "FrameBuffer.hxx"
#include "Sound.hxx"
#include "Settings.hxx"
#include "PropsSet.hxx"
#include "EventHandler.hxx"
#include "bspf.hxx"
#include "OSystem.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystem::OSystem(FrameBuffer& framebuffer, Sound& sound,
Settings& settings, PropertiesSet& propset)
: myFrameBuffer(framebuffer),
mySound(sound),
mySettings(settings),
myPropSet(propset)
{
// Create an event handler which will collect and dispatch events
myEventHandler = new EventHandler(*this);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystem::~OSystem()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::update()
{
// myFrameBuffer.update();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystem::OSystem(const OSystem& osystem)
: myFrameBuffer(osystem.myFrameBuffer),
mySound(osystem.mySound),
mySettings(osystem.mySettings),
myPropSet(osystem.myPropSet)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystem& OSystem::operator = (const OSystem&)
{
assert(false);
return *this;
}

View File

@ -0,0 +1,168 @@
//============================================================================
//
// 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-1999 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.hxx,v 1.1 2005-02-21 02:23:49 stephena Exp $
//============================================================================
#ifndef OSYSTEM_HXX
#define OSYSTEM_HXX
class EventHandler;
class FrameBuffer;
class Sound;
class Settings;
class PropertiesSet;
#include "Console.hxx"
#include "bspf.hxx"
/**
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: OSystem.hxx,v 1.1 2005-02-21 02:23:49 stephena Exp $
*/
class OSystem
{
public:
/**
Create a new OSystem abstract class
*/
OSystem(FrameBuffer& framebuffer, Sound& sound,
Settings& settings, PropertiesSet& propset);
/**
Destructor
*/
virtual ~OSystem();
public:
/**
Updates the osystem by one frame. Determines which subsystem should
be updated. Generally will be called 'framerate' times per second.
*/
void update();
/**
Adds the specified console to the system.
@param console The console (game emulation object) to add
*/
void addConsole(Console* console) { myConsole = console; }
/**
Removes the currently attached console from the system.
*/
void removeConsole(void) { delete myConsole; myConsole = NULL; }
/**
Get the console of the system.
@return The console object
*/
Console& console(void) const { return *myConsole; }
/**
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; }
public:
//////////////////////////////////////////////////////////////////////
// The following methods are system-specific and must be implemented
// in derived classes.
//////////////////////////////////////////////////////////////////////
/**
This method should be called to get the filename of a state file
given the state number.
@param md5 The md5sum to use as part of the filename.
@param state The state to use as part of the filename.
@return String representing the full path of the state filename.
*/
virtual string stateFilename(const string& md5, uInt32 state) = 0;
/**
This method should be called to test whether the given file exists.
@param filename The filename to test for existence.
@return boolean representing whether or not the file exists
*/
virtual bool fileExists(const string& filename) = 0;
protected:
// Pointer to the EventHandler object
EventHandler* myEventHandler;
// Reference to the FrameBuffer object
FrameBuffer& myFrameBuffer;
// Reference to the Sound object
Sound& mySound;
// Reference to the Settings object
Settings& mySettings;
// Reference to the PropertiesSet object
PropertiesSet& myPropSet;
// Pointer to the (currently defined) Console object
Console* myConsole;
private:
// 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

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Settings.cxx,v 1.30 2004-09-14 16:10:28 stephena Exp $
// $Id: Settings.cxx,v 1.31 2005-02-21 02:23:57 stephena Exp $
//============================================================================
#include <cassert>
@ -168,7 +168,7 @@ void Settings::usage()
{
#ifndef MAC_OSX
cout << endl
<< "Stella version 1.4.2_cvs\n\nUsage: stella [options ...] romfile" << endl
<< "Stella version 1.5_cvs\n\nUsage: stella [options ...] romfile" << endl
<< endl
<< "Valid options are:" << endl
<< endl

View File

@ -13,12 +13,14 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Settings.hxx,v 1.18 2004-08-17 01:17:08 stephena Exp $
// $Id: Settings.hxx,v 1.19 2005-02-21 02:23:57 stephena Exp $
//============================================================================
#ifndef SETTINGS_HXX
#define SETTINGS_HXX
class OSystem;
#include "bspf.hxx"
@ -26,7 +28,7 @@
This class provides an interface for accessing frontend specific settings.
@author Stephen Anthony
@version $Id: Settings.hxx,v 1.18 2004-08-17 01:17:08 stephena Exp $
@version $Id: Settings.hxx,v 1.19 2005-02-21 02:23:57 stephena Exp $
*/
class Settings
{
@ -136,32 +138,6 @@ class Settings
*/
void setString(const string& key, const string& value, bool save = true);
public:
//////////////////////////////////////////////////////////////////////
// The following methods are system-specific and must be implemented
// in derived classes.
//////////////////////////////////////////////////////////////////////
/**
This method should be called to get the filename of a state file
given the state number.
@param md5 The md5sum to use as part of the filename.
@param state The state to use as part of the filename.
@return String representing the full path of the state filename.
*/
virtual string stateFilename(const string& md5, uInt32 state) = 0;
/**
This method should be called to test whether the given file exists.
@param filename The filename to test for existence.
@return boolean representing whether or not the file exists
*/
virtual bool fileExists(const string& filename) = 0;
public:
/**
This method should be called to get the filename of the
@ -201,6 +177,11 @@ class Settings
*/
string baseDir() { return myBaseDir; }
/**
Set the OSystem object for this settings class
*/
void setOSystem(OSystem* osystem) { myOSystem = osystem; }
protected:
void set(const string& key, const string& value, bool save = true);
@ -212,6 +193,8 @@ class Settings
string myConfigInputFile;
string myConfigOutputFile;
OSystem* myOSystem;
// Structure used for storing settings
struct Setting
{
@ -229,7 +212,6 @@ class Settings
// Test whether the given setting is present in the array
bool contains(const string& key);
private:
// Copy constructor isn't supported by this class so make it private
Settings(const Settings&);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Sound.cxx,v 1.14 2005-01-04 02:29:30 stephena Exp $
// $Id: Sound.cxx,v 1.15 2005-02-21 02:23:57 stephena Exp $
//============================================================================
#include "Serializer.hxx"
@ -44,11 +44,9 @@ void Sound::mute(bool state)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Sound::init(Console* console, MediaSource* mediasrc, System* system,
double displayframerate)
void Sound::initialize(OSystem* osystem, System* system, double displayframerate)
{
myConsole = console;
myMediaSource = mediasrc;
myOSystem = osystem;
mySystem = system;
myLastRegisterSetCycle = 0;
myDisplayFrameRate = displayframerate;

View File

@ -13,14 +13,13 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Sound.hxx,v 1.13 2005-01-04 02:29:31 stephena Exp $
// $Id: Sound.hxx,v 1.14 2005-02-21 02:23:57 stephena Exp $
//============================================================================
#ifndef SOUND_HXX
#define SOUND_HXX
class Console;
class MediaSource;
class OSystem;
class Serializer;
class Deserializer;
class System;
@ -33,7 +32,7 @@ class System;
to compile Stella with no sound support whatsoever.
@author Stephen Anthony and Bradford W. Mott
@version $Id: Sound.hxx,v 1.13 2005-01-04 02:29:31 stephena Exp $
@version $Id: Sound.hxx,v 1.14 2005-02-21 02:23:57 stephena Exp $
*/
class Sound
{
@ -62,13 +61,11 @@ class Sound
Initializes the sound device. This must be called before any
calls are made to derived methods.
@param console The console
@param mediasrc The mediasource
@param system The system
@param osystem The OSystem
@param system The M6502 system
@param framerate The base framerate depending on NTSC or PAL ROM
*/
virtual void init(Console* console, MediaSource* mediasrc, System* system,
double displayframerate);
virtual void initialize(OSystem* osystem, System* system, double displayframerate);
/**
Return true iff the sound device was successfully initialized.
@ -133,13 +130,10 @@ public:
virtual bool save(Serializer& out);
protected:
// The Console for the system
Console* myConsole;
// The OSystem for this sound object
OSystem* myOSystem;
// The Mediasource for the system
MediaSource* myMediaSource;
// The System for the system
// The M6502 system for this sound object
System* mySystem;
// Indicates the cycle when a sound register was last set

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TIA.cxx,v 1.35 2005-01-05 02:57:58 bwmott Exp $
// $Id: TIA.cxx,v 1.36 2005-02-21 02:23:57 stephena Exp $
//============================================================================
#include <cassert>
@ -30,13 +30,15 @@
#include "Deserializer.hxx"
#include "Settings.hxx"
#include "Sound.hxx"
#include "OSystem.hxx"
#define HBLANK 68
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TIA::TIA(const Console& console, Sound& sound)
: myConsole(console),
mySound(sound),
TIA::TIA(OSystem& osystem)
: myOSystem(osystem),
myConsole(osystem.console()),
mySound(osystem.sound()),
myColorLossEnabled(false),
myMaximumNumberOfScanlines(262),
myCOLUBK(myColor[0]),
@ -533,7 +535,7 @@ void TIA::update()
const uInt32* TIA::palette() const
{
// See which palette we should be using
string type = myConsole.settings().getString("palette");
string type = myOSystem.settings().getString("palette");
string format = myConsole.properties().get("Display.Format");
if(type == "standard")
@ -3270,7 +3272,8 @@ const uInt32 TIA::ourPALPaletteZ26[256] = {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TIA::TIA(const TIA& c)
: myConsole(c.myConsole),
: myOSystem(c.myOSystem),
myConsole(c.myConsole),
mySound(c.mySound),
myCOLUBK(myColor[0]),
myCOLUPF(myColor[1]),

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TIA.hxx,v 1.14 2004-06-13 04:53:04 bwmott Exp $
// $Id: TIA.hxx,v 1.15 2005-02-21 02:23:57 stephena Exp $
//============================================================================
#ifndef TIA_HXX
@ -24,8 +24,7 @@ class Sound;
class System;
class Serializer;
class Deserializer;
#include <string>
class OSystem;
#include "bspf.hxx"
#include "Device.hxx"
@ -43,7 +42,7 @@ class Deserializer;
be displayed on screen.
@author Bradford W. Mott
@version $Id: TIA.hxx,v 1.14 2004-06-13 04:53:04 bwmott Exp $
@version $Id: TIA.hxx,v 1.15 2005-02-21 02:23:57 stephena Exp $
*/
class TIA : public Device , public MediaSource
{
@ -54,7 +53,7 @@ class TIA : public Device , public MediaSource
@param console The console the TIA is associated with
@param sound The sound object the TIA is associated with
*/
TIA(const Console& console, Sound& sound);
TIA(OSystem& osystem);
/**
Destructor
@ -204,6 +203,9 @@ class TIA : public Device , public MediaSource
void waitHorizontalSync();
private:
// OSsystem the TIA is associated with
const OSystem& myOSystem;
// Console the TIA is associated with
const Console& myConsole;

View File

@ -0,0 +1,56 @@
//============================================================================
//
// 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-1999 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: OSystemUNIX.cxx,v 1.1 2005-02-21 02:23:57 stephena Exp $
//============================================================================
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "bspf.hxx"
#include "OSystem.hxx"
#include "OSystemUNIX.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystemUNIX::OSystemUNIX(FrameBuffer& framebuffer, Sound& sound,
Settings& settings, PropertiesSet& propset)
: OSystem(framebuffer, sound, settings, propset)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystemUNIX::~OSystemUNIX()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string OSystemUNIX::stateFilename(const string& md5, uInt32 state)
{
ostringstream buf;
//FIXME buf << myStateDir << md5 << ".st" << state;
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool OSystemUNIX::fileExists(const string& filename)
{
return (access(filename.c_str(), F_OK) == 0);
}

View File

@ -0,0 +1,73 @@
//============================================================================
//
// 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-1999 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: OSystemUNIX.hxx,v 1.1 2005-02-21 02:23:57 stephena Exp $
//============================================================================
#ifndef OSYSTEM_UNIX_HXX
#define OSYSTEM_UNIX_HXX
class FrameBuffer;
class Sound;
class Settings;
class PropertiesSet;
#include "bspf.hxx"
/**
This class defines UNIX-like OS's (Linux) system specific settings.
@author Stephen Anthony
@version $Id: OSystemUNIX.hxx,v 1.1 2005-02-21 02:23:57 stephena Exp $
*/
class OSystemUNIX : public OSystem
{
public:
/**
Create a new UNIX-specific operating system object
*/
OSystemUNIX(FrameBuffer& framebuffer, Sound& sound,
Settings& settings, PropertiesSet& propset);
/**
Destructor
*/
virtual ~OSystemUNIX();
public:
/**
This method should be called to get the filename of a state file
given the state number.
@param md5 The md5sum to use as part of the filename.
@param state The state to use as part of the filename.
@return String representing the full path of the state filename.
*/
virtual string stateFilename(const string& md5, uInt32 state);
/**
This method should be called to test whether the given file exists.
@param filename The filename to test for existence.
@return boolean representing whether or not the file exists
*/
virtual bool fileExists(const string& filename);
};
#endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SettingsUNIX.cxx,v 1.7 2004-08-17 01:17:08 stephena Exp $
// $Id: SettingsUNIX.cxx,v 1.8 2005-02-21 02:23:57 stephena Exp $
//============================================================================
#include <cstdlib>
@ -25,6 +25,7 @@
#include <sys/types.h>
#include "bspf.hxx"
#include "OSystem.hxx"
#include "Settings.hxx"
#include "SettingsUNIX.hxx"
@ -35,11 +36,12 @@ SettingsUNIX::SettingsUNIX()
myBaseDir = getenv("HOME");
string stelladir = myBaseDir + "/.stella";
if(!fileExists(stelladir))
if(!myOSystem->fileExists(stelladir))
mkdir(stelladir.c_str(), 0777);
// FIXME - add a OSystem mkdir
myStateDir = stelladir + "/state/";
if(!fileExists(myStateDir))
if(!myOSystem->fileExists(myStateDir))
mkdir(myStateDir.c_str(), 0777);
string userPropertiesFile = stelladir + "/stella.pro";
@ -49,18 +51,18 @@ SettingsUNIX::SettingsUNIX()
// Set up the names of the input and output config files
myConfigOutputFile = userConfigFile;
if(fileExists(userConfigFile))
if(myOSystem->fileExists(userConfigFile))
myConfigInputFile = userConfigFile;
else if(fileExists(systemConfigFile))
else if(myOSystem->fileExists(systemConfigFile))
myConfigInputFile = systemConfigFile;
else
myConfigInputFile = "";
// Set up the input and output properties files
myPropertiesOutputFile = userPropertiesFile;
if(fileExists(userPropertiesFile))
if(myOSystem->fileExists(userPropertiesFile))
myPropertiesInputFile = userPropertiesFile;
else if(fileExists(systemPropertiesFile))
else if(myOSystem->fileExists(systemPropertiesFile))
myPropertiesInputFile = systemPropertiesFile;
else
myPropertiesInputFile = "";
@ -70,18 +72,3 @@ SettingsUNIX::SettingsUNIX()
SettingsUNIX::~SettingsUNIX()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string SettingsUNIX::stateFilename(const string& md5, uInt32 state)
{
ostringstream buf;
buf << myStateDir << md5 << ".st" << state;
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SettingsUNIX::fileExists(const string& filename)
{
return (access(filename.c_str(), F_OK) == 0);
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SettingsUNIX.hxx,v 1.3 2004-07-05 00:53:48 stephena Exp $
// $Id: SettingsUNIX.hxx,v 1.4 2005-02-21 02:23:57 stephena Exp $
//============================================================================
#ifndef SETTINGS_UNIX_HXX
@ -21,12 +21,11 @@
#include "bspf.hxx"
/**
This class defines UNIX-like OS's (Linux) system specific settings.
@author Stephen Anthony
@version $Id: SettingsUNIX.hxx,v 1.3 2004-07-05 00:53:48 stephena Exp $
@version $Id: SettingsUNIX.hxx,v 1.4 2005-02-21 02:23:57 stephena Exp $
*/
class SettingsUNIX : public Settings
{
@ -40,28 +39,6 @@ class SettingsUNIX : public Settings
Destructor
*/
virtual ~SettingsUNIX();
public:
/**
This method should be called to get the filename of a state file
given the state number.
@param md5 The md5sum to use as part of the filename.
@param state The state to use as part of the filename.
@return String representing the full path of the state filename.
*/
virtual string stateFilename(const string& md5, uInt32 state);
/**
This method should be called to test whether the given file exists.
@param filename The filename to test for existence.
@return boolean representing whether or not the file exists
*/
virtual bool fileExists(const string& filename);
};
#endif