[Scummvm-git-logs] scummvm master -> 530a892012a452a1afd1589e294df39be57cdcab

sev- sev at scummvm.org
Wed Oct 7 00:20:20 UTC 2020


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

Summary:
489823a739 Revert "LASTEXPRESS: added detection entry for gog release"
7af0fb302e LASTEXPRESS: Fix detection for GOG release
4a401e36fc COMMON: Extend FSDirectory, so matching functions could also match subdirectories
6d0072475f SWORD25: Make the extracted version working
530a892012 NEWS: Mention Sword25 improvement


Commit: 489823a73927953a00226fc427eb4561dde6a269
    https://github.com/scummvm/scummvm/commit/489823a73927953a00226fc427eb4561dde6a269
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-10-07T01:40:03+02:00

Commit Message:
Revert "LASTEXPRESS: added detection entry for gog release"

This reverts commit 3128c0be2f376da913f3bd14708b0fa127f51f34.

The md5s are for full files, it was never tested or even compiled,
as it is obvious from the PR#1333. There are different reasons why the
version was not detected, this will be fixed separately.

Changed paths:
    engines/lastexpress/detection.cpp


diff --git a/engines/lastexpress/detection.cpp b/engines/lastexpress/detection.cpp
index fc070cef93..12e82df17b 100644
--- a/engines/lastexpress/detection.cpp
+++ b/engines/lastexpress/detection.cpp
@@ -200,25 +200,6 @@ static const ADGameDescription gameDescriptions[] = {
 		GUIO2(GUIO_NOASPECT, GUIO_NOMIDI)
 	},
 
-	// The Last Express (GOG)
-	//   expressw.exe ???
-	//   express.exe  2010-12-14 13:49:04
-	{
-		"lastexpress",
-		"",
-		{
-			{"HD.HPF",  0, "ab940d5815008b176502f759ae753fb7", 30715904},   // 2000-03-01 17:03:58
-			{"CD1.HPF", 0, "cec8810125b050f41b7f34ab72371f81", 525522944},  // 2000-02-14 16:02:02
-			{"CD2.HPF", 0, "c648872b31e43d458680cf16bedc636c", 669581312},  // 1997-02-10 21:19:30
-			{"CD3.HPF", 0, "8cb3e68a6dca354e556c487ea24a6b10", 641128448},  // 1997-02-10 20:44:08
-			AD_LISTEND
-		},
-		Common::EN_ANY,
-		Common::kPlatformUnknown,
-		ADGF_UNSTABLE,
-		GUIO2(GUIO_NOASPECT, GUIO_NOMIDI)
-	},
-
 	AD_TABLE_END_MARKER
 };
 


Commit: 7af0fb302eb2a9012536341af58965385fcf3fbd
    https://github.com/scummvm/scummvm/commit/7af0fb302eb2a9012536341af58965385fcf3fbd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-10-07T01:40:03+02:00

Commit Message:
LASTEXPRESS: Fix detection for GOG release

Changed paths:
    engines/lastexpress/detection.cpp


diff --git a/engines/lastexpress/detection.cpp b/engines/lastexpress/detection.cpp
index 12e82df17b..cfb7373966 100644
--- a/engines/lastexpress/detection.cpp
+++ b/engines/lastexpress/detection.cpp
@@ -203,11 +203,17 @@ static const ADGameDescription gameDescriptions[] = {
 	AD_TABLE_END_MARKER
 };
 
+static const char *const directoryGlobs[] = {
+        "data", // GOG release
+        0
+};
 
 class LastExpressMetaEngineStatic : public AdvancedMetaEngineStatic {
 public:
 	LastExpressMetaEngineStatic() : AdvancedMetaEngineStatic(gameDescriptions, sizeof(ADGameDescription), lastExpressGames) {
 		_guiOptions = GUIO2(GUIO_NOSUBTITLES, GUIO_NOSFX);
+		_maxScanDepth = 2;
+		_directoryGlobs = directoryGlobs;
 	}
 
 	const char *getEngineId() const override {


Commit: 4a401e36fcce9395376ebb68697e1e5712279408
    https://github.com/scummvm/scummvm/commit/4a401e36fcce9395376ebb68697e1e5712279408
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-10-07T01:40:03+02:00

Commit Message:
COMMON: Extend FSDirectory, so matching functions could also match subdirectories

Changed paths:
    common/fs.cpp
    common/fs.h


diff --git a/common/fs.cpp b/common/fs.cpp
index 89c19aaaab..aac774714c 100644
--- a/common/fs.cpp
+++ b/common/fs.cpp
@@ -168,24 +168,28 @@ bool FSNode::createDirectory() const {
 	return _realNode->createDirectory();
 }
 
-FSDirectory::FSDirectory(const FSNode &node, int depth, bool flat, bool ignoreClashes)
-  : _node(node), _cached(false), _depth(depth), _flat(flat), _ignoreClashes(ignoreClashes) {
+FSDirectory::FSDirectory(const FSNode &node, int depth, bool flat, bool ignoreClashes, bool includeDirectories)
+  : _node(node), _cached(false), _depth(depth), _flat(flat), _ignoreClashes(ignoreClashes),
+	_includeDirectories(includeDirectories) {
 }
 
 FSDirectory::FSDirectory(const String &prefix, const FSNode &node, int depth, bool flat,
-                         bool ignoreClashes)
-  : _node(node), _cached(false), _depth(depth), _flat(flat), _ignoreClashes(ignoreClashes) {
+                         bool ignoreClashes, bool includeDirectories)
+  : _node(node), _cached(false), _depth(depth), _flat(flat), _ignoreClashes(ignoreClashes),
+    _includeDirectories(includeDirectories) {
 
 	setPrefix(prefix);
 }
 
-FSDirectory::FSDirectory(const String &name, int depth, bool flat, bool ignoreClashes)
-  : _node(name), _cached(false), _depth(depth), _flat(flat), _ignoreClashes(ignoreClashes) {
+FSDirectory::FSDirectory(const String &name, int depth, bool flat, bool ignoreClashes, bool includeDirectories)
+  : _node(name), _cached(false), _depth(depth), _flat(flat), _ignoreClashes(ignoreClashes),
+    _includeDirectories(includeDirectories) {
 }
 
 FSDirectory::FSDirectory(const String &prefix, const String &name, int depth, bool flat,
-                         bool ignoreClashes)
-  : _node(name), _cached(false), _depth(depth), _flat(flat), _ignoreClashes(ignoreClashes) {
+                         bool ignoreClashes, bool includeDirectories)
+  : _node(name), _cached(false), _depth(depth), _flat(flat), _ignoreClashes(ignoreClashes),
+    _includeDirectories(includeDirectories) {
 
 	setPrefix(prefix);
 }
@@ -337,13 +341,21 @@ int FSDirectory::listMatchingMembers(ArchiveMemberList &list, const String &patt
 	lowercasePattern.toLowercase();
 
 	int matches = 0;
-	NodeCache::const_iterator it = _fileCache.begin();
-	for ( ; it != _fileCache.end(); ++it) {
+	for (NodeCache::const_iterator it = _fileCache.begin(); it != _fileCache.end(); ++it) {
 		if (it->_key.matchString(lowercasePattern, false, true)) {
 			list.push_back(ArchiveMemberPtr(new FSNode(it->_value)));
 			matches++;
 		}
 	}
+	if (_includeDirectories) {
+		for (NodeCache::const_iterator it = _subDirCache.begin(); it != _subDirCache.end(); ++it) {
+			if (it->_key.matchString(lowercasePattern, false, true)) {
+				list.push_back(ArchiveMemberPtr(new FSNode(it->_value)));
+				matches++;
+			}
+		}
+	}
+
 	return matches;
 }
 
@@ -360,6 +372,13 @@ int FSDirectory::listMembers(ArchiveMemberList &list) const {
 		++files;
 	}
 
+	if (_includeDirectories) {
+		for (NodeCache::const_iterator it = _subDirCache.begin(); it != _subDirCache.end(); ++it) {
+			list.push_back(ArchiveMemberPtr(new FSNode(it->_value)));
+			++files;
+		}
+	}
+
 	return files;
 }
 
diff --git a/common/fs.h b/common/fs.h
index e550bef34b..43024499d3 100644
--- a/common/fs.h
+++ b/common/fs.h
@@ -295,6 +295,7 @@ class FSDirectory : public Archive {
 	int _depth;
 	bool _flat;
 	bool _ignoreClashes;
+	bool _includeDirectories;
 
 	String	_prefix; // string that is prepended to each cache item key
 	void setPrefix(const String &prefix);
@@ -321,18 +322,18 @@ public:
 	 * valid directory.
 	 */
 	FSDirectory(const String &name, int depth = 1, bool flat = false,
-	            bool ignoreClashes = false);
+	            bool ignoreClashes = false, bool includeDirectories = false);
 	FSDirectory(const FSNode &node, int depth = 1, bool flat = false,
-	            bool ignoreClashes = false);
+	            bool ignoreClashes = false, bool includeDirectories = false);
 
 	/**
 	 * Create a FSDirectory representing a tree with the specified depth. The parameter
 	 * prefix is prepended to the keys in the cache. See class comment.
 	 */
 	FSDirectory(const String &prefix, const String &name, int depth = 1,
-	            bool flat = false, bool ignoreClashes = false);
+	            bool flat = false, bool ignoreClashes = false, bool includeDirectories = false);
 	FSDirectory(const String &prefix, const FSNode &node, int depth = 1,
-	            bool flat = false, bool ignoreClashes = false);
+	            bool flat = false, bool ignoreClashes = false, bool includeDirectories = false);
 
 	virtual ~FSDirectory();
 


Commit: 6d0072475f3c2104418db96415b1d9c49f99112a
    https://github.com/scummvm/scummvm/commit/6d0072475f3c2104418db96415b1d9c49f99112a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-10-07T01:40:03+02:00

Commit Message:
SWORD25: Make the extracted version working

Our FSDirectory Archive behaviour differs from other Archive-based
classes such as Zip. It returns only files, while the archivers
return whole paths. Thus, we have to use custom code for pattern-based
queries which Lua code uses extensively

Changed paths:
    engines/sword25/package/packagemanager.cpp
    engines/sword25/package/packagemanager.h


diff --git a/engines/sword25/package/packagemanager.cpp b/engines/sword25/package/packagemanager.cpp
index 19425b50ab..695db7341f 100644
--- a/engines/sword25/package/packagemanager.cpp
+++ b/engines/sword25/package/packagemanager.cpp
@@ -57,7 +57,8 @@ static Common::String normalizePath(const Common::String &path, const Common::St
 PackageManager::PackageManager(Kernel *pKernel) : Service(pKernel),
 	_currentDirectory(PATH_SEPARATOR),
 	_rootFolder(ConfMan.get("path")),
-	_useEnglishSpeech(ConfMan.getBool("english_speech")) {
+	_useEnglishSpeech(ConfMan.getBool("english_speech")),
+	_extractedFiles(false) {
 	if (!registerScriptBindings())
 		error("Script bindings could not be registered.");
 	else
@@ -142,7 +143,7 @@ bool PackageManager::loadPackage(const Common::String &fileName, const Common::S
 
 bool PackageManager::loadDirectoryAsPackage(const Common::String &directoryName, const Common::String &mountPosition) {
 	Common::FSNode directory(directoryName);
-	Common::Archive *folderArchive = new Common::FSDirectory(directory, 6);
+	Common::Archive *folderArchive = new Common::FSDirectory(directory, 6, false, false, true);
 	if (!directory.exists() || (folderArchive == NULL)) {
 		error("Unable to mount directory \"%s\" to \"%s\".", directoryName.c_str(), mountPosition.c_str());
 		return false;
@@ -155,6 +156,9 @@ bool PackageManager::loadDirectoryAsPackage(const Common::String &directoryName,
 
 		_archiveList.push_front(new ArchiveEntry(folderArchive, mountPosition));
 
+		_extractedFiles = true;
+		_directoryName = directoryName;
+
 		return true;
 	}
 }
@@ -270,20 +274,37 @@ int PackageManager::doSearch(Common::ArchiveMemberList &list, const Common::Stri
 
 		// Create a list of the matching names
 		for (Common::ArchiveMemberList::iterator it = memberList.begin(); it != memberList.end(); ++it) {
-			if (((typeFilter & PackageManager::FT_DIRECTORY) && (*it)->getName().hasSuffix("/")) ||
-				((typeFilter & PackageManager::FT_FILE) && !(*it)->getName().hasSuffix("/"))) {
+			Common::String name;
+			bool matchType;
+
+			// FSNode->getName() returns only name of the file, without the directory
+			// getPath() returns full path in the FS. Thus, we're getting it and
+			// removing the root from it.
+			if (_extractedFiles) {
+				Common::FSNode *node = (Common::FSNode *)(it->get());
+
+				name = node->getPath().substr(_directoryName.size());
+
+				matchType = (((typeFilter & PackageManager::FT_DIRECTORY) && node->isDirectory()) ||
+					((typeFilter & PackageManager::FT_FILE) && !node->isDirectory()));
+			} else {
+				matchType = ((typeFilter & PackageManager::FT_DIRECTORY) && name.hasSuffix("/")) ||
+				((typeFilter & PackageManager::FT_FILE) && !name.hasSuffix("/"));
+			}
+
+			if (matchType) {
 
 				// Do not add duplicate files
 				bool found = false;
 				for (Common::ArchiveMemberList::iterator it1 = list.begin(); it1 != list.end(); ++it1) {
-					if ((*it1)->getName() == (*it)->getName()) {
+					if ((*it1)->getName() == name) {
 						found = true;
 						break;
 					}
 				}
 
 				if (!found)
-					list.push_back(*it);
+					list.push_back(Common::ArchiveMemberList::value_type(new Common::GenericArchiveMember(name, (*i)->archive)));
 				num++;
 			}
 		}
diff --git a/engines/sword25/package/packagemanager.h b/engines/sword25/package/packagemanager.h
index c79734cca8..5687763379 100644
--- a/engines/sword25/package/packagemanager.h
+++ b/engines/sword25/package/packagemanager.h
@@ -87,6 +87,8 @@ private:
 	Common::String _currentDirectory;
 	Common::FSNode _rootFolder;
 	Common::List<ArchiveEntry *> _archiveList;
+	bool _extractedFiles;
+	Common::String _directoryName;
 
 	bool _useEnglishSpeech;
 	Common::String ensureSpeechLang(const Common::String &fileName);


Commit: 530a892012a452a1afd1589e294df39be57cdcab
    https://github.com/scummvm/scummvm/commit/530a892012a452a1afd1589e294df39be57cdcab
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-10-07T01:40:03+02:00

Commit Message:
NEWS: Mention Sword25 improvement

Changed paths:
    NEWS.md


diff --git a/NEWS.md b/NEWS.md
index ebc38f3c78..96b505b480 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -15,6 +15,9 @@ For a more comprehensive changelog of the latest experimental code, see:
  Supernova:
    - Added Italian translation for part 1.
 
+ Sword25:
+   - Made the extracted version working.
+
  Xeen:
    - Fixed occasional border corruption during fights.
 




More information about the Scummvm-git-logs mailing list