mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-03 15:41:41 +00:00
Extended advancedDetector with depth parameter.
Now AD can search nested directories. By default it is turned off, but there is new parameter to ADParameters struct. Usually value of 2 is good enough for all purposes. svn-id: r49653
This commit is contained in:
parent
4f3bb60cd5
commit
4d517ed0e9
@ -340,6 +340,35 @@ static void reportUnknown(const Common::FSNode &path, const SizeMD5Map &filesSiz
|
||||
|
||||
static ADGameDescList detectGameFilebased(const FileMap &allFiles, const ADParams ¶ms);
|
||||
|
||||
static void composeFileHashMap(const Common::FSList &fslist, FileMap &allFiles, int depth) {
|
||||
if (depth == 0)
|
||||
return;
|
||||
|
||||
if (fslist.empty())
|
||||
return;
|
||||
|
||||
// First we compose a hashmap of all files in fslist.
|
||||
// Includes nifty stuff like removing trailing dots and ignoring case.
|
||||
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
||||
if (file->isDirectory()) {
|
||||
Common::FSList files;
|
||||
|
||||
if (!file->getChildren(files, Common::FSNode::kListAll))
|
||||
continue;
|
||||
|
||||
composeFileHashMap(files, allFiles, depth - 1);
|
||||
}
|
||||
|
||||
Common::String tstr = file->getName();
|
||||
|
||||
// Strip any trailing dot
|
||||
if (tstr.lastChar() == '.')
|
||||
tstr.deleteLastChar();
|
||||
|
||||
allFiles[tstr] = *file; // Record the presence of this file
|
||||
}
|
||||
}
|
||||
|
||||
static ADGameDescList detectGame(const Common::FSList &fslist, const ADParams ¶ms, Common::Language language, Common::Platform platform, const Common::String &extra) {
|
||||
FileMap allFiles;
|
||||
SizeMD5Map filesSizeMD5;
|
||||
@ -355,18 +384,7 @@ static ADGameDescList detectGame(const Common::FSList &fslist, const ADParams &p
|
||||
|
||||
// First we compose a hashmap of all files in fslist.
|
||||
// Includes nifty stuff like removing trailing dots and ignoring case.
|
||||
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
||||
if (file->isDirectory())
|
||||
continue;
|
||||
|
||||
Common::String tstr = file->getName();
|
||||
|
||||
// Strip any trailing dot
|
||||
if (tstr.lastChar() == '.')
|
||||
tstr.deleteLastChar();
|
||||
|
||||
allFiles[tstr] = *file; // Record the presence of this file
|
||||
}
|
||||
composeFileHashMap(fslist, allFiles, (params.depth == 0 ? 1 : params.depth));
|
||||
|
||||
// Check which files are included in some ADGameDescription *and* present
|
||||
// in fslist. Compute MD5s and file sizes for these files.
|
||||
|
@ -190,6 +190,13 @@ struct ADParams {
|
||||
* enum for the list.
|
||||
*/
|
||||
uint32 guioptions;
|
||||
|
||||
/**
|
||||
*
|
||||
* Maximum depth of directories to look up
|
||||
* If set to 0, the depth is 1 level
|
||||
*/
|
||||
uint32 depth;
|
||||
};
|
||||
|
||||
|
||||
|
@ -979,7 +979,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI
|
||||
Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
} // End of namespace Agi
|
||||
|
@ -102,7 +102,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOLAUNCHLOAD
|
||||
Common::GUIO_NOLAUNCHLOAD,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
using namespace AGOS;
|
||||
|
@ -569,7 +569,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI
|
||||
Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
class CineMetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -237,7 +237,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI
|
||||
Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
class CruiseMetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -94,7 +94,9 @@ const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Global GUI options
|
||||
Common::GUIO_NONE
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
class DraciMetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -264,7 +264,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOMIDI
|
||||
Common::GUIO_NOMIDI,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
class DrasculaMetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -5094,7 +5094,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOLAUNCHLOAD
|
||||
Common::GUIO_NOLAUNCHLOAD,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
class GobMetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -176,7 +176,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
kADFlagUseExtraAsHint,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOSUBTITLES | Common::GUIO_NOSFX
|
||||
Common::GUIO_NOSUBTITLES | Common::GUIO_NOSFX,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
|
||||
|
@ -1226,7 +1226,9 @@ const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NONE
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
} // End of anonymous namespace
|
||||
|
@ -196,7 +196,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
kADFlagUseExtraAsHint,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOSPEECH
|
||||
Common::GUIO_NOSPEECH,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
class LureMetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -400,7 +400,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOMIDI
|
||||
Common::GUIO_NOMIDI,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
class M4MetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -493,7 +493,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NONE
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
class MadeMetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -1011,7 +1011,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Additional GUI options (for every game)
|
||||
Common::GUIO_NONE
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
class MohawkMetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -240,7 +240,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NOLAUNCHLOAD
|
||||
Common::GUIO_NOLAUNCHLOAD,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
class ParallactionMetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -122,7 +122,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NONE
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
class SagaMetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -310,7 +310,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NONE
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
class SciMetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -91,7 +91,8 @@ static const ADParams detectionParams = {
|
||||
"teenagent",
|
||||
0,
|
||||
0,
|
||||
Common::GUIO_NONE
|
||||
Common::GUIO_NONE,
|
||||
1
|
||||
};
|
||||
|
||||
#define MAX_SAVES 20
|
||||
|
@ -637,7 +637,9 @@ static const ADParams detectionParams = {
|
||||
// Flags
|
||||
0,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NONE
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
class TinselMetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -134,7 +134,9 @@ static const ADParams detectionParams = {
|
||||
Touche::fileBasedFallback, // file-based detection data to enable not yet known versions to start
|
||||
kADFlagPrintWarningOnFileBasedFallback,
|
||||
// Additional GUI options (for every game}
|
||||
Common::GUIO_NONE
|
||||
Common::GUIO_NONE,
|
||||
// Maximum directory depth
|
||||
1
|
||||
};
|
||||
|
||||
class ToucheMetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -114,7 +114,8 @@ static const ADParams detectionParams = {
|
||||
"tucker",
|
||||
0,
|
||||
0,
|
||||
Common::GUIO_NONE
|
||||
Common::GUIO_NONE,
|
||||
1
|
||||
};
|
||||
|
||||
static const ADGameDescription tuckerDemoGameDescription = {
|
||||
|
Loading…
Reference in New Issue
Block a user