From 24050a1ce66d1b0d83cef1949e98b22c1f5977c6 Mon Sep 17 00:00:00 2001 From: stephena Date: Wed, 6 Feb 2002 00:59:36 +0000 Subject: [PATCH] Added '-pro' commandline argument to use an alternate stella.pro file to the X11 and SDL versions. This is only a commandline option and can't be specified in the stellarc file. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@41 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/ui/sdl/mainSDL.cxx | 27 ++++++++++++++++++++++++++- stella/src/ui/x11/mainX11.cxx | 27 ++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/stella/src/ui/sdl/mainSDL.cxx b/stella/src/ui/sdl/mainSDL.cxx index 2663b32c2..c9b05a63b 100644 --- a/stella/src/ui/sdl/mainSDL.cxx +++ b/stella/src/ui/sdl/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.7 2002-02-03 16:51:22 stephena Exp $ +// $Id: mainSDL.cxx,v 1.8 2002-02-06 00:59:36 stephena Exp $ //============================================================================ #include @@ -226,6 +226,9 @@ uInt32 theDesiredFrameRate = 60; // 4 - Use real Atari 2600 paddles uInt32 thePaddleMode = 0; +// An alternate properties file to use +string theAlternateProFile = ""; + /** This routine should be called once the console is created to setup @@ -1176,6 +1179,7 @@ void usage() " -ssdir The directory to save snapshot files to", " -ssname How to name the snapshot (romname or md5sum)", #endif + " -pro Use the given properties file instead of stella.pro", "", 0 }; @@ -1201,6 +1205,23 @@ bool setupProperties(PropertiesSet& set) homePropertiesFile += "/.stella.pro"; string systemPropertiesFile = "/etc/stella.pro"; + // Check to see if the user has specified an alternate .pro file. + // If it exists, use it. + if(theAlternateProFile != "") + { + if(access(theAlternateProFile.c_str(), R_OK) == 0) + { + set.load(theAlternateProFile, &Console::defaultProperties(), false); + return true; + } + else + { + cerr << "ERROR: Couldn't find \"" << theAlternateProFile << + "\" properties file." << endl; + return false; + } + } + if(access(homePropertiesFile.c_str(), R_OK) == 0) { set.load(homePropertiesFile, &Console::defaultProperties(), false); @@ -1308,6 +1329,10 @@ void handleCommandLineArguments(int argc, char* argv[]) theSnapShotName = argv[++i]; } #endif + else if(string(argv[i]) == "-pro") + { + theAlternateProFile = argv[++i]; + } else { cout << "Undefined option " << argv[i] << endl; diff --git a/stella/src/ui/x11/mainX11.cxx b/stella/src/ui/x11/mainX11.cxx index 92b898081..879dfa881 100644 --- a/stella/src/ui/x11/mainX11.cxx +++ b/stella/src/ui/x11/mainX11.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: mainX11.cxx,v 1.7 2002-02-03 16:51:22 stephena Exp $ +// $Id: mainX11.cxx,v 1.8 2002-02-06 00:59:36 stephena Exp $ //============================================================================ #include @@ -240,6 +240,9 @@ uInt32 theDesiredFrameRate = 60; // 4 - Use real Atari 2600 paddles uInt32 thePaddleMode = 0; +// An alternate properties file to use +string theAlternateProFile = ""; + /** This routine should be called once the console is created to setup the X11 connection and open a window for us to use. Return false if any @@ -1128,6 +1131,7 @@ void usage() " -ssdir The directory to save snapshot files to", " -ssname How to name the snapshot (romname or md5sum)", #endif + " -pro Use the given properties file instead of stella.pro", "", 0 }; @@ -1152,6 +1156,23 @@ bool setupProperties(PropertiesSet& set) homePropertiesFile += "/.stella.pro"; string systemPropertiesFile = "/etc/stella.pro"; + // Check to see if the user has specified an alternate .pro file. + // If it exists, use it. + if(theAlternateProFile != "") + { + if(access(theAlternateProFile.c_str(), R_OK) == 0) + { + set.load(theAlternateProFile, &Console::defaultProperties(), false); + return true; + } + else + { + cerr << "ERROR: Couldn't find \"" << theAlternateProFile << + "\" properties file." << endl; + return false; + } + } + if(access(homePropertiesFile.c_str(), R_OK) == 0) { set.load(homePropertiesFile, &Console::defaultProperties(), false); @@ -1266,6 +1287,10 @@ void handleCommandLineArguments(int argc, char* argv[]) theSnapShotName = argv[++i]; } #endif + else if(string(argv[i]) == "-pro") + { + theAlternateProFile = argv[++i]; + } else { cout << "Undefined option " << argv[i] << endl;