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
22 changed files with 95 additions and 32 deletions
|
@ -340,6 +340,35 @@ static void reportUnknown(const Common::FSNode &path, const SizeMD5Map &filesSiz
|
||||||
|
|
||||||
static ADGameDescList detectGameFilebased(const FileMap &allFiles, const ADParams ¶ms);
|
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) {
|
static ADGameDescList detectGame(const Common::FSList &fslist, const ADParams ¶ms, Common::Language language, Common::Platform platform, const Common::String &extra) {
|
||||||
FileMap allFiles;
|
FileMap allFiles;
|
||||||
SizeMD5Map filesSizeMD5;
|
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.
|
// First we compose a hashmap of all files in fslist.
|
||||||
// Includes nifty stuff like removing trailing dots and ignoring case.
|
// Includes nifty stuff like removing trailing dots and ignoring case.
|
||||||
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
composeFileHashMap(fslist, allFiles, (params.depth == 0 ? 1 : params.depth));
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check which files are included in some ADGameDescription *and* present
|
// Check which files are included in some ADGameDescription *and* present
|
||||||
// in fslist. Compute MD5s and file sizes for these files.
|
// in fslist. Compute MD5s and file sizes for these files.
|
||||||
|
|
|
@ -190,6 +190,13 @@ struct ADParams {
|
||||||
* enum for the list.
|
* enum for the list.
|
||||||
*/
|
*/
|
||||||
uint32 guioptions;
|
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
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Additional GUI options (for every game}
|
// 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
|
} // End of namespace Agi
|
||||||
|
|
|
@ -102,7 +102,9 @@ static const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Additional GUI options (for every game}
|
// Additional GUI options (for every game}
|
||||||
Common::GUIO_NOLAUNCHLOAD
|
Common::GUIO_NOLAUNCHLOAD,
|
||||||
|
// Maximum directory depth
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
using namespace AGOS;
|
using namespace AGOS;
|
||||||
|
|
|
@ -569,7 +569,9 @@ static const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Additional GUI options (for every game}
|
// 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 {
|
class CineMetaEngine : public AdvancedMetaEngine {
|
||||||
|
|
|
@ -237,7 +237,9 @@ static const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Additional GUI options (for every game}
|
// 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 {
|
class CruiseMetaEngine : public AdvancedMetaEngine {
|
||||||
|
|
|
@ -94,7 +94,9 @@ const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Global GUI options
|
// Global GUI options
|
||||||
Common::GUIO_NONE
|
Common::GUIO_NONE,
|
||||||
|
// Maximum directory depth
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
class DraciMetaEngine : public AdvancedMetaEngine {
|
class DraciMetaEngine : public AdvancedMetaEngine {
|
||||||
|
|
|
@ -264,7 +264,9 @@ static const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Additional GUI options (for every game}
|
// Additional GUI options (for every game}
|
||||||
Common::GUIO_NOMIDI
|
Common::GUIO_NOMIDI,
|
||||||
|
// Maximum directory depth
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
class DrasculaMetaEngine : public AdvancedMetaEngine {
|
class DrasculaMetaEngine : public AdvancedMetaEngine {
|
||||||
|
|
|
@ -5094,7 +5094,9 @@ static const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Additional GUI options (for every game}
|
// Additional GUI options (for every game}
|
||||||
Common::GUIO_NOLAUNCHLOAD
|
Common::GUIO_NOLAUNCHLOAD,
|
||||||
|
// Maximum directory depth
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
class GobMetaEngine : public AdvancedMetaEngine {
|
class GobMetaEngine : public AdvancedMetaEngine {
|
||||||
|
|
|
@ -176,7 +176,9 @@ static const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
kADFlagUseExtraAsHint,
|
kADFlagUseExtraAsHint,
|
||||||
// Additional GUI options (for every game}
|
// 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
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Additional GUI options (for every game}
|
// Additional GUI options (for every game}
|
||||||
Common::GUIO_NONE
|
Common::GUIO_NONE,
|
||||||
|
// Maximum directory depth
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of anonymous namespace
|
} // End of anonymous namespace
|
||||||
|
|
|
@ -196,7 +196,9 @@ static const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
kADFlagUseExtraAsHint,
|
kADFlagUseExtraAsHint,
|
||||||
// Additional GUI options (for every game}
|
// Additional GUI options (for every game}
|
||||||
Common::GUIO_NOSPEECH
|
Common::GUIO_NOSPEECH,
|
||||||
|
// Maximum directory depth
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
class LureMetaEngine : public AdvancedMetaEngine {
|
class LureMetaEngine : public AdvancedMetaEngine {
|
||||||
|
|
|
@ -400,7 +400,9 @@ static const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Additional GUI options (for every game}
|
// Additional GUI options (for every game}
|
||||||
Common::GUIO_NOMIDI
|
Common::GUIO_NOMIDI,
|
||||||
|
// Maximum directory depth
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
class M4MetaEngine : public AdvancedMetaEngine {
|
class M4MetaEngine : public AdvancedMetaEngine {
|
||||||
|
|
|
@ -493,7 +493,9 @@ static const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Additional GUI options (for every game}
|
// Additional GUI options (for every game}
|
||||||
Common::GUIO_NONE
|
Common::GUIO_NONE,
|
||||||
|
// Maximum directory depth
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
class MadeMetaEngine : public AdvancedMetaEngine {
|
class MadeMetaEngine : public AdvancedMetaEngine {
|
||||||
|
|
|
@ -1011,7 +1011,9 @@ static const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Additional GUI options (for every game)
|
// Additional GUI options (for every game)
|
||||||
Common::GUIO_NONE
|
Common::GUIO_NONE,
|
||||||
|
// Maximum directory depth
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
class MohawkMetaEngine : public AdvancedMetaEngine {
|
class MohawkMetaEngine : public AdvancedMetaEngine {
|
||||||
|
|
|
@ -240,7 +240,9 @@ static const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Additional GUI options (for every game}
|
// Additional GUI options (for every game}
|
||||||
Common::GUIO_NOLAUNCHLOAD
|
Common::GUIO_NOLAUNCHLOAD,
|
||||||
|
// Maximum directory depth
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
class ParallactionMetaEngine : public AdvancedMetaEngine {
|
class ParallactionMetaEngine : public AdvancedMetaEngine {
|
||||||
|
|
|
@ -122,7 +122,9 @@ static const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Additional GUI options (for every game}
|
// Additional GUI options (for every game}
|
||||||
Common::GUIO_NONE
|
Common::GUIO_NONE,
|
||||||
|
// Maximum directory depth
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
class SagaMetaEngine : public AdvancedMetaEngine {
|
class SagaMetaEngine : public AdvancedMetaEngine {
|
||||||
|
|
|
@ -310,7 +310,9 @@ static const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Additional GUI options (for every game}
|
// Additional GUI options (for every game}
|
||||||
Common::GUIO_NONE
|
Common::GUIO_NONE,
|
||||||
|
// Maximum directory depth
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
class SciMetaEngine : public AdvancedMetaEngine {
|
class SciMetaEngine : public AdvancedMetaEngine {
|
||||||
|
|
|
@ -91,7 +91,8 @@ static const ADParams detectionParams = {
|
||||||
"teenagent",
|
"teenagent",
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
Common::GUIO_NONE
|
Common::GUIO_NONE,
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_SAVES 20
|
#define MAX_SAVES 20
|
||||||
|
|
|
@ -637,7 +637,9 @@ static const ADParams detectionParams = {
|
||||||
// Flags
|
// Flags
|
||||||
0,
|
0,
|
||||||
// Additional GUI options (for every game}
|
// Additional GUI options (for every game}
|
||||||
Common::GUIO_NONE
|
Common::GUIO_NONE,
|
||||||
|
// Maximum directory depth
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
class TinselMetaEngine : public AdvancedMetaEngine {
|
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
|
Touche::fileBasedFallback, // file-based detection data to enable not yet known versions to start
|
||||||
kADFlagPrintWarningOnFileBasedFallback,
|
kADFlagPrintWarningOnFileBasedFallback,
|
||||||
// Additional GUI options (for every game}
|
// Additional GUI options (for every game}
|
||||||
Common::GUIO_NONE
|
Common::GUIO_NONE,
|
||||||
|
// Maximum directory depth
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
class ToucheMetaEngine : public AdvancedMetaEngine {
|
class ToucheMetaEngine : public AdvancedMetaEngine {
|
||||||
|
|
|
@ -114,7 +114,8 @@ static const ADParams detectionParams = {
|
||||||
"tucker",
|
"tucker",
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
Common::GUIO_NONE
|
Common::GUIO_NONE,
|
||||||
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
static const ADGameDescription tuckerDemoGameDescription = {
|
static const ADGameDescription tuckerDemoGameDescription = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue