aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.common16
-rw-r--r--backends/morphos/morphos_start.cpp2
-rw-r--r--base/.cvsignore1
-rw-r--r--base/gameDetector.cpp (renamed from common/gameDetector.cpp)50
-rw-r--r--base/gameDetector.h (renamed from common/gameDetector.h)4
-rw-r--r--base/main.cpp (renamed from common/main.cpp)4
-rw-r--r--base/module.mk16
-rw-r--r--base/plugins.cpp (renamed from common/plugins.cpp)4
-rw-r--r--base/plugins.h (renamed from common/plugins.h)0
-rw-r--r--common/engine.cpp2
-rw-r--r--common/module.mk1
-rw-r--r--gui/launcher.cpp5
-rw-r--r--gui/options.cpp2
-rw-r--r--scumm/charset.cpp2
-rw-r--r--scumm/imuse.cpp2
-rw-r--r--scumm/scummvm.cpp2
-rw-r--r--simon/simon.cpp2
-rw-r--r--sky/control.cpp2
-rw-r--r--sky/logic.cpp2
-rw-r--r--sky/sky.cpp2
-rw-r--r--sword2/sword2.cpp2
21 files changed, 55 insertions, 68 deletions
diff --git a/Makefile.common b/Makefile.common
index 9e86893506..7e10a67a0b 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -45,6 +45,8 @@ PLUGIN_SUFFIX := .a
# Module settings
######################################################################
+MODULES := base $(MODULES)
+
ifdef DISABLE_SCUMM
DEFINES += -DDISABLE_SCUMM
else
@@ -88,18 +90,12 @@ CPPFLAGS:= $(DEFINES) $(INCLUDES)
# Include the build instructions for all modules
-include $(addsuffix /module.mk,$(MODULES))
-# Make engine.o depend on all other object files. This way if anything is
-# changed, it causes engine.cpp to be recompiled. This in turn ensures that
+# Make main.o depend on all other object files. This way if anything is
+# changed, it causes main.cpp to be recompiled. This in turn ensures that
# the build date in gScummVMBuildDate is correct.
-common/main.o: $(OBJS)
-
-# Some files depend on the values of the DISABLE_* flags; we let these
-# depend on config.mak, so that they get recompiled if config.mak changes.
-common/plugins.o common/gameDetector.o: config.mak
-
-# HACK temporary fix to get compilation on OS X (and possibly others) working again
-OBJS:=common/main.o common/gameDetector.o $(OBJS)
+base/main.o: $(OBJS)
+# The build rule for the ScummVM executable
scummvm$(EXEEXT): $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $+ $(LIBS)
diff --git a/backends/morphos/morphos_start.cpp b/backends/morphos/morphos_start.cpp
index a1cf354aa3..fafba9683c 100644
--- a/backends/morphos/morphos_start.cpp
+++ b/backends/morphos/morphos_start.cpp
@@ -35,7 +35,7 @@
#include "stdafx.h"
#include "scumm/scumm.h"
-#include "common/gameDetector.h"
+#include "base/gameDetector.h"
#include "common/scaler.h"
#include "sound/mididrv.h"
#include "morphos.h"
diff --git a/base/.cvsignore b/base/.cvsignore
new file mode 100644
index 0000000000..39a06683b7
--- /dev/null
+++ b/base/.cvsignore
@@ -0,0 +1 @@
+.deps
diff --git a/common/gameDetector.cpp b/base/gameDetector.cpp
index fac5292b19..a7f468f4fa 100644
--- a/common/gameDetector.cpp
+++ b/base/gameDetector.cpp
@@ -22,10 +22,10 @@
#include "stdafx.h"
#include "backends/intern.h"
+#include "base/gameDetector.h"
+#include "base/plugins.h"
#include "common/config-file.h"
#include "common/engine.h"
-#include "common/gameDetector.h"
-#include "common/plugins.h"
#include "common/scaler.h" // Only for gfx_modes
#include "sound/mididrv.h"
#include "sound/mixer.h"
@@ -191,6 +191,7 @@ GameDetector::GameDetector() {
_midi_driver = MD_AUTO;
_game.id = 0;
_game.features = 0;
+ _plugin = 0;
_multi_midi = false;
_native_mt32 = false;
@@ -297,7 +298,7 @@ void GameDetector::list_games() {
}
}
-const TargetSettings *GameDetector::findTarget(const char *targetName) const {
+const TargetSettings *GameDetector::findTarget(const char *targetName, const Plugin **plugin) const {
// Find the TargetSettings for this target
assert(targetName);
const TargetSettings *target;
@@ -305,8 +306,11 @@ const TargetSettings *GameDetector::findTarget(const char *targetName) const {
for (int i = 0; i < plugins.size(); i++) {
target = plugins[i]->findTarget(targetName);
- if (target)
+ if (target) {
+ if (plugin)
+ *plugin = plugins[i];
return target;
+ }
}
return 0;
}
@@ -636,7 +640,7 @@ bool GameDetector::detectGame() {
realGame = _gameFileName.c_str();
printf("Looking for %s\n", realGame);
- target = findTarget(realGame);
+ target = findTarget(realGame, &_plugin);
if (target) {
_game = *target;
@@ -740,41 +744,9 @@ OSystem *GameDetector::createSystem() {
Engine *GameDetector::createEngine(OSystem *system) {
Engine *engine = NULL;
- // FIXME: These checks are evil, as they require us to hard code GIDs.
- // Much better would be to e.g. put a pointer to the instance creation
- // method into the TargetSettings or so. That way, in addition to
- // simplifying this code, GIDs wouldn't have to be unique globally
- // anymore - only locally for each plugin. And it would be trivial
- // to add new plugins, without touching the code here.
-
-#ifndef DISABLE_SCUMM
- if (_game.id >= GID_SCUMM_FIRST && _game.id <= GID_SCUMM_LAST) {
- // Some kind of Scumm game
- engine = Engine_SCUMM_create(this, system);
- }
-#endif
-
-#ifndef DISABLE_SIMON
- if (_game.id >= GID_SIMON_FIRST && _game.id <= GID_SIMON_LAST) {
- // Simon the Sorcerer
- engine = Engine_SIMON_create(this, system);
- }
-#endif
+ assert(_plugin);
+ engine = _plugin->createInstance(this, system);
-#ifndef DISABLE_SKY
- if (_game.id >= GID_SKY_FIRST && _game.id <= GID_SKY_LAST) {
- // Beneath a Steel Sky
- engine = Engine_SKY_create(this, system);
- }
-#endif
-
-#ifndef DISABLE_SWORD2
- if (_game.id >= GID_SWORD2_FIRST && _game.id <= GID_SWORD2_LAST) {
- // Broken Sword 2
- engine = Engine_SWORD2_create(this, system);
- }
-#endif
-
return engine;
}
diff --git a/common/gameDetector.h b/base/gameDetector.h
index dd6f12964d..32eaf96630 100644
--- a/common/gameDetector.h
+++ b/base/gameDetector.h
@@ -30,6 +30,7 @@ class GameDetector;
class MidiDriver;
class OSystem;
class SoundMixer;
+class Plugin;
/** Default sound/music volumes.
* @todo move this to a better place.
@@ -143,6 +144,7 @@ public:
String _gameFileName;
TargetSettings _game;
+ const Plugin *_plugin;
bool _fullScreen;
bool _aspectRatio;
@@ -191,7 +193,7 @@ public:
int parseGraphicsMode(const char *s);
void updateconfig();
- const TargetSettings *findTarget(const char *targetName) const;
+ const TargetSettings *findTarget(const char *targetName, const Plugin **plugin = NULL) const;
protected:
String _gameText;
diff --git a/common/main.cpp b/base/main.cpp
index 3b475926ad..f549c2b831 100644
--- a/common/main.cpp
+++ b/base/main.cpp
@@ -29,10 +29,10 @@
*/
#include "stdafx.h"
+#include "base/gameDetector.h"
+#include "base/plugins.h"
#include "common/config-file.h"
#include "common/engine.h"
-#include "common/gameDetector.h"
-#include "common/plugins.h"
#include "common/scaler.h" // For GFX_NORMAL
#include "gui/newgui.h"
#include "gui/launcher.h"
diff --git a/base/module.mk b/base/module.mk
new file mode 100644
index 0000000000..e3af9b367c
--- /dev/null
+++ b/base/module.mk
@@ -0,0 +1,16 @@
+MODULE := base
+
+MODULE_OBJS := \
+ base/gameDetector.o \
+ base/main.o \
+ base/plugins.o
+
+MODULE_DIRS += \
+ base
+
+# Some of the base files depend on the values of the DISABLE_* flags defined
+# in config.mak. Hence we add an explicit make dependency on that file.
+base/gameDetector.o base/plugins.o: config.mak
+
+# Include common rules
+include common.rules
diff --git a/common/plugins.cpp b/base/plugins.cpp
index 006f342e5f..174a097b4d 100644
--- a/common/plugins.cpp
+++ b/base/plugins.cpp
@@ -20,9 +20,9 @@
*
*/
-#include "common/plugins.h"
+#include "base/gameDetector.h"
+#include "base/plugins.h"
#include "common/engine.h"
-#include "common/gameDetector.h"
PluginManager *g_pluginManager = 0;
diff --git a/common/plugins.h b/base/plugins.h
index 8257bf1a53..8257bf1a53 100644
--- a/common/plugins.h
+++ b/base/plugins.h
diff --git a/common/engine.cpp b/common/engine.cpp
index b26338ed0f..9f127fc53e 100644
--- a/common/engine.cpp
+++ b/common/engine.cpp
@@ -24,7 +24,7 @@
#endif
#include "common/config-file.h"
#include "common/engine.h"
-#include "common/gameDetector.h"
+#include "base/gameDetector.h"
#include "common/timer.h"
#include "sound/mixer.h"
diff --git a/common/module.mk b/common/module.mk
index 9e0ade9533..b38c3e2ba7 100644
--- a/common/module.mk
+++ b/common/module.mk
@@ -4,7 +4,6 @@ MODULE_OBJS := \
common/config-file.o \
common/engine.o \
common/file.o \
- common/plugins.o \
common/scaler.o \
common/str.o \
common/timer.o \
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index d157160bbc..dc62755e3f 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -32,10 +32,11 @@
#include "backends/fs/fs.h"
+#include "base/gameDetector.h"
+#include "base/plugins.h"
+
#include "common/config-file.h"
#include "common/engine.h"
-#include "common/gameDetector.h"
-#include "common/plugins.h"
enum {
kStartCmd = 'STRT',
diff --git a/gui/options.cpp b/gui/options.cpp
index 9072b0b2a6..abba0229e0 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -27,7 +27,7 @@
#include "backends/fs/fs.h"
#include "common/config-file.h"
-#include "common/gameDetector.h"
+#include "base/gameDetector.h"
#if (!( defined(__DC__) || defined(__GP32__)) && !defined(_MSC_VER))
#include <unistd.h>
diff --git a/scumm/charset.cpp b/scumm/charset.cpp
index e86cde493c..f2dd44d28f 100644
--- a/scumm/charset.cpp
+++ b/scumm/charset.cpp
@@ -22,7 +22,7 @@
#include "charset.h"
#include "scumm.h"
#include "nut_renderer.h"
-#include "common/gameDetector.h"
+#include "base/gameDetector.h"
CharsetRenderer::CharsetRenderer(Scumm *vm) {
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index a02acd538c..30ca18ba98 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -22,8 +22,8 @@
#include "stdafx.h"
+#include "base/gameDetector.h" // For kDefaultMasterVolume etc.
#include "common/util.h"
-#include "common/gameDetector.h" // For kDefaultMasterVolume etc.
#include "scumm/imuse.h"
#include "scumm/imuse_internal.h"
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 408e3f9dae..1f5f2ab1a3 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -23,7 +23,7 @@
#include "stdafx.h"
#include "common/config-file.h"
-#include "common/gameDetector.h"
+#include "base/gameDetector.h"
#include "gui/console.h"
#include "gui/message.h"
diff --git a/simon/simon.cpp b/simon/simon.cpp
index 68fe1ce9ea..3025112718 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -26,7 +26,7 @@
#include "sound/mididrv.h"
#include "common/config-file.h"
#include "common/file.h"
-#include "common/gameDetector.h"
+#include "base/gameDetector.h"
#include <errno.h>
#include <time.h>
diff --git a/sky/control.cpp b/sky/control.cpp
index 4d84a428ac..ca36685866 100644
--- a/sky/control.cpp
+++ b/sky/control.cpp
@@ -23,7 +23,7 @@
#include "sky/skydefs.h"
#include "sky/sky.h"
#include "common/file.h"
-#include "common/gameDetector.h"
+#include "base/gameDetector.h"
#ifdef _WIN32_WCE
extern void force_keyboard(bool);
diff --git a/sky/logic.cpp b/sky/logic.cpp
index ccddf1b17a..69fd9748ef 100644
--- a/sky/logic.cpp
+++ b/sky/logic.cpp
@@ -25,7 +25,7 @@
#include "sky/compact.h"
#include "sky/skydefs.h"
#include "sky/talks.h"
-#include "common/gameDetector.h"
+#include "base/gameDetector.h"
uint32 SkyLogic::_scriptVariables[838];
diff --git a/sky/sky.cpp b/sky/sky.cpp
index 4981149806..c2c0708d23 100644
--- a/sky/sky.cpp
+++ b/sky/sky.cpp
@@ -26,8 +26,8 @@
#include "sky/logic.h"
#include "sky/debug.h"
#include "sky/mouse.h"
+#include "base/gameDetector.h"
#include "common/file.h"
-#include "common/gameDetector.h"
#include <errno.h>
#include <time.h>
diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp
index fe99a229c1..0ba862dcc8 100644
--- a/sword2/sword2.cpp
+++ b/sword2/sword2.cpp
@@ -21,7 +21,7 @@
#include "stdafx.h"
#include "driver/driver96.h"
#include "driver/palette.h"
-#include "common/gameDetector.h"
+#include "base/gameDetector.h"
#include "common/config-file.h"
#include "build_display.h"
#include "console.h"