aboutsummaryrefslogtreecommitdiff
path: root/base/main.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2010-11-28 17:26:27 +0000
committerTorbjörn Andersson2010-11-28 17:26:27 +0000
commit1857076d76d8bde59bf6b47fe49c32ba6c462c10 (patch)
tree7920ff256173a2c35016083369638763be377cca /base/main.cpp
parentbed8c34a87512282e582dc7ee5471e9f5a94d6c7 (diff)
downloadscummvm-rg350-1857076d76d8bde59bf6b47fe49c32ba6c462c10.tar.gz
scummvm-rg350-1857076d76d8bde59bf6b47fe49c32ba6c462c10.tar.bz2
scummvm-rg350-1857076d76d8bde59bf6b47fe49c32ba6c462c10.zip
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. svn-id: r54534
Diffstat (limited to 'base/main.cpp')
-rw-r--r--base/main.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/base/main.cpp b/base/main.cpp
index 2958dea283..c6fffe5ce3 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -372,6 +372,25 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
// 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.