[Scummvm-cvs-logs] SF.net SVN: scummvm: [25273] scummvm/trunk/common/advancedDetector.cpp

sev at users.sourceforge.net sev at users.sourceforge.net
Tue Jan 30 03:02:10 CET 2007


Revision: 25273
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25273&view=rev
Author:   sev
Date:     2007-01-29 18:02:10 -0800 (Mon, 29 Jan 2007)

Log Message:
-----------
- Fixed bug with single ID detection
- Added more debug output

Modified Paths:
--------------
    scummvm/trunk/common/advancedDetector.cpp

Modified: scummvm/trunk/common/advancedDetector.cpp
===================================================================
--- scummvm/trunk/common/advancedDetector.cpp	2007-01-30 00:24:09 UTC (rev 25272)
+++ scummvm/trunk/common/advancedDetector.cpp	2007-01-30 02:02:10 UTC (rev 25273)
@@ -223,11 +223,16 @@
 	Common::ADList matches = detectGame(0, params, language, platform);
 
 	int gameNumber = -1;
-	for (uint i = 0; i < matches.size(); i++) {
-		if (((const ADGameDescription *)(params.descs + matches[i] * params.descItemSize))->gameid == gameid) {
-			gameNumber = matches[i];
-			break;
+
+	if (params.singleid == NULL) {
+		for (uint i = 0; i < matches.size(); i++) {
+			if (((const ADGameDescription *)(params.descs + matches[i] * params.descItemSize))->gameid == gameid) {
+				gameNumber = matches[i];
+				break;
+			}
 		}
+	} else {
+		gameNumber = matches[0];
 	}
 
 	if (gameNumber >= 0) {
@@ -258,11 +263,15 @@
 	const ADGameFileDescription *fileDesc;
 
 	Common::ADGameDescList gameDescriptions;
+
+	debug(3, "Starting detection");
+
 	for (const byte *descPtr = params.descs; ((const ADGameDescription *)descPtr)->gameid != 0; descPtr += params.descItemSize)
 		gameDescriptions.push_back((const ADGameDescription *)descPtr);
 
 	assert(gameDescriptions.size());
 
+	debug(4, "List of descriptions: %d", gameDescriptions.size());
 
 	// First we compose list of files which we need MD5s for
 	for (i = 0; i < gameDescriptions.size(); i++) {
@@ -284,6 +293,8 @@
 			tstr.toLowercase();
 			tstr2 = tstr + ".";
 
+			debug(3, "+ %s", tstr.c_str());
+
 			if (!filesList.contains(tstr) && !filesList.contains(tstr2)) continue;
 
 			if (!md5_file(*file, md5sum, params.md5Bytes)) continue;
@@ -293,6 +304,8 @@
 			filesMD5[tstr] = String(md5str);
 			filesMD5[tstr2] = String(md5str);
 
+			debug(3, "> %s: %s", tstr.c_str(), md5str);
+
 			if (f.open(file->path())) {
 				filesSize[tstr] = filesSize[tstr2] = (int32)f.size();
 				f.close();
@@ -350,6 +363,7 @@
 					break;
 				}
 				if (strcmp(fileDesc->md5, filesMD5[tstr].c_str()) && strcmp(fileDesc->md5, filesMD5[tstr2].c_str())) {
+					debug(3, "MD5 Mismatch. Skipping (%s) (%s)", fileDesc->md5, filesMD5[tstr].c_str());
 					fileMissing = true;
 					break;
 				}
@@ -360,6 +374,7 @@
 					break;
 				}
 				if (fileDesc->fileSize != filesSize[tstr] && fileDesc->fileSize != filesSize[tstr2]) {
+					debug(3, "Size Mismatch. Skipping");
 					fileMissing = true;
 					break;
 				}


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