[Scummvm-cvs-logs] SF.net SVN: scummvm: [21455] scummvm/trunk/common

sev at users.sourceforge.net sev at users.sourceforge.net
Sat Mar 25 13:19:01 CET 2006


Revision: 21455
Author:   sev
Date:     2006-03-25 13:17:38 -0800 (Sat, 25 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21455&view=rev

Log Message:
-----------
Fixing bug #1458388: "SIMON1: Game Detection fails".
Sometimes instead of "GAMEPC" we get "GAMEPC." (note trailing dot)

Modified Paths:
--------------
    scummvm/trunk/common/file.cpp
    scummvm/trunk/engines/simon/game.cpp
Modified: scummvm/trunk/common/file.cpp
===================================================================
--- scummvm/trunk/common/file.cpp	2006-03-25 20:15:41 UTC (rev 21454)
+++ scummvm/trunk/common/file.cpp	2006-03-25 21:17:38 UTC (rev 21455)
@@ -221,6 +221,11 @@
 	} else if (_filesMap.contains(fname)) {
 		debug(3, "Opening hashed: %s", _filesMap[fname].c_str());
 		_handle = fopen(_filesMap[fname].c_str(), modeStr);
+	} else if (_filesMap.contains(fname + ".")) {
+		// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
+		// sometimes instead of "GAMEPC" we get "GAMEPC." (note trailing dot)
+		debug(3, "Opening hashed: %s", _filesMap[fname].c_str());
+		_handle = fopen(_filesMap[fname].c_str(), modeStr);
 	} else {
 
 		StringList::const_iterator x;

Modified: scummvm/trunk/engines/simon/game.cpp
===================================================================
--- scummvm/trunk/engines/simon/game.cpp	2006-03-25 20:15:41 UTC (rev 21454)
+++ scummvm/trunk/engines/simon/game.cpp	2006-03-25 21:17:38 UTC (rev 21455)
@@ -1344,7 +1344,7 @@
 	Common::File test_file;
 	bool file_missing;
 
-	Common::String tstr, tstr1;
+	Common::String tstr, tstr1, tstr2;
 	char md5str[32+1];
 	uint8 md5sum[16];
 
@@ -1352,11 +1352,16 @@
 	for (int i = 0; i < ARRAYSIZE(gameMD5); i++) {
 		tstr = Common::String(gameMD5[i].filename);
 		tstr.toLowercase();
+		// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
+		// sometimes instead of "GAMEPC" we get "GAMEPC." (note trailing dot)
+		tstr2 = tstr + ".";
 
 		if (gameMD5[i].caseSensitive && !mode)
 			filesList[Common::String(gameMD5[i].filename)] = true;
-		else
+		else {
 			filesList[tstr] = true;
+			filesList[tstr2] = true;
+		}
 	}
 
 	if (mode) {
@@ -1368,14 +1373,17 @@
 				// makes tstr1 lowercase as well
 				tstr1 = Common::String(file->displayName().c_str());
 				tstr.toLowercase();
+				// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
+				tstr2 = tstr + ".";
 
-				if (filesList.contains(tstr) || filesList.contains(tstr1)) {
+				if (filesList.contains(tstr) || filesList.contains(tstr1) || filesList.contains(tstr2)) {
 					if (Common::md5_file(file->path().c_str(), md5sum, NULL, FILE_MD5_BYTES)) {
 						for (int j = 0; j < 16; j++) {
 							sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
 						}
 						filesMD5[tstr] = Common::String(md5str);
 						filesMD5[tstr1] = Common::String(md5str);
+						filesMD5[tstr2] = Common::String(md5str);
 					}
 				}
 			}
@@ -1403,8 +1411,10 @@
 		// Try to open all files for this game
 		for (file_n = 0; file_n < file_count; file_n++) {
 			tstr = gameDescriptions[game_n].filesDescriptions[file_n].fileName;
+			// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
+			tstr2 = tstr + ".";
 
-			if (!filesMD5.contains(tstr)) {
+			if (!filesMD5.contains(tstr) && !filesMD5.contains(tstr2)) {
 				file_missing = true;
 				break;
 			}
@@ -1422,8 +1432,10 @@
 			for (int i = 0; i < ARRAYSIZE(gameMD5); i++) {
 				if (gameMD5[i].id == gameDescriptions[game_n].gameId) {
 					tstr = gameMD5[i].filename;
+					// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
+					tstr2 = tstr + ".";
 
-					if (strcmp(gameMD5[i].md5, filesMD5[tstr].c_str())) {
+					if (strcmp(gameMD5[i].md5, filesMD5[tstr].c_str()) && strcmp(gameMD5[i].md5, filesMD5[tstr2].c_str())) {
 						match = false;
 						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