diff options
author | Filippos Karapetis | 2012-11-07 21:56:26 +0200 |
---|---|---|
committer | Filippos Karapetis | 2012-11-07 21:56:26 +0200 |
commit | f915daad6d4af80a1da663de9fbbf0e4be021932 (patch) | |
tree | 3537b1df51f3fbdbbee17e4d3efe0ce1b81e9efd | |
parent | 3b5e92d4f3ce587bb8fce0251fa62a4c25a5a6d9 (diff) | |
download | scummvm-rg350-f915daad6d4af80a1da663de9fbbf0e4be021932.tar.gz scummvm-rg350-f915daad6d4af80a1da663de9fbbf0e4be021932.tar.bz2 scummvm-rg350-f915daad6d4af80a1da663de9fbbf0e4be021932.zip |
SWORD1: Fix bug #3049346 - "BS1: Detects games in wrong places"
We no longer detect the sword1 files inside the "clusters" folder
-rw-r--r-- | engines/sword1/detection.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp index 5662e4672b..f3af04c81d 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); } } } |