[Scummvm-cvs-logs] scummvm master -> f915daad6d4af80a1da663de9fbbf0e4be021932

bluegr bluegr at gmail.com
Wed Nov 7 20:57:37 CET 2012


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
f915daad6d SWORD1: Fix bug #3049346 - "BS1: Detects games in wrong places"


Commit: f915daad6d4af80a1da663de9fbbf0e4be021932
    https://github.com/scummvm/scummvm/commit/f915daad6d4af80a1da663de9fbbf0e4be021932
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2012-11-07T11:56:26-08:00

Commit Message:
SWORD1: Fix bug #3049346 - "BS1: Detects games in wrong places"

We no longer detect the sword1 files inside the "clusters" folder

Changed paths:
    engines/sword1/detection.cpp



diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index 5662e46..f3af04c 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -143,9 +143,24 @@ GameDescriptor SwordMetaEngine::findGame(const char *gameid) const {
 	return GameDescriptor();
 }
 
-void Sword1CheckDirectory(const Common::FSList &fslist, bool *filesFound) {
+void Sword1CheckDirectory(const Common::FSList &fslist, bool *filesFound, bool recursion = false) {
 	for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
 		if (!file->isDirectory()) {
+			// The required game data files can be located in the game directory, or in
+			// a subdirectory called "clusters". In the latter case, we don't want to
+			// detect the game in that subdirectory, as this will detect the game twice
+			// when mass add is searching inside a directory. In this case, the first
+			// result (the game directory) will be correct, but the second result (the
+			// clusters subdirectory) will be wrong, as the optional speech, music and
+			// video data files will be ignored. Note that this fix will skip the game
+			// data files if the user has placed them inside a "clusters" subdirectory,
+			// or if he/she points ScummVM directly to the "clusters" directory of the
+			// game CD. Fixes bug #3049346.
+			Common::String directory = file->getParent().getName();
+			directory.toLowercase();
+			if (directory.hasPrefix("clusters") && directory.size() <= 9 && !recursion)
+				continue;
+
 			const char *fileName = file->getName().c_str();
 			for (int cnt = 0; cnt < NUM_FILES_TO_CHECK; cnt++)
 				if (scumm_stricmp(fileName, g_filesToCheck[cnt]) == 0)
@@ -155,7 +170,7 @@ void Sword1CheckDirectory(const Common::FSList &fslist, bool *filesFound) {
 				if (scumm_stricmp(file->getName().c_str(), g_dirNames[cnt]) == 0) {
 					Common::FSList fslist2;
 					if (file->getChildren(fslist2, Common::FSNode::kListFilesOnly))
-						Sword1CheckDirectory(fslist2, filesFound);
+						Sword1CheckDirectory(fslist2, filesFound, true);
 				}
 		}
 	}






More information about the Scummvm-git-logs mailing list