Skip to content

Commit

Permalink
BASE: Only reload engine plugins after return to launcher
Browse files Browse the repository at this point in the history
The other plugins do not need to be reloaded. Reloading
the scaler plugins breaks the graphics.
  • Loading branch information
singron authored and bluegr committed Mar 10, 2019
1 parent 36b4926 commit 6d11f46
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/main.cpp
Expand Up @@ -605,7 +605,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
ConfMan.setActiveDomain("");
}

PluginManager::instance().loadAllPlugins(); // only for cached manager
PluginManager::instance().loadAllPluginsOfType(PLUGIN_TYPE_ENGINE); // only for cached manager
} else {
GUI::displayErrorDialog(_("Could not find any engine capable of running the selected game"));

Expand Down
24 changes: 24 additions & 0 deletions base/plugins.cpp
Expand Up @@ -379,6 +379,30 @@ void PluginManager::loadAllPlugins() {
}
}

void PluginManager::loadAllPluginsOfType(PluginType type) {
for (ProviderList::iterator pp = _providers.begin();
pp != _providers.end();
++pp) {
PluginList pl((*pp)->getPlugins());
for (PluginList::iterator p = pl.begin();
p != pl.end();
++p) {
if ((*p)->loadPlugin()) {
if ((*p)->getType() == type) {
addToPluginsInMemList((*p));
} else {
// Plugin is wrong type
(*p)->unloadPlugin();
delete (*p);
}
} else {
// Plugin did not load
delete (*p);
}
}
}
}

void PluginManager::unloadAllPlugins() {
for (int i = 0; i < PLUGIN_TYPE_MAX; i++)
unloadPluginsExcept((PluginType)i, NULL);
Expand Down
4 changes: 3 additions & 1 deletion base/plugins.h
Expand Up @@ -320,6 +320,7 @@ class PluginManager {

// Functions used only by the cached PluginManager
virtual void loadAllPlugins();
virtual void loadAllPluginsOfType(PluginType type);
void unloadAllPlugins();

void unloadPluginsExcept(PluginType type, const Plugin *plugin, bool deletePlugin = true);
Expand Down Expand Up @@ -347,7 +348,8 @@ class PluginManagerUncached : public PluginManager {
virtual bool loadPluginFromGameId(const Common::String &gameId);
virtual void updateConfigWithFileName(const Common::String &gameId);

virtual void loadAllPlugins() {} // we don't allow this
virtual void loadAllPlugins() {} // we don't allow these
virtual void loadAllPluginsOfType(PluginType type) {}
};

#endif

0 comments on commit 6d11f46

Please sign in to comment.