aboutsummaryrefslogtreecommitdiff
path: root/engines/advancedDetector.cpp
diff options
context:
space:
mode:
authorColin Snover2017-05-21 15:31:37 -0500
committerColin Snover2017-05-21 15:56:42 -0500
commit159e5a97ce4f04eddd3d91a00aee2f3131b13a50 (patch)
tree7735077479553bbf1e2e05a419bce61dd36928ba /engines/advancedDetector.cpp
parentfa0bb7dd5a60c8f323ecbd5e190ad705bec3e934 (diff)
downloadscummvm-rg350-159e5a97ce4f04eddd3d91a00aee2f3131b13a50.tar.gz
scummvm-rg350-159e5a97ce4f04eddd3d91a00aee2f3131b13a50.tar.bz2
scummvm-rg350-159e5a97ce4f04eddd3d91a00aee2f3131b13a50.zip
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.
Diffstat (limited to 'engines/advancedDetector.cpp')
-rw-r--r--engines/advancedDetector.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index 8b6dc0c0d9..64f462a936 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 {