aboutsummaryrefslogtreecommitdiff
path: root/base/plugins.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/plugins.h')
-rw-r--r--base/plugins.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/base/plugins.h b/base/plugins.h
index a4c7f114f9..5472ab2fce 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -30,6 +30,7 @@
#include "common/error.h"
#include "common/singleton.h"
#include "common/util.h"
+#include "backends/plugins/elf/version.h"
namespace Common {
class FSList;
@@ -90,6 +91,21 @@ extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
#define PLUGIN_ENABLED_DYNAMIC(ID) \
(ENABLE_##ID && (ENABLE_##ID == DYNAMIC_PLUGIN) && DYNAMIC_MODULES)
+// see comments in backends/plugins/elf/elf-provider.cpp
+#if defined(USE_ELF_LOADER) && defined(ELF_LOADER_CXA_ATEXIT)
+#define PLUGIN_DYNAMIC_DSO_HANDLE \
+ uint32 __dso_handle __attribute__((visibility("hidden"))) = 0;
+#else
+#define PLUGIN_DYNAMIC_DSO_HANDLE
+#endif
+
+#ifdef USE_ELF_LOADER
+#define PLUGIN_DYNAMIC_BUILD_DATE \
+ PLUGIN_EXPORT const char *PLUGIN_getBuildDate() { return gScummVMPluginBuildDate; }
+#else
+#define PLUGIN_DYNAMIC_BUILD_DATE
+#endif
+
/**
* REGISTER_PLUGIN_STATIC is a convenience macro which is used to declare
* the plugin interface for static plugins. Code (such as game engines)
@@ -119,6 +135,8 @@ extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
*/
#define REGISTER_PLUGIN_DYNAMIC(ID,TYPE,PLUGINCLASS) \
extern "C" { \
+ PLUGIN_DYNAMIC_DSO_HANDLE \
+ PLUGIN_DYNAMIC_BUILD_DATE \
PLUGIN_EXPORT int32 PLUGIN_getVersion() { return PLUGIN_VERSION; } \
PLUGIN_EXPORT int32 PLUGIN_getType() { return TYPE; } \
PLUGIN_EXPORT int32 PLUGIN_getTypeVersion() { return TYPE##_VERSION; } \
@@ -212,6 +230,11 @@ public:
* @return a list of Plugin instances
*/
virtual PluginList getPlugins() = 0;
+
+ /**
+ * @return whether or not object is a FilePluginProvider.
+ */
+ virtual bool isFilePluginProvider() { return false; }
};
#ifdef DYNAMIC_MODULES
@@ -234,6 +257,11 @@ public:
*/
virtual PluginList getPlugins();
+ /**
+ * @return whether or not object is a FilePluginProvider.
+ */
+ bool isFilePluginProvider() { return true; }
+
protected:
/**
* Create a Plugin instance from a loadable code module with the specified name.
@@ -276,8 +304,15 @@ private:
PluginList _plugins[PLUGIN_TYPE_MAX];
ProviderList _providers;
- bool tryLoadPlugin(Plugin *plugin);
+ PluginList _allPlugs;
+ PluginList::iterator _currentPlugin;
+ bool _skipStaticPlugs;
+
+ uint _nonEnginePlugs;
+
+ bool tryLoadPlugin(Plugin *plugin);
+
friend class Common::Singleton<SingletonBaseType>;
PluginManager();
@@ -286,6 +321,9 @@ public:
void addPluginProvider(PluginProvider *pp);
+ void loadFirstPlugin();
+ bool loadNextPlugin();
+
void loadPlugins();
void unloadPlugins();
void unloadPluginsExcept(PluginType type, const Plugin *plugin);