[Scummvm-git-logs] scummvm master -> 8117b6bad870c61ab41f3d5ff7a182394d9b5751
sluicebox
22204938+sluicebox at users.noreply.github.com
Fri Apr 17 08:14:07 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:
8117b6bad8 SCI32: Use correct resource type mapping on Mac
Commit: 8117b6bad870c61ab41f3d5ff7a182394d9b5751
https://github.com/scummvm/scummvm/commit/8117b6bad870c61ab41f3d5ff7a182394d9b5751
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-04-17T01:10:44-07:00
Commit Message:
SCI32: Use correct resource type mapping on Mac
Fixes video in GK2 Mac
Changed paths:
engines/sci/resource.cpp
engines/sci/resource.h
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 74154a3928..a9435e31a0 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -186,11 +186,15 @@ ResourceType ResourceManager::convertResType(byte type) {
// older resource types here.
// PQ4 CD and QFG4 CD are SCI2.1, but use the resource types of the
// corresponding SCI2 floppy disk versions.
+ // GK1 is the only SCI 2.0 Mac game and uses the older resource types.
if (g_sci && (g_sci->getGameId() == GID_LSL6HIRES ||
- g_sci->getGameId() == GID_QFG4 || g_sci->getGameId() == GID_PQ4))
+ g_sci->getGameId() == GID_QFG4 ||
+ g_sci->getGameId() == GID_PQ4 ||
+ g_sci->getGameId() == GID_GK1)) {
forceSci0 = true;
+ }
- if (_mapVersion < kResVersionSci2 || forceSci0) {
+ if ((_mapVersion < kResVersionSci2 && !_isSci2Mac) || forceSci0) {
// SCI0 - SCI2
if (type < ARRAYSIZE(s_resTypeMapSci0))
return s_resTypeMapSci0[type];
@@ -1018,6 +1022,13 @@ void ResourceManager::init() {
return;
}
+#ifdef ENABLE_SCI32
+ if (_volVersion == kResVersionSci11Mac)
+ _isSci2Mac = detectSci2Mac();
+ else
+#endif
+ _isSci2Mac = false;
+
scanNewSources();
if (!addAudioSources()) {
@@ -1473,6 +1484,36 @@ ResVersion ResourceManager::detectVolVersion() {
return kResVersionUnknown;
}
+#ifdef ENABLE_SCI32
+bool ResourceManager::detectSci2Mac() {
+ // SCI2 Mac games use the same volume format as SCI11 and so an extra initial check is required
+ // to differentiate between versions so that resource parsing can apply the correct resource
+ // type mapping before full SCI version detection occurs. A simple way to differentiate is to
+ // search for the SCI2 Object class' script resource in Mac volume files.
+ Common::MacResManager macResManager;
+ for (Common::List<ResourceSource *>::iterator it = _sources.begin(); it != _sources.end(); ++it) {
+ ResourceSource *rsrc = *it;
+ if (rsrc->getSourceType() == kSourceMacResourceFork) {
+ if (macResManager.open(rsrc->getLocationName().c_str())) {
+ const uint32 scriptTypeID = MKTAG('S', 'C', 'R', ' ');
+ const uint32 objectScriptID = 64999;
+ Common::SeekableReadStream *resource = macResManager.getResource(scriptTypeID, objectScriptID);
+ bool objectScriptExists = false;
+ if (resource != nullptr) {
+ objectScriptExists = true;
+ delete resource;
+ }
+ macResManager.close();
+ if (objectScriptExists) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+#endif
+
bool ResourceManager::isBlacklistedPatch(const ResourceId &resId) const {
switch (g_sci->getGameId()) {
case GID_SHIVERS:
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index f76bdc36bd..7cebf18c82 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -493,6 +493,7 @@ protected:
ResourceSource *_audioMapSCI1; ///< Currently loaded audio map for SCI1
ResVersion _volVersion; ///< resource.0xx version
ResVersion _mapVersion; ///< resource.map version
+ bool _isSci2Mac;
/**
* Add a path to the resource manager's list of sources.
@@ -557,6 +558,9 @@ protected:
/**--- Resource map decoding functions ---*/
ResVersion detectMapVersion();
ResVersion detectVolVersion();
+#ifdef ENABLE_SCI32
+ bool detectSci2Mac();
+#endif
/**
* Reads the SCI0 resource.map file from a local directory.
More information about the Scummvm-git-logs
mailing list