Yet more code reorganization in preparation for key remapping.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@176 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2003-09-05 18:02:58 +00:00
parent 3d45e5801e
commit 06a673592f
7 changed files with 406 additions and 6 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.31 2003-09-03 20:10:58 stephena Exp $
## $Id: makefile,v 1.32 2003-09-05 18:02:58 stephena Exp $
##============================================================================
##============================================================================
@ -265,7 +265,7 @@ CORE_OBJS = Booster.o Cart.o Cart2K.o Cart3F.o Cart4K.o CartAR.o CartDPC.o \
CartMB.o Console.o Control.o Driving.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 \
Serializer.o Deserializer.o TIASound.o EventHandler.o Frontend.o \
$(M6502_OBJS)
stella.exe: $(CORE_OBJS) $(OBJS)
@ -313,6 +313,9 @@ Event.o: $(CORE)/Event.cxx
EventHandler.o: $(CORE)/EventHandler.cxx $(CORE)/EventHandler.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/EventHandler.cxx
Frontend.o: $(CORE)/Frontend.cxx $(CORE)/Frontend.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Frontend.cxx
Control.o: $(CORE)/Control.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Control.cxx
@ -424,8 +427,8 @@ Serializer.o: $(CORE)/Serializer.cxx
Deserializer.o: $(CORE)/Deserializer.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Deserializer.cxx
Settings.o: $(UI)/common/Settings.cxx $(UI)/common/Settings.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(UI)/common/Settings.cxx
Settings.o: $(CORE)/Settings.cxx $(CORE)/Settings.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/Settings.cxx
Terminal.o: $(UI)/x11/Terminal.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(UI)/x11/Terminal.cxx

View File

@ -0,0 +1,43 @@
//============================================================================
//
// 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-1998 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: Frontend.cxx,v 1.1 2003-09-05 18:02:58 stephena Exp $
//============================================================================
#include <assert.h>
#include "Frontend.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Frontend::Frontend()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Frontend::~Frontend()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Frontend::Frontend(const Frontend&)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Frontend& Frontend::operator = (const Frontend&)
{
assert(false);
return *this;
}

View File

@ -0,0 +1,120 @@
//============================================================================
//
// 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-1998 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: Frontend.hxx,v 1.1 2003-09-05 18:02:58 stephena Exp $
//============================================================================
#ifndef FRONTEND_HXX
#define FRONTEND_HXX
class Console;
#include "bspf.hxx"
/**
This class provides an interface for accessing frontend specific data.
@author Stephen Anthony
@version $Id: Frontend.hxx,v 1.1 2003-09-05 18:02:58 stephena Exp $
*/
class Frontend
{
public:
/**
Create a new frontend
*/
Frontend();
/**
Destructor
*/
virtual ~Frontend();
public:
/**
This method should be called when the emulation core sets
the console object.
*/
virtual void setConsole(Console* console) = 0;
/**
This method should be called when the emulation core receives
a QUIT event.
*/
virtual void quit() = 0;
/**
This method should be called at when the emulation core receives
a PAUSE event.
*/
virtual void pause(bool status) = 0;
/**
This method should be called to get the filename of a state file
given the md5 and state number.
@return String representing the full path of the state filename.
*/
virtual string& stateFilename(string& md5, uInt32 state) = 0;
/**
This method should be called to get the filename of a snapshot
file given the md5 and state number.
@return String representing the full path of the snapshot filename.
*/
virtual string& snapshotFilename(string& md5, uInt32 state) = 0;
/**
This method should be called to get the filename of the users
properties (stella.pro) file.
@return String representing the full path of the user properties filename.
*/
virtual string& userPropertiesFilename() = 0;
/**
This method should be called to get the filename of the system
properties (stella.pro) file.
@return String representing the full path of the system properties filename.
*/
virtual string& systemPropertiesFilename() = 0;
/**
This method should be called to get the filename of the users
config (stellarc) file.
@return String representing the full path of the users config filename.
*/
virtual string& userConfigFilename() = 0;
/**
This method should be called to get the filename of the system
config (stellarc) file.
@return String representing the full path of the system config filename.
*/
virtual string& systemConfigFilename() = 0;
private:
// Copy constructor isn't supported by this class so make it private
Frontend(const Frontend&);
// Assignment operator isn't supported by this class so make it private
Frontend& operator = (const Frontend&);
};
#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.10 2003-09-04 16:50:48 stephena Exp $
// $Id: Settings.cxx,v 1.1 2003-09-05 18:02:58 stephena Exp $
//============================================================================
#include <fstream>

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.hxx,v 1.8 2003-09-04 16:50:48 stephena Exp $
// $Id: Settings.hxx,v 1.1 2003-09-05 18:02:58 stephena Exp $
//============================================================================
#ifndef SETTINGS_HXX

View File

@ -0,0 +1,103 @@
//============================================================================
//
// 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-2002 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: FrontendUNIX.cxx,v 1.1 2003-09-05 18:02:58 stephena Exp $
//============================================================================
#ifndef FRONTEND_UNIX_HXX
#define FRONTEND_UNIX_HXX
#include "bspf.hxx"
#include "Console.hxx"
#include "FrontendUNIX.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrontendUNIX::FrontendUNIX()
{
myHomeDir = getenv("HOME");
string path = homeDir + "/.stella";
if(access(path.c_str(), R_OK|W_OK|X_OK) != 0 )
mkdir(path.c_str(), 0777);
myStateDir = myHomeDir + "/.stella/state/";
if(access(myStateDir.c_str(), R_OK|W_OK|X_OK) != 0 )
mkdir(myStateDir.c_str(), 0777);
myHomePropertiesFile = myHomeDir + "/.stella/stella.pro";
mySystemPropertiesFile = "/etc/stella.pro";
myHomeRCFile = myHomeDir + "/.stella/stellarc";
mySystemRCFile = "/etc/stellarc";
mySnapshotFilename = "";
myStateFilename = "";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrontendUNIX::~FrontendUNIX()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrontendUNIX::setConsole(Console* console)
{
myConsole = console;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrontendUNIX::quit()
{
theQuitIndicator = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrontendUNIX::pause(bool status)
{
thePauseIndicator = status;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string& FrontendUNIX::stateFilename(string& md5, uInt32 state)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string& FrontendUNIX::snapshotFilename(string& md5, uInt32 state)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string& FrontendUNIX::userPropertiesFilename()
{
return myHomePropertiesFile;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string& FrontendUNIX::systemPropertiesFilename()
{
return mySystemPropertiesFile;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string& FrontendUNIX::userConfigFilename()
{
return myHomeRCFile;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string& FrontendUNIX::systemConfigFilename()
{
return mySystemRCFile;
}

View File

@ -0,0 +1,131 @@
//============================================================================
//
// 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-2002 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: FrontendUNIX.hxx,v 1.1 2003-09-05 18:02:58 stephena Exp $
//============================================================================
#ifndef FRONTEND_UNIX_HXX
#define FRONTEND_UNIX_HXX
class Console;
#include "bspf.hxx"
#include "Frontend.hxx"
/**
This class defines UNIX-like OS's (Linux) system specific file locations
and events.
@author Stephen Anthony
@version $Id: FrontendUNIX.hxx,v 1.1 2003-09-05 18:02:58 stephena Exp $
*/
class FrontendUNIX : public Frontend
{
public:
/**
Create a new UNIX frontend
// @param console The console the TIA is associated with
// @param sampleRate The sample rate to create audio samples at
*/
FrontendUNIX();
/**
Destructor
*/
virtual ~FrontendUNIX();
public:
/**
Let the frontend know about the console object
*/
virtual void setConsole(Console* console);
/**
Called when the emulation core receives a QUIT event.
*/
virtual void quit();
/**
Called when the emulation core receives a PAUSE event.
*/
virtual void pause(bool status);
/**
Returns the UNIX filename representing a state file.
@param md5 The md5 string to use as part of the filename.
@param state The state number to use as part of the filename.
@return The full path and filename of the state file.
*/
virtual string& stateFilename(string& md5, uInt32 state);
/**
Returns the UNIX filename representing a state file.
@param md5 The md5 string to use as part of the filename.
@param state The state number to use as part of the filename.
@return The full path and filename of the snapshot file.
*/
virtual string& snapshotFilename(string& md5, uInt32 state);
/**
Returns the UNIX filename representing a users properties file.
@return The full path and filename of the user properties file.
*/
virtual string& userPropertiesFilename();
/**
Returns the UNIX filename representing a system properties file.
@return The full path and filename of the system properties file.
*/
virtual string& systemPropertiesFilename();
/**
Returns the UNIX filename representing a users config file.
@return The full path and filename of the user config file.
*/
virtual string& userConfigFilename();
/**
Returns the UNIX filename representing a system config file.
@return The full path and filename of the system config file.
*/
virtual string& systemConfigFilename();
public:
bool theQuitIndicator;
bool thePauseIndicator
private:
string myHomeDir;
string myStateDir;
string mySnapshotFile;
string myStateFile;
string myHomePropertiesFile;
string mySystemPropertiesFile;
string myHomeRCFile;
string mySystemRCFile;
// The global Console object
Console* myConsole;
};
#endif