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
This commit is contained in:
stephena 2002-02-06 00:59:36 +00:00
parent 9fb178961d
commit 24050a1ce6
2 changed files with 52 additions and 2 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.7 2002-02-03 16:51:22 stephena Exp $
// $Id: mainSDL.cxx,v 1.8 2002-02-06 00:59:36 stephena Exp $
//============================================================================
#include <assert.h>
@ -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 <path> The directory to save snapshot files to",
" -ssname <name> How to name the snapshot (romname or md5sum)",
#endif
" -pro <props file> 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;

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: 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 <assert.h>
@ -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 <path> The directory to save snapshot files to",
" -ssname <name> How to name the snapshot (romname or md5sum)",
#endif
" -pro <props file> 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;