[Scummvm-cvs-logs] SF.net SVN: scummvm:[33484] residual/trunk

aquadran at users.sourceforge.net aquadran at users.sourceforge.net
Fri Aug 1 00:01:35 CEST 2008


Revision: 33484
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33484&view=rev
Author:   aquadran
Date:     2008-07-31 22:01:31 +0000 (Thu, 31 Jul 2008)

Log Message:
-----------
moved into config manager

Modified Paths:
--------------
    residual/trunk/README
    residual/trunk/common/config-file.cpp
    residual/trunk/common/config-manager.cpp
    residual/trunk/common/sys.h
    residual/trunk/common/util.h
    residual/trunk/dists/msvc7/residual.vcproj
    residual/trunk/dists/msvc71/residual.vcproj
    residual/trunk/dists/msvc8/residual.vcproj
    residual/trunk/dists/msvc9/residual.vcproj
    residual/trunk/dists/residual.ini.example
    residual/trunk/engine/localize.cpp
    residual/trunk/engine/lua.cpp
    residual/trunk/engine/main.cpp
    residual/trunk/engine/module.mk
    residual/trunk/engine/registry.cpp
    residual/trunk/engine/registry.h
    residual/trunk/engine/resource.cpp

Added Paths:
-----------
    residual/trunk/engine/cmd_line.cpp
    residual/trunk/engine/cmd_line.h

Modified: residual/trunk/README
===================================================================
--- residual/trunk/README	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/README	2008-07-31 22:01:31 UTC (rev 33484)
@@ -63,9 +63,11 @@
         residual.ini in the current directory
 
 An example config file looks as follows:
+	[residual]
 
-       DataDir=[path to all the .lab files]
-       good_times=TRUE
+	[grim]
+	path=[path to all the .lab files]
+	game_devel_mode=TRUE
 
 It runs really slow when using -zbuffer!
 ----------------------------------------

Modified: residual/trunk/common/config-file.cpp
===================================================================
--- residual/trunk/common/config-file.cpp	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/common/config-file.cpp	2008-07-31 22:01:31 UTC (rev 33484)
@@ -203,7 +203,12 @@
 		stream.writeByte('[');
 		stream.writeString(i->name);
 		stream.writeByte(']');
+#ifdef _WIN32
+		stream.writeByte(0x0d);
+		stream.writeByte(0x0a);
+#else
 		stream.writeByte('\n');
+#endif
 
 		// Write out the key/value pairs
 		for (List<KeyValue>::iterator kv = i->keys.begin(); kv != i->keys.end(); ++kv) {
@@ -215,7 +220,12 @@
 			stream.writeString(kv->key);
 			stream.writeByte('=');
 			stream.writeString(kv->value);
+#ifdef _WIN32
+			stream.writeByte(0x0d);
+			stream.writeByte(0x0a);
+#else
 			stream.writeByte('\n');
+#endif
 		}
 	}
 

Modified: residual/trunk/common/config-manager.cpp
===================================================================
--- residual/trunk/common/config-manager.cpp	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/common/config-manager.cpp	2008-07-31 22:01:31 UTC (rev 33484)
@@ -32,7 +32,6 @@
 #include "common/config-manager.h"
 #include "common/file.h"
 #include "common/util.h"
-#include "common/debug.h"
 
 DECLARE_SINGLETON(Common::ConfigManager);
 
@@ -173,7 +172,11 @@
 
 			// Read a line
 			String line;
+#ifdef _WIN32
+			while (line.lastChar() != 0x0a) {
+#else
 			while (line.lastChar() != '\n') {
+#endif
 				char buf[MAXLINELEN];
 				if (!cfg_file.readLine_NEW(buf, MAXLINELEN))
 					break;
@@ -324,7 +327,12 @@
 	stream.writeByte('[');
 	stream.writeString(name);
 	stream.writeByte(']');
+#ifdef _WIN32
+	stream.writeByte(0x0d);
+	stream.writeByte(0x0a);
+#else
 	stream.writeByte('\n');
+#endif
 
 	// Write all key/value pairs in this domain, including comments
 	Domain::const_iterator x;
@@ -339,10 +347,20 @@
 			stream.writeString(x->_key);
 			stream.writeByte('=');
 			stream.writeString(x->_value);
+#ifdef _WIN32
+			stream.writeByte(0x0d);
+			stream.writeByte(0x0a);
+#else
 			stream.writeByte('\n');
+#endif
 		}
 	}
+#ifdef _WIN32
+	stream.writeByte(0x0d);
+	stream.writeByte(0x0a);
+#else
 	stream.writeByte('\n');
+#endif
 }
 
 

Modified: residual/trunk/common/sys.h
===================================================================
--- residual/trunk/common/sys.h	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/common/sys.h	2008-07-31 22:01:31 UTC (rev 33484)
@@ -249,6 +249,18 @@
 #endif
 
 //
+// GCC specific stuff
+//
+#if defined(__GNUC__)
+	#define NORETURN __attribute__((__noreturn__))
+	#define PACKED_STRUCT __attribute__((packed))
+	#define GCC_PRINTF(x, y) __attribute__((format(printf, x, y)))
+#else
+	#define PACKED_STRUCT
+	#define GCC_PRINTF(x, y)
+#endif
+
+//
 // Fallbacks / default values for various special macros
 //
 #ifndef FORCEINLINE

Modified: residual/trunk/common/util.h
===================================================================
--- residual/trunk/common/util.h	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/common/util.h	2008-07-31 22:01:31 UTC (rev 33484)
@@ -28,6 +28,10 @@
 #include "common/sys.h"
 #include "common/debug.h"
 
+#if defined(WIN32)
+#include <windows.h>
+#endif
+
 #ifdef MIN
 #undef MIN
 #endif

Modified: residual/trunk/dists/msvc7/residual.vcproj
===================================================================
--- residual/trunk/dists/msvc7/residual.vcproj	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/dists/msvc7/residual.vcproj	2008-07-31 22:01:31 UTC (rev 33484)
@@ -253,6 +253,12 @@
 				RelativePath="..\..\engine\bitmap.h">
 			</File>
 			<File
+				RelativePath="..\..\engine\cmd_line.cpp">
+			</File>
+			<File
+				RelativePath="..\..\engine\cmd_line.h">
+			</File>
+			<File
 				RelativePath="..\..\engine\color.h">
 			</File>
 			<File

Modified: residual/trunk/dists/msvc71/residual.vcproj
===================================================================
--- residual/trunk/dists/msvc71/residual.vcproj	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/dists/msvc71/residual.vcproj	2008-07-31 22:01:31 UTC (rev 33484)
@@ -267,6 +267,12 @@
 				RelativePath="..\..\engine\bitmap.h">
 			</File>
 			<File
+				RelativePath="..\..\engine\cmd_line.cpp">
+			</File>
+			<File
+				RelativePath="..\..\engine\cmd_line.h">
+			</File>
+			<File
 				RelativePath="..\..\engine\color.h">
 			</File>
 			<File

Modified: residual/trunk/dists/msvc8/residual.vcproj
===================================================================
--- residual/trunk/dists/msvc8/residual.vcproj	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/dists/msvc8/residual.vcproj	2008-07-31 22:01:31 UTC (rev 33484)
@@ -376,6 +376,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\engine\cmd_line.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\engine\cmd_line.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\engine\color.h"
 				>
 			</File>

Modified: residual/trunk/dists/msvc9/residual.vcproj
===================================================================
--- residual/trunk/dists/msvc9/residual.vcproj	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/dists/msvc9/residual.vcproj	2008-07-31 22:01:31 UTC (rev 33484)
@@ -381,6 +381,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\engine\cmd_line.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\engine\cmd_line.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\engine\color.h"
 				>
 			</File>

Modified: residual/trunk/dists/residual.ini.example
===================================================================
--- residual/trunk/dists/residual.ini.example	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/dists/residual.ini.example	2008-07-31 22:01:31 UTC (rev 33484)
@@ -1,2 +1,6 @@
-DataDir=C:\Games\Grim
-good_times=TRUE
+[residual]
+
+[grim]
+path=C:\Games\Grim
+show_fps=TRUE
+game_devel_mode=TRUE

Added: residual/trunk/engine/cmd_line.cpp
===================================================================
--- residual/trunk/engine/cmd_line.cpp	                        (rev 0)
+++ residual/trunk/engine/cmd_line.cpp	2008-07-31 22:01:31 UTC (rev 33484)
@@ -0,0 +1,453 @@
+/* Residual - Virtual machine to run LucasArts' 3D adventure games
+ *
+ * Residual is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the AUTHORS
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/config-manager.h"
+#include "common/sys.h"
+#include "common/fs.h"
+
+#include "engine/cmd_line.h"
+#include "engine/version.h"
+#include "engine/backend/platform/driver.h"
+
+#ifdef IPHONE
+#include "engine/backend/platform/iphone/osys_iphone.h"
+#endif
+
+#ifdef UNIX
+#ifdef MACOSX
+#define DEFAULT_SAVE_PATH "Documents/Residual Savegames"
+#else
+#define DEFAULT_SAVE_PATH ".residual"
+#endif
+#elif defined(__SYMBIAN32__)
+#define DEFAULT_SAVE_PATH "Residual"
+#elif defined(PALMOS_MODE)
+#define DEFAULT_SAVE_PATH "/PALM/Programs/Residual/Saved"
+#endif
+
+#define DETECTOR_TESTING_HACK
+
+static const char USAGE_STRING[] =
+	"%s: %s\n"
+	"Usage: %s [OPTIONS]... [GAME]\n"
+	"\n"
+	"Try '%s --help' for more options.\n"
+;
+
+// DONT FIXME: DO NOT ORDER ALPHABETICALLY, THIS IS ORDERED BY IMPORTANCE/CATEGORY! :)
+#if defined(PALMOS_MODE) || defined(__SYMBIAN32__) || defined(__GP32__)
+static const char HELP_STRING[] = "NoUsageString"; // save more data segment space
+#else
+static const char HELP_STRING[] =
+	"Residual - Virtual machine to run LucasArts' 3D adventure games\n"
+	"Usage: %s [OPTIONS]... [GAME]\n"
+	"  -v, --version            Display Residual version information and exit\n"
+	"  -h, --help               Display a brief help text and exit\n"
+	"  -z, --list-games         Display list of supported games and exit\n"
+
+	"\n"
+	"  -c, --config=CONFIG      Use alternate configuration file\n"
+	"  -p, --path=PATH          Path to where the game is installed\n"
+	"  -f, --fullscreen         Force full-screen mode\n"
+	"  -F, --no-fullscreen      Force windowed mode\n"
+	"  -m, --music-volume=NUM   Set the music volume, 0-255 (default: 192)\n"
+	"  -s, --sfx-volume=NUM     Set the sfx volume, 0-255 (default: 192)\n"
+	"  -r, --speech-volume=NUM  Set the speech volume, 0-255 (default: 192)\n"
+	"  -b, --boot-param=NUM     Pass number to the boot script (boot param)\n"
+	"  -d, --debuglevel=NUM     Set debug verbosity level\n"
+	"  --debugflags=FLAGS       Enables engine specific debug flags\n"
+	"                           (separated by commas)\n"
+	"\n"
+	"  --savepath=PATH          Path to where savegames are stored\n"
+	"  --extrapath=PATH         Extra path to additional game data\n"
+	"  --output-rate=RATE       Select output sample rate in Hz (e.g. 22050)\n"
+	"\n"
+	"  --textspeed=NUM          Set talk speed for games (default: 7)\n"
+	"\n"
+;
+#endif
+
+static const char *s_appName = "residual";
+
+static void usage(const char *s, ...) GCC_PRINTF(1, 2);
+
+static void usage(const char *s, ...) {
+	char buf[STRINGBUFLEN];
+	va_list va;
+
+	va_start(va, s);
+	vsnprintf(buf, STRINGBUFLEN, s, va);
+	va_end(va);
+
+#if !(defined(__GP32__) || defined (__SYMBIAN32__))
+	printf(USAGE_STRING, s_appName, buf, s_appName, s_appName);
+#endif
+	exit(1);
+}
+
+void registerDefaults() {
+	// Sound & Music
+	ConfMan.registerDefault("music_volume", 127);
+	ConfMan.registerDefault("sfx_volume", 127);
+	ConfMan.registerDefault("speech_volume", 127);
+
+	// Game specific
+	ConfMan.registerDefault("path", ".");
+	ConfMan.registerDefault("savepath", "");
+
+	ConfMan.registerDefault("boot_param", "0");
+	ConfMan.registerDefault("text_speed", "7");
+	ConfMan.registerDefault("speech_mode", "3");
+	ConfMan.registerDefault("transcript", "TRUE");
+	ConfMan.registerDefault("game_devel_mode", "TRUE");
+	ConfMan.registerDefault("joystick", "TRUE");
+	ConfMan.registerDefault("movement", "Character");
+
+	// Miscellaneous
+	ConfMan.registerDefault("disable_sdl_parachute", false);
+	ConfMan.registerDefault("show_fps", "TRUE");
+	ConfMan.registerDefault("gl_zbuffer", "TRUE");
+	ConfMan.registerDefault("soft_renderer", "TRUE");
+	ConfMan.registerDefault("fullscreen", "FALSE");
+
+	// Register default savepath
+#ifdef DEFAULT_SAVE_PATH
+	char savePath[MAXPATHLEN];
+#if defined(UNIX) && !defined(IPHONE)
+	const char *home = getenv("HOME");
+	if (home && *home && strlen(home) < MAXPATHLEN) {
+		snprintf(savePath, MAXPATHLEN, "%s/%s", home, DEFAULT_SAVE_PATH);
+		ConfMan.registerDefault("savepath", savePath);
+	}
+#elif defined(__SYMBIAN32__)
+	strcpy(savePath, Symbian::GetExecutablePath());
+	strcat(savePath, DEFAULT_SAVE_PATH);
+	ConfMan.registerDefault("savepath", savePath);
+#elif defined (IPHONE)
+	ConfMan.registerDefault("savepath", OSystem_IPHONE::getSavePath());
+
+#elif defined(PALMOS_MODE)
+	ConfMan.registerDefault("savepath", DEFAULT_SAVE_PATH);
+#endif
+#endif // #ifdef DEFAULT_SAVE_PATH
+
+	ConfMan.registerDefault("record_mode", "none");
+	ConfMan.registerDefault("record_file_name", "record.bin");
+	ConfMan.registerDefault("record_temp_file_name", "record.tmp");
+	ConfMan.registerDefault("record_time_file_name", "record.time");
+}
+
+//
+// Various macros used by the command line parser.
+//
+
+// Use this for options which have an *optional* value
+#define DO_OPTION_OPT(shortCmd, longCmd, defaultVal) \
+	if (isLongCmd ? (!strcmp(s+2, longCmd) || !memcmp(s+2, longCmd"=", sizeof(longCmd"=") - 1)) : (tolower(s[1]) == shortCmd)) { \
+		s += 2; \
+		if (isLongCmd) { \
+			s += sizeof(longCmd) - 1; \
+			if (*s == '=') \
+				s++; \
+		} \
+		const char *option = s; \
+		if (*s == '\0' && !isLongCmd) { option = s2; i++; } \
+		if (!option || *option == '\0') option = defaultVal; \
+		if (option) settings[longCmd] = option;
+
+// Use this for options which have a required (string) value
+#define DO_OPTION(shortCmd, longCmd) \
+	DO_OPTION_OPT(shortCmd, longCmd, 0) \
+	if (!option) usage("Option '%s' requires an argument", argv[isLongCmd ? i : i-1]);
+
+// Use this for options which have a required integer value
+#define DO_OPTION_INT(shortCmd, longCmd) \
+	DO_OPTION(shortCmd, longCmd) \
+	char *endptr = 0; \
+	int intValue; intValue = (int)strtol(option, &endptr, 0); \
+	if (endptr == NULL || *endptr != 0) usage("--%s: Invalid number '%s'", longCmd, option);
+
+// Use this for boolean options; this distinguishes between "-x" and "-X",
+// resp. between "--some-option" and "--no-some-option".
+#define DO_OPTION_BOOL(shortCmd, longCmd) \
+	if (isLongCmd ? (!strcmp(s+2, longCmd) || !strcmp(s+2, "no-"longCmd)) : (tolower(s[1]) == shortCmd)) { \
+		bool boolValue = (islower(s[1]) != 0); \
+		s += 2; \
+		if (isLongCmd) { \
+			boolValue = !strcmp(s, longCmd); \
+			s += boolValue ? (sizeof(longCmd) - 1) : (sizeof("no-"longCmd) - 1); \
+		} \
+		if (*s != '\0') goto unknownOption; \
+		const char *option = boolValue ? "true" : "false"; \
+		settings[longCmd] = option;
+
+// Use this for options which never have a value, i.e. for 'commands', like "--help".
+#define DO_COMMAND(shortCmd, longCmd) \
+	if (isLongCmd ? (!strcmp(s+2, longCmd)) : (tolower(s[1]) == shortCmd)) { \
+		s += 2; \
+		if (isLongCmd) \
+			s += sizeof(longCmd) - 1; \
+		if (*s != '\0') goto unknownOption; \
+		return longCmd;
+
+
+#define DO_LONG_OPTION_OPT(longCmd, d)  DO_OPTION_OPT(0, longCmd, d)
+#define DO_LONG_OPTION(longCmd)         DO_OPTION(0, longCmd)
+#define DO_LONG_OPTION_INT(longCmd)     DO_OPTION_INT(0, longCmd)
+#define DO_LONG_OPTION_BOOL(longCmd)    DO_OPTION_BOOL(0, longCmd)
+#define DO_LONG_COMMAND(longCmd)        DO_COMMAND(0, longCmd)
+
+// End an option handler
+#define END_OPTION \
+		continue; \
+	}
+
+Common::String parseCommandLine(Common::StringMap &settings, int argc, char **argv) {
+	const char *s, *s2;
+
+	// argv[0] contains the name of the executable.
+	if (argv && argv[0]) {
+		s = strrchr(argv[0], '/');
+		s_appName = s ? (s + 1) : argv[0];
+	}
+
+	// We store all command line settings into a string map.
+
+	// Iterate over all command line arguments and parse them into our string map.
+	for (int i = 1; i < argc; ++i) {
+		s = argv[i];
+		s2 = (i < argc - 1) ? argv[i + 1] : 0;
+
+		if (s[0] != '-') {
+			// The argument doesn't start with a dash, so it's not an option.
+			// Hence it must be the target name. We currently enforce that
+			// this always comes last.
+			if (i != argc - 1)
+				usage("Stray argument '%s'", s);
+
+			// We defer checking whether this is a valid target to a later point.
+			return s;
+		} else {
+
+			bool isLongCmd = (s[0] == '-' && s[1] == '-');
+
+			DO_COMMAND('h', "help")
+			END_OPTION
+
+			DO_COMMAND('v', "version")
+			END_OPTION
+
+			DO_COMMAND('z', "list-games")
+			END_OPTION
+
+			DO_OPTION('c', "config")
+			END_OPTION
+
+			DO_OPTION_INT('b', "boot-param")
+			END_OPTION
+
+			DO_OPTION_OPT('d', "debuglevel", "0")
+			END_OPTION
+
+			DO_LONG_OPTION("debugflags")
+			END_OPTION
+
+			DO_LONG_OPTION_INT("output-rate")
+			END_OPTION
+
+			DO_OPTION_BOOL('f', "fullscreen")
+			END_OPTION
+
+			DO_OPTION_INT('m', "music_volume")
+			END_OPTION
+
+			DO_OPTION('s', "sfx_volume")
+			END_OPTION
+
+			DO_OPTION('r', "speech_volume")
+			END_OPTION
+
+			DO_LONG_OPTION("transcript")
+			END_OPTION
+
+			DO_LONG_OPTION("game_devel_mode")
+			END_OPTION
+
+			DO_LONG_OPTION("joystick")
+			END_OPTION
+
+			DO_LONG_OPTION("show_fps")
+			END_OPTION
+
+			DO_LONG_OPTION("gl_zbuffer")
+			END_OPTION
+
+			DO_LONG_OPTION("soft_renderer")
+			END_OPTION
+
+			DO_LONG_OPTION("manny_state")
+			END_OPTION
+
+			DO_LONG_OPTION("movement")
+			END_OPTION
+
+			DO_LONG_OPTION("gamma")
+			END_OPTION
+
+			DO_OPTION('p', "path")
+				FilesystemNode path(option);
+				if (!path.exists()) {
+					usage("Non-existent game path '%s'", option);
+				} else if (!path.isReadable()) {
+					usage("Non-readable game path '%s'", option);
+				}
+			END_OPTION
+
+			DO_LONG_OPTION_BOOL("disable-sdl-parachute")
+			END_OPTION
+
+			DO_LONG_OPTION("savepath")
+				FilesystemNode path(option);
+				if (!path.exists()) {
+					usage("Non-existent savegames path '%s'", option);
+				} else if (!path.isWritable()) {
+					usage("Non-writable savegames path '%s'", option);
+				}
+			END_OPTION
+
+			DO_LONG_OPTION("extrapath")
+				FilesystemNode path(option);
+				if (!path.exists()) {
+					usage("Non-existent extra path '%s'", option);
+				} else if (!path.isReadable()) {
+					usage("Non-readable extra path '%s'", option);
+				}
+			END_OPTION
+
+			DO_LONG_OPTION("text_speed")
+			END_OPTION
+
+			DO_LONG_OPTION("speech_mode")
+			END_OPTION
+
+			DO_LONG_OPTION("record-mode")
+			END_OPTION
+
+			DO_LONG_OPTION("record-file-name")
+			END_OPTION
+
+			DO_LONG_OPTION("record-temp-file-name")
+			END_OPTION
+
+			DO_LONG_OPTION("record-time-file-name")
+			END_OPTION
+
+#ifdef IPHONE
+			// This is automatically set when launched from the Springboard.
+			DO_LONG_OPTION_OPT("launchedFromSB", 0)
+			END_OPTION
+#endif
+
+unknownOption:
+			// If we get till here, the option is unhandled and hence unknown.
+			usage("Unrecognized option '%s'", argv[i]);
+		}
+	}
+
+	return Common::String::emptyString;
+}
+
+/** List all supported game IDs, i.e. all games which any loaded plugin supports. */
+static void listGames() {
+	printf("Game ID              Full Title                                            \n"
+	       "-------------------- ------------------------------------------------------\n");
+
+	printf("%-20s %s\n", "grim", "Grim Fandando");
+	//printf("%-20s %s\n"), "monkey", "Monkey Island 4");
+}
+
+bool processSettings(Common::String &command, Common::StringMap &settings) {
+	if (command == "list-games") {
+		listGames();
+		return false;
+	} else if (command == "version") {
+		printf("%s\n", gResidualFullVersion);
+		printf("Features compiled in: %s\n", gResidualFeatures);
+		return false;
+	} else if (command == "help") {
+		printf(HELP_STRING, s_appName);
+		return false;
+	}
+
+	// If a target was specified, check whether there is either a game
+	// domain (i.e. a target) matching this argument, or alternatively
+	// whether there is a gameid matching that name.
+	if (!command.empty()) {
+		if (command.compareToIgnoreCase("grim")/* || command.compareToIgnoreCase("monkey")*/) {
+			ConfMan.setActiveDomain(command);
+		} else {
+			usage("Unrecognized game target '%s'", command.c_str());
+		}
+	} else {
+		// for development set default to grim
+		ConfMan.setActiveDomain("grim");
+	}
+
+	// The user can override the savepath with the RESIDUAL_SAVEPATH
+	// environment variable. This is weaker than a --savepath on the
+	// command line, but overrides the default savepath, hence it is
+	// handled here, just before the command line gets parsed.
+#if !defined(MACOS_CARBON) && !defined(_WIN32_WCE) && !defined(PALMOS_MODE) && !defined(__GP32__)
+	if (!settings.contains("savepath")) {
+		const char *dir = getenv("RESIDUAL_SAVEPATH");
+		if (dir && *dir && strlen(dir) < MAXPATHLEN) {
+			FilesystemNode saveDir(dir);
+			if (!saveDir.exists()) {
+				warning("Non-existent RESIDUAL_SAVEPATH save path. It will be ignored.");
+			} else if (!saveDir.isWritable()) {
+				warning("Non-writable RESIDUAL_SAVEPATH save path. It will be ignored.");
+			} else {
+				settings["savepath"] = dir;
+			}
+		}
+	}
+#endif
+
+	// Finally, store the command line settings into the config manager.
+	for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
+		Common::String key(x->_key);
+		Common::String value(x->_value);
+
+		// Replace any "-" in the key by "_" (e.g. change "save-slot" to "save_slot").
+		for (Common::String::iterator c = key.begin(); c != key.end(); ++c)
+			if (*c == '-')
+				*c = '_';
+
+		// Store it into ConfMan.
+		ConfMan.set(key, value, Common::ConfigManager::kTransientDomain);
+	}
+
+	return true;
+}


Property changes on: residual/trunk/engine/cmd_line.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: residual/trunk/engine/cmd_line.h
===================================================================
--- residual/trunk/engine/cmd_line.h	                        (rev 0)
+++ residual/trunk/engine/cmd_line.h	2008-07-31 22:01:31 UTC (rev 33484)
@@ -0,0 +1,36 @@
+/* Residual - Virtual machine to run LucasArts' 3D adventure games
+ *
+ * Residual is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the AUTHORS
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef CMD_OPTIONS_H
+#define CMD_OPTIONS_H
+
+#include "common/str.h"
+#include "common/config-manager.h"
+
+void registerDefaults();
+Common::String parseCommandLine(Common::StringMap &settings, int argc, char **argv);
+bool processSettings(Common::String &command, Common::StringMap &settings);
+
+#endif


Property changes on: residual/trunk/engine/cmd_line.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: residual/trunk/engine/localize.cpp
===================================================================
--- residual/trunk/engine/localize.cpp	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/engine/localize.cpp	2008-07-31 22:01:31 UTC (rev 33484)
@@ -43,7 +43,7 @@
 		return;
 
 	for (unsigned i = 0; i < sizeof(namesToTry) / sizeof(namesToTry[0]); i++) {
-		const char *datadir = g_registry->get("DataDir", NULL);
+		const char *datadir = g_registry->get("GrimDataDir", ".");
 		std::string fname = (datadir != NULL ? datadir : ".");
 		fname += namesToTry[i];
 		f = std::fopen(fname.c_str(), "rb");

Modified: residual/trunk/engine/lua.cpp
===================================================================
--- residual/trunk/engine/lua.cpp	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/engine/lua.cpp	2008-07-31 22:01:31 UTC (rev 33484)
@@ -752,10 +752,9 @@
 	DEBUG_FUNCTION();
 	accel = getbool(1);
 	if (accel)
-		g_registry->set("soft", "FALSE");
+		g_registry->set("soft_renderer", "FALSE");
 	else
-		g_registry->set("soft", "TRUE");
-	g_registry->save();
+		g_registry->set("soft_renderer", "TRUE");
 }
 
 static void SetVideoDevices() {

Modified: residual/trunk/engine/main.cpp
===================================================================
--- residual/trunk/engine/main.cpp	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/engine/main.cpp	2008-07-31 22:01:31 UTC (rev 33484)
@@ -24,7 +24,6 @@
  */
 
 #include "common/sys.h"
-#include "common/debug.h"
 #include "common/timer.h"
 
 #include "engine/bitmap.h"
@@ -34,6 +33,7 @@
 #include "engine/localize.h"
 #include "engine/engine.h"
 #include "engine/version.h"
+#include "engine/cmd_line.h"
 #include "engine/smush/smush.h"
 
 #include "engine/backend/platform/sdl/driver_gl.h"
@@ -50,107 +50,57 @@
 static bool g_lua_initialized = false;
 Driver *g_driver = NULL;
 
-static bool parseBoolStr(const char *val) {
-	if (!val || val[0] == 0)
-		return false;
-
-	switch (val[0]) {
-	case 'y': case 'Y':	// yes
-	case 't': case 'T':	// true
-	case '1':
-		return true;
-	case 'n': case 'N':	// no
-	case 'f': case 'F':	// false
-	case '0':
-		return false;
-	case 'o':
-		switch (val[1]) {
-		case 'n': case 'N': // on
-			return true;
-		case 'f': case 'F': // off
-			return false;
-		}
-	}
-
-	error("Unrecognized boolean value %s\n", val);
-	return false;
-}
-
 void quit();
 
 extern "C" int residual_main(int argc, char *argv[]) {
-	int i;
+	Common::String specialDebug;
+	Common::String command;
 
 	printf("%s\n", gResidualFullVersion);
 	printf("------------------------------------------------\n");
 
-	g_registry = new Registry();
+	registerDefaults();
 
-	// Parse command line
-	ZBUFFER_GLOBAL = parseBoolStr(g_registry->get("zbuffer", "TRUE"));
-	SHOWFPS_GLOBAL = parseBoolStr(g_registry->get("fps", "FALSE"));
-	TINYGL_GLOBAL = parseBoolStr(g_registry->get("soft", "FALSE"));
-	bool fullscreen = parseBoolStr(g_registry->get("fullscreen", "FALSE"));
-	for (i = 1; i < argc; i++) {
-		if (strcmp(argv[i], "-zbuffer") == 0)
-			ZBUFFER_GLOBAL = true;
-		else if (strcmp(argv[i], "-nozbuffer") == 0)
-			ZBUFFER_GLOBAL = false;
-		else if (strcmp(argv[i], "-fps") == 0)
-			SHOWFPS_GLOBAL = true;
-		else if (strcmp(argv[i], "-nofps") == 0)
-			SHOWFPS_GLOBAL = false;
-		else if (strcmp(argv[i], "-fullscreen") == 0)
-			fullscreen = true;
-		else if (strcmp(argv[i], "-nofullscreen") == 0)
-			fullscreen = false;
-		else if (strcmp(argv[i], "-soft") == 0)
-			TINYGL_GLOBAL = true;
-		else if (strcmp(argv[i], "-nosoft") == 0)
-			TINYGL_GLOBAL = false;
-		else if (strncmp(argv[i], "-debug=", 7) == 0) {
-			bool numeric = true;
-			char debugtxt[20];
-			unsigned int j;
-			int level;
-			
-			sscanf(argv[i], "%*[^=]%*1s%s", debugtxt);
-			for (j = 0;j < strlen(debugtxt); j++) {
-				if (!isdigit(debugtxt[j]))
-					numeric = false;
-			}
-			if (numeric) {
-				sscanf(debugtxt, "%d", &level);
-				if (level < 0 || level > DEBUG_ALL)
-					goto needshelp;
-			} else {
-				level = -1;
-				for (j = 0; j <= DEBUG_ALL; j++) {
-					if (!strcasecmp(debugtxt, debug_levels[j])) {
-						level = j;
-						break;
-					}
-				}
-				if (level == -1)
-					goto needshelp;
-			}
-			debugLevel = (enDebugLevels) level;
-			printf("Debug level set to: %s\n", debug_levels[debugLevel]);
-		} else {
-			int j;
-needshelp:
-			printf("Recognised options:\n");
-			printf("\t-[no]zbuffer\t\tEnable/disable ZBuffers (Very slow on older cards)\n");
-			printf("\t-[no]fps\t\tEnable/disable fps display in upper right corner\n");
-			printf("\t-[no]fullscreen\t\tEnable/disable fullscreen mode at startup\n");
-			printf("\t-[no]soft\t\tEnable/disable software renderer\n");
-			printf("\t-debug=[level]\t\tSet debug to [level], valid levels:\n");
-			for (j = 0;j <= DEBUG_ALL; j++)
-				printf("\t\t%-8s (%d): %s.\n", debug_levels[j], j, debug_descriptions[j]);
-			exit(-1);
-		}
+	// Parse the command line
+	Common::StringMap settings;
+	command = parseCommandLine(settings, argc, argv);
+
+	// Load the config file (possibly overriden via command line):
+	if (settings.contains("config")) {
+		ConfMan.loadConfigFile(settings["config"]);
+		settings.erase("config");
+	} else {
+		ConfMan.loadDefaultConfigFile();
 	}
 
+	// Update the config file
+	ConfMan.set("versioninfo", gResidualVersion, Common::ConfigManager::kApplicationDomain);
+
+	// Load and setup the debuglevel and the debug flags. We do this at the
+	// soonest possible moment to ensure debug output starts early on, if
+	// requested.
+	if (settings.contains("debuglevel")) {
+		debugLevel = (enDebugLevels)strtol(settings["debuglevel"].c_str(), 0, 10);
+		printf("Debuglevel (from command line): %d\n", debugLevel);
+		settings.erase("debuglevel");	// This option should not be passed to ConfMan.
+	} else if (ConfMan.hasKey("debuglevel"))
+		debugLevel = (enDebugLevels)ConfMan.getInt("debuglevel");
+
+	if (settings.contains("debugflags")) {
+		specialDebug = settings["debugflags"];
+		settings.erase("debugflags");
+	}
+
+	if (!processSettings(command, settings))
+		return 0;
+
+	g_registry = new Registry();
+
+	SHOWFPS_GLOBAL = (tolower(g_registry->get("show_fps", "FALSE")[0]) == 't');
+	TINYGL_GLOBAL = (tolower(g_registry->get("soft_renderer", "FALSE")[0]) == 't');
+	ZBUFFER_GLOBAL = (tolower(g_registry->get("gl_zbuffer", "FALSE")[0]) == 't');
+	bool fullscreen = (tolower(g_registry->get("fullscreen", "FALSE")[0]) == 't');
+
 	if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
 		return 1;
 
@@ -176,7 +126,7 @@
 	Bitmap *splash_bm = NULL;
 	if (!(g_flags & GF_DEMO))
 		splash_bm = g_resourceloader->loadBitmap("splash.bm");
-	if (splash_bm != NULL)
+	if (splash_bm)
 		splash_bm->ref();
 
 	g_driver->clearScreen();
@@ -186,7 +136,7 @@
 
 	g_driver->flipBuffer();
 
-	if (splash_bm != NULL)
+	if (splash_bm)
 		splash_bm->deref();
 
 	lua_iolibopen();

Modified: residual/trunk/engine/module.mk
===================================================================
--- residual/trunk/engine/module.mk	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/engine/module.mk	2008-07-31 22:01:31 UTC (rev 33484)
@@ -3,6 +3,7 @@
 MODULE_OBJS := \
 	actor.o \
 	bitmap.o \
+	cmd_line.o \
 	costume.o \
 	engine.o \
 	font.o \

Modified: residual/trunk/engine/registry.cpp
===================================================================
--- residual/trunk/engine/registry.cpp	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/engine/registry.cpp	2008-07-31 22:01:31 UTC (rev 33484)
@@ -23,99 +23,96 @@
  *
  */
 
-#if defined(WIN32)
-#include <windows.h>
-#endif
-
 #include "common/sys.h"
 #include "common/debug.h"
+#include "common/str.h"
 
 #include "engine/registry.h"
+#include "engine/cmd_line.h"
 
-#include <cstdlib>
-#include <cstring>
-
-#if defined(UNIX)
-#ifdef MACOSX
-#define DEFAULT_CONFIG_FILE "Library/Preferences/Residual Preferences"
-#else
-#define DEFAULT_CONFIG_FILE ".residualrc"
-#endif
-#else
-#define DEFAULT_CONFIG_FILE "residual.ini"
-#endif
-
 Registry *g_registry = NULL;
 
-Registry::Registry() : _dirty(false) {
-	char configFile[MAXPATHLEN];
-#ifndef __DC__
-#ifdef WIN32
-	OSVERSIONINFO win32OsVersion;
-	ZeroMemory(&win32OsVersion, sizeof(OSVERSIONINFO));
-	win32OsVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-	GetVersionEx(&win32OsVersion);
-	// Check for non-9X version of Windows.
-	if (win32OsVersion.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS) {
-		// Use the Application Data directory of the user profile.
-		if (win32OsVersion.dwMajorVersion >= 5) {
-			if (!GetEnvironmentVariable("APPDATA", configFile, sizeof(configFile)))
-				error("Unable to access application data directory");
-		} else {
-			if (!GetEnvironmentVariable("USERPROFILE", configFile, sizeof(configFile)))
-				error("Unable to access user profile directory");
+// SpewOnError
+// GrimLastSet
+// JoystickEnabled
+// MovementMode
+// SpeechMode
+// GammaCorrection, Gamma
+// GrimDeveloper
+// SfxVolume
+// MusicVolume
+// VoiceVolume
+// TextSpeed
+// VoiceEffects
+// LastSavedGame
+// good_times
 
-			strcat(configFile, "\\Application Data");
-			CreateDirectory(configFile, NULL);
-		}
+// fps
+// gl_zbuffer
+// soft_renderer
+// fullscreen
 
-		strcat(configFile, "\\Residual");
-		CreateDirectory(configFile, NULL);
-		strcat(configFile, "\\" DEFAULT_CONFIG_FILE);
-	} else {
-		// Check windows directory
-		GetWindowsDirectory(configFile, MAXPATHLEN);
-		strcat(configFile, "\\" DEFAULT_CONFIG_FILE);
-	}
-#elif defined __amigaos4__
-	strcpy(configFile,"/PROGDIR/residual.ini");
-#else
-	const char *home = getenv("HOME");
-	if (home != NULL && strlen(home) < MAXPATHLEN)
-		snprintf(configFile, MAXPATHLEN, "%s/%s", home, DEFAULT_CONFIG_FILE);
-	else
-		strcpy(configFile, DEFAULT_CONFIG_FILE);
-#endif
+Registry::Registry() : _dirty(true) {
+	_develMode = ConfMan.get("game_devel_mode");
+	_dataPath = ConfMan.get("path");
+	_lastSet = ConfMan.get("last_set");
+	_musicVolume = ConfMan.get("music_volume");
+	_sfxVolume = ConfMan.get("sfx_volume");
+	_voiceVolume = ConfMan.get("voice_volume");
+	_lastSavedGame = ConfMan.get("last_saved_game");
+	_gamma = ConfMan.get("gamma");
+	_voiceEffects = ConfMan.get("voice_effects");
+	_textSpeed = ConfMan.get("text_speed");
+	_speechMode = ConfMan.get("speech_mode");
+	_movement = ConfMan.get("movement");
+	_joystick = ConfMan.get("joystick");
+	_spewOnError = ConfMan.get("spew_on_error");
+	_showFps = ConfMan.get("show_fps");
+	_softRenderer = ConfMan.get("soft_renderer");
+	_glZbuffer = ConfMan.get("gl_zbuffer");
+	_fullscreen = ConfMan.get("fullscreen");
+}
 
-	std::FILE *f = fopen(configFile, "r");
-	if (f != NULL) {
-		char line[1024];
-		while (!feof(f) && fgets(line, sizeof(line), f) != NULL) {
-			char *equals = std::strchr(line, '=');
-			char *newline = std::strchr(line, '\n');
-			if (newline != NULL)
-				*newline = '\0';
-			if (equals != NULL) {
-				std::string key = std::string(line, equals - line);
-				std::string val = std::string(equals + 1);
-				_settings[key] = val;
-			}
-		}
-		std::fclose(f);
+const char *Registry::get(const char *key, const char *defval) const {
+	if (strcasecmp("good_times", key) == 0 || strcasecmp("GrimDeveloper", key) == 0) {
+		return _develMode.c_str();
+	} else if (strcasecmp("GrimDataDir", key) == 0) {
+		return _dataPath.c_str();
+	} else if (strcasecmp("GrimLastSet", key) == 0) {
+		return _lastSet.c_str();
+	} else if (strcasecmp("MusicVolume", key) == 0) {
+		return _musicVolume.c_str();
+	} else if (strcasecmp("SfxVolume", key) == 0) {
+		return _sfxVolume.c_str();
+	} else if (strcasecmp("VoiceVolume", key) == 0) {
+		return _voiceVolume.c_str();
+	} else if (strcasecmp("LastSavedGame", key) == 0) {
+		return _lastSavedGame.c_str();
+	} else if (strcasecmp("Gamma", key) == 0 || strcasecmp("GammaCorrection", key) == 0) {
+		return "";//_gamma.c_str();
+	} else if (strcasecmp("VoiceEffects", key) == 0) {
+		return _voiceEffects.c_str();
+	} else if (strcasecmp("TextSpeed", key) == 0) {
+		return _textSpeed.c_str();
+	} else if (strcasecmp("SpeechMode", key) == 0) {
+		return _speechMode.c_str();
+	} else if (strcasecmp("MovementMode", key) == 0) {
+		return _movement.c_str();
+	} else if (strcasecmp("JoystickEnabled", key) == 0) {
+		return _joystick.c_str();
+	} else if (strcasecmp("SpewOnError", key) == 0) {
+		return _spewOnError.c_str();
+	} else if (strcasecmp("show_fps", key) == 0) {
+		return _showFps.c_str();
+	} else if (strcasecmp("soft_renderer", key) == 0) {
+		return _softRenderer.c_str();
+	} else if (strcasecmp("gl_zbuffer", key) == 0) {
+		return _glZbuffer.c_str();
+	} else if (strcasecmp("fullscreen", key) == 0) {
+		return _fullscreen.c_str();
 	}
-#endif
-}
 
-const char *Registry::get(const char *key, const char *defval) const {
-	// GrimDataDir is an alias for DataDir for our purposes
-	if (!strcmp(key, "GrimDataDir"))
-		key = "DataDir";
-	
-	Group::const_iterator i = _settings.find(key);
-	if (i == _settings.end())
-		return defval;
-	else
-		return i->second.c_str();
+	return defval;
 }
 
 void Registry::set(const char *key, const char *val) {
@@ -124,34 +121,90 @@
 	if (strstr(key, "GrimLastSet") || strstr(key, "GrimMannyState"))
 		return;
 
-	_settings[key] = val;
 	_dirty = true;
+	assert(val);
+
+	if (strcasecmp("good_times", key) == 0 || strcasecmp("GrimDeveloper", key) == 0) {
+		_develMode = val;
+		return;
+	} else if (strcasecmp("GrimDataDir", key) == 0) {
+		_dataPath = val;
+		return;
+	} else if (strcasecmp("GrimLastSet", key) == 0) {
+		_lastSet = val;
+		return;
+	} else if (strcasecmp("MusicVolume", key) == 0) {
+		_musicVolume = val;
+		return;
+	} else if (strcasecmp("SfxVolume", key) == 0) {
+		_sfxVolume = val;
+		return;
+	} else if (strcasecmp("VoiceVolume", key) == 0) {
+		_voiceVolume = val;
+		return;
+	} else if (strcasecmp("LastSavedGame", key) == 0) {
+		_lastSavedGame = val;
+		return;
+	} else if (strcasecmp("Gamma", key) == 0 || strcasecmp("GammaCorrection", key) == 0) {
+		_gamma = "";//val;
+		return;
+	} else if (strcasecmp("VoiceEffects", key) == 0) {
+		_voiceEffects = val;
+		return;
+	} else if (strcasecmp("TextSpeed", key) == 0) {
+		_textSpeed = val;
+		return;
+	} else if (strcasecmp("SpeechMode", key) == 0) {
+		_speechMode = val;
+		return;
+	} else if (strcasecmp("MovementMode", key) == 0) {
+		_movement = val;
+		return;
+	} else if (strcasecmp("JoystickEnabled", key) == 0) {
+		_joystick = val;
+		return;
+	} else if (strcasecmp("SpewOnError", key) == 0) {
+		_spewOnError = val;
+		return;
+	} else if (strcasecmp("show_fps", key) == 0) {
+		_showFps = val;
+		return;
+	} else if (strcasecmp("soft_renderer", key) == 0) {
+		_softRenderer = val;
+		return;
+	} else if (strcasecmp("gl_zbuffer", key) == 0) {
+		_glZbuffer = val;
+		return;
+	} else if (strcasecmp("fullscreen", key) == 0) {
+		_fullscreen = val;
+		return;
+	}
 }
 
 void Registry::save() {
 	if (!_dirty)
 		return;
 
-#ifndef __DC__
-#ifdef WIN32
-	std::string filename = "residual.ini";
-#elif defined __amigaos4__
-	std::string filename = "/PROGDIR/residual.ini";
-#else
-	std::string filename = std::string(std::getenv("HOME")) + "/.residualrc";
-#endif
+	ConfMan.set("game_devel_mode", _develMode);
+	ConfMan.set("path", _dataPath);
+	ConfMan.set("last_set", _lastSet);
+	ConfMan.set("music_volume", _musicVolume);
+	ConfMan.set("sfx_volume", _sfxVolume);
+	ConfMan.set("voice_volume", _voiceVolume);
+	ConfMan.set("last_saved_game", _lastSavedGame);
+	ConfMan.set("gamma", _gamma);
+	ConfMan.set("voice_effects", _voiceEffects);
+	ConfMan.set("text_speed", _textSpeed);
+	ConfMan.set("speech_mode", _speechMode);
+	ConfMan.set("movement", _movement);
+	ConfMan.set("joystick", _joystick);
+	ConfMan.set("spew_on_error", _spewOnError);
+	ConfMan.set("show_fps", _showFps);
+	ConfMan.set("soft_renderer", _softRenderer);
+	ConfMan.set("gl_zbuffer", _glZbuffer);
+	ConfMan.set("fullscreen", _fullscreen);
 
-	std::FILE *f = std::fopen(filename.c_str(), "w");
-	if (f == NULL) {
-		warning("Could not open registry file %s for writing\n",
-			filename.c_str());
-		return;
-	}
+	ConfMan.flushToDisk();
 
-	for (Group::iterator i = _settings.begin(); i != _settings.end(); i++)
-		std::fprintf(f, "%s=%s\n", i->first.c_str(), i->second.c_str());
-
-	std::fclose(f);
-#endif
 	_dirty = false;
 }

Modified: residual/trunk/engine/registry.h
===================================================================
--- residual/trunk/engine/registry.h	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/engine/registry.h	2008-07-31 22:01:31 UTC (rev 33484)
@@ -26,8 +26,7 @@
 #ifndef REGISTRY_HH
 #define REGISTRY_HH
 
-#include <string>
-#include <map>
+#include "common/str.h"
 
 class Registry {
 public:
@@ -42,8 +41,25 @@
 
 	static Registry *_instance;
 
-	typedef std::map<std::string, std::string> Group;
-	Group _settings;
+	Common::String _develMode;
+	Common::String _dataPath;
+	Common::String _lastSet;
+	Common::String _musicVolume;
+	Common::String _sfxVolume;
+	Common::String _voiceVolume;
+	Common::String _lastSavedGame;
+	Common::String _gamma;
+	Common::String _voiceEffects;
+	Common::String _textSpeed;
+	Common::String _speechMode;
+	Common::String _movement;
+	Common::String _joystick;
+	Common::String _spewOnError;
+	Common::String _showFps;
+	Common::String _softRenderer;
+	Common::String _glZbuffer;
+	Common::String _fullscreen;
+
 	bool _dirty;
 };
 

Modified: residual/trunk/engine/resource.cpp
===================================================================
--- residual/trunk/engine/resource.cpp	2008-07-31 21:56:05 UTC (rev 33483)
+++ residual/trunk/engine/resource.cpp	2008-07-31 22:01:31 UTC (rev 33484)
@@ -54,7 +54,7 @@
 ResourceLoader *g_resourceloader = NULL;
 
 ResourceLoader::ResourceLoader() {
-	const char *directory = g_registry->get("DataDir", NULL);
+	const char *directory = g_registry->get("GrimDataDir", ".");
 	std::string dir_str = (directory != NULL ? directory : ".");
 	dir_str += '/';
 	int lab_counter = 0;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list