[Scummvm-git-logs] scummvm master -> d6645f3fc9bbd74174be544417780185fd9a9743
hpvb
hp at tmm.cx
Sun May 28 11:40:10 CEST 2017
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:
159e5a97ce ENGINES: Allow detection entries to match on full paths
d6645f3fc9 Merge pull request #949 from csnover/advanceddetector-fullpaths
Commit: 159e5a97ce4f04eddd3d91a00aee2f3131b13a50
https://github.com/scummvm/scummvm/commit/159e5a97ce4f04eddd3d91a00aee2f3131b13a50
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-05-21T15:56:42-05:00
Commit Message:
ENGINES: Allow detection entries to match on full paths
This allows an engine to match files that exist multiple times
in the same game directory with the same basename.
For example, different releases of Torin's Passage in SCI engine
come with zero or more GERMAN, FRENCH, ENGLISH, etc. directories,
all containing files with the same basenames but with different
contents per language. Because the allFiles map used only the
basename of a file as a key, it could not match more than one of
these localization directories, which made it impossible to select
from all the possible languages.
Refs Trac#9772.
Changed paths:
engines/advancedDetector.cpp
engines/advancedDetector.h
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index 8b6dc0c..64f462a 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -345,7 +345,7 @@ void AdvancedMetaEngine::reportUnknown(const Common::FSNode &path, const ADFileP
g_system->logMessage(LogMessageType::kInfo, report.c_str());
}
-void AdvancedMetaEngine::composeFileHashMap(FileMap &allFiles, const Common::FSList &fslist, int depth) const {
+void AdvancedMetaEngine::composeFileHashMap(FileMap &allFiles, const Common::FSList &fslist, int depth, const Common::String &parentName) const {
if (depth <= 0)
return;
@@ -353,6 +353,8 @@ void AdvancedMetaEngine::composeFileHashMap(FileMap &allFiles, const Common::FSL
return;
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
+ Common::String tstr = (_matchFullPaths && !parentName.empty() ? parentName + "/" : "") + file->getName();
+
if (file->isDirectory()) {
Common::FSList files;
@@ -372,11 +374,9 @@ void AdvancedMetaEngine::composeFileHashMap(FileMap &allFiles, const Common::FSL
if (!file->getChildren(files, Common::FSNode::kListAll))
continue;
- composeFileHashMap(allFiles, files, depth - 1);
+ composeFileHashMap(allFiles, files, depth - 1, tstr);
}
- Common::String tstr = file->getName();
-
// Strip any trailing dot
if (tstr.lastChar() == '.')
tstr.deleteLastChar();
@@ -625,6 +625,7 @@ AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, con
_guiOptions = GUIO_NONE;
_maxScanDepth = 1;
_directoryGlobs = NULL;
+ _matchFullPaths = false;
}
void AdvancedMetaEngine::initSubSystems(const ADGameDescription *gameDesc) const {
diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h
index ab3ec22..e218c41 100644
--- a/engines/advancedDetector.h
+++ b/engines/advancedDetector.h
@@ -251,6 +251,17 @@ protected:
*/
const char * const *_directoryGlobs;
+ /**
+ * If true, filenames will be matched against the entire path, relative to
+ * the root detection directory (e.g. "foo/bar.000" for a file at
+ * "<root>/foo/bar.000"). Otherwise, filenames only match the basename
+ * (e.g. "bar.000" for the same file).
+ *
+ * @note _maxScanDepth and _directoryGlobs must still be configured to allow
+ * the detector to find files inside subdirectories.
+ */
+ bool _matchFullPaths;
+
public:
AdvancedMetaEngine(const void *descs, uint descItemSize, const PlainGameDescriptor *gameIds, const ADExtraGuiOptionsMap *extraGuiOptions = 0);
@@ -326,7 +337,7 @@ protected:
* Compose a hashmap of all files in fslist.
* Includes nifty stuff like removing trailing dots and ignoring case.
*/
- void composeFileHashMap(FileMap &allFiles, const Common::FSList &fslist, int depth) const;
+ void composeFileHashMap(FileMap &allFiles, const Common::FSList &fslist, int depth, const Common::String &parentName = Common::String()) const;
/** Get the properties (size and MD5) of this file. */
bool getFileProperties(const Common::FSNode &parent, const FileMap &allFiles, const ADGameDescription &game, const Common::String fname, ADFileProperties &fileProps) const;
Commit: d6645f3fc9bbd74174be544417780185fd9a9743
https://github.com/scummvm/scummvm/commit/d6645f3fc9bbd74174be544417780185fd9a9743
Author: Hein-Pieter van Braam (hp at tmm.cx)
Date: 2017-05-28T11:40:07+02:00
Commit Message:
Merge pull request #949 from csnover/advanceddetector-fullpaths
ENGINES: Allow detection entries to match on full paths
Changed paths:
engines/advancedDetector.cpp
engines/advancedDetector.h
More information about the Scummvm-git-logs
mailing list