aboutsummaryrefslogtreecommitdiff
path: root/backends/plugins/dc
diff options
context:
space:
mode:
authorJordi Vilalta Prat2008-05-02 14:30:06 +0000
committerJordi Vilalta Prat2008-05-02 14:30:06 +0000
commit3f44977885d33ea694df399a83cf198dd85b5fed (patch)
treec081843c9cd64d3e077482fbc7f43bbf3b39d087 /backends/plugins/dc
parent6a98108eac1203eaf1058fa24ad9c80fc9ba45a8 (diff)
downloadscummvm-rg350-3f44977885d33ea694df399a83cf198dd85b5fed.tar.gz
scummvm-rg350-3f44977885d33ea694df399a83cf198dd85b5fed.tar.bz2
scummvm-rg350-3f44977885d33ea694df399a83cf198dd85b5fed.zip
Added support to load plugins from different directories and the ability to specify the default directory from configure.
svn-id: r31816
Diffstat (limited to 'backends/plugins/dc')
-rw-r--r--backends/plugins/dc/dc-provider.cpp43
-rw-r--r--backends/plugins/dc/dc-provider.h13
2 files changed, 13 insertions, 43 deletions
diff --git a/backends/plugins/dc/dc-provider.cpp b/backends/plugins/dc/dc-provider.cpp
index 6ca524150b..1cae4bbd32 100644
--- a/backends/plugins/dc/dc-provider.cpp
+++ b/backends/plugins/dc/dc-provider.cpp
@@ -27,12 +27,8 @@
#include "backends/plugins/dc/dc-provider.h"
#include "backends/plugins/dynamic-plugin.h"
-#include "common/fs.h"
#include "dcloader.h"
-#define PLUGIN_DIRECTORY "/"
-#define PLUGIN_PREFIX ""
-#define PLUGIN_SUFFIX ".PLG"
class DCPlugin : public DynamicPlugin {
@@ -75,6 +71,7 @@ public:
return ret;
}
+
void unloadPlugin() {
DynamicPlugin::unloadPlugin();
if (_dlHandle) {
@@ -86,42 +83,8 @@ public:
};
-PluginList DCPluginProvider::getPlugins() {
- PluginList pl;
-
-
- // Load dynamic plugins
- // TODO... this is right now just a nasty hack.
- // This should search one or multiple directories for all plugins it can
- // find (to this end, we maybe should use a special prefix/suffix; e.g.
- // instead of libscumm.so, use scumm.engine or scumm.plugin etc.).
- //
- // The list of directories to search could be e.g.:
- // User specified (via config file), ".", "./plugins", "$(prefix)/lib".
- //
- // We also need to add code which ensures what we are looking at is
- // a) a ScummVM engine and b) matches the version of the executable.
- // Hence one more symbol should be exported by plugins which returns
- // the "ABI" version the plugin was built for, and we can compare that
- // to the ABI version of the executable.
-
- // Load all plugins.
- // Scan for all plugins in this directory
- FilesystemNode dir(PLUGIN_DIRECTORY);
- FSList files;
- if (!dir.getChildren(files, FilesystemNode::kListFilesOnly)) {
- error("Couldn't open plugin directory '%s'", PLUGIN_DIRECTORY);
- }
-
- for (FSList::const_iterator i = files.begin(); i != files.end(); ++i) {
- Common::String name(i->getName());
- if (name.hasPrefix(PLUGIN_PREFIX) && name.hasSuffix(PLUGIN_SUFFIX)) {
- pl.push_back(new DCPlugin(i->getPath()));
- }
- }
-
-
- return pl;
+Plugin* SDLPluginProvider::createPlugin(const Common::String &filename) const {
+ return new DCPlugin(filename);
}
diff --git a/backends/plugins/dc/dc-provider.h b/backends/plugins/dc/dc-provider.h
index f13bdf0636..1b96f55d4d 100644
--- a/backends/plugins/dc/dc-provider.h
+++ b/backends/plugins/dc/dc-provider.h
@@ -30,9 +30,16 @@
#if defined(DYNAMIC_MODULES) && defined(__DC__)
-class DCPluginProvider : public PluginProvider {
-public:
- virtual PluginList getPlugins();
+class DCPluginProvider : public FilePluginProvider {
+protected:
+ Plugin* createPlugin(const Common::String &filename) const;
+
+ virtual const char* getPrefix() const { return ""; }
+ virtual const char* getSuffix() const { return ".PLG"; }
+
+ virtual void addCustomDirectories(Common::StringList &dirs) const {
+ dirs.push_back("/");
+ }
};
#endif // defined(DYNAMIC_MODULES) && defined(__DC__)