Properly implemented the AD fallback callback
svn-id: r25576
This commit is contained in:
parent
59b1526e5a
commit
75ae7cdb73
2 changed files with 18 additions and 12 deletions
|
@ -33,8 +33,6 @@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
typedef Array<const ADGameDescription*> ADGameDescList;
|
|
||||||
|
|
||||||
namespace AdvancedDetector {
|
namespace AdvancedDetector {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -344,9 +342,10 @@ static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams &p
|
||||||
|
|
||||||
ADGameDescList matched;
|
ADGameDescList matched;
|
||||||
int maxFilesMatched = 0;
|
int maxFilesMatched = 0;
|
||||||
|
const ADGameDescription *g;
|
||||||
|
|
||||||
for (i = 0; i < gameDescriptions.size(); i++) {
|
for (i = 0; i < gameDescriptions.size(); i++) {
|
||||||
const ADGameDescription *g = gameDescriptions[i];
|
g = gameDescriptions[i];
|
||||||
fileMissing = false;
|
fileMissing = false;
|
||||||
|
|
||||||
// Do not even bother to look at entries which do not have matching
|
// 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
|
if (matchEntry) { // We got a match
|
||||||
for (i = 0; i < gameDescriptions.size(); i++) {
|
for (i = 0; i < gameDescriptions.size(); i++) {
|
||||||
if (gameDescriptions[i]->filesDescriptions[0].fileName == 0) {
|
g = gameDescriptions[i];
|
||||||
if (!scumm_stricmp(gameDescriptions[i]->gameid, *matchEntry)) {
|
if (g->filesDescriptions[0].fileName == 0) {
|
||||||
|
if (!scumm_stricmp(g->gameid, *matchEntry)) {
|
||||||
// FIXME: This warning, if ever seen by somebody, is
|
// FIXME: This warning, if ever seen by somebody, is
|
||||||
// extremly cryptic!
|
// extremly cryptic!
|
||||||
warning("But it looks like unknown variant of %s", *matchEntry);
|
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 we still haven't got a match, try to use the fallback callback :-)
|
||||||
if (matched.empty() && params.fallbackDetectFunc != 0) {
|
if (matched.empty() && params.fallbackDetectFunc != 0) {
|
||||||
matched = (*params.fallbackDetectFunc)(fslist);
|
matched = (*params.fallbackDetectFunc)(fslist);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return matched;
|
return matched;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,11 @@ struct ADGameDescription {
|
||||||
uint32 flags;
|
uint32 flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* End marker for a table of ADGameDescription structs. Use this to
|
||||||
* terminate a list to be passed to the AdvancedDetector API.
|
* 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
|
* 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
|
* 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
|
* @note The fslist parameter may be 0 -- in that case, it is assumed
|
||||||
* that the callback searchs the current directory.
|
* that the callback searchs the current directory.
|
||||||
|
*
|
||||||
|
* @todo
|
||||||
*/
|
*/
|
||||||
//GameList (*fallbackDetectFunc)(const FSList *fslist);
|
ADGameDescList (*fallbackDetectFunc)(const FSList *fslist);
|
||||||
uint dummy;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A bitmask of flags which can be used to configure the behavior
|
* A bitmask of flags which can be used to configure the behavior
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue