[Scummvm-cvs-logs] CVS: scummvm/base gameDetector.cpp,1.66,1.67 main.cpp,1.32,1.33
James Brown
ender at users.sourceforge.net
Sat Feb 7 06:15:02 CET 2004
Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5644/base
Modified Files:
gameDetector.cpp main.cpp
Log Message:
Add -c/--config option to specific alternate configuration file. Sorry Max, but it's damn useful for coverdiscs :)
Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- gameDetector.cpp 5 Feb 2004 13:54:54 -0000 1.66
+++ gameDetector.cpp 7 Feb 2004 04:53:59 -0000 1.67
@@ -48,6 +48,7 @@
" -z, --list-games Display list of supported games and exit\n"
" -t, --list-targets Display list of configured targets and exit\n"
"\n"
+ " -c, --config=CONFIG Use alternate configuration file\n"
" -p, --path=PATH Path to where the game is installed\n"
" -x, --save-slot[=NUM] Save game slot to load (default: autosave)\n"
" -f, --fullscreen Force full-screen mode\n"
@@ -284,6 +285,10 @@
cmdValue = (shortCmdLower == s[1]);
s += 2;
+ DO_OPTION('c', "config")
+ // Dummy
+ END_OPTION
+
DO_OPTION('b', "boot-param")
ConfMan.set("boot_param", (int)strtol(option, 0, 10), kTransientDomain);
END_OPTION
Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/main.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- main.cpp 26 Jan 2004 07:32:25 -0000 1.32
+++ main.cpp 7 Feb 2004 04:53:59 -0000 1.33
@@ -245,6 +245,7 @@
extern "C" int scummvm_main(GameDetector &detector, int argc, char *argv[]) {
#endif
OSystem::Property prop;
+ char *cfgFilename = NULL, *s=argv[1];
#if defined(UNIX)
/* On Unix, do a quick endian / alignement check before starting */
@@ -286,6 +287,28 @@
#endif //defined(WIN32) && defined(USE_CONSOLE)
+
+ // Quick preparse of command-line, looking for alt configfile path
+ for (int i = argc - 1; i >= 1; i--) {
+ s = argv[i];
+ bool shortOpt = (s[0] == '-' && tolower(s[1]) == 'c');
+ bool longOpt = (s[0] == '-' && s[1] == '-' && s[2] == 'c' && s[3] == 'o' \
+ && s[4] == 'n' && s[5] == 'f' && s[6] == 'i' && s[7] == 'g');
+
+ if (shortOpt || longOpt) {
+ if (longOpt) s+=9;
+ if (shortOpt) s+=2;
+
+ if (*s == '\0')
+ break;
+
+ cfgFilename = s;
+ break;
+ }
+ }
+ if (cfgFilename != NULL)
+ ConfMan.switchFile(cfgFilename);
+
// Update the config file
ConfMan.set("versioninfo", gScummVMVersion, Common::ConfigManager::kApplicationDomain);
More information about the Scummvm-git-logs
mailing list