[Scummvm-cvs-logs] SF.net SVN: scummvm: [27424] scummvm/trunk
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Fri Jun 15 19:36:42 CEST 2007
Revision: 27424
http://scummvm.svn.sourceforge.net/scummvm/?rev=27424&view=rev
Author: fingolfin
Date: 2007-06-15 10:36:41 -0700 (Fri, 15 Jun 2007)
Log Message:
-----------
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
Modified Paths:
--------------
scummvm/trunk/common/advancedDetector.cpp
scummvm/trunk/common/advancedDetector.h
scummvm/trunk/engines/agos/detection.cpp
scummvm/trunk/engines/kyra/detection.cpp
Modified: scummvm/trunk/common/advancedDetector.cpp
===================================================================
--- scummvm/trunk/common/advancedDetector.cpp 2007-06-15 17:29:49 UTC (rev 27423)
+++ scummvm/trunk/common/advancedDetector.cpp 2007-06-15 17:36:41 UTC (rev 27424)
@@ -100,25 +100,31 @@
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++;
- }
+ // First search the list of supported game IDs for a match.
+ const PlainGameDescriptor *g = findPlainGameDescriptor(gameid, list);
+ if (g)
+ return GameDescriptor(*g);
- if (params.obsoleteList != 0) {
- const Common::ADObsoleteGameID *o = params.obsoleteList;
+ // 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();
}
Modified: scummvm/trunk/common/advancedDetector.h
===================================================================
--- scummvm/trunk/common/advancedDetector.h 2007-06-15 17:29:49 UTC (rev 27423)
+++ scummvm/trunk/common/advancedDetector.h 2007-06-15 17:36:41 UTC (rev 27424)
@@ -224,7 +224,11 @@
* '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 @@
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); \
Modified: scummvm/trunk/engines/agos/detection.cpp
===================================================================
--- scummvm/trunk/engines/agos/detection.cpp 2007-06-15 17:29:49 UTC (rev 27423)
+++ scummvm/trunk/engines/agos/detection.cpp 2007-06-15 17:36:41 UTC (rev 27424)
@@ -106,7 +106,7 @@
}
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) {
Modified: scummvm/trunk/engines/kyra/detection.cpp
===================================================================
--- scummvm/trunk/engines/kyra/detection.cpp 2007-06-15 17:29:49 UTC (rev 27423)
+++ scummvm/trunk/engines/kyra/detection.cpp 2007-06-15 17:36:41 UTC (rev 27424)
@@ -122,7 +122,7 @@
}
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) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list