[Scummvm-cvs-logs] scummvm master -> c321a71241a4d01038d404be3eb2ce3a30f42bf0

lordhoto lordhoto at gmail.com
Sun Jan 17 02:19:47 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c321a71241 BASE: Initialize default GUI option values before engine instantiation.


Commit: c321a71241a4d01038d404be3eb2ce3a30f42bf0
    https://github.com/scummvm/scummvm/commit/c321a71241a4d01038d404be3eb2ce3a30f42bf0
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2016-01-17T02:18:03+01:00

Commit Message:
BASE: Initialize default GUI option values before engine instantiation.

This fixes engines (like AGI) which query the configuration options inside
their constructor.

Changed paths:
    base/main.cpp



diff --git a/base/main.cpp b/base/main.cpp
index 3ea38b5..ff441df 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();
 






More information about the Scummvm-git-logs mailing list