diff options
author | Max Horn | 2006-10-07 01:05:12 +0000 |
---|---|---|
committer | Max Horn | 2006-10-07 01:05:12 +0000 |
commit | df5be194098e188f9cd3234af2bea34b67d19da2 (patch) | |
tree | e9b797f971d73146f4f9e973168f4fe8bc79bb42 /base | |
parent | c8a21d19d164d40fc543d3a908789ee249a292fc (diff) | |
download | scummvm-rg350-df5be194098e188f9cd3234af2bea34b67d19da2.tar.gz scummvm-rg350-df5be194098e188f9cd3234af2bea34b67d19da2.tar.bz2 scummvm-rg350-df5be194098e188f9cd3234af2bea34b67d19da2.zip |
Instantiate and hook up the plugin providers in the main() function of the corresponding backends (porters may have to update their ports if they were using the POSIX or Win32 module loading code implicitly); some cleanup
svn-id: r24153
Diffstat (limited to 'base')
-rw-r--r-- | base/plugins.cpp | 50 | ||||
-rw-r--r-- | base/plugins.h | 1 |
2 files changed, 17 insertions, 34 deletions
diff --git a/base/plugins.cpp b/base/plugins.cpp index a1c73560a9..326b56be82 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -21,20 +21,8 @@ * */ -#include "common/stdafx.h" #include "base/plugins.h" #include "common/util.h" -#include "common/fs.h" - -#ifdef DYNAMIC_MODULES - #if defined(UNIX) - #include "backends/plugins/posix/posix-provider.h" - #elif defined(__DC__) - #include "backends/plugins/dc/dc-provider.h" - #elif defined(_WIN32) - #include "backends/plugins/win32/win32-provider.h" - #endif -#endif void DetectedGame::updateDesc(const char *extra) { @@ -162,8 +150,7 @@ public: #ifndef DISABLE_AGI LINK_PLUGIN(AGI) #endif - - + return pl; } }; @@ -176,22 +163,9 @@ public: DECLARE_SINGLETON(PluginManager); PluginManager::PluginManager() { - -// FIXME: The following code should be moved to the backend specific code, -// usually into the main() function just before scummvm_main is called -#ifdef DYNAMIC_MODULES - -#if defined(UNIX) - addPluginProvider(new POSIXPluginProvider()); -#elif defined(__DC__) - addPluginProvider(new DCPluginProvider()); -#elif defined(_WIN32) - addPluginProvider(new Win32PluginProvider()); -#else -#error No support for loading plugins on non-unix systems at this point! -#endif - -#else +#ifndef DYNAMIC_MODULES + // Add the static plugin provider if we do not build with dynamic + // plugins. addPluginProvider(new StaticPluginProvider()); #endif } @@ -199,6 +173,13 @@ PluginManager::PluginManager() { PluginManager::~PluginManager() { // Explicitly unload all loaded plugins unloadPlugins(); + + // Delete the plugin providers + for (ProviderList::iterator pp = _providers.begin(); + pp != _providers.end(); + ++pp) { + delete *pp; + } } void PluginManager::addPluginProvider(PluginProvider *pp) { @@ -224,12 +205,13 @@ void PluginManager::unloadPlugins() { void PluginManager::unloadPluginsExcept(const Plugin *plugin) { Plugin *found = NULL; uint i; + for (PluginList::iterator p = _plugins.begin(); p != _plugins.end(); ++p) for (i = 0; i < _plugins.size(); i++) { - if (_plugins[i] == plugin) { - found = _plugins[i]; + if (*p == plugin) { + found = *p; } else { - _plugins[i]->unloadPlugin(); - delete _plugins[i]; + (**p).unloadPlugin(); + delete *p; } } _plugins.clear(); diff --git a/base/plugins.h b/base/plugins.h index acaa637162..e5a6882e39 100644 --- a/base/plugins.h +++ b/base/plugins.h @@ -24,6 +24,7 @@ #ifndef BASE_PLUGINS_H #define BASE_PLUGINS_H +#include "common/stdafx.h" #include "common/array.h" #include "common/list.h" #include "common/singleton.h" |