From 5626e42f5bf50ae7fdde587047d48cf6986d61e8 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 26 Apr 2003 11:44:13 +0000 Subject: Make it possible to disable some/all of our three game modules (scumm/simon/sky) with three flags in the Makefile svn-id: r7131 --- common/engine.cpp | 20 ++++++++++++++------ common/engine.h | 14 +++++++++++--- common/gameDetector.cpp | 27 +++++++++++++++++++++++---- 3 files changed, 48 insertions(+), 13 deletions(-) (limited to 'common') diff --git a/common/engine.cpp b/common/engine.cpp index e764a3d3f7..93747f3735 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 11d2fc815c..ec2e7cad38 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); + +#ifndef DISABLE_SCUMM +extern const VersionSettings *Engine_SCUMM_targetList(); extern Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst); -extern Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst); +#endif +#ifndef DISABLE_SIMON +extern Engine *Engine_SIMON_create(GameDetector *detector, OSystem *syst); extern const VersionSettings *Engine_SIMON_targetList(); -extern const VersionSettings *Engine_SCUMM_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 71399b8751..6cb0f025a8 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 } } -- cgit v1.2.3