[Scummvm-git-logs] scummvm master -> 1a9e5ab3ac71668722f6c66477a86e68a6bd4692

bluegr noreply at scummvm.org
Fri Dec 22 19:06:44 UTC 2023


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

Summary:
1a9e5ab3ac COMMON: Add createReadStreamForMemberAltStream to FSDirectory


Commit: 1a9e5ab3ac71668722f6c66477a86e68a6bd4692
    https://github.com/scummvm/scummvm/commit/1a9e5ab3ac71668722f6c66477a86e68a6bd4692
Author: elasota (1137273+elasota at users.noreply.github.com)
Date: 2023-12-22T21:06:41+02:00

Commit Message:
COMMON: Add createReadStreamForMemberAltStream to FSDirectory

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


diff --git a/common/fs.cpp b/common/fs.cpp
index 7b68f566051..76aad9ef8f4 100644
--- a/common/fs.cpp
+++ b/common/fs.cpp
@@ -390,6 +390,23 @@ SeekableReadStream *FSDirectory::createReadStreamForMember(const Path &path) con
 	return stream;
 }
 
+SeekableReadStream *FSDirectory::createReadStreamForMemberAltStream(const Path &path, AltStreamType altStreamType) const {
+	if (path.toString().empty() || !_node.isDirectory())
+		return nullptr;
+
+	FSNode *node = lookupCache(_fileCache, path);
+	if (!node)
+		return nullptr;
+
+	debug(5, "FSDirectory::createReadStreamForMemberAltStream('%s', %i) -> '%s'", path.toString().c_str(), static_cast<int>(altStreamType), node->getPath().c_str());
+
+	SeekableReadStream *stream = node->createReadStreamForAltStream(altStreamType);
+	if (!stream)
+		warning("FSDirectory::createReadStreamForMemberAltStream: Can't create stream for file '%s' alt stream type %i", Common::toPrintable(path.toString()).c_str(), static_cast<int>(altStreamType));
+
+	return stream;
+}
+
 FSDirectory *FSDirectory::getSubDirectory(const Path &name, int depth, bool flat, bool ignoreClashes) {
 	return getSubDirectory(Path(), name, depth, flat, ignoreClashes);
 }
diff --git a/common/fs.h b/common/fs.h
index 7480cd2ac7a..7e2f13ea0de 100644
--- a/common/fs.h
+++ b/common/fs.h
@@ -441,6 +441,12 @@ public:
 	 * for success.
 	 */
 	SeekableReadStream *createReadStreamForMember(const Path &path) const override;
+
+	/**
+	 * Open an alternate stream for a specified file. A full match of relative path and file name is needed
+	 * for success.
+	 */
+	SeekableReadStream *createReadStreamForMemberAltStream(const Path &path, AltStreamType altStreamType) const override;
 };
 
 /** @} */




More information about the Scummvm-git-logs mailing list