mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 00:15:30 +00:00
Provide unloading of unneeded plugins.
svn-id: r14829
This commit is contained in:
parent
ca6ad7a76f
commit
f6af7cdcc7
@ -381,8 +381,14 @@ extern "C" int scummvm_main(GameDetector &detector, int argc, char *argv[]) {
|
||||
//while(1) {
|
||||
// Verify the given game name is a valid supported game
|
||||
if (detector.detectMain()) {
|
||||
// Unload all plugins not needed for this game,
|
||||
// to save memory
|
||||
PluginManager::instance().unloadPluginsExcept(detector._plugin);
|
||||
|
||||
runGame(detector, system);
|
||||
|
||||
// PluginManager::instance().unloadPlugins();
|
||||
// PluginManager::instance().loadPlugins();
|
||||
// launcherDialog(detector, system);
|
||||
}
|
||||
//}
|
||||
|
@ -265,12 +265,24 @@ void PluginManager::loadPlugins() {
|
||||
}
|
||||
|
||||
void PluginManager::unloadPlugins() {
|
||||
unloadPluginsExcept(NULL);
|
||||
}
|
||||
|
||||
void PluginManager::unloadPluginsExcept(const Plugin *plugin) {
|
||||
Plugin *found = NULL;
|
||||
uint i;
|
||||
for (i = 0; i < _plugins.size(); i++) {
|
||||
_plugins[i]->unloadPlugin();
|
||||
delete _plugins[i];
|
||||
if (_plugins[i] == plugin) {
|
||||
found = _plugins[i];
|
||||
} else {
|
||||
_plugins[i]->unloadPlugin();
|
||||
delete _plugins[i];
|
||||
}
|
||||
}
|
||||
_plugins.clear();
|
||||
if (found != NULL) {
|
||||
_plugins.push_back(found);
|
||||
}
|
||||
}
|
||||
|
||||
bool PluginManager::tryLoadPlugin(Plugin *plugin) {
|
||||
|
@ -123,6 +123,7 @@ public:
|
||||
|
||||
void loadPlugins();
|
||||
void unloadPlugins();
|
||||
void unloadPluginsExcept(const Plugin *plugin);
|
||||
|
||||
const PluginList &getPlugins() { return _plugins; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user