From 1871a2e68d377b45a3b065875faa2dd899e2d301 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 13 Jul 2009 18:31:42 +0000 Subject: Support transparent guioptions update on game launch for AdvancedMetaEngine. svn-id: r42444 --- engines/advancedDetector.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'engines/advancedDetector.cpp') diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index c127faec28..d1395fbe04 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -291,15 +291,24 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) } } - if (agdDesc == 0) { + if (agdDesc == 0) return Common::kNoGameDataFoundError; + + // If the GUI options were updated, we catch this here and update them in the users config + // file transparently. + const uint32 guiOptions = agdDesc->guioptions | params.guioptions; + + if ((guiOptions && !ConfMan.hasKey("guioptions")) || + (ConfMan.hasKey("guioptions") && parseGameGUIOptions(ConfMan.get("guioptions")) != guiOptions)) { + ConfMan.set("guioptions", Common::getGameGUIOptionsDescription(guiOptions)); + ConfMan.flushToDisk(); } debug(2, "Running %s", toGameDescriptor(*agdDesc, params.list).description().c_str()); - if (!createInstance(syst, engine, agdDesc)) { + if (!createInstance(syst, engine, agdDesc)) return Common::kNoGameDataFoundError; - } - return Common::kNoError; + else + return Common::kNoError; } struct SizeMD5 { -- cgit v1.2.3 From 51a9bfc9e2881aa7c7ddaa9cc6b2709acab5e725 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 13 Jul 2009 18:47:32 +0000 Subject: Refactor GUI options update into a function in Common: updateGameGUIOptions. svn-id: r42446 --- engines/advancedDetector.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'engines/advancedDetector.cpp') diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index d1395fbe04..7d86f3ef32 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -296,13 +296,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) // If the GUI options were updated, we catch this here and update them in the users config // file transparently. - const uint32 guiOptions = agdDesc->guioptions | params.guioptions; - - if ((guiOptions && !ConfMan.hasKey("guioptions")) || - (ConfMan.hasKey("guioptions") && parseGameGUIOptions(ConfMan.get("guioptions")) != guiOptions)) { - ConfMan.set("guioptions", Common::getGameGUIOptionsDescription(guiOptions)); - ConfMan.flushToDisk(); - } + Common::updateGameGUIOptions(agdDesc->guioptions | params.guioptions); debug(2, "Running %s", toGameDescriptor(*agdDesc, params.list).description().c_str()); if (!createInstance(syst, engine, agdDesc)) -- cgit v1.2.3