aboutsummaryrefslogtreecommitdiff
path: root/common/advancedDetector.cpp
diff options
context:
space:
mode:
authorMax Horn2007-02-13 23:37:44 +0000
committerMax Horn2007-02-13 23:37:44 +0000
commit7572d2b4f2ac98cf31602d6c5e4ed7399de54a30 (patch)
treed96c82e9cae2736feef9b6d5ac7801273c5107a7 /common/advancedDetector.cpp
parentde02e840a6dd619e221a750b0b2a63d157f05114 (diff)
downloadscummvm-rg350-7572d2b4f2ac98cf31602d6c5e4ed7399de54a30.tar.gz
scummvm-rg350-7572d2b4f2ac98cf31602d6c5e4ed7399de54a30.tar.bz2
scummvm-rg350-7572d2b4f2ac98cf31602d6c5e4ed7399de54a30.zip
Changed detectBestMatchingGame to return a pointer to a ADGameDescription (or a subclass of it); added a (currently fake) fallback callback entry in ADParams
svn-id: r25574
Diffstat (limited to 'common/advancedDetector.cpp')
-rw-r--r--common/advancedDetector.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp
index d6ec293620..1b0f5e2817 100644
--- a/common/advancedDetector.cpp
+++ b/common/advancedDetector.cpp
@@ -188,9 +188,10 @@ GameList detectAllGames(
return detectedGames;
}
-int detectBestMatchingGame(
+const ADGameDescription *detectBestMatchingGame(
const Common::ADParams &params
) {
+ const ADGameDescription *agdDesc = 0;
Common::Language language = Common::UNK_LANG;
Common::Platform platform = Common::kPlatformUnknown;
@@ -203,24 +204,23 @@ int detectBestMatchingGame(
Common::ADList matches = detectGame(0, params, language, platform);
- int gameNumber = -1;
-
if (params.singleid == NULL) {
for (uint i = 0; i < matches.size(); i++) {
- if (((const ADGameDescription *)(params.descs + matches[i] * params.descItemSize))->gameid == gameid) {
- gameNumber = matches[i];
+ agdDesc = (const ADGameDescription *)(params.descs + matches[i] * params.descItemSize);
+ if (agdDesc->gameid == gameid) {
break;
}
+ agdDesc = 0;
}
- } else {
- gameNumber = matches[0];
+ } else if (matches.size() > 0) {
+ agdDesc = (const ADGameDescription *)(params.descs + matches[0] * params.descItemSize);
}
- if (gameNumber >= 0) {
- debug(2, "Running %s", toGameDescriptor(*(const ADGameDescription *)(params.descs + gameNumber * params.descItemSize), params.list).description().c_str());
+ if (agdDesc != 0) {
+ debug(2, "Running %s", toGameDescriptor(*agdDesc, params.list).description().c_str());
}
- return gameNumber;
+ return agdDesc;
}
PluginError detectGameForEngineCreation(
@@ -426,6 +426,8 @@ static ADList detectGame(const FSList *fslist, const Common::ADParams &params, L
return matched;
if (!filesMD5.empty()) {
+ // TODO: This message should be cleaned up / made more specific.
+ // For example, we should specify at least which engine triggered this.
printf("MD5s of your game version are unknown. Please, report following data to\n");
printf("ScummVM team along with your game name and version:\n");
@@ -505,7 +507,7 @@ static ADList detectGame(const FSList *fslist, const Common::ADParams &params, L
matchEntry = entryStart;
maxFiles = matchFiles;
- debug(4, "and overrided");
+ debug(4, "and overriden");
}
ptr++;
@@ -515,6 +517,8 @@ static ADList detectGame(const FSList *fslist, const Common::ADParams &params, L
for (i = 0; i < gameDescriptions.size(); i++) {
if (gameDescriptions[i]->filesDescriptions[0].fileName == 0) {
if (!scumm_stricmp(gameDescriptions[i]->gameid, *matchEntry)) {
+ // FIXME: This warning, if ever seen by somebody, is
+ // extremly cryptic!
warning("But it looks like unknown variant of %s", *matchEntry);
matched.push_back(i);
@@ -523,7 +527,12 @@ static ADList detectGame(const FSList *fslist, const Common::ADParams &params, L
}
}
}
-
+/*
+ // If we still haven't got a match, try to use the fallback callback :-)
+ if (matched.empty() && params.fallbackDetectFunc != 0) {
+ matched = (*params.fallbackDetectFunc)(fslist);
+ }
+*/
return matched;
}