[Scummvm-git-logs] scummvm master -> eb0c76f78289aa9d8436a68764f9191bb1305e40
bgK
bastien.bouclet at gmail.com
Sun Sep 13 08:58:42 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0eb3fea404 SWORD1: Change detection to query the name of the parent folder only once
eb0c76f782 SWORD2: Change detection to query the name of the parent folder only once
Commit: 0eb3fea404b7cfb6b1465b26898bb05c1522af80
https://github.com/scummvm/scummvm/commit/0eb3fea404b7cfb6b1465b26898bb05c1522af80
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-09-13T09:31:07+02:00
Commit Message:
SWORD1: Change detection to query the name of the parent folder only once
All the files passed to the detector are in the same folder. They all
have the same parent. No need to check each one individually.
This saves 2500 ms on the 3DS.
Changed paths:
engines/sword1/detection.cpp
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index fdd1377430..b024e29730 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -147,24 +147,9 @@ PlainGameDescriptor SwordMetaEngine::findGame(const char *gameId) const {
return PlainGameDescriptor::empty();
}
-void Sword1CheckDirectory(const Common::FSList &fslist, bool *filesFound, bool recursion = false) {
+void Sword1CheckDirectory(const Common::FSList &fslist, bool *filesFound) {
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;
-
for (int cnt = 0; cnt < NUM_FILES_TO_CHECK; cnt++)
if (scumm_stricmp(file->getName().c_str(), g_filesToCheck[cnt]) == 0)
filesFound[cnt] = true;
@@ -173,7 +158,7 @@ void Sword1CheckDirectory(const Common::FSList &fslist, bool *filesFound, bool r
if (scumm_stricmp(file->getName().c_str(), g_dirNames[cnt]) == 0) {
Common::FSList fslist2;
if (file->getChildren(fslist2, Common::FSNode::kListFilesOnly))
- Sword1CheckDirectory(fslist2, filesFound, true);
+ Sword1CheckDirectory(fslist2, filesFound);
}
}
}
@@ -186,6 +171,22 @@ DetectedGames SwordMetaEngine::detectGames(const Common::FSList &fslist) const {
for (i = 0; i < NUM_FILES_TO_CHECK; i++)
filesFound[i] = false;
+ // 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.
+ if (!fslist.empty()) {
+ Common::String directory = fslist[0].getParent().getName();
+ if (directory.hasPrefixIgnoreCase("clusters") && directory.size() <= 9)
+ return detectedGames;
+ }
+
Sword1CheckDirectory(fslist, filesFound);
bool mainFilesFound = true;
bool pcFilesFound = true;
Commit: eb0c76f78289aa9d8436a68764f9191bb1305e40
https://github.com/scummvm/scummvm/commit/eb0c76f78289aa9d8436a68764f9191bb1305e40
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-09-13T09:31:07+02:00
Commit Message:
SWORD2: Change detection to query the name of the parent folder only once
All the files passed to the detector are in the same folder. They all
have the same parent. No need to check each one individually.
This saves 14500 ms on the 3DS.
Changed paths:
engines/sword2/sword2.cpp
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index a939d82783..396d094052 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -173,42 +173,27 @@ DetectedGames detectGamesImpl(const Common::FSList &fslist, bool recursion = fal
for (g = Sword2::sword2_settings; g->gameid; ++g) {
// Iterate over all files in the given directory
for (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 #3049336.
- Common::String directory = file->getParent().getName();
- directory.toLowercase();
- if (directory.hasPrefix("clusters") && directory.size() <= 9 && !recursion)
- continue;
+ if (file->isDirectory()) continue;
- if (file->getName().equalsIgnoreCase(g->detectname)) {
- // Make sure that the sword2 demo is not mixed up with the
- // full version, since they use the same filename for detection
- if ((g->features == Sword2::GF_DEMO && isFullVersion) ||
- (g->features == 0 && !isFullVersion))
- continue;
+ if (file->getName().equalsIgnoreCase(g->detectname)) {
+ // Make sure that the sword2 demo is not mixed up with the
+ // full version, since they use the same filename for detection
+ if ((g->features == Sword2::GF_DEMO && isFullVersion) ||
+ (g->features == 0 && !isFullVersion))
+ continue;
- // Match found, add to list of candidates, then abort inner loop.
- DetectedGame game = DetectedGame("sword2", g->gameid, g->description);
- game.setGUIOptions(GUIO2(GUIO_NOMIDI, GUIO_NOASPECT));
+ // Match found, add to list of candidates, then abort inner loop.
+ DetectedGame game = DetectedGame("sword2", g->gameid, g->description);
+ game.setGUIOptions(GUIO2(GUIO_NOMIDI, GUIO_NOASPECT));
- detectedGames.push_back(game);
- break;
- }
+ detectedGames.push_back(game);
+ break;
}
}
}
- if (detectedGames.empty()) {
+ if (detectedGames.empty() && !recursion) {
// Nothing found -- try to recurse into the 'clusters' subdirectory,
// present e.g. if the user copied the data straight from CD.
for (file = fslist.begin(); file != fslist.end(); ++file) {
@@ -232,6 +217,22 @@ DetectedGames detectGamesImpl(const Common::FSList &fslist, bool recursion = fal
}
DetectedGames Sword2MetaEngine::detectGames(const Common::FSList &fslist) const {
+ // 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 #3049336.
+ if (!fslist.empty()) {
+ Common::String directory = fslist[0].getParent().getName();
+ if (directory.hasPrefixIgnoreCase("clusters") && directory.size() <= 9)
+ return DetectedGames();
+ }
+
return detectGamesImpl(fslist);
}
More information about the Scummvm-git-logs
mailing list