aboutsummaryrefslogtreecommitdiff
path: root/base/plugins.cpp
diff options
context:
space:
mode:
authorYotam Barnoy2010-12-23 07:54:54 +0000
committerYotam Barnoy2010-12-23 07:54:54 +0000
commit81dd62f3cb5b1fa6c303bbc240a759e0d5324086 (patch)
treeddc83a9ee1216c9344f156300b85b230ea444c60 /base/plugins.cpp
parent8cc28b218c3727a1b55fe135ba60a336760b70b1 (diff)
downloadscummvm-rg350-81dd62f3cb5b1fa6c303bbc240a759e0d5324086.tar.gz
scummvm-rg350-81dd62f3cb5b1fa6c303bbc240a759e0d5324086.tar.bz2
scummvm-rg350-81dd62f3cb5b1fa6c303bbc240a759e0d5324086.zip
PLUGINS: don't fully load each plugins at startup for single plugin method
The reason to load each plugin was to figure out if it's a sound or engine plugin. Since all our plugin files are currently engines, there's no reason to load every file. If we get dynamic sound plugins, it'd be a good idea to make a quick and easy way to know which kind of plugin it is (e.g. a prefix or suffix in the filename). svn-id: r55021
Diffstat (limited to 'base/plugins.cpp')
-rw-r--r--base/plugins.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/base/plugins.cpp b/base/plugins.cpp
index e881944a1b..ab09b26027 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -338,16 +338,20 @@ void PluginManager::loadNonEnginePluginsAndEnumerate() {
pp != _providers.end();
++pp) {
PluginList pl((*pp)->getPlugins());
+
for (PluginList::iterator p = pl.begin(); p != pl.end(); ++p) {
- // To find out which are engine plugins, we have to load them. This is inefficient
- // Hopefully another way can be found (e.g. if the music plugins are all static,
- // we can use only the static provider
- if ((*p)->loadPlugin()) {
+ // This is a 'hack' based on the assumption that we have no sound
+ // file plugins. Currently this is the case. If it changes, we
+ // should find a fast way of detecting whether a plugin is a
+ // music or an engine plugin.
+ if ((*pp)->isFilePluginProvider()) {
+ _allEnginePlugins.push_back(*p);
+ } else if ((*p)->loadPlugin()) { // and this is the proper method
if ((*p)->getType() == PLUGIN_TYPE_ENGINE) {
- (*p)->unloadPlugin(); // to prevent fragmentation
+ (*p)->unloadPlugin();
_allEnginePlugins.push_back(*p);
} else { // add non-engine plugins to the 'in-memory' list
- // these won't ever get unloaded (in this implementation)
+ // these won't ever get unloaded
addToPluginsInMemList(*p);
}
}