Removed all reference to 'user.pro', in favour of the previous (to v/2.0)

functionality.  The new scheme is as follows:
 -  Per-user properties are stored in stella.pro, which is located in
    system-specific directories (homedir for UNIX/POSIX systems, currentdir
    for Win32 systems).
 -  Completely removed concept of a global properties file, since that
    functionality is now included in Stella directly.
 -  Retained the ability to use an alternative properties file, in which
    case the per-user one isn't used at all, and any entries in it override
    the built-in defaults.

Removed all reference to 'system' vs. 'user' config files, for much the
same reasons as above.  As above, config files are stored in
user-specific places depending on platform.  There is no longer a
system-wide config file.  This made sense when Stella didn't have built-in
defaults and relied on such a file, but that's no longer the case.

Sorry for any confusion this causes, but it was causing even more confusion
for users.  And now we can distribute Stella has a single binary which
doesn't depend on any external files (but will still use them if they're
present).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1050 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-03-17 19:44:19 +00:00
parent dfd7faf454
commit a6ad33c40b
10 changed files with 76 additions and 169 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: mainSDL.cxx,v 1.62 2006-03-06 03:22:32 stephena Exp $
// $Id: mainSDL.cxx,v 1.63 2006-03-17 19:44:16 stephena Exp $
//============================================================================
#include <sstream>
@ -68,7 +68,7 @@ static void SetupProperties(PropertiesSet& set);
static void Cleanup();
// Pointer to the main parent osystem object or the null pointer
OSystem* theOSystem = (OSystem*) NULL;
static OSystem* theOSystem = (OSystem*) NULL;
/**
@ -88,17 +88,14 @@ void SetupProperties(PropertiesSet& set)
string altpro = theOSystem->settings().getString("pro");
if(altpro != "")
{
buf << "Game properties: \'" << altpro << "\'\n";
set.load(altpro, false); // don't save alternate properties to userPro
buf << "User game properties: \'" << altpro << "\'\n";
set.load(altpro, false); // don't save alternate properties
}
else
{
const string& sysPro = theOSystem->systemProperties();
const string& userPro = theOSystem->userProperties();
buf << "Game properties: \'" << sysPro << "\', \'" << userPro << "\'\n";
set.load(sysPro, false); // don't save system-wide properties
set.load(userPro, true);
const string& props = theOSystem->propertiesFile();
buf << "User game properties: \'" << props << "\'\n";
set.load(props, true); // do save these properties
}
if(theOSystem->settings().getBool("showinfo"))

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.cxx,v 1.153 2006-03-15 23:14:01 stephena Exp $
// $Id: EventHandler.cxx,v 1.154 2006-03-17 19:44:18 stephena Exp $
//============================================================================
#include <sstream>
@ -2122,7 +2122,7 @@ void EventHandler::setEventState(State state)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::saveProperties()
{
myOSystem->console().saveProperties(myOSystem->userProperties(), true);
myOSystem->console().saveProperties(myOSystem->propertiesFile(), true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: OSystem.cxx,v 1.63 2006-03-05 01:18:42 stephena Exp $
// $Id: OSystem.cxx,v 1.64 2006-03-17 19:44:18 stephena Exp $
//============================================================================
#include <cassert>
@ -152,33 +152,15 @@ void OSystem::setStateDir(const string& statedir)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setPropertiesDir(const string& userpath,
const string& systempath)
void OSystem::setPropertiesDir(const string& path)
{
// Set up the input and output properties files
myUserPropertiesFile = userpath + BSPF_PATH_SEPARATOR + "user.pro";
#ifdef NIGHTLY_BUILD
// snapshots look in current dir
mySystemPropertiesFile = "stella.pro";
#else
// releases look in system dir
mySystemPropertiesFile = systempath + BSPF_PATH_SEPARATOR + "stella.pro";
#endif
myPropertiesFile = path + BSPF_PATH_SEPARATOR + "stella.pro";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setConfigFiles(const string& userconfig,
const string& systemconfig)
void OSystem::setConfigFile(const string& file)
{
// Set up the names of the input and output config files
myConfigOutputFile = userconfig;
if(FilesystemNode::fileExists(userconfig))
myConfigInputFile = userconfig;
else if(FilesystemNode::fileExists(systemconfig))
myConfigInputFile = systemconfig;
else
myConfigInputFile = "";
myConfigFile = file;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: OSystem.hxx,v 1.39 2006-03-02 13:10:53 stephena Exp $
// $Id: OSystem.hxx,v 1.40 2006-03-17 19:44:18 stephena Exp $
//============================================================================
#ifndef OSYSTEM_HXX
@ -44,7 +44,7 @@ class CheatManager;
other objects belong.
@author Stephen Anthony
@version $Id: OSystem.hxx,v 1.39 2006-03-02 13:10:53 stephena Exp $
@version $Id: OSystem.hxx,v 1.40 2006-03-17 19:44:18 stephena Exp $
*/
class OSystem
{
@ -201,57 +201,48 @@ class OSystem
@return The video framerate currently in use
*/
uInt32 frameRate() { return myDisplayFrameRate; }
uInt32 frameRate() const { return myDisplayFrameRate; }
/**
Return the default directory for storing data.
*/
const string& baseDir() { return myBaseDir; }
const string& baseDir() const { return myBaseDir; }
/**
Return the directory for storing state files.
*/
const string& stateDir() { return myStateDir; }
const string& stateDir() const { return myStateDir; }
/**
This method should be called to get the filename of the
system-wide properties file (stella.pro).
@return String representing the full path of the properties filename.
*/
const string& systemProperties() { return mySystemPropertiesFile; }
/**
This method should be called to get the filename of the
user-specific properties file (user.pro).
@return String representing the full path of the properties filename.
*/
const string& userProperties() { return myUserPropertiesFile; }
/**
This method should be called to get the filename of the config file
for the purpose of loading.
This method should be called to get the full path of the config file.
@return String representing the full path of the config filename.
*/
const string& configInputFilename() { return myConfigInputFile; }
const string& configFile() const { return myConfigFile; }
/**
This method should be called to get the filename of the config file
for the purpose of saving.
This method should be called to get the full path of the
properties file (stella.pro).
@return String representing the full path of the config filename.
@return String representing the full path of the properties filename.
*/
const string& configOutputFilename() { return myConfigOutputFile; }
const string& propertiesFile() const { return myPropertiesFile; }
/**
This method should be called to get the filename of the gamelist
This method should be called to get the full path of the gamelist
cache file (used by the Launcher to show a listing of available games).
@return String representing the full path of the gamelist cache file.
*/
const string& cacheFile() { return myGameListCacheFile; }
const string& cacheFile() const { return myGameListCacheFile; }
/**
This method should be called to get the full path of the currently
loaded ROM.
@return String representing the full path of the ROM file.
*/
const string& romFile() const { return myRomFile; }
/**
Creates the various framebuffers/renderers available in this system
@ -290,7 +281,7 @@ class OSystem
@return The supported features
*/
const string& features() { return myFeatures; }
const string& features() const { return myFeatures; }
/**
Open the given ROM and return an array containing its contents.
@ -304,8 +295,6 @@ class OSystem
*/
bool openROM(const string& rom, string& md5, uInt8** image, int* size);
const string& romFile() { return myRomFile; }
public:
//////////////////////////////////////////////////////////////////////
// The following methods are system-specific and must be implemented
@ -376,14 +365,14 @@ class OSystem
void setStateDir(const string& statedir);
/**
Set the locations of game properties files
Set the locations of game properties file
*/
void setPropertiesDir(const string& userpath, const string& systempath);
void setPropertiesDir(const string& path);
/**
Set the locations of config files
Set the locations of config file
*/
void setConfigFiles(const string& userconfig, const string& systemconfig);
void setConfigFile(const string& file);
/**
Set the location of the gamelist cache file
@ -434,10 +423,8 @@ class OSystem
string myBaseDir;
string myStateDir;
string mySystemPropertiesFile;
string myUserPropertiesFile;
string myConfigInputFile;
string myConfigOutputFile;
string myConfigFile;
string myPropertiesFile;
string myGameListCacheFile;
string myRomFile;

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.80 2006-03-09 17:04:01 stephena Exp $
// $Id: Settings.cxx,v 1.81 2006-03-17 19:44:18 stephena Exp $
//============================================================================
#include <cassert>
@ -94,12 +94,7 @@ void Settings::loadConfig()
string line, key, value;
string::size_type equalPos, garbage;
// FIXME - add infrastructure to print output
#ifdef PSP_DEBUG
fprintf(stdout,"Settings::loadConfig '%s'\n",myOSystem->configInputFilename().c_str());
#endif
ifstream in(myOSystem->configInputFilename().c_str());
ifstream in(myOSystem->configFile().c_str());
if(!in || !in.is_open())
{
cout << "Error: Couldn't load settings file\n";
@ -380,7 +375,7 @@ void Settings::saveConfig()
if(!settingsChanged)
return;
ofstream out(myOSystem->configOutputFilename().c_str());
ofstream out(myOSystem->configFile().c_str());
if(!out || !out.is_open())
{
cout << "Error: Couldn't save settings file\n";

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: OSystemGP2X.cxx,v 1.8 2006-03-06 14:06:07 stephena Exp $
// $Id: OSystemGP2X.cxx,v 1.9 2006-03-17 19:44:18 stephena Exp $
// Modified on 2006/01/06 by Alex Zaballa for use on GP2X
//============================================================================
@ -41,13 +41,9 @@
setBaseDir()
setStateDir()
setPropertiesDir()
setConfigFiles()
setConfigFile()
setCacheFile()
And for initializing the following variables:
myDriverList (a StringList)
See OSystem.hxx for a further explanation
*/
@ -61,23 +57,14 @@ OSystemGP2X::OSystemGP2X()
free(currdir);
setBaseDir(basedir);
string statedir = basedir + "/state";
setStateDir(statedir);
setStateDir(basedir + "/state");
setPropertiesDir(basedir, basedir);
setPropertiesDir(basedir);
setConfigFile(basedir + "/stellarc");
string userPropertiesFile = basedir + "/user.pro";
string systemPropertiesFile = basedir + "/stella.pro";
setConfigFiles(userPropertiesFile, systemPropertiesFile);
setCacheFile(basedir + "/stella.cache");
string userConfigFile = basedir + "/stellarc";
string systemConfigFile = statedir + "/stellarc";
setConfigFiles(userConfigFile, systemConfigFile);
string cacheFile = basedir + "/stella.cache";
setCacheFile(cacheFile);
// Set hat event handler to a known state
// Set event arrays to a known state
myPreviousEvents = new uInt8[8]; memset(myPreviousEvents, 0, 8);
myCurrentEvents = new uInt8[8]; memset(myCurrentEvents, 0, 8);
}
@ -123,22 +110,6 @@ void OSystemGP2X::mainLoop()
frameTime += currentTime;
++numberOfFrames;
}
// Only print console information if a console was actually created
if(mySettings->getBool("showinfo") && myConsole)
{
double executionTime = (double) frameTime / 1000000.0;
double framesPerSecond = (double) numberOfFrames / executionTime;
cout << endl;
cout << numberOfFrames << " total frames drawn\n";
cout << framesPerSecond << " frames/second\n";
cout << endl;
cout << "Cartridge Name: " << myConsole->properties().get(Cartridge_Name);
cout << endl;
cout << "Cartridge MD5: " << myConsole->properties().get(Cartridge_MD5);
cout << endl << endl;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -181,7 +152,7 @@ void OSystemGP2X::setDefaultJoymap()
void OSystemGP2X::pollEvent()
{
// Translate joystick button events that act as directions into proper
// SDL HAT events. This method will use 'case 2', as discussed on the
// SDL axis events. This method will use 'case 2', as discussed on the
// GP2X forums. Technically, this code should be integrated directly
// into the GP2X SDL port.

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: OSystemMACOSX.cxx,v 1.7 2006-01-08 02:28:04 stephena Exp $
// $Id: OSystemMACOSX.cxx,v 1.8 2006-03-17 19:44:19 stephena Exp $
//============================================================================
#include <cstdlib>
@ -59,7 +59,7 @@ void macOpenConsole(char *romname)
setBaseDir()
setStateDir()
setPropertiesFiles()
setConfigFiles()
setConfigFile()
setCacheFile()
See OSystem.hxx for a further explanation
@ -72,19 +72,12 @@ OSystemMACOSX::OSystemMACOSX()
string basedir = string(getenv("HOME")) + "/.stella";
setBaseDir(basedir);
string statedir = basedir + "/state";
setStateDir(statedir);
setStateDir(basedir + "/state");
strcat(parentdir,"/../../..");
string systemPropertiesDir = parentdir;
setPropertiesDir(basedir, systemPropertiesDir);
setPropertiesDir(basedir);
setConfigFile(basedir + "/stellarc");
string userConfigFile = basedir + "/stellarc";
string systemConfigFile = "/etc/stellarc";
setConfigFiles(userConfigFile, systemConfigFile);
string cacheFile = basedir + "/stella.cache";
setCacheFile(cacheFile);
setCacheFile(basedir + "/stella.cache");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: OSystemUNIX.cxx,v 1.16 2006-03-05 01:18:42 stephena Exp $
// $Id: OSystemUNIX.cxx,v 1.17 2006-03-17 19:44:19 stephena Exp $
//============================================================================
#include <SDL.h>
@ -43,7 +43,7 @@
setBaseDir()
setStateDir()
setPropertiesDir()
setConfigFiles()
setConfigFile()
setCacheFile()
See OSystem.hxx for a further explanation
@ -56,18 +56,12 @@ OSystemUNIX::OSystemUNIX()
string basedir = string(getenv("HOME")) + "/.stella";
setBaseDir(basedir);
string statedir = basedir + "/state";
setStateDir(statedir);
setStateDir(basedir + "/state");
string propdir = PROPDIR; // Hopefully this is defined
setPropertiesDir(basedir, propdir);
setPropertiesDir(basedir);
setConfigFile(basedir + "/stellarc");
string userConfigFile = basedir + "/stellarc";
string systemConfigFile = propdir + "/stellarc";
setConfigFiles(userConfigFile, systemConfigFile);
string cacheFile = basedir + "/stella.cache";
setCacheFile(cacheFile);
setCacheFile(basedir + "/stella.cache");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: OSystemWin32.cxx,v 1.11 2006-03-06 21:41:58 stephena Exp $
// $Id: OSystemWin32.cxx,v 1.12 2006-03-17 19:44:19 stephena Exp $
//============================================================================
#include <sstream>
@ -31,13 +31,9 @@
setBaseDir()
setStateDir()
setPropertiesDir()
setConfigFiles()
setConfigFile()
setCacheFile()
And for initializing the following variables:
myDriverList (a StringList)
See OSystem.hxx for a further explanation
*/
@ -53,16 +49,12 @@ OSystemWin32::OSystemWin32()
string basedir = ".\\";
setBaseDir(basedir);
string stateDir = basedir + "state\\";
setStateDir(stateDir);
setStateDir(basedir + "state\\");
setPropertiesDir(basedir, basedir);
setPropertiesDir(basedir);
setConfigFile(basedir + "stella.ini");
string configFile = basedir + "stella.ini";
setConfigFiles(configFile, configFile); // Input and output are the same
string cacheFile = basedir + "stella.cache";
setCacheFile(cacheFile);
setCacheFile(basedir + "stella.cache");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -36,16 +36,12 @@ OSystemWinCE::OSystemWinCE()
string basedir = ((string) getcwd()) + '\\';
setBaseDir(basedir);
string stateDir = basedir;
setStateDir(stateDir);
setStateDir(basedir);
setPropertiesDir(basedir, basedir);
setPropertiesDir(basedir);
setConfigFile(basedir + "stella.ini");
string configFile = basedir + "stella.ini";
setConfigFiles(configFile, configFile); // Input and output are the same
string cacheFile = basedir + "stella.cache";
setCacheFile(cacheFile);
setCacheFile(basedir + "stella.cache");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -169,4 +165,4 @@ inline const GUI::Font& OSystemWinCE::font() const
return consoleFont();
else
return OSystem::font();
}
}