diff options
author | Bastien Bouclet | 2020-01-04 17:21:53 +0100 |
---|---|---|
committer | Bastien Bouclet | 2020-01-04 17:49:32 +0100 |
commit | f17a7a96da9f51c5c4735ff34f985516157fcbef (patch) | |
tree | aff5df2f68b56925ad2a95779a80317d1ddf1a91 /base | |
parent | cb2bb8fac7356e5f8231f855a8aa26d32ea9befa (diff) | |
download | scummvm-rg350-f17a7a96da9f51c5c4735ff34f985516157fcbef.tar.gz scummvm-rg350-f17a7a96da9f51c5c4735ff34f985516157fcbef.tar.bz2 scummvm-rg350-f17a7a96da9f51c5c4735ff34f985516157fcbef.zip |
BASE: Fix being unable to run games when using dynamic plugins
When the plugin-engine mapping is not cached in the configuration file,
we were not scanning all the plugins to establish the mapping.
This is a regression from commit: e2d91258b7bfb989dc099f516bb31ceb44554529
This commit reverts the offending commit and implements a proper fix for
the case where there are no dynamic plugins.
Fixes #11300.
Diffstat (limited to 'base')
-rw-r--r-- | base/plugins.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/base/plugins.cpp b/base/plugins.cpp index 490ca33821..cb9d172d0b 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -357,6 +357,9 @@ void PluginManagerUncached::loadFirstPlugin() { bool PluginManagerUncached::loadNextPlugin() { unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false); + if (!_currentPlugin) + return false; + for (++_currentPlugin; _currentPlugin != _allEnginePlugins.end(); ++_currentPlugin) { if ((*_currentPlugin)->loadPlugin()) { addToPluginsInMemList(*_currentPlugin); @@ -533,7 +536,7 @@ DetectionResults EngineManager::detectGames(const Common::FSList &fslist) const DetectedGames candidates; PluginList plugins; PluginList::const_iterator iter; - PluginManager::instance().loadFirstPlugin(); + PluginMan.loadFirstPlugin(); do { plugins = getPlugins(); // Iterate over all known games and for each check if it might be @@ -549,7 +552,7 @@ DetectionResults EngineManager::detectGames(const Common::FSList &fslist) const } } - } while (PluginManager::instance().loadNextPlugin()); + } while (PluginMan.loadNextPlugin()); return DetectionResults(candidates); } @@ -641,18 +644,15 @@ const Plugin *EngineManager::findPlugin(const Common::String &engineId) const { } // We failed to find it using the engine ID. Scan the list of plugins - const PluginList &plugins = getPlugins(); - if (!plugins.empty()) { - PluginMan.loadFirstPlugin(); - do { - plugin = findLoadedPlugin(engineId); - if (plugin) { - // Update with new plugin file name - PluginMan.updateConfigWithFileName(engineId); - return plugin; - } - } while (PluginMan.loadNextPlugin()); - } + PluginMan.loadFirstPlugin(); + do { + plugin = findLoadedPlugin(engineId); + if (plugin) { + // Update with new plugin file name + PluginMan.updateConfigWithFileName(engineId); + return plugin; + } + } while (PluginMan.loadNextPlugin()); return 0; } |