diff options
author | Max Horn | 2007-06-15 17:36:41 +0000 |
---|---|---|
committer | Max Horn | 2007-06-15 17:36:41 +0000 |
commit | d6e47d5fd322cf7cb61bee94b946096ecef64abb (patch) | |
tree | 76165532afde8da326a3568735b4e790d20e9b8d | |
parent | a097a11ce7847bd33e98aa48af8748ecbd07e390 (diff) | |
download | scummvm-rg350-d6e47d5fd322cf7cb61bee94b946096ecef64abb.tar.gz scummvm-rg350-d6e47d5fd322cf7cb61bee94b946096ecef64abb.tar.bz2 scummvm-rg350-d6e47d5fd322cf7cb61bee94b946096ecef64abb.zip |
ADV detector: Refactored findGameID() a bit, making it possible to use it outside the AdvancedDetector framework; also made it generate somewhat more user friendly desc for obsolete game IDs
svn-id: r27424
-rw-r--r-- | common/advancedDetector.cpp | 28 | ||||
-rw-r--r-- | common/advancedDetector.h | 8 | ||||
-rw-r--r-- | engines/agos/detection.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/detection.cpp | 2 |
4 files changed, 25 insertions, 15 deletions
diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp index 7d7cadbade..6b4d3f685e 100644 --- a/common/advancedDetector.cpp +++ b/common/advancedDetector.cpp @@ -100,25 +100,31 @@ static void upgradeTargetIfNecessary(const Common::ADParams ¶ms) { GameDescriptor findGameID( const char *gameid, - const Common::ADParams ¶ms + const PlainGameDescriptor *list, + const Common::ADObsoleteGameID *obsoleteList ) { - const PlainGameDescriptor *g = params.list; - while (g->gameid) { - if (0 == scumm_stricmp(gameid, g->gameid)) - return GameDescriptor(*g); - g++; - } - - if (params.obsoleteList != 0) { - const Common::ADObsoleteGameID *o = params.obsoleteList; + // First search the list of supported game IDs for a match. + const PlainGameDescriptor *g = findPlainGameDescriptor(gameid, list); + if (g) + return GameDescriptor(*g); + + // If we didn't find the gameid in the main list, check if it + // is an obsolete game id. + if (obsoleteList != 0) { + const Common::ADObsoleteGameID *o = obsoleteList; while (o->from) { if (0 == scumm_stricmp(gameid, o->from)) { - return GameDescriptor(gameid, "Obsolete game ID"); + g = findPlainGameDescriptor(o->to, list); + if (g && g->description) + return GameDescriptor(gameid, "Obsolete game ID (" + Common::String(g->description) + ")"); + else + return GameDescriptor(gameid, "Obsolete game ID"); } o++; } } + // No match found return GameDescriptor(); } diff --git a/common/advancedDetector.h b/common/advancedDetector.h index 2031f001a9..5066ba71e9 100644 --- a/common/advancedDetector.h +++ b/common/advancedDetector.h @@ -224,7 +224,11 @@ GameList gameIDList(const Common::ADParams ¶ms); * 'gameid' in there. If a match is found, returns a GameDescriptor * with gameid and description set. */ -GameDescriptor findGameID(const char *gameid, const Common::ADParams ¶ms); +GameDescriptor findGameID( + const char *gameid, + const PlainGameDescriptor *list, + const Common::ADObsoleteGameID *obsoleteList = 0 + ); // FIXME/TODO: Rename this function to something more sensible. GameList detectAllGames(const FSList &fslist, const Common::ADParams ¶ms); @@ -253,7 +257,7 @@ PluginError detectGameForEngineCreation(const Common::ADParams ¶ms); return Common::AdvancedDetector::gameIDList(params); \ } \ GameDescriptor Engine_##engine##_findGameID(const char *gameid) { \ - return Common::AdvancedDetector::findGameID(gameid, params); \ + return Common::AdvancedDetector::findGameID(gameid, params.list, params.obsoleteList); \ } \ GameList Engine_##engine##_detectGames(const FSList &fslist) { \ return Common::AdvancedDetector::detectAllGames(fslist, params); \ diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp index 138be5b1d2..f16224dacd 100644 --- a/engines/agos/detection.cpp +++ b/engines/agos/detection.cpp @@ -106,7 +106,7 @@ GameList Engine_AGOS_gameIDList() { } GameDescriptor Engine_AGOS_findGameID(const char *gameid) { - return Common::AdvancedDetector::findGameID(gameid, detectionParams); + return Common::AdvancedDetector::findGameID(gameid, simonGames, obsoleteGameIDsTable); } GameList Engine_AGOS_detectGames(const FSList &fslist) { diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index 00d6cae81b..46bcc1e85f 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -122,7 +122,7 @@ GameList Engine_KYRA_gameIDList() { } GameDescriptor Engine_KYRA_findGameID(const char *gameid) { - return Common::AdvancedDetector::findGameID(gameid, detectionParams); + return Common::AdvancedDetector::findGameID(gameid, gameList); } GameList Engine_KYRA_detectGames(const FSList &fslist) { |