The functionality of these files has been integrated into SettingsUNIX.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@184 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2003-09-20 13:41:37 +00:00
parent 63ea3d3e93
commit e25d504c02
3 changed files with 4 additions and 312 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.39 2003-09-19 15:45:01 stephena Exp $
## $Id: makefile,v 1.40 2003-09-20 13:41:36 stephena Exp $
##============================================================================
##============================================================================
@ -30,9 +30,9 @@ OPTIMIZATIONS = $(CXXFLAGS) -Wall -Wno-unused
### SDL sound not yet supported in the X11 version
### comment out all lines to completely disable sound
###
#SOUND_ALSA = 1
#SOUND_OSS = 1
#SOUND_SDL = 1
SOUND_ALSA = 1
SOUND_OSS = 1
SOUND_SDL = 1
### if your C++ compiler doesn't support the bool type
# BSPF_BOOL = 1

View File

@ -1,166 +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-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.3 2003-09-12 18:08:54 stephena Exp $
//============================================================================
#include <cstdlib>
#include <sstream>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "bspf.hxx"
#include "Console.hxx"
#include "FrontendUNIX.hxx"
#include "Settings.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrontendUNIX::FrontendUNIX()
: myPauseIndicator(false),
myQuitIndicator(false),
myConsole(0)
{
myHomeDir = getenv("HOME");
string path = myHomeDir + "/.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";
mySnapshotFile = "";
myStateFile = "";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrontendUNIX::~FrontendUNIX()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrontendUNIX::setConsole(Console* console)
{
myConsole = console;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrontendUNIX::setQuitEvent()
{
myQuitIndicator = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrontendUNIX::quit()
{
return myQuitIndicator;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrontendUNIX::setPauseEvent()
{
myPauseIndicator = !myPauseIndicator;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrontendUNIX::pause()
{
return myPauseIndicator;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FrontendUNIX::stateFilename(string& md5, uInt32 state)
{
ostringstream buf;
buf << myStateDir << md5 << ".st" << state;
myStateFile = buf.str();
return myStateFile;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FrontendUNIX::snapshotFilename()
{
if(!myConsole)
return "";
string path = myConsole->settings().theSnapshotDir;
string filename;
if(myConsole->settings().theSnapshotName == "romname")
path = path + "/" + myConsole->properties().get("Cartridge.Name");
else if(myConsole->settings().theSnapshotName == "md5sum")
path = path + "/" + myConsole->properties().get("Cartridge.MD5");
// Replace all spaces in name with underscores
replace(path.begin(), path.end(), ' ', '_');
// Check whether we want multiple snapshots created
if(myConsole->settings().theMultipleSnapshotFlag)
{
// Determine if the file already exists, checking each successive filename
// until one doesn't exist
filename = path + ".png";
if(access(filename.c_str(), F_OK) == 0 )
{
ostringstream buf;
for(uInt32 i = 1; ;++i)
{
buf.str("");
buf << path << "_" << i << ".png";
if(access(buf.str().c_str(), F_OK) == -1 )
break;
}
filename = buf.str();
}
}
else
filename = path + ".png";
mySnapshotFile = filename;
return mySnapshotFile;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FrontendUNIX::userPropertiesFilename()
{
return myHomePropertiesFile;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FrontendUNIX::systemPropertiesFilename()
{
return mySystemPropertiesFile;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FrontendUNIX::userConfigFilename()
{
return myHomeRCFile;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FrontendUNIX::systemConfigFilename()
{
return mySystemRCFile;
}

View File

@ -1,142 +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-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.4 2003-09-12 18:08:54 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.4 2003-09-12 18:08:54 stephena Exp $
*/
class FrontendUNIX : public Frontend
{
public:
/**
Create a new UNIX frontend
*/
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 setQuitEvent();
/**
Check whether a QUIT event has been received.
*/
virtual bool quit();
/**
Called when the emulation core receives a PAUSE event.
*/
virtual void setPauseEvent();
/**
Check whether a PAUSE event has been received.
*/
virtual bool pause();
/**
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 snapshot file.
@return The full path and filename of the snapshot file.
*/
virtual string snapshotFilename();
/**
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();
/**
Returns the filename representing the users home directory.
@return The full path and filename of the home directory.
*/
virtual string userHomeDir() { return myHomeDir; }
private:
bool myPauseIndicator;
bool myQuitIndicator;
string myHomeDir;
string myStateDir;
string mySnapshotFile;
string myStateFile;
string myHomePropertiesFile;
string mySystemPropertiesFile;
string myHomeRCFile;
string mySystemRCFile;
// The global Console object
Console* myConsole;
};
#endif