diff options
author | Johannes Schickel | 2016-01-17 02:15:03 +0100 |
---|---|---|
committer | Johannes Schickel | 2016-01-17 02:18:03 +0100 |
commit | c321a71241a4d01038d404be3eb2ce3a30f42bf0 (patch) | |
tree | f6993c82884f9f97088a63a4ccccbe9b1451c702 | |
parent | f04cadf0a4f29b57cffb648ffd87ef66a603d386 (diff) | |
download | scummvm-rg350-c321a71241a4d01038d404be3eb2ce3a30f42bf0.tar.gz scummvm-rg350-c321a71241a4d01038d404be3eb2ce3a30f42bf0.tar.bz2 scummvm-rg350-c321a71241a4d01038d404be3eb2ce3a30f42bf0.zip |
BASE: Initialize default GUI option values before engine instantiation.
This fixes engines (like AGI) which query the configuration options inside
their constructor.
-rw-r--r-- | base/main.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/base/main.cpp b/base/main.cpp index 3ea38b547a..ff441df49c 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -152,8 +152,17 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const err = Common::kPathNotDirectory; // Create the game engine - if (err.getCode() == Common::kNoError) + if (err.getCode() == Common::kNoError) { + // Set default values for all of the custom engine options + // Appareantly some engines query them in their constructor, thus we + // need to set this up before instance creation. + const ExtraGuiOptions engineOptions = (*plugin)->getExtraGuiOptions(Common::String()); + for (uint i = 0; i < engineOptions.size(); i++) { + ConfMan.registerDefault(engineOptions[i].configOption, engineOptions[i].defaultState); + } + err = (*plugin)->createInstance(&system, &engine); + } // Check for errors if (!engine || err.getCode() != Common::kNoError) { @@ -231,12 +240,6 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const // Initialize any game-specific keymaps engine->initKeymap(); - // Set default values for all of the custom engine options - const ExtraGuiOptions engineOptions = (*plugin)->getExtraGuiOptions(Common::String()); - for (uint i = 0; i < engineOptions.size(); i++) { - ConfMan.registerDefault(engineOptions[i].configOption, engineOptions[i].defaultState); - } - // Inform backend that the engine is about to be run system.engineInit(); |