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

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sun Nov 28 18:26:27 CET 2010


Revision: 54534
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54534&view=rev
Author:   eriktorbjorn
Date:     2010-11-28 17:26:27 +0000 (Sun, 28 Nov 2010)

Log Message:
-----------
MAIN: Fix --gfx-mode regression

We cannot check for supported graphics mode until after the backend has
been initialised, or there won't be a graphics manager to ask.

Modified Paths:
--------------
    scummvm/trunk/base/commandLine.cpp
    scummvm/trunk/base/main.cpp

Modified: scummvm/trunk/base/commandLine.cpp
===================================================================
--- scummvm/trunk/base/commandLine.cpp	2010-11-28 17:18:08 UTC (rev 54533)
+++ scummvm/trunk/base/commandLine.cpp	2010-11-28 17:26:27 UTC (rev 54534)
@@ -383,19 +383,6 @@
 			END_OPTION
 
 			DO_OPTION('g', "gfx-mode")
-				// Check whether 'option' specifies a valid graphics mode.
-				bool isValid = false;
-				if (!scumm_stricmp(option, "normal") || !scumm_stricmp(option, "default"))
-					isValid = true;
-				if (!isValid) {
-					const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
-					while (gm->name && !isValid) {
-						isValid = !scumm_stricmp(gm->name, option);
-						gm++;
-					}
-				}
-				if (!isValid)
-					usage("Unrecognized graphics mode '%s'", option);
 			END_OPTION
 
 			DO_OPTION_INT('m', "music-volume")

Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp	2010-11-28 17:18:08 UTC (rev 54533)
+++ scummvm/trunk/base/main.cpp	2010-11-28 17:26:27 UTC (rev 54534)
@@ -372,6 +372,25 @@
 	// the command line params) was read.
 	system.initBackend();
 
+	// If we received an invalid graphics mode parameter via command line
+	// we check this here. We can't do it until after the backend is inited,
+	// or there won't be a graphics manager to ask for the supported modes.
+
+	if (settings.contains("gfx-mode")) {
+		const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
+		Common::String option = settings["gfx-mode"];
+		bool isValid = false;
+
+		while (gm->name && !isValid) {
+			isValid = !scumm_stricmp(gm->name, option.c_str());
+			gm++;
+		}
+		if (!isValid) {
+			warning("Unrecognized graphics mode '%s'. Switching to default mode", option.c_str());
+			settings["gfx-mode"] = "default";
+		}
+	}
+
 	setupGraphics(system);
 
 	// Init the different managers that are used by the engines.


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