aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2006-02-18 11:15:37 +0000
committerMax Horn2006-02-18 11:15:37 +0000
commit8ac17430ac7aa3bba5630d74a1eeda54bce7801b (patch)
tree5c3a57c00428e599f43edde027ff3ff87475ceb9 /engines
parentd0e637f7aa5c23ef66a4a5685bba8aecd58e14a7 (diff)
downloadscummvm-rg350-8ac17430ac7aa3bba5630d74a1eeda54bce7801b.tar.gz
scummvm-rg350-8ac17430ac7aa3bba5630d74a1eeda54bce7801b.tar.bz2
scummvm-rg350-8ac17430ac7aa3bba5630d74a1eeda54bce7801b.zip
- renamed PLUGIN_getSupportedGames to PLUGIN_gameIDList for consistency
- renamed Engine_XXX_gameList to Engine_XXX_gameList for consistency - added new Engine_XXX_findGameID / PLUGIN_findGameID function - updated plugins code to take advantage of the new plugin API, to support obsolete gameids w/o showing them to the user svn-id: r20752
Diffstat (limited to 'engines')
-rw-r--r--engines/gob/gob.cpp12
-rw-r--r--engines/kyra/kyra.cpp12
-rw-r--r--engines/lure/lure.cpp12
-rw-r--r--engines/queen/queen.cpp17
-rw-r--r--engines/saga/saga.cpp12
-rw-r--r--engines/scumm/scumm.cpp51
-rw-r--r--engines/simon/simon.cpp51
-rw-r--r--engines/sky/sky.cpp9
-rw-r--r--engines/sword1/sword1.cpp11
-rw-r--r--engines/sword2/sword2.cpp12
10 files changed, 142 insertions, 57 deletions
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index 2fe6455480..641470a194 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -266,7 +266,7 @@ int GobEngine::init(GameDetector &detector) {
using namespace Gob;
-GameList Engine_GOB_gameList() {
+GameList Engine_GOB_gameIDList() {
GameList games;
const GameSettings *g = gob_list;
@@ -278,6 +278,16 @@ GameList Engine_GOB_gameList() {
return games;
}
+GameSettings Engine_GOB_findGameID(const char *gameid) {
+ const GameSettings *g = gob_list;
+ while (g->gameid) {
+ if (0 == strcmp(gameid, g->gameid))
+ break;
+ g++;
+ }
+ return *g;
+}
+
DetectedGameList Engine_GOB_detectGames(const FSList &fslist) {
DetectedGameList detectedGames;
const GobGameSettings *g;
diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp
index c6c5df604f..a54bdc0a5b 100644
--- a/engines/kyra/kyra.cpp
+++ b/engines/kyra/kyra.cpp
@@ -129,7 +129,7 @@ static Common::Language convertKyraLang(uint32 features) {
return Common::UNK_LANG;
}
-GameList Engine_KYRA_gameList() {
+GameList Engine_KYRA_gameIDList() {
GameList games;
const GameSettings *g = kyra_list;
@@ -140,6 +140,16 @@ GameList Engine_KYRA_gameList() {
return games;
}
+GameSettings Engine_KYRA_findGameID(const char *gameid) {
+ const GameSettings *g = kyra_list;
+ while (g->gameid) {
+ if (0 == strcmp(gameid, g->gameid))
+ break;
+ g++;
+ }
+ return *g;
+}
+
DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
DetectedGameList detectedGames;
const KyraGameSettings *g;
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp
index 96f15a7240..181f78d444 100644
--- a/engines/lure/lure.cpp
+++ b/engines/lure/lure.cpp
@@ -73,7 +73,7 @@ static const GameSettings lure_list[] = {
{ 0, 0 }
};
-GameList Engine_LURE_gameList() {
+GameList Engine_LURE_gameIDList() {
GameList games;
const GameSettings *g = lure_list;
@@ -84,6 +84,16 @@ GameList Engine_LURE_gameList() {
return games;
}
+GameSettings Engine_LURE_findGameID(const char *gameid) {
+ const GameSettings *g = lure_list;
+ while (g->gameid) {
+ if (0 == strcmp(gameid, g->gameid))
+ break;
+ g++;
+ }
+ return *g;
+}
+
DetectedGameList Engine_LURE_detectGames(const FSList &fslist) {
DetectedGameList detectedGames;
const LureGameSettings *g;
diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp
index d7f3a80491..a5833d017b 100644
--- a/engines/queen/queen.cpp
+++ b/engines/queen/queen.cpp
@@ -62,17 +62,20 @@ static const GameSettings queen_setting[] = {
{ 0, 0 }
};
-GameList Engine_QUEEN_gameList() {
+GameList Engine_QUEEN_gameIDList() {
GameList games;
- const GameSettings *g = queen_setting;
-
- while (g->gameid) {
- games.push_back(*g);
- g++;
- }
+ games.push_back(queen_setting[0]);
return games;
}
+GameSettings Engine_QUEEN_findGameID(const char *gameid) {
+ if (0 == strcmp(gameid, queen_setting[0].gameid))
+ return queen_setting[0];
+ GameSettings dummy = { 0, 0 };
+ return dummy;
+}
+
+
GameSettings determineTarget(uint32 size) {
switch (size) {
case 3724538: //regular demo
diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp
index 45c12f616d..4222b93b08 100644
--- a/engines/saga/saga.cpp
+++ b/engines/saga/saga.cpp
@@ -62,7 +62,7 @@ static const GameSettings saga_games[] = {
{0, 0}
};
-GameList Engine_SAGA_gameList() {
+GameList Engine_SAGA_gameIDList() {
GameList games;
const GameSettings *g = saga_games;
@@ -74,6 +74,16 @@ GameList Engine_SAGA_gameList() {
return games;
}
+GameSettings Engine_SAGA_findGameID(const char *gameid) {
+ const GameSettings *g = saga_games;
+ while (g->gameid) {
+ if (0 == strcmp(gameid, g->gameid))
+ break;
+ g++;
+ }
+ return *g;
+}
+
DetectedGameList Engine_SAGA_detectGames(const FSList &fslist) {
return Saga::GAME_ProbeGame(fslist);
}
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index c09fefc143..695a1c9bc8 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -91,15 +91,10 @@ namespace Scumm {
ScummEngine *g_scumm = 0;
-struct GameDescription {
- const char *gameid;
- const char *description;
-};
-
/**
* Lookup table mapping game IDs to game descriptions.
*/
-static GameDescription gameDescriptions[] = {
+static const GameSettings gameDescriptions[] = {
{ "atlantis", "Indiana Jones and the Fate of Atlantis" },
{ "indy3", "Indiana Jones and the Last Crusade" },
{ "loom", "Loom" },
@@ -175,7 +170,7 @@ static GameDescription gameDescriptions[] = {
};
static const char *findDescriptionFromGameID(const char *gameid) {
- GameDescription *g = gameDescriptions;
+ const GameSettings *g = gameDescriptions;
while (g->gameid) {
if (!strcmp(g->gameid, gameid)) {
return g->description;
@@ -206,15 +201,10 @@ enum {
};
-struct ObsoleteGameIDs {
+struct ObsoleteGameID {
const char *from;
const char *to;
Common::Platform platform;
-
- GameSettings toGameSettings() const {
- GameSettings dummy = { from, "Obsolete game ID" };
- return dummy;
- }
};
static const Common::Platform UNK = Common::kPlatformUnknown;
@@ -225,7 +215,7 @@ static const Common::Platform UNK = Common::kPlatformUnknown;
*
* We use an ugly macro 'UNK' here to make the following table more readable.
*/
-static ObsoleteGameIDs obsoleteGameIDsTable[] = {
+static const ObsoleteGameID obsoleteGameIDsTable[] = {
{"comidemo", "comi", UNK},
{"digdemo", "dig", UNK},
{"digdemoMac", "dig", Common::kPlatformMacintosh},
@@ -2970,22 +2960,41 @@ int ScummEngine::generateSubstResFileName(const char *filename, char *buf, int b
using namespace Scumm;
-GameList Engine_SCUMM_gameList() {
- const ScummGameSettings *g = scumm_settings;
- const ObsoleteGameIDs *o = obsoleteGameIDsTable;
+GameList Engine_SCUMM_gameIDList() {
+ const GameSettings *g = gameDescriptions;
GameList games;
while (g->gameid) {
- games.push_back(g->toGameSettings());
+ games.push_back(*g);
+ g++;
+ }
+ return games;
+}
+
+GameSettings Engine_SCUMM_findGameID(const char *gameid) {
+ // First search the list of supported game IDs.
+ const GameSettings *g = gameDescriptions;
+ while (g->gameid) {
+ if (0 == strcmp(gameid, g->gameid))
+ return *g;
g++;
}
+ // If we didn't find the gameid in the main list, check if it
+ // is an obsolete game id.
+ GameSettings gs = { 0, 0 };
+ const ObsoleteGameID *o = obsoleteGameIDsTable;
while (o->from) {
- games.push_back(o->toGameSettings());
+ if (0 == strcmp(gameid, o->from)) {
+ gs.gameid = gameid;
+ gs.gameid = "Obsolete game ID";
+ return gs;
+ }
o++;
}
- return games;
+ return gs;
}
+
enum {
kDetectNameMethodsCount = 8
};
@@ -3350,7 +3359,7 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) {
// We start by checking whether the specified game ID is obsolete.
// If that is the case, we automaticlaly upgrade the target to use
// the correct new game ID (and platform, if specified).
- const ObsoleteGameIDs *o = obsoleteGameIDsTable;
+ const ObsoleteGameID *o = obsoleteGameIDsTable;
while (o->from) {
if (!scumm_stricmp(detector->_game.gameid, o->from)) {
// Match found, perform upgrade
diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp
index 2ef92cb3e1..cd9c36d564 100644
--- a/engines/simon/simon.cpp
+++ b/engines/simon/simon.cpp
@@ -51,15 +51,10 @@ extern bool isSmartphone(void);
using Common::File;
-struct ObsoleteTargets {
+struct ObsoleteGameID {
const char *from;
const char *to;
Common::Platform platform;
-
- GameSettings toGameSettings() const {
- GameSettings dummy = { from, "Obsolete Target" };
- return dummy;
- }
};
/**
@@ -67,7 +62,7 @@ struct ObsoleteTargets {
* corresponding new target and platform combination.
*
*/
-static ObsoleteTargets obsoleteTargetsTable[] = {
+static const ObsoleteGameID obsoleteGameIDsTable[] = {
{"simon1acorn", "simon1", Common::kPlatformAcorn},
{"simon1amiga", "simon1", Common::kPlatformAmiga},
{"simon1cd32", "simon1", Common::kPlatformAmiga},
@@ -82,27 +77,15 @@ static ObsoleteTargets obsoleteTargetsTable[] = {
};
static const GameSettings simonGames[] = {
- // Simon the Sorcerer 1 & 2 (not SCUMM games)
+ // Simon the Sorcerer 1 & 2
{"feeble", "The Feeble Files"},
{"simon1", "Simon the Sorcerer 1"},
{"simon2", "Simon the Sorcerer 2"},
- {"simon1acorn", "Simon the Sorcerer 1 (Acorn)"},
- {"simon1amiga", "Simon the Sorcerer 1 (Amiga)"},
- {"simon1cd32", "Simon the Sorcerer 1 Talkie (Amiga CD32)"},
- {"simon1demo", "Simon the Sorcerer 1 (DOS Demo)"},
- {"simon1dos", "Simon the Sorcerer 1 (DOS)"},
- {"simon1talkie", "Simon the Sorcerer 1 Talkie"},
- {"simon1win", "Simon the Sorcerer 1 Talkie (Windows)"},
- {"simon2dos", "Simon the Sorcerer 2 (DOS)"},
- {"simon2talkie", "Simon the Sorcerer 2 Talkie"},
- {"simon2win", "Simon the Sorcerer 2 Talkie (Windows)"},
- {"simon2mac", "Simon the Sorcerer 2 Talkie (Amiga or Mac)"},
-
{NULL, NULL}
};
-GameList Engine_SIMON_gameList() {
+GameList Engine_SIMON_gameIDList() {
GameList games;
const GameSettings *g = simonGames;
while (g->gameid) {
@@ -113,12 +96,36 @@ GameList Engine_SIMON_gameList() {
return games;
}
+GameSettings Engine_SIMON_findGameID(const char *gameid) {
+ // First search the list of supported game IDs.
+ const GameSettings *g = simonGames;
+ while (g->gameid) {
+ if (0 == strcmp(gameid, g->gameid))
+ return *g;
+ g++;
+ }
+
+ // If we didn't find the gameid in the main list, check if it
+ // is an obsolete game id.
+ GameSettings gs = { 0, 0 };
+ const ObsoleteGameID *o = obsoleteGameIDsTable;
+ while (o->from) {
+ if (0 == strcmp(gameid, o->from)) {
+ gs.gameid = gameid;
+ gs.gameid = "Obsolete game ID";
+ return gs;
+ }
+ o++;
+ }
+ return gs;
+}
+
DetectedGameList Engine_SIMON_detectGames(const FSList &fslist) {
return Simon::GAME_ProbeGame(fslist);
}
Engine *Engine_SIMON_create(GameDetector *detector, OSystem *syst) {
- const ObsoleteTargets *o = obsoleteTargetsTable;
+ const ObsoleteGameID *o = obsoleteGameIDsTable;
while (o->from) {
if (!scumm_stricmp(detector->_game.gameid, o->from)) {
detector->_game.gameid = o->to;
diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp
index 71cc74dc00..30e605fe4f 100644
--- a/engines/sky/sky.cpp
+++ b/engines/sky/sky.cpp
@@ -80,12 +80,19 @@ extern bool isSmartphone(void);
static const GameSettings skySetting =
{"sky", "Beneath a Steel Sky" };
-GameList Engine_SKY_gameList() {
+GameList Engine_SKY_gameIDList() {
GameList games;
games.push_back(skySetting);
return games;
}
+GameSettings Engine_SKY_findGameID(const char *gameid) {
+ if (0 == strcmp(gameid, skySetting.gameid))
+ return skySetting;
+ GameSettings dummy = { 0, 0 };
+ return dummy;
+}
+
DetectedGameList Engine_SKY_detectGames(const FSList &fslist) {
DetectedGameList detectedGames;
// Iterate over all files in the given directory
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index 689c4625c3..47b4a9e780 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -66,13 +66,22 @@ static const char *g_filesToCheck[NUM_FILES_TO_CHECK] = { // these files have to
// the engine needs several more files to work, but checking these should be sufficient
};
-GameList Engine_SWORD1_gameList() {
+GameList Engine_SWORD1_gameIDList() {
GameList games;
games.push_back(sword1FullSettings);
games.push_back(sword1DemoSettings);
return games;
}
+GameSettings Engine_SWORD1_findGameID(const char *gameid) {
+ if (0 == strcmp(gameid, sword1FullSettings.gameid))
+ return sword1FullSettings;
+ if (0 == strcmp(gameid, sword1DemoSettings.gameid))
+ return sword1DemoSettings;
+ GameSettings dummy = { 0, 0 };
+ return dummy;
+}
+
void Sword1CheckDirectory(const FSList &fslist, bool *filesFound) {
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
if (!file->isDirectory()) {
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index bcc1e36e86..56ae60b7ff 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -63,7 +63,7 @@ static const Sword2GameSettings sword2_settings[] = {
{NULL, NULL, 0, NULL}
};
-GameList Engine_SWORD2_gameList() {
+GameList Engine_SWORD2_gameIDList() {
const Sword2GameSettings *g = sword2_settings;
GameList games;
while (g->gameid) {
@@ -73,6 +73,16 @@ GameList Engine_SWORD2_gameList() {
return games;
}
+GameSettings Engine_SWORD2_findGameID(const char *gameid) {
+ const Sword2GameSettings *g = sword2_settings;
+ while (g->gameid) {
+ if (0 == strcmp(gameid, g->gameid))
+ break;
+ g++;
+ }
+ return toGameSettings(*g);
+}
+
DetectedGameList Engine_SWORD2_detectGames(const FSList &fslist) {
DetectedGameList detectedGames;
const Sword2GameSettings *g;