BASE: Set debug flags before instantiating an engine

This commit is contained in:
Eugene Sandulenko 2021-09-26 13:43:23 +02:00
parent d9ed62041d
commit 44b12eb0c7
No known key found for this signature in database
GPG key ID: 014D387312D34F08

View file

@ -196,6 +196,17 @@ static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, O
// before we instantiate the engine, we register debug channels for it
DebugMan.addAllDebugChannels(metaEngineDetection.getDebugChannels());
// On creation the engine should have set up all debug levels so we can use
// the command line arguments here
Common::StringTokenizer tokenizer(debugLevels, " ,");
while (!tokenizer.empty()) {
Common::String token = tokenizer.nextToken();
if (token.equalsIgnoreCase("all"))
DebugMan.enableAllDebugChannels();
else if (!DebugMan.enableDebugChannel(token))
warning("Engine does not support debug level '%s'", token.c_str());
}
// Create the game's MetaEngine.
MetaEngine &metaEngine = enginePlugin->get<MetaEngine>();
err = metaEngine.createInstance(&system, &engine);
@ -267,17 +278,6 @@ static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, O
}
}
// On creation the engine should have set up all debug levels so we can use
// the command line arguments here
Common::StringTokenizer tokenizer(debugLevels, " ,");
while (!tokenizer.empty()) {
Common::String token = tokenizer.nextToken();
if (token.equalsIgnoreCase("all"))
DebugMan.enableAllDebugChannels();
else if (!DebugMan.enableDebugChannel(token))
warning("Engine does not support debug level '%s'", token.c_str());
}
#ifdef USE_TRANSLATION
Common::String previousLanguage = TransMan.getCurrentLanguage();
if (ConfMan.hasKey("gui_use_game_language")