[Scummvm-cvs-logs] SF.net SVN: scummvm: [21909] scummvm/trunk/base

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Apr 15 06:52:01 CEST 2006


Revision: 21909
Author:   fingolfin
Date:     2006-04-15 06:50:44 -0700 (Sat, 15 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21909&view=rev

Log Message:
-----------
- Get rid of GameDetector::_dumpScripts and GameDetector::_force1xOverlay in favor of settings in the transient config domain
- This also means you can now set those options in the config file
- Fixed a bug I recently introduced that made bool command line options (like -u, -f) always return 'false' when used in their single letter form

Modified Paths:
--------------
    scummvm/trunk/base/gameDetector.cpp
    scummvm/trunk/base/gameDetector.h
    scummvm/trunk/base/main.cpp
    scummvm/trunk/engines/scumm/scumm.cpp
Modified: scummvm/trunk/base/gameDetector.cpp
===================================================================
--- scummvm/trunk/base/gameDetector.cpp	2006-04-15 13:34:02 UTC (rev 21908)
+++ scummvm/trunk/base/gameDetector.cpp	2006-04-15 13:50:44 UTC (rev 21909)
@@ -157,7 +157,13 @@
 	ConfMan.registerDefault("aspect_ratio", false);
 	ConfMan.registerDefault("gfx_mode", "normal");
 	ConfMan.registerDefault("render_mode", "default");
+#if defined(__SYMBIAN32__)
+	ConfMan.registerDefault("force_1x_overlay", true);
+#else
+	ConfMan.registerDefault("force_1x_overlay", false);
+#endif
 
+
 	// Sound & Music
 	ConfMan.registerDefault("music_volume", 192);
 	ConfMan.registerDefault("sfx_volume", 192);
@@ -182,6 +188,7 @@
 	ConfMan.registerDefault("sfx_mute", false);
 	ConfMan.registerDefault("subtitles", false);
 	ConfMan.registerDefault("boot_param", 0);
+	ConfMan.registerDefault("dump_scripts", false);
 	ConfMan.registerDefault("save_slot", -1);
 	ConfMan.registerDefault("autosave_period", 5 * 60);	// By default, trigger autosave every 5 minutes
 
@@ -242,14 +249,6 @@
 #endif
 #endif // #ifdef DEFAULT_SAVE_PATH
 
-	_dumpScripts = false;
-
-#if defined(__SYMBIAN32__)
-	_force1xOverlay = true;
-#else
-	_force1xOverlay = false;
-#endif
-
 	_plugin = 0;
 }
 
@@ -276,7 +275,8 @@
 
 // Use this for options which have an *optional* value
 #define DO_OPTION_OPT(shortCmd, longCmd, defaultVal) \
-	if (isLongCmd ? (!memcmp(s, longCmd"=", sizeof(longCmd"=") - 1)) : (shortCmdLower == shortCmd)) { \
+	if (isLongCmd ? (!memcmp(s+2, longCmd"=", sizeof(longCmd"=") - 1)) : (tolower(s[1]) == shortCmd)) { \
+		s += 2; \
 		if (isLongCmd) \
 			s += sizeof(longCmd"=") - 1; \
 		const char *option = s; \
@@ -300,8 +300,9 @@
 // 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, longCmd) || !strcmp(s, "no-"longCmd)) : (shortCmdLower == shortCmd)) { \
-		bool boolValue = (shortCmdLower == s[1]); \
+	if (isLongCmd ? (!strcmp(s+2, longCmd) || !strcmp(s+2, "no-"longCmd)) : (tolower(s[1]) == shortCmd)) { \
+		bool boolValue = islower(s[1]); \
+		s += 2; \
 		if (isLongCmd) { \
 			boolValue = !strcmp(s, longCmd); \
 			s += boolValue ? (sizeof(longCmd) - 1) : (sizeof("no-"longCmd) - 1); \
@@ -312,7 +313,8 @@
 
 // Use this for options which never have a value, i.e. for 'commands', like "--help".
 #define DO_OPTION_CMD(shortCmd, longCmd) \
-	if (isLongCmd ? (!strcmp(s, longCmd)) : (shortCmdLower == shortCmd)) { \
+	if (isLongCmd ? (!strcmp(s+2, longCmd)) : (tolower(s[1]) == shortCmd)) { \
+		s += 2; \
 		if (isLongCmd) \
 			s += sizeof(longCmd) - 1; \
 		if (*s != '\0') goto unknownOption;
@@ -357,9 +359,7 @@
 			return s;
 		} else {
 
-			char shortCmdLower = tolower(s[1]);
 			bool isLongCmd = (s[0] == '-' && s[1] == '-');
-			s += 2;
 
 			DO_OPTION_CMD('h', "help")
 				printf(HELP_STRING, argv[0]);
@@ -567,17 +567,6 @@
 #endif
 
 
-	if (settings.contains("dump-scripts")) {
-		_dumpScripts = (settings["dump-scripts"] == "true");
-		settings.erase("dump-scripts");	// This option should not be passed to ConfMan.
-	}
-
-	if (settings.contains("force-1x-overlay")) {
-		_force1xOverlay = (settings["force-1x-overlay"] == "true");
-		settings.erase("force-1x-overlay");	// This option should not be passed to ConfMan.
-	}
-
-
 	// Finally, store the command line settings into the config manager.
 	for (Common::StringMap::const_iterator x = settings.begin(); x != settings.end(); ++x) {
 		String key(x->_key);

Modified: scummvm/trunk/base/gameDetector.h
===================================================================
--- scummvm/trunk/base/gameDetector.h	2006-04-15 13:34:02 UTC (rev 21908)
+++ scummvm/trunk/base/gameDetector.h	2006-04-15 13:50:44 UTC (rev 21909)
@@ -76,10 +76,6 @@
 	String _targetName;
 	String _gameid;
 
-	bool _dumpScripts;
-
-	bool _force1xOverlay;
-
 	const Plugin *_plugin;	// TODO: This should be protected
 
 public:

Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp	2006-04-15 13:34:02 UTC (rev 21908)
+++ scummvm/trunk/base/main.cpp	2006-04-15 13:50:44 UTC (rev 21909)
@@ -137,7 +137,7 @@
 		system.setGraphicsMode(ConfMan.get("gfx_mode").c_str());
 
 		// Make GUI 640 x 400
-		system.initSize(320, 200, (detector._force1xOverlay ? 1 : 2));
+		system.initSize(320, 200, (ConfMan.getBool("force-1x-overlay") ? 1 : 2));
 	system.endGFXTransaction();
 
 

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2006-04-15 13:34:02 UTC (rev 21908)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2006-04-15 13:50:44 UTC (rev 21909)
@@ -536,7 +536,7 @@
 
 	// Read settings from the detector & config manager
 	_debugMode = (gDebugLevel >= 0);
-	_dumpScripts = detector->_dumpScripts;
+	_dumpScripts = ConfMan.getBool("dump_scripts");
 	_bootParam = ConfMan.getInt("boot_param");
 	// Boot params often need debugging switched on to work
 	if (_bootParam)
@@ -859,7 +859,12 @@
 			_system->initSize(Common::kHercW, Common::kHercH, 1);
 			defaultTo1XScaler = true;
 		} else {
-			_system->initSize(_screenWidth, _screenHeight, (detector._force1xOverlay ? 1 : 2));
+			// FIXME: The way we now handle the force_1x_overlay setting implies
+			// that if you start scummvm into the launcher with force_1x_overlay
+			// set to true, it'll get reset to the default value (usually 'false'
+			// except for Symbian) before launching a game.
+			// This may or may not be the desired behavior...
+			_system->initSize(_screenWidth, _screenHeight, (ConfMan.getBool("force_1x_overlay") ? 1 : 2));
 			defaultTo1XScaler = (_screenWidth > 320);
 		}
 		initCommonGFX(detector, defaultTo1XScaler);


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