mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-20 19:21:46 +00:00
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.
This commit is contained in:
parent
cb2bb8fac7
commit
f17a7a96da
@ -181,15 +181,15 @@ PluginList ELFPluginProvider::getPlugins() {
|
||||
PluginList pl = FilePluginProvider::getPlugins();
|
||||
|
||||
#if defined(UNCACHED_PLUGINS) && !defined(ELF_NO_MEM_MANAGER)
|
||||
if (!pl.empty()) {
|
||||
// This static downcast is safe because all of the plugins must
|
||||
// be ELF plugins
|
||||
for (PluginList::iterator p = pl.begin(); p != pl.end(); ++p) {
|
||||
(static_cast<ELFPlugin *>(*p))->trackSize();
|
||||
}
|
||||
// This static downcast is safe because all of the plugins must
|
||||
// be ELF plugins
|
||||
for (PluginList::iterator p = pl.begin(); p != pl.end(); ++p) {
|
||||
(static_cast<ELFPlugin *>(*p))->trackSize();
|
||||
}
|
||||
|
||||
// The Memory Manager should now allocate space based on the information
|
||||
// it collected
|
||||
// The Memory Manager should now allocate space based on the information
|
||||
// it collected
|
||||
if (!pl.empty()) {
|
||||
ELFMemMan.allocateHeap();
|
||||
}
|
||||
#endif
|
||||
|
@ -78,9 +78,13 @@ void ELFMemoryManager::trackAlloc(uint32 align, uint32 size) {
|
||||
}
|
||||
|
||||
void ELFMemoryManager::allocateHeap() {
|
||||
if (!_heapSize) {
|
||||
warning("ELFMemoryManager: Unable to allocate the heap as its size could not be determined.");
|
||||
return;
|
||||
}
|
||||
|
||||
// The memory manager should only allocate once
|
||||
assert (!_heap);
|
||||
assert (_heapSize);
|
||||
|
||||
// clear the list
|
||||
_allocList.clear();
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user