[Scummvm-git-logs] scummvm master -> b975da233521e9eeb6bc05feb2ebf98d17e9d9bd

sev- noreply at scummvm.org
Thu Jul 27 09:02:33 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:
b975da2335 COMMON: fix MacResManager native resource forks


Commit: b975da233521e9eeb6bc05feb2ebf98d17e9d9bd
    https://github.com/scummvm/scummvm/commit/b975da233521e9eeb6bc05feb2ebf98d17e9d9bd
Author: Misty De Meo (mistydemeo at gmail.com)
Date: 2023-07-27T11:02:29+02:00

Commit Message:
COMMON: fix MacResManager native resource forks

These broke in the archive refactor,
b8acbe6bee730a9024e73acc769b54285be9afde/#5108, because it removed
the ability to directly convert an `ArchiveMember` to an `FSNode`.
As a result, it was no longer possible to directly open a resource
fork as a stream.

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


diff --git a/common/fs.cpp b/common/fs.cpp
index 7b24adac6f8..e794adbe6bc 100644
--- a/common/fs.cpp
+++ b/common/fs.cpp
@@ -362,6 +362,18 @@ void FSDirectory::cacheDirectoryRecursive(FSNode node, int depth, const Path& pr
 				}
 			} else {
 				_fileCache[name] = *it;
+
+#ifdef MACOSX
+				// On Mac, check for native resource fork
+				String rsrcName = it->getPath() + "/..namedfork/rsrc";
+				FSNode rsrc = FSNode(rsrcName);
+
+				Path cacheName = prefix.join(it->getRealName() + "/..namedfork/rsrc");
+
+				if (rsrc.exists()) {
+					_fileCache[cacheName] = rsrc;
+				}
+#endif
 			}
 		}
 	}
diff --git a/common/macresman.cpp b/common/macresman.cpp
index 801817ae581..3601ce364c8 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -274,8 +274,7 @@ bool MacResManager::open(const Path &fileName, Archive &archive) {
 	// Check the actual fork on a Mac computer. It's even worse than __MACOSX as
 	// it's present on any HFS(+) and appears even after copying macbin on HFS(+).
 	const ArchiveMemberPtr archiveMember = archive.getMember(fileName);
-	const Common::FSNode *plainFsNode = dynamic_cast<const Common::FSNode *>(archiveMember.get());
-	if (plainFsNode) {
+	if (archiveMember.get()) {
 		// This could be a MacBinary file that still has a
 		// resource fork; if it is, it needs to get opened as MacBinary
 		// and not treated as raw.
@@ -286,9 +285,8 @@ bool MacResManager::open(const Path &fileName, Archive &archive) {
 		}
 		delete stream;
 
-		String fullPath = plainFsNode->getPath() + "/..namedfork/rsrc";
-		FSNode resFsNode = FSNode(fullPath);
-		SeekableReadStream *macResForkRawStream = resFsNode.createReadStream();
+		Path fullPath = archiveMember.get()->getPathInArchive().join("/..namedfork/rsrc");
+		SeekableReadStream *macResForkRawStream = archive.createReadStreamForMember(fullPath);
 		if (!isMacBinaryFile && macResForkRawStream && loadFromRawFork(macResForkRawStream)) {
 			_baseFileName = fileName;
 			return true;




More information about the Scummvm-git-logs mailing list