[Scummvm-git-logs] scummvm master -> 8fdfb15f6e8fff27f1b19338c63049687db66060

bluegr bluegr at gmail.com
Sat Oct 31 09:27:53 UTC 2020


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:
8fdfb15f6e SCI: Fix crash when running sq6-mac with macbinary


Commit: 8fdfb15f6e8fff27f1b19338c63049687db66060
    https://github.com/scummvm/scummvm/commit/8fdfb15f6e8fff27f1b19338c63049687db66060
Author: Vladimir Serbinenko (phcoder at google.com)
Date: 2020-10-31T11:27:49+02:00

Commit Message:
SCI: Fix crash when running sq6-mac with macbinary

The resource validation fails big time because no file Data9 exists.
It's expected as its in Data9.bin instead. Since we check resource fork
explicitly in the case of resource-fork resources this check is redundant

Changed paths:
    engines/sci/resource.cpp


diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index d8501d0405..7b58d9a6e3 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -2187,16 +2187,22 @@ Resource *ResourceManager::updateResource(ResourceId resId, ResourceSource *src,
 	// Update a patched resource, whether it exists or not
 	Resource *res = _resMap.getVal(resId, nullptr);
 
-	Common::SeekableReadStream *volumeFile = getVolumeFile(src);
-	if (volumeFile == nullptr) {
-		error("Could not open %s for reading", src->getLocationName().c_str());
+	// When pulling from resource the "main" file may not even
+	// exist as both forks may be combined into MacBin
+	Common::SeekableReadStream *volumeFile = nullptr;
+	if (src->getSourceType() != kSourceMacResourceFork) {
+		volumeFile = getVolumeFile(src);
+		if (volumeFile == nullptr) {
+			error("Could not open %s for reading", src->getLocationName().c_str());
+		}
 	}
 
 	AudioVolumeResourceSource *avSrc = dynamic_cast<AudioVolumeResourceSource *>(src);
 	if (avSrc != nullptr && !avSrc->relocateMapOffset(offset, size)) {
 		warning("Compressed volume %s does not contain a valid entry for %s (map offset %u)", src->getLocationName().c_str(), resId.toString().c_str(), offset);
 		_hasBadResources = true;
-		disposeVolumeFileStream(volumeFile, src);
+		if (volumeFile != nullptr)
+			disposeVolumeFileStream(volumeFile, src);
 		return res;
 	}
 
@@ -2220,7 +2226,8 @@ Resource *ResourceManager::updateResource(ResourceId resId, ResourceSource *src,
 		_hasBadResources = true;
 	}
 
-	disposeVolumeFileStream(volumeFile, src);
+	if (volumeFile != nullptr)
+		disposeVolumeFileStream(volumeFile, src);
 	return res;
 }
 




More information about the Scummvm-git-logs mailing list