diff --git a/Makefile b/Makefile index 2bbc39b4ab2..747d138664a 100644 --- a/Makefile +++ b/Makefile @@ -48,11 +48,17 @@ LIBS += -lmad ####################################################################### -# Misc stuff - you should normally never have to edit this # +# Control which modules are built - uncomment any to disable module # ####################################################################### -# Concat DEFINES and INCLUDES to for the CPPFLAGS -CPPFLAGS:= $(DEFINES) $(INCLUDES) +# DISABLE_SCUMM = 1 +# DISABLE_SIMON = 1 +# DISABLE_SKY = 1 + + +####################################################################### +# Misc stuff - you should normally never have to edit this # +####################################################################### include Makefile.common diff --git a/Makefile.common b/Makefile.common index 0ef447dcd23..5a596dea581 100644 --- a/Makefile.common +++ b/Makefile.common @@ -22,10 +22,26 @@ DEPDIR := .deps # TODO - the nested ones (scumm/smush, backends/...) should be handled from the # module.mk of their parents. In fact the only reason they are listed here is to ensure the # DEPDIRS directive works correctly. + +ifdef DISABLE_SCUMM +DEFINES += -DDISABLE_SCUMM +else +MODULES += scumm +endif + +ifdef DISABLE_SIMON +DEFINES += -DDISABLE_SIMON +else +MODULES += simon +endif + +ifdef DISABLE_SKY +DEFINES += -DDISABLE_SKY +else +MODULES += sky +endif + MODULES += \ - scumm \ - simon \ - sky \ common \ gui \ backends \ @@ -36,8 +52,11 @@ MODULES += \ backends/fs/windows \ backends/midi +# Concat DEFINES and INCLUDES to form the CPPFLAGS +CPPFLAGS:= $(DEFINES) $(INCLUDES) + # Include the build instructions for all modules --include $(patsubst %,%/module.mk,$(MODULES)) +-include $(addsuffix /module.mk,$(MODULES)) # HACK temporary fix to get compilation on OS X (and possibly others) working again OBJS:=common/engine.o $(OBJS) @@ -59,8 +78,8 @@ clean: # If you use GCC, disable the above and enable this for intelligent # dependency tracking. -DEPDIRS = $(patsubst %,%/$(DEPDIR),$(MODULES)) -DEPFILES = $(wildcard $(patsubst %,%/*.d,$(DEPDIRS))) +DEPDIRS = $(addsuffix /$(DEPDIR),$(MODULES)) +DEPFILES = $(wildcard $(addsuffix /*.d,$(DEPDIRS))) .cpp.o: $(MKDIR) $(*D)/$(DEPDIR) diff --git a/Makefile.mingw b/Makefile.mingw index ea3bf0c0c7a..18cba2d8a78 100644 --- a/Makefile.mingw +++ b/Makefile.mingw @@ -50,9 +50,6 @@ LIBS += -lvorbisfile -lvorbis -logg # Misc stuff - you should normally never have to edit this # ####################################################################### -# Concat DEFINES and INCLUDES to for the CPPFLAGS -CPPFLAGS:= $(DEFINES) $(INCLUDES) - include Makefile.common scummvmico.o: scummvm.ico diff --git a/common/engine.cpp b/common/engine.cpp index e764a3d3f71..93747f37354 100644 --- a/common/engine.cpp +++ b/common/engine.cpp @@ -79,18 +79,26 @@ const char *Engine::getSavePath() const { Engine *Engine::createFromDetector(GameDetector *detector, OSystem *syst) { Engine *engine = NULL; +#ifndef DISABLE_SCUMM + if (detector->_gameId >= GID_SCUMM_FIRST && detector->_gameId <= GID_SCUMM_LAST) { + // Some kind of Scumm game + engine = Engine_SCUMM_create(detector, syst); + } +#endif + +#ifndef DISABLE_SIMON if (detector->_gameId >= GID_SIMON_FIRST && detector->_gameId <= GID_SIMON_LAST) { // Simon the Sorcerer engine = Engine_SIMON_create(detector, syst); - } else if (detector->_gameId >= GID_SCUMM_FIRST && detector->_gameId <= GID_SCUMM_LAST) { - // Some kind of Scumm game - engine = Engine_SCUMM_create(detector, syst); - } else if (detector->_gameId >= GID_SKY_FIRST && detector->_gameId <= GID_SKY_LAST) { + } +#endif + +#ifndef DISABLE_SKY + if (detector->_gameId >= GID_SKY_FIRST && detector->_gameId <= GID_SKY_LAST) { // Beneath a Steel Sky engine = Engine_SKY_create(detector, syst); - } else { - // Unknown game } +#endif return engine; } diff --git a/common/engine.h b/common/engine.h index 11d2fc815c4..ec2e7cad38d 100644 --- a/common/engine.h +++ b/common/engine.h @@ -82,13 +82,21 @@ void checkHeap(); // in this header. This serves two purposes: // 1) Clean seperation from the game modules (scumm, simon) and the generic code // 2) Faster (compiler doesn't have to parse lengthy header files) -extern Engine *Engine_SIMON_create(GameDetector *detector, OSystem *syst); -extern Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst); -extern Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst); -extern const VersionSettings *Engine_SIMON_targetList(); +#ifndef DISABLE_SCUMM extern const VersionSettings *Engine_SCUMM_targetList(); +extern Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst); +#endif + +#ifndef DISABLE_SIMON +extern Engine *Engine_SIMON_create(GameDetector *detector, OSystem *syst); +extern const VersionSettings *Engine_SIMON_targetList(); +#endif + +#ifndef DISABLE_SKY extern const VersionSettings *Engine_SKY_targetList(); +extern Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst); +#endif #endif diff --git a/common/gameDetector.cpp b/common/gameDetector.cpp index 71399b87512..6cb0f025a80 100644 --- a/common/gameDetector.cpp +++ b/common/gameDetector.cpp @@ -162,26 +162,45 @@ GameDetector::GameDetector() { _default_gfx_mode = true; if (version_settings == NULL) { + int totalCount = 0; + // Gather & combine the target lists from the modules + +#ifndef DISABLE_SCUMM const VersionSettings *scummVersions = Engine_SCUMM_targetList(); - const VersionSettings *simonVersions = Engine_SIMON_targetList(); - const VersionSettings *skyVersions = Engine_SKY_targetList(); - int scummCount = countVersions(scummVersions); + totalCount += scummCount; +#endif + +#ifndef DISABLE_SIMON + const VersionSettings *simonVersions = Engine_SIMON_targetList(); int simonCount = countVersions(simonVersions); + totalCount += simonCount; +#endif + +#ifndef DISABLE_SKY + const VersionSettings *skyVersions = Engine_SKY_targetList(); int skyCount = countVersions(skyVersions); + totalCount += skyCount; +#endif - VersionSettings *v = (VersionSettings *)calloc(scummCount + simonCount + skyCount + 1, sizeof(VersionSettings)); + VersionSettings *v = (VersionSettings *)calloc(totalCount + 1, sizeof(VersionSettings)); version_settings = v; +#ifndef DISABLE_SCUMM memcpy(v, scummVersions, scummCount * sizeof(VersionSettings)); v += scummCount; +#endif +#ifndef DISABLE_SIMON memcpy(v, simonVersions, simonCount * sizeof(VersionSettings)); v += simonCount; +#endif +#ifndef DISABLE_SKY memcpy(v, skyVersions, skyCount * sizeof(VersionSettings)); v += skyCount; +#endif } }