[Scummvm-cvs-logs] SF.net SVN: scummvm:[49653] scummvm/trunk/engines

sev at users.sourceforge.net sev at users.sourceforge.net
Mon Jun 14 16:50:23 CEST 2010


Revision: 49653
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49653&view=rev
Author:   sev
Date:     2010-06-14 14:50:23 +0000 (Mon, 14 Jun 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    scummvm/trunk/engines/advancedDetector.cpp
    scummvm/trunk/engines/advancedDetector.h
    scummvm/trunk/engines/agi/detection.cpp
    scummvm/trunk/engines/agos/detection.cpp
    scummvm/trunk/engines/cine/detection.cpp
    scummvm/trunk/engines/cruise/detection.cpp
    scummvm/trunk/engines/draci/detection.cpp
    scummvm/trunk/engines/drascula/detection.cpp
    scummvm/trunk/engines/gob/detection.cpp
    scummvm/trunk/engines/groovie/detection.cpp
    scummvm/trunk/engines/kyra/detection.cpp
    scummvm/trunk/engines/lure/detection.cpp
    scummvm/trunk/engines/m4/detection.cpp
    scummvm/trunk/engines/made/detection.cpp
    scummvm/trunk/engines/mohawk/detection.cpp
    scummvm/trunk/engines/parallaction/detection.cpp
    scummvm/trunk/engines/saga/detection.cpp
    scummvm/trunk/engines/sci/detection.cpp
    scummvm/trunk/engines/teenagent/detection.cpp
    scummvm/trunk/engines/tinsel/detection.cpp
    scummvm/trunk/engines/touche/detection.cpp
    scummvm/trunk/engines/tucker/detection.cpp

Modified: scummvm/trunk/engines/advancedDetector.cpp
===================================================================
--- scummvm/trunk/engines/advancedDetector.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/advancedDetector.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -340,6 +340,35 @@
 
 static ADGameDescList detectGameFilebased(const FileMap &allFiles, const ADParams &params);
 
+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 &params, Common::Language language, Common::Platform platform, const Common::String &extra) {
 	FileMap allFiles;
 	SizeMD5Map filesSizeMD5;
@@ -355,19 +384,8 @@
 
 	// 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;
+	composeFileHashMap(fslist, allFiles, (params.depth == 0 ? 1 : params.depth));
 
-		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
 	// in fslist. Compute MD5s and file sizes for these files.
 	for (descPtr = params.descs; ((const ADGameDescription *)descPtr)->gameid != 0; descPtr += params.descItemSize) {

Modified: scummvm/trunk/engines/advancedDetector.h
===================================================================
--- scummvm/trunk/engines/advancedDetector.h	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/advancedDetector.h	2010-06-14 14:50:23 UTC (rev 49653)
@@ -190,6 +190,13 @@
 	 * enum for the list.
 	 */
 	uint32 guioptions;
+
+	/**
+	 *
+	 * Maximum depth of directories to look up
+	 * If set to 0, the depth is 1 level
+	 */
+	uint32 depth;
 };
 
 

Modified: scummvm/trunk/engines/agi/detection.cpp
===================================================================
--- scummvm/trunk/engines/agi/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/agi/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -979,7 +979,9 @@
 	// 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

Modified: scummvm/trunk/engines/agos/detection.cpp
===================================================================
--- scummvm/trunk/engines/agos/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/agos/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -102,7 +102,9 @@
 	// Flags
 	0,
 	// Additional GUI options (for every game}
-	Common::GUIO_NOLAUNCHLOAD
+	Common::GUIO_NOLAUNCHLOAD,
+	// Maximum directory depth
+	1
 };
 
 using namespace AGOS;

Modified: scummvm/trunk/engines/cine/detection.cpp
===================================================================
--- scummvm/trunk/engines/cine/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/cine/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -569,7 +569,9 @@
 	// 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 {

Modified: scummvm/trunk/engines/cruise/detection.cpp
===================================================================
--- scummvm/trunk/engines/cruise/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/cruise/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -237,7 +237,9 @@
 	// 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 {

Modified: scummvm/trunk/engines/draci/detection.cpp
===================================================================
--- scummvm/trunk/engines/draci/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/draci/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -94,7 +94,9 @@
 	// Flags
 	0,
 	// Global GUI options
-	Common::GUIO_NONE
+	Common::GUIO_NONE,
+	// Maximum directory depth
+	1
 };
 
 class DraciMetaEngine : public AdvancedMetaEngine {

Modified: scummvm/trunk/engines/drascula/detection.cpp
===================================================================
--- scummvm/trunk/engines/drascula/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/drascula/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -264,7 +264,9 @@
 	// Flags
 	0,
 	// Additional GUI options (for every game}
-	Common::GUIO_NOMIDI
+	Common::GUIO_NOMIDI,
+	// Maximum directory depth
+	1
 };
 
 class DrasculaMetaEngine : public AdvancedMetaEngine {

Modified: scummvm/trunk/engines/gob/detection.cpp
===================================================================
--- scummvm/trunk/engines/gob/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/gob/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -5094,7 +5094,9 @@
 	// Flags
 	0,
 	// Additional GUI options (for every game}
-	Common::GUIO_NOLAUNCHLOAD
+	Common::GUIO_NOLAUNCHLOAD,
+	// Maximum directory depth
+	1
 };
 
 class GobMetaEngine : public AdvancedMetaEngine {

Modified: scummvm/trunk/engines/groovie/detection.cpp
===================================================================
--- scummvm/trunk/engines/groovie/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/groovie/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -176,7 +176,9 @@
 	// Flags
 	kADFlagUseExtraAsHint,
 	// Additional GUI options (for every game}
-	Common::GUIO_NOSUBTITLES | Common::GUIO_NOSFX
+	Common::GUIO_NOSUBTITLES | Common::GUIO_NOSFX,
+	// Maximum directory depth
+	1
 };
 
 

Modified: scummvm/trunk/engines/kyra/detection.cpp
===================================================================
--- scummvm/trunk/engines/kyra/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/kyra/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -1226,7 +1226,9 @@
 	// Flags
 	0,
 	// Additional GUI options (for every game}
-	Common::GUIO_NONE
+	Common::GUIO_NONE,
+	// Maximum directory depth
+	1
 };
 
 } // End of anonymous namespace

Modified: scummvm/trunk/engines/lure/detection.cpp
===================================================================
--- scummvm/trunk/engines/lure/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/lure/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -196,7 +196,9 @@
 	// Flags
 	kADFlagUseExtraAsHint,
 	// Additional GUI options (for every game}
-	Common::GUIO_NOSPEECH
+	Common::GUIO_NOSPEECH,
+	// Maximum directory depth
+	1
 };
 
 class LureMetaEngine : public AdvancedMetaEngine {

Modified: scummvm/trunk/engines/m4/detection.cpp
===================================================================
--- scummvm/trunk/engines/m4/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/m4/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -400,7 +400,9 @@
 	// Flags
 	0,
 	// Additional GUI options (for every game}
-	Common::GUIO_NOMIDI
+	Common::GUIO_NOMIDI,
+	// Maximum directory depth
+	1
 };
 
 class M4MetaEngine : public AdvancedMetaEngine {

Modified: scummvm/trunk/engines/made/detection.cpp
===================================================================
--- scummvm/trunk/engines/made/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/made/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -493,7 +493,9 @@
 	// Flags
 	0,
 	// Additional GUI options (for every game}
-	Common::GUIO_NONE
+	Common::GUIO_NONE,
+	// Maximum directory depth
+	1
 };
 
 class MadeMetaEngine : public AdvancedMetaEngine {

Modified: scummvm/trunk/engines/mohawk/detection.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/mohawk/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -1011,7 +1011,9 @@
 	// Flags
 	0,
 	// Additional GUI options (for every game)
-	Common::GUIO_NONE
+	Common::GUIO_NONE,
+	// Maximum directory depth
+	1
 };
 
 class MohawkMetaEngine : public AdvancedMetaEngine {

Modified: scummvm/trunk/engines/parallaction/detection.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/parallaction/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -240,7 +240,9 @@
 	// Flags
 	0,
 	// Additional GUI options (for every game}
-	Common::GUIO_NOLAUNCHLOAD
+	Common::GUIO_NOLAUNCHLOAD,
+	// Maximum directory depth
+	1
 };
 
 class ParallactionMetaEngine : public AdvancedMetaEngine {

Modified: scummvm/trunk/engines/saga/detection.cpp
===================================================================
--- scummvm/trunk/engines/saga/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/saga/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -122,7 +122,9 @@
 	// Flags
 	0,
 	// Additional GUI options (for every game}
-	Common::GUIO_NONE
+	Common::GUIO_NONE,
+	// Maximum directory depth
+	1
 };
 
 class SagaMetaEngine : public AdvancedMetaEngine {

Modified: scummvm/trunk/engines/sci/detection.cpp
===================================================================
--- scummvm/trunk/engines/sci/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/sci/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -310,7 +310,9 @@
 	// Flags
 	0,
 	// Additional GUI options (for every game}
-	Common::GUIO_NONE
+	Common::GUIO_NONE,
+	// Maximum directory depth
+	1
 };
 
 class SciMetaEngine : public AdvancedMetaEngine {

Modified: scummvm/trunk/engines/teenagent/detection.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/teenagent/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -91,7 +91,8 @@
 	"teenagent",
 	0,
 	0,
-	Common::GUIO_NONE
+	Common::GUIO_NONE,
+	1
 };
 
 #define MAX_SAVES 20

Modified: scummvm/trunk/engines/tinsel/detection.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/tinsel/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -637,7 +637,9 @@
 	// Flags
 	0,
 	// Additional GUI options (for every game}
-	Common::GUIO_NONE
+	Common::GUIO_NONE,
+	// Maximum directory depth
+	1
 };
 
 class TinselMetaEngine : public AdvancedMetaEngine {

Modified: scummvm/trunk/engines/touche/detection.cpp
===================================================================
--- scummvm/trunk/engines/touche/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/touche/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -134,7 +134,9 @@
 	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 {

Modified: scummvm/trunk/engines/tucker/detection.cpp
===================================================================
--- scummvm/trunk/engines/tucker/detection.cpp	2010-06-14 13:53:15 UTC (rev 49652)
+++ scummvm/trunk/engines/tucker/detection.cpp	2010-06-14 14:50:23 UTC (rev 49653)
@@ -114,7 +114,8 @@
 	"tucker",
 	0,
 	0,
-	Common::GUIO_NONE
+	Common::GUIO_NONE,
+	1
 };
 
 static const ADGameDescription tuckerDemoGameDescription = {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list