aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/commandLine.cpp14
-rw-r--r--base/plugins.cpp48
-rw-r--r--base/plugins.h21
3 files changed, 45 insertions, 38 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 573cb59c79..a4c867edee 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -116,14 +116,14 @@ static const char HELP_STRING[] =
" --render-mode=MODE Enable additional render modes (cga, ega, hercGreen,\n"
" hercAmber, amiga)\n"
"\n"
-#if !defined(DISABLE_SKY) || !defined(DISABLE_QUEEN)
+#if defined(ENABLE_SKY) || defined(ENABLE_QUEEN)
" --alt-intro Use alternative intro for CD versions of Beneath a\n"
" Steel Sky and Flight of the Amazon Queen\n"
#endif
" --copy-protection Enable copy protection in SCUMM games, when\n"
" ScummVM disables it by default.\n"
" --talkspeed=NUM Set talk speed for games (default: 60)\n"
-#ifndef DISABLE_SCUMM
+#ifdef ENABLE_SCUMM
" --demo-mode Start demo mode of Maniac Mansion\n"
" --tempo=NUM Set music tempo (in percent, 50-200) for SCUMM games\n"
" (default: 100)\n"
@@ -190,19 +190,19 @@ void registerDefaults() {
ConfMan.registerDefault("save_slot", -1);
ConfMan.registerDefault("autosave_period", 5 * 60); // By default, trigger autosave every 5 minutes
-#if !defined(DISABLE_SCUMM) || !defined(DISABLE_SWORD2)
+#if defined(ENABLE_SCUMM) || defined(ENABLE_SWORD2)
ConfMan.registerDefault("object_labels", true);
#endif
ConfMan.registerDefault("copy_protection", false);
ConfMan.registerDefault("talkspeed", 60);
-#ifndef DISABLE_SCUMM
+#ifdef ENABLE_SCUMM
ConfMan.registerDefault("demo_mode", false);
ConfMan.registerDefault("tempo", 0);
#endif
-#if !defined(DISABLE_SKY) || !defined(DISABLE_QUEEN)
+#if defined(ENABLE_SKY) || defined(ENABLE_QUEEN)
ConfMan.registerDefault("alt_intro", false);
#endif
@@ -513,7 +513,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar
DO_LONG_OPTION("target-md5")
END_OPTION
-#ifndef DISABLE_SCUMM
+#ifdef ENABLE_SCUMM
DO_LONG_OPTION_INT("tempo")
END_OPTION
@@ -521,7 +521,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar
END_OPTION
#endif
-#if !defined(DISABLE_SKY) || !defined(DISABLE_QUEEN)
+#if defined(ENABLE_SKY) || defined(ENABLE_QUEEN)
DO_LONG_OPTION_BOOL("alt-intro")
END_OPTION
#endif
diff --git a/base/plugins.cpp b/base/plugins.cpp
index c62d1a00b9..9e2c2599ce 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -63,7 +63,6 @@ SaveStateList Plugin::listSaves(const char *target) const {
}
-#ifndef DYNAMIC_MODULES
class StaticPlugin : public Plugin {
public:
StaticPlugin(PluginObject *pluginobject, PluginType type) {
@@ -100,61 +99,61 @@ public:
// "Loader" for the static plugins.
// Iterate over all registered (static) plugins and load them.
- #ifndef DISABLE_SCUMM
+ #if PLUGIN_ENABLED_STATIC(SCUMM)
LINK_PLUGIN(SCUMM)
#endif
- #ifndef DISABLE_AGI
+ #if PLUGIN_ENABLED_STATIC(AGI)
LINK_PLUGIN(AGI)
#endif
- #ifndef DISABLE_AGOS
+ #if PLUGIN_ENABLED_STATIC(AGOS)
LINK_PLUGIN(AGOS)
#endif
- #ifndef DISABLE_CINE
+ #if PLUGIN_ENABLED_STATIC(CINE)
LINK_PLUGIN(CINE)
#endif
- #ifndef DISABLE_CRUISE
+ #if PLUGIN_ENABLED_STATIC(CRUISE)
LINK_PLUGIN(CRUISE)
#endif
- #ifndef DISABLE_DRASCULA
+ #if PLUGIN_ENABLED_STATIC(DRASCULA)
LINK_PLUGIN(DRASCULA)
#endif
- #ifndef DISABLE_GOB
+ #if PLUGIN_ENABLED_STATIC(GOB)
LINK_PLUGIN(GOB)
#endif
- #ifndef DISABLE_IGOR
+ #if PLUGIN_ENABLED_STATIC(IGOR)
LINK_PLUGIN(IGOR)
#endif
- #ifndef DISABLE_KYRA
+ #if PLUGIN_ENABLED_STATIC(KYRA)
LINK_PLUGIN(KYRA)
#endif
- #ifndef DISABLE_LURE
+ #if PLUGIN_ENABLED_STATIC(LURE)
LINK_PLUGIN(LURE)
#endif
- #ifndef DISABLE_M4
+ #if PLUGIN_ENABLED_STATIC(M4)
LINK_PLUGIN(M4)
#endif
- #ifndef DISABLE_MADE
+ #if PLUGIN_ENABLED_STATIC(MADE)
LINK_PLUGIN(MADE)
#endif
- #ifndef DISABLE_PARALLACTION
+ #if PLUGIN_ENABLED_STATIC(PARALLACTION)
LINK_PLUGIN(PARALLACTION)
#endif
- #ifndef DISABLE_QUEEN
+ #if PLUGIN_ENABLED_STATIC(QUEEN)
LINK_PLUGIN(QUEEN)
#endif
- #ifndef DISABLE_SAGA
+ #if PLUGIN_ENABLED_STATIC(SAGA)
LINK_PLUGIN(SAGA)
#endif
- #ifndef DISABLE_SKY
+ #if PLUGIN_ENABLED_STATIC(SKY)
LINK_PLUGIN(SKY)
#endif
- #ifndef DISABLE_SWORD1
+ #if PLUGIN_ENABLED_STATIC(SWORD1)
LINK_PLUGIN(SWORD1)
#endif
- #ifndef DISABLE_SWORD2
+ #if PLUGIN_ENABLED_STATIC(SWORD2)
LINK_PLUGIN(SWORD2)
#endif
- #ifndef DISABLE_TOUCHE
+ #if PLUGIN_ENABLED_STATIC(TOUCHE)
LINK_PLUGIN(TOUCHE)
#endif
@@ -162,7 +161,7 @@ public:
}
};
-#else
+#ifdef DYNAMIC_MODULES
PluginList FilePluginProvider::getPlugins() {
PluginList pl;
@@ -222,18 +221,15 @@ void FilePluginProvider::addCustomDirectories(Common::StringList &dirs) const {
#endif
}
-#endif
+#endif // DYNAMIC_MODULES
#pragma mark -
DECLARE_SINGLETON(PluginManager);
PluginManager::PluginManager() {
-#ifndef DYNAMIC_MODULES
- // Add the static plugin provider if we do not build with dynamic
- // plugins.
+ // Always add the static plugin provider.
addPluginProvider(new StaticPluginProvider());
-#endif
}
PluginManager::~PluginManager() {
diff --git a/base/plugins.h b/base/plugins.h
index f317a533ae..ca08a0c628 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -100,6 +100,15 @@ public:
};
+#define STATIC_PLUGIN 1
+#define DYNAMIC_PLUGIN 2
+
+#define PLUGIN_ENABLED_STATIC(ID) \
+ (defined(ENABLE_##ID) && !PLUGIN_ENABLED_DYNAMIC(ID))
+
+#define PLUGIN_ENABLED_DYNAMIC(ID) \
+ (defined(ENABLE_##ID) && (ENABLE_##ID == DYNAMIC_PLUGIN) && defined(DYNAMIC_MODULES))
+
/**
* REGISTER_PLUGIN is a convenience macro meant to ease writing
* the plugin interface for our modules. In particular, using it
@@ -109,15 +118,16 @@ public:
* @todo add some means to query the plugin API version etc.
*/
-#ifndef DYNAMIC_MODULES
-#define REGISTER_PLUGIN(ID,TYPE,PLUGINCLASS) \
+#define REGISTER_PLUGIN_STATIC(ID,TYPE,PLUGINCLASS) \
PluginType g_##ID##_type = TYPE; \
PluginObject *g_##ID##_getObject() { \
return new PLUGINCLASS(); \
} \
void dummyFuncToAllowTrailingSemicolon()
-#else
-#define REGISTER_PLUGIN(ID,TYPE,PLUGINCLASS) \
+
+#ifdef DYNAMIC_MODULES
+
+#define REGISTER_PLUGIN_DYNAMIC(ID,TYPE,PLUGINCLASS) \
extern "C" { \
PLUGIN_EXPORT int32 PLUGIN_getVersion() { return PLUGIN_VERSION; } \
PLUGIN_EXPORT int32 PLUGIN_getType() { return TYPE; } \
@@ -127,7 +137,8 @@ public:
} \
} \
void dummyFuncToAllowTrailingSemicolon()
-#endif
+
+#endif // DYNAMIC_MODULES
/** List of plugins. */