BASE: Initialize default GUI option values before engine instantiation.
This fixes engines (like AGI) which query the configuration options inside their constructor.
This commit is contained in:
parent
f04cadf0a4
commit
c321a71241
1 changed files with 10 additions and 7 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue