[Scummvm-git-logs] scummvm master -> 2005ed79d60632b92e3653bf0da69479b2d2324b

csnover csnover at users.noreply.github.com
Sun Jul 23 23:09:38 CEST 2017


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

Summary:
4d52b018a2 SCI: Keep audio maps out of the LRU cache
d38704e16d SCI: Blacklist certain audio map patch files
2005ed79d6 SCI32: Emit a warning when an audio resource cannot be found


Commit: 4d52b018a23114813fd5c0d159abb97a02a96d34
    https://github.com/scummvm/scummvm/commit/4d52b018a23114813fd5c0d159abb97a02a96d34
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-23T16:01:19-05:00

Commit Message:
SCI: Keep audio maps out of the LRU cache

Changed paths:
    engines/sci/resource.cpp
    engines/sci/resource_audio.cpp


diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index bf669c9..29f3017 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -1877,12 +1877,6 @@ int ResourceManager::readResourceMapSCI1(ResourceSource *map) {
 				// if we use the first entries in the resource file, half of the
 				// game will be English and umlauts will also be missing :P
 				if (resource->_source->getSourceType() == kSourceVolume) {
-					// Maps are read during the scanning process (below), so
-					// need to be treated as unallocated in order for the new
-					// data from this volume to be picked up and used
-					if (resId.getType() == kResourceTypeMap) {
-						resource->_status = kResStatusNoMalloc;
-					}
 					updateResource(resId, source, fileOffset, 0, map->getLocationName());
 				}
 			}
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index 92761ca..741968b 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -297,13 +297,29 @@ int ResourceManager::readAudioMapSCI11(IntMapResourceSource *map) {
 
 	uint32 offset = 0;
 	const ResourceId mapResId(kResourceTypeMap, map->_mapNumber);
-	Resource *mapRes = findResource(mapResId, false);
+	Resource *mapRes = _resMap.getVal(mapResId, nullptr);
 
 	if (!mapRes) {
 		warning("Failed to open %s", mapResId.toString().c_str());
 		return SCI_ERROR_RESMAP_NOT_FOUND;
 	}
 
+	// Here, we allocate audio maps ourselves instead of using findResource to
+	// do this for us. This is in order to prevent the map resources from
+	// getting into the LRU cache. These resources must be read and then
+	// deallocated in games with multi-disc audio in order to read the audio
+	// maps from every CD, and LRU eviction freaks out if an unallocated
+	// resource ends up in the LRU list. It is also not necessary for these
+	// resources to be cached in the LRU at all, since they are only used upon
+	// game startup to populate _resMap.
+	assert(mapRes->_status == kResStatusNoMalloc);
+	loadResource(mapRes);
+
+	if (!mapRes->data()) {
+		warning("Failed to read data for %s", mapResId.toString().c_str());
+		return SCI_ERROR_RESMAP_NOT_FOUND;
+	}
+
 	ResourceSource *src = findVolume(map, map->_volumeNumber);
 
 	if (!src) {
@@ -484,6 +500,8 @@ int ResourceManager::readAudioMapSCI11(IntMapResourceSource *map) {
 		}
 	}
 
+	mapRes->unalloc();
+
 	return 0;
 }
 


Commit: d38704e16d33b4ccd735a1b824edcdef60ce2a9c
    https://github.com/scummvm/scummvm/commit/d38704e16d33b4ccd735a1b824edcdef60ce2a9c
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-23T16:01:19-05:00

Commit Message:
SCI: Blacklist certain audio map patch files

Refs Trac#9976.

Changed paths:
    engines/sci/resource.cpp
    engines/sci/resource.h


diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 29f3017..019aaff 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -1423,6 +1423,30 @@ ResVersion ResourceManager::detectVolVersion() {
 	return kResVersionUnknown;
 }
 
+bool ResourceManager::isBlacklistedPatch(const ResourceId &resId) const {
+	switch (g_sci->getGameId()) {
+	case GID_SHIVERS:
+		// The SFX resource map patch in the Shivers interactive demo has
+		// broken offsets for some sounds; ignore it so that the correct map
+		// from RESSCI.000 will be used instead.
+		return g_sci->isDemo() &&
+			resId.getType() == kResourceTypeMap &&
+			resId.getNumber() == 65535;
+	case GID_PHANTASMAGORIA:
+		// The GOG release of Phantasmagoria 1 merges all resources into a
+		// single-disc bundle, but they also include the 65535.MAP & 37.MAP
+		// patch files from original game's CD 1, which (of course) do not
+		// contain the entries for audio from later CDs. So, just ignore these
+		// map patches since the correct maps will be found in the RESSCI.000
+		// file. This also helps eliminate user error when copying files from
+		// the original CDs.
+		return resId.getType() == kResourceTypeMap &&
+			(resId.getNumber() == 65535 || resId.getNumber() == 37);
+	default:
+		return false;
+	}
+}
+
 // version-agnostic patch application
 void ResourceManager::processPatch(ResourceSource *source, ResourceType resourceType, uint16 resourceNr, uint32 tuple) {
 	Common::SeekableReadStream *fileStream = 0;
@@ -1430,12 +1454,8 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType resource
 	ResourceId resId = ResourceId(resourceType, resourceNr, tuple);
 	ResourceType checkForType = resourceType;
 
-	// HACK: The SFX resource map patch in the Shivers interactive demo has
-	// broken offsets for some sounds; ignore it so that the correct map from
-	// RESSCI.000 will be used instead
-	if (g_sci->getGameId() == GID_SHIVERS && g_sci->isDemo() &&
-		resourceType == kResourceTypeMap && resourceNr == 65535) {
-
+	if (isBlacklistedPatch(resId)) {
+		debug("Skipping blacklisted patch file %s", source->getLocationName().c_str());
 		delete source;
 		return;
 	}
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index 878e2ac..8e91a60 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -575,6 +575,13 @@ protected:
 	 */
 	void readResourcePatches();
 	void readResourcePatchesBase36();
+
+	/**
+	 * Determines whether or not a patch file matching the given resource ID
+	 * should be ignored when processing patches.
+	 */
+	bool isBlacklistedPatch(const ResourceId &resId) const;
+
 	void processPatch(ResourceSource *source, ResourceType resourceType, uint16 resourceNr, uint32 tuple = 0);
 
 	/**


Commit: 2005ed79d60632b92e3653bf0da69479b2d2324b
    https://github.com/scummvm/scummvm/commit/2005ed79d60632b92e3653bf0da69479b2d2324b
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-07-23T16:01:19-05:00

Commit Message:
SCI32: Emit a warning when an audio resource cannot be found

Refs Trac#9976.

Changed paths:
    engines/sci/sound/audio32.cpp


diff --git a/engines/sci/sound/audio32.cpp b/engines/sci/sound/audio32.cpp
index 04d1a47..be3f99d 100644
--- a/engines/sci/sound/audio32.cpp
+++ b/engines/sci/sound/audio32.cpp
@@ -776,6 +776,7 @@ uint16 Audio32::play(int16 channelIndex, const ResourceId resourceId, const bool
 	// probably rewriting a bunch of the resource manager.
 	Resource *resource = _resMan->findResource(resourceId, true);
 	if (resource == nullptr) {
+		warning("[Audio32::play]: %s could not be found", resourceId.toString().c_str());
 		return 0;
 	}
 





More information about the Scummvm-git-logs mailing list