BASE: MAIN: Change how running games works.

- In runGame(), in main.cpp, we get a plugin of type MetaEngine.
- This MetaEngine cannot createInstances, but it just a helper class.
- Connect a MetaEngine class with it's factory class - MetaEngineConnect.
- Then, simply call the method.
This commit is contained in:
aryanrawlani28 2020-08-02 20:42:14 +05:30 committed by Eugene Sandulenko
parent e69d9c98a4
commit 575e77522a

View File

@ -187,7 +187,15 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common
// need to set this up before instance creation.
metaEngine.registerDefaultSettings(target);
err = metaEngine.createInstance(&system, &engine);
// Right now we have a MetaEngine plugin. We must find the matching engine plugin to
// call createInstance and other connecting functions.
Plugin *enginePluginToLaunchGame = PluginMan.giveEngineFromMetaEngine(plugin);
if (enginePluginToLaunchGame) {
err = enginePluginToLaunchGame->get<MetaEngineConnect>().createInstance(&system, &engine);
} else {
err = Common::Error(Common::kEnginePluginNotFound);
}
}
// Check for errors