[Scummvm-git-logs] scummvm master -> 85e27b0caf46a72598fdb22c57eb5add6a75aeec

sluicebox 22204938+sluicebox at users.noreply.github.com
Tue May 5 19:20:31 UTC 2020


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

Summary:
e7da80dddf SCI: Update FPFP Mac easter egg patch comments
85e27b0caf SCI32: Implement Mac kSetLanguage


Commit: e7da80dddf1790d1d15a261f8768a75617b53e44
    https://github.com/scummvm/scummvm/commit/e7da80dddf1790d1d15a261f8768a75617b53e44
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-05-05T12:07:28-07:00

Commit Message:
SCI: Update FPFP Mac easter egg patch comments

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 8f2ab3a2ab..97dd4dd927 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -1756,6 +1756,13 @@ static const uint16 freddypharkasPatchMacInventory[] = {
 // We work around this by setting macSound:loop correctly on the heap so that it
 //  only plays once and macThing proceeds.
 //
+// This buggy script didn't break in the original because the Mac interpreter
+//  didn't support looping sounds. It always played sounds just once and then 
+//  signaled when they were complete and ignored the value of the loop property.
+//  This was most apparent in the KQ6 Mac port. All the room music, which was
+//  designed to loop, stopped abruptly after a minute in a room and then
+//  jarringly returned when changing rooms.
+//
 // Applies to: Mac Floppy
 // Responsible method: Heap in script 270
 // Fixes bug #7065


Commit: 85e27b0caf46a72598fdb22c57eb5add6a75aeec
    https://github.com/scummvm/scummvm/commit/85e27b0caf46a72598fdb22c57eb5add6a75aeec
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-05-05T12:14:18-07:00

Commit Message:
SCI32: Implement Mac kSetLanguage

Changed paths:
    engines/sci/engine/ksound.cpp
    engines/sci/resource.cpp
    engines/sci/resource.h
    engines/sci/resource_audio.cpp


diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index 4c8e9759ac..976c965ffa 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -469,9 +469,14 @@ reg_t kDoAudioPanOff(EngineState *s, int argc, reg_t *argv) {
 
 reg_t kSetLanguage(EngineState *s, int argc, reg_t *argv) {
 	// Used by script 90 of MUMG Deluxe from the main menu to toggle between
-	// English and Spanish.
+	// English and Spanish in some versions and English and Spanish and
+	// French and German in others.
 	const Common::String audioDirectory = s->_segMan->getString(argv[0]);
-	g_sci->getResMan()->changeAudioDirectory(audioDirectory);
+	if (g_sci->getPlatform() == Common::kPlatformMacintosh) {
+		g_sci->getResMan()->changeMacAudioDirectory(audioDirectory);
+	} else {
+		g_sci->getResMan()->changeAudioDirectory(audioDirectory);
+	}
 	return s->r_acc;
 }
 
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 47486fa23c..0ac0c31614 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -1654,7 +1654,7 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType resource
 	debugC(1, kDebugLevelResMan, "Patching %s - OK", source->getLocationName().c_str());
 }
 
-static ResourceId convertPatchNameBase36(ResourceType type, const Common::String &filename) {
+ResourceId convertPatchNameBase36(ResourceType type, const Common::String &filename) {
 	// The base36 encoded resource contains the following:
 	// uint16 resourceId, byte noun, byte verb, byte cond, byte seq
 
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index 7cebf18c82..8e7b13e664 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -399,6 +399,7 @@ public:
 	void setAudioLanguage(int language);
 	int getAudioLanguage() const;
 	void changeAudioDirectory(Common::String path);
+	void changeMacAudioDirectory(Common::String path);
 	bool isGMTrackIncluded();
 	bool isSci11Mac() const { return _volVersion == kResVersionSci11Mac; }
 	ViewType getViewType() const { return _viewType; }
@@ -699,6 +700,8 @@ private:
 	byte _soundPriority;
 };
 
+ResourceId convertPatchNameBase36(ResourceType type, const Common::String &filename);
+
 } // End of namespace Sci
 
 #endif // SCI_RESOURCE_H
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index 593fa6d14b..7fcc95220d 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -1148,4 +1148,47 @@ void ResourceManager::changeAudioDirectory(Common::String path) {
 	scanNewSources();
 }
 
+void ResourceManager::changeMacAudioDirectory(Common::String path) {
+	// delete all Audio36 resources so that they can be replaced with
+	//  different patch files from the new directory.
+	for (ResourceMap::iterator it = _resMap.begin(); it != _resMap.end(); ++it) {
+		const ResourceType type = it->_key.getType();
+
+		if (type == kResourceTypeAudio36) {
+			Resource *resource = it->_value;
+			if (resource) {
+				// If one of these resources ends up being locked here, it
+				// probably means Audio32 is using it and we need to stop
+				// playback of audio before switching directories
+				assert(!resource->isLocked());
+
+				if (resource->_status == kResStatusEnqueued) {
+					removeFromLRU(resource);
+				}
+
+				delete resource;
+			}
+
+			_resMap.erase(it);
+		}
+	}
+
+	if (path.empty()) {
+		path = "english";
+	}
+	path = "voices/" + path + "/";
+
+	// add all Audio36 wave patch files from language directory
+	Common::ArchiveMemberList audio36Files;
+	SearchMan.listMatchingMembers(audio36Files, path + "A???????.???");
+	for (Common::ArchiveMemberList::const_iterator it = audio36Files.begin(); it != audio36Files.end(); ++it) {
+		const Common::ArchiveMemberPtr &file = *it;
+		assert(file);
+
+		const Common::String fileName = file->getName();
+		ResourceId resource36 = convertPatchNameBase36(kResourceTypeAudio36, fileName);
+		processWavePatch(resource36, path + fileName);
+	}
+}
+
 } // End of namespace Sci




More information about the Scummvm-git-logs mailing list