mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-03 07:30:56 +00:00
DETECTOR: Treat file based fallback like any other fallback method
This commit is contained in:
parent
879c3c7817
commit
01f806c2db
@ -472,24 +472,19 @@ ADGameDescList AdvancedMetaEngine::detectGame(const Common::FSNode &parent, cons
|
||||
}
|
||||
|
||||
// Filename based fallback
|
||||
if (_fileBasedFallback != 0) {
|
||||
g = detectGameFilebased(allFiles);
|
||||
if (g)
|
||||
matched.push_back(g);
|
||||
}
|
||||
}
|
||||
|
||||
return matched;
|
||||
}
|
||||
|
||||
const ADGameDescription *AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles) const {
|
||||
const ADGameDescription *AdvancedMetaEngine::detectGameFilebased(const FileMap &allFiles, const ADFileBasedFallback *fileBasedFallback) const {
|
||||
const ADFileBasedFallback *ptr;
|
||||
const char* const* filenames;
|
||||
|
||||
int maxNumMatchedFiles = 0;
|
||||
const ADGameDescription *matchedDesc = 0;
|
||||
|
||||
for (ptr = _fileBasedFallback; ptr->desc; ++ptr) {
|
||||
for (ptr = fileBasedFallback; ptr->desc; ++ptr) {
|
||||
const ADGameDescription *agdesc = (const ADGameDescription *)ptr->desc;
|
||||
int numMatchedFiles = 0;
|
||||
bool fileMissing = false;
|
||||
@ -566,7 +561,6 @@ AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, con
|
||||
|
||||
_md5Bytes = 5000;
|
||||
_singleid = NULL;
|
||||
_fileBasedFallback = NULL;
|
||||
_flags = 0;
|
||||
_guioptions = Common::GUIO_NONE;
|
||||
_maxScanDepth = 1;
|
||||
|
@ -172,16 +172,6 @@ protected:
|
||||
*/
|
||||
const char *_singleid;
|
||||
|
||||
/**
|
||||
* List of files for file-based fallback detection (optional).
|
||||
* This is used if the regular MD5 based detection failed to
|
||||
* detect anything.
|
||||
* As usual this list is terminated by an all-zero entry.
|
||||
*
|
||||
* @todo Properly explain this
|
||||
*/
|
||||
const ADFileBasedFallback *_fileBasedFallback;
|
||||
|
||||
/**
|
||||
* A bitmask of flags which can be used to configure the behavior
|
||||
* of the AdvancedDetector. Refer to ADFlags for a list of flags
|
||||
@ -234,8 +224,7 @@ protected:
|
||||
|
||||
/**
|
||||
* An (optional) generic fallback detect function which is invoked
|
||||
* if both the regular MD5 based detection as well as the file
|
||||
* based fallback failed to detect anything.
|
||||
* if the regular MD5 based detection failed to detect anything.
|
||||
*/
|
||||
virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
|
||||
return 0;
|
||||
@ -256,7 +245,7 @@ protected:
|
||||
ADGameDescList detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const;
|
||||
|
||||
/**
|
||||
* Iterates over all ADFileBasedFallback records inside _fileBasedFallback.
|
||||
* Iterates over all ADFileBasedFallback records inside fileBasedFallback.
|
||||
* This then returns the record (or rather, the ADGameDescription
|
||||
* contained in it) for which all files described by it are present, and
|
||||
* among those the one with the maximal number of matching files.
|
||||
@ -265,7 +254,7 @@ protected:
|
||||
* @param allFiles a map describing all present files
|
||||
* @param fileBasedFallback a list of ADFileBasedFallback records, zero-terminated
|
||||
*/
|
||||
const ADGameDescription *detectGameFilebased(const FileMap &allFiles) const;
|
||||
const ADGameDescription *detectGameFilebased(const FileMap &allFiles, const ADFileBasedFallback *fileBasedFallback) const;
|
||||
|
||||
// TODO
|
||||
void updateGameDescriptor(GameDescriptor &desc, const ADGameDescription *realDesc) const;
|
||||
|
@ -91,7 +91,6 @@ class GobMetaEngine : public AdvancedMetaEngine {
|
||||
public:
|
||||
GobMetaEngine() : AdvancedMetaEngine(Gob::gameDescriptions, sizeof(Gob::GOBGameDescription), gobGames) {
|
||||
_singleid = "gob";
|
||||
_fileBasedFallback = Gob::fileBased;
|
||||
_guioptions = Common::GUIO_NOLAUNCHLOAD;
|
||||
}
|
||||
|
||||
@ -99,6 +98,10 @@ public:
|
||||
return Engines::findGameID(gameid, _gameids, obsoleteGameIDsTable);
|
||||
}
|
||||
|
||||
virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
|
||||
return detectGameFilebased(allFiles, Gob::fileBased);
|
||||
}
|
||||
|
||||
virtual const char *getName() const {
|
||||
return "Gob";
|
||||
}
|
||||
|
@ -162,10 +162,14 @@ class MohawkMetaEngine : public AdvancedMetaEngine {
|
||||
public:
|
||||
MohawkMetaEngine() : AdvancedMetaEngine(Mohawk::gameDescriptions, sizeof(Mohawk::MohawkGameDescription), mohawkGames) {
|
||||
_singleid = "mohawk";
|
||||
_fileBasedFallback = Mohawk::fileBased;
|
||||
_maxScanDepth = 2;
|
||||
_directoryGlobs = directoryGlobs;
|
||||
}
|
||||
|
||||
virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
|
||||
return detectGameFilebased(allFiles, Mohawk::fileBased);
|
||||
}
|
||||
|
||||
virtual const char *getName() const {
|
||||
return "Mohawk";
|
||||
}
|
||||
|
@ -121,10 +121,14 @@ class ToonMetaEngine : public AdvancedMetaEngine {
|
||||
public:
|
||||
ToonMetaEngine() : AdvancedMetaEngine(Toon::gameDescriptions, sizeof(ADGameDescription), toonGames) {
|
||||
_singleid = "toon";
|
||||
_fileBasedFallback = Toon::fileBasedFallback;
|
||||
_maxScanDepth = 3;
|
||||
_directoryGlobs = directoryGlobs;
|
||||
}
|
||||
|
||||
virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
|
||||
return detectGameFilebased(allFiles, Toon::fileBasedFallback);
|
||||
}
|
||||
|
||||
virtual const char *getName() const {
|
||||
return "Toon";
|
||||
}
|
||||
|
@ -131,11 +131,15 @@ public:
|
||||
ToucheMetaEngine() : AdvancedMetaEngine(Touche::gameDescriptions, sizeof(ADGameDescription), toucheGames) {
|
||||
_md5Bytes = 4096;
|
||||
_singleid = "touche";
|
||||
_fileBasedFallback = Touche::fileBasedFallback;
|
||||
_flags = kADFlagPrintWarningOnFileBasedFallback;
|
||||
_maxScanDepth = 2;
|
||||
_directoryGlobs = directoryGlobs;
|
||||
}
|
||||
|
||||
virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
|
||||
return detectGameFilebased(allFiles, Touche::fileBasedFallback);
|
||||
}
|
||||
|
||||
virtual const char *getName() const {
|
||||
return "Touche";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user