aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorJordi Vilalta Prat2008-02-08 01:02:25 +0000
committerJordi Vilalta Prat2008-02-08 01:02:25 +0000
commit00987db3a97f37439cfc6e70991a08fde424d2b3 (patch)
tree5b537564da7280d60668bd947e31d7b4c6e1e087 /base
parentc103290e2b123510e9d9eb4716ae0336a9e61ede (diff)
downloadscummvm-rg350-00987db3a97f37439cfc6e70991a08fde424d2b3.tar.gz
scummvm-rg350-00987db3a97f37439cfc6e70991a08fde424d2b3.tar.bz2
scummvm-rg350-00987db3a97f37439cfc6e70991a08fde424d2b3.zip
Implemented plugin versioning
svn-id: r30826
Diffstat (limited to 'base')
-rw-r--r--base/plugins.cpp4
-rw-r--r--base/plugins.h13
2 files changed, 15 insertions, 2 deletions
diff --git a/base/plugins.cpp b/base/plugins.cpp
index bb4ef309ed..e7b1faff94 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -26,6 +26,10 @@
#include "base/plugins.h"
#include "common/util.h"
+int pluginTypeVersions[PLUGIN_TYPE_MAX] = {
+ PLUGIN_TYPE_ENGINE_VERSION,
+};
+
PluginType Plugin::getType() const {
return _type;
}
diff --git a/base/plugins.h b/base/plugins.h
index f3022e7010..6da8af0ab0 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -48,12 +48,21 @@ public:
#include "engines/metaengine.h"
+// Global Plugin API version
+#define PLUGIN_VERSION 1
+
enum PluginType {
PLUGIN_TYPE_ENGINE = 0,
PLUGIN_TYPE_MAX
};
+// TODO: Make the engine API version depend on ScummVM's version
+// because of the backlinking
+#define PLUGIN_TYPE_ENGINE_VERSION 1
+
+extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
+
class Engine;
class FSList;
class OSystem;
@@ -83,8 +92,6 @@ public:
const char *getName() const;
const char *getCopyright() const;
-// virtual int getVersion() const { return 0; } // TODO!
-
PluginError createInstance(OSystem *syst, Engine **engine) const;
GameList getSupportedGames() const;
GameDescriptor findGame(const char *gameid) const;
@@ -112,7 +119,9 @@ public:
#else
#define REGISTER_PLUGIN(ID,TYPE,PLUGINCLASS) \
extern "C" { \
+ PLUGIN_EXPORT int32 PLUGIN_getVersion() { return PLUGIN_VERSION; } \
PLUGIN_EXPORT int32 PLUGIN_getType() { return TYPE; } \
+ PLUGIN_EXPORT int32 PLUGIN_getTypeVersion() { return TYPE##_VERSION; } \
PLUGIN_EXPORT PluginObject *PLUGIN_getObject() { \
return new PLUGINCLASS(); \
} \