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
This commit is contained in:
parent
a097a11ce7
commit
d6e47d5fd3
4 changed files with 24 additions and 14 deletions
|
@ -100,25 +100,31 @@ static void upgradeTargetIfNecessary(const Common::ADParams ¶ms) {
|
||||||
|
|
||||||
GameDescriptor findGameID(
|
GameDescriptor findGameID(
|
||||||
const char *gameid,
|
const char *gameid,
|
||||||
const Common::ADParams ¶ms
|
const PlainGameDescriptor *list,
|
||||||
|
const Common::ADObsoleteGameID *obsoleteList
|
||||||
) {
|
) {
|
||||||
const PlainGameDescriptor *g = params.list;
|
// First search the list of supported game IDs for a match.
|
||||||
while (g->gameid) {
|
const PlainGameDescriptor *g = findPlainGameDescriptor(gameid, list);
|
||||||
if (0 == scumm_stricmp(gameid, g->gameid))
|
if (g)
|
||||||
return GameDescriptor(*g);
|
return GameDescriptor(*g);
|
||||||
g++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params.obsoleteList != 0) {
|
// If we didn't find the gameid in the main list, check if it
|
||||||
const Common::ADObsoleteGameID *o = params.obsoleteList;
|
// is an obsolete game id.
|
||||||
|
if (obsoleteList != 0) {
|
||||||
|
const Common::ADObsoleteGameID *o = obsoleteList;
|
||||||
while (o->from) {
|
while (o->from) {
|
||||||
if (0 == scumm_stricmp(gameid, 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++;
|
o++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No match found
|
||||||
return GameDescriptor();
|
return GameDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -224,7 +224,11 @@ GameList gameIDList(const Common::ADParams ¶ms);
|
||||||
* 'gameid' in there. If a match is found, returns a GameDescriptor
|
* 'gameid' in there. If a match is found, returns a GameDescriptor
|
||||||
* with gameid and description set.
|
* 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.
|
// FIXME/TODO: Rename this function to something more sensible.
|
||||||
GameList detectAllGames(const FSList &fslist, const Common::ADParams ¶ms);
|
GameList detectAllGames(const FSList &fslist, const Common::ADParams ¶ms);
|
||||||
|
@ -253,7 +257,7 @@ PluginError detectGameForEngineCreation(const Common::ADParams ¶ms);
|
||||||
return Common::AdvancedDetector::gameIDList(params); \
|
return Common::AdvancedDetector::gameIDList(params); \
|
||||||
} \
|
} \
|
||||||
GameDescriptor Engine_##engine##_findGameID(const char *gameid) { \
|
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) { \
|
GameList Engine_##engine##_detectGames(const FSList &fslist) { \
|
||||||
return Common::AdvancedDetector::detectAllGames(fslist, params); \
|
return Common::AdvancedDetector::detectAllGames(fslist, params); \
|
||||||
|
|
|
@ -106,7 +106,7 @@ GameList Engine_AGOS_gameIDList() {
|
||||||
}
|
}
|
||||||
|
|
||||||
GameDescriptor Engine_AGOS_findGameID(const char *gameid) {
|
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) {
|
GameList Engine_AGOS_detectGames(const FSList &fslist) {
|
||||||
|
|
|
@ -122,7 +122,7 @@ GameList Engine_KYRA_gameIDList() {
|
||||||
}
|
}
|
||||||
|
|
||||||
GameDescriptor Engine_KYRA_findGameID(const char *gameid) {
|
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) {
|
GameList Engine_KYRA_detectGames(const FSList &fslist) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue