aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2007-02-14 00:21:53 +0000
committerMax Horn2007-02-14 00:21:53 +0000
commit75ae7cdb730859838097aec1374cad81d9040ec6 (patch)
treed34252630531f28273f67479d75ac6277364ab1e /common
parent59b1526e5aee8094e51d76305c1e5a7ab3aa88e8 (diff)
downloadscummvm-rg350-75ae7cdb730859838097aec1374cad81d9040ec6.tar.gz
scummvm-rg350-75ae7cdb730859838097aec1374cad81d9040ec6.tar.bz2
scummvm-rg350-75ae7cdb730859838097aec1374cad81d9040ec6.zip
Properly implemented the AD fallback callback
svn-id: r25576
Diffstat (limited to 'common')
-rw-r--r--common/advancedDetector.cpp16
-rw-r--r--common/advancedDetector.h14
2 files changed, 18 insertions, 12 deletions
diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp
index 54576fdfa7..242d1b8238 100644
--- a/common/advancedDetector.cpp
+++ b/common/advancedDetector.cpp
@@ -33,8 +33,6 @@
namespace Common {
-typedef Array<const ADGameDescription*> ADGameDescList;
-
namespace AdvancedDetector {
/**
@@ -344,9 +342,10 @@ static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &p
ADGameDescList matched;
int maxFilesMatched = 0;
+ const ADGameDescription *g;
for (i = 0; i < gameDescriptions.size(); i++) {
- const ADGameDescription *g = gameDescriptions[i];
+ g = gameDescriptions[i];
fileMissing = false;
// Do not even bother to look at entries which do not have matching
@@ -511,24 +510,25 @@ static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &p
if (matchEntry) { // We got a match
for (i = 0; i < gameDescriptions.size(); i++) {
- if (gameDescriptions[i]->filesDescriptions[0].fileName == 0) {
- if (!scumm_stricmp(gameDescriptions[i]->gameid, *matchEntry)) {
+ g = gameDescriptions[i];
+ if (g->filesDescriptions[0].fileName == 0) {
+ if (!scumm_stricmp(g->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(gameDescriptions[i]);
+ matched.push_back(g);
}
}
}
}
}
-/*
+
// 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;
}
diff --git a/common/advancedDetector.h b/common/advancedDetector.h
index 799c796d3f..937c190b19 100644
--- a/common/advancedDetector.h
+++ b/common/advancedDetector.h
@@ -61,6 +61,11 @@ struct ADGameDescription {
};
/**
+ * A list of pointers to ADGameDescription structs (or subclasses thereof).
+ */
+typedef Array<const ADGameDescription*> ADGameDescList;
+
+/**
* End marker for a table of ADGameDescription structs. Use this to
* terminate a list to be passed to the AdvancedDetector API.
*/
@@ -144,15 +149,16 @@ struct ADParams {
/**
* A callback pointing to an (optional) generic fallback detect
- * function. If present, this gets called if both the regular
+ * function. If present, this callback is invoked if both the regular
* MD5 based detection as well as the file based fallback failed
- * to detect anything. It is supposed
+ * to detect anything.
*
* @note The fslist parameter may be 0 -- in that case, it is assumed
* that the callback searchs the current directory.
+ *
+ * @todo
*/
- //GameList (*fallbackDetectFunc)(const FSList *fslist);
- uint dummy;
+ ADGameDescList (*fallbackDetectFunc)(const FSList *fslist);
/**
* A bitmask of flags which can be used to configure the behavior