diff --git a/stella/src/common/mainSDL.cxx b/stella/src/common/mainSDL.cxx index 23f477cd3..0fe5d2a7b 100644 --- a/stella/src/common/mainSDL.cxx +++ b/stella/src/common/mainSDL.cxx @@ -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 @@ -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")) diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index a91345cd1..0cc42c856 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.cxx @@ -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 @@ -2122,7 +2122,7 @@ void EventHandler::setEventState(State state) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EventHandler::saveProperties() { - myOSystem->console().saveProperties(myOSystem->userProperties(), true); + myOSystem->console().saveProperties(myOSystem->propertiesFile(), true); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/OSystem.cxx b/stella/src/emucore/OSystem.cxx index a9ba3ae53..0f7a633a3 100644 --- a/stella/src/emucore/OSystem.cxx +++ b/stella/src/emucore/OSystem.cxx @@ -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 @@ -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; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/OSystem.hxx b/stella/src/emucore/OSystem.hxx index cdc8f9ba3..345c9682d 100644 --- a/stella/src/emucore/OSystem.hxx +++ b/stella/src/emucore/OSystem.hxx @@ -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; diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index 581f74276..378f13df8 100644 --- a/stella/src/emucore/Settings.cxx +++ b/stella/src/emucore/Settings.cxx @@ -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 @@ -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"; diff --git a/stella/src/gp2x/OSystemGP2X.cxx b/stella/src/gp2x/OSystemGP2X.cxx index 006db8223..72f1cc35a 100644 --- a/stella/src/gp2x/OSystemGP2X.cxx +++ b/stella/src/gp2x/OSystemGP2X.cxx @@ -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. diff --git a/stella/src/macosx/OSystemMACOSX.cxx b/stella/src/macosx/OSystemMACOSX.cxx index eb20a2533..cfb66951b 100644 --- a/stella/src/macosx/OSystemMACOSX.cxx +++ b/stella/src/macosx/OSystemMACOSX.cxx @@ -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 @@ -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"); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/unix/OSystemUNIX.cxx b/stella/src/unix/OSystemUNIX.cxx index 7dfb59eef..3706c7339 100644 --- a/stella/src/unix/OSystemUNIX.cxx +++ b/stella/src/unix/OSystemUNIX.cxx @@ -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 @@ -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"); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/win32/OSystemWin32.cxx b/stella/src/win32/OSystemWin32.cxx index 15a007678..6b771d97d 100644 --- a/stella/src/win32/OSystemWin32.cxx +++ b/stella/src/win32/OSystemWin32.cxx @@ -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 @@ -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"); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/wince/OSystemWinCE.cxx b/stella/src/wince/OSystemWinCE.cxx index b6f059040..ba46cc7de 100644 --- a/stella/src/wince/OSystemWinCE.cxx +++ b/stella/src/wince/OSystemWinCE.cxx @@ -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(); -} \ No newline at end of file +}