diff --git a/base/plugins.cpp b/base/plugins.cpp index 14870561a6f..b0675c6e5a0 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -409,6 +409,20 @@ bool PluginManagerUncached::loadPluginFromEngineId(const Common::String &engineI } } } + // Check for a plugin with the same name as the engine before starting + // to scan all plugins + Common::String tentativeEnginePluginFilename = engineId; +#ifdef PLUGIN_SUFFIX + tentativeEnginePluginFilename += PLUGIN_SUFFIX; +#endif + for (PluginList::iterator p = _allEnginePlugins.begin(); p != _allEnginePlugins.end(); ++p) { + Common::String filename = (*p)->getFileName(); + if (filename.hasSuffixIgnoreCase(tentativeEnginePluginFilename)) { + if (loadPluginByFileName(filename)) { + return true; + } + } + } return false; }