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

sluicebox noreply at scummvm.org
Wed Nov 13 19:39:53 UTC 2024


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:
f209a2304e SCI: Fix script patch comment typos
e4f8b6a456 AGI: Fix AGIv1 sound detection


Commit: f209a2304e763e8b8bbcd16ba3f66a690578e3c1
    https://github.com/scummvm/scummvm/commit/f209a2304e763e8b8bbcd16ba3f66a690578e3c1
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-11-13T11:32:36-08:00

Commit Message:
SCI: Fix script patch comment typos

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 161a53fbe0b..42e4ad6cf12 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -5558,7 +5558,7 @@ static const uint16 kq4SignatureLolotteDoor[] = {
 	0x78,                           // push1
 	0x38, SIG_UINT16(0xc000),       // pushi c000
 	SIG_ADDTOOFFSET(+10),
-	0x4a, 0x32,                     // send 32 [ ego ... illegalBits: c000 ... ]
+	0x4a, 0x32,                     // send 32 [ ego ... baseSetter: 0 ... illegalBits: c000 ... ]
 	SIG_END
 };
 
@@ -5568,7 +5568,7 @@ static const uint16 kq4PatchLolotteDoor[] = {
 	0x0e,                            // shl  [ acc = 8000 if door open, c000 if closed ]
 	0x36,                            // push [ ego:illegalBits = acc ]
 	PATCH_ADDTOOFFSET(+10),
-	0x4a, 0x2c,                      // send 2a [ ego ... illegalBits: 8000 or c000 ... ]
+	0x4a, 0x2c,                      // send 2c [ ego ... illegalBits: 8000 or c000 ... ]
 	PATCH_END
 };
 
@@ -5589,7 +5589,7 @@ static const SciScriptPatcherEntry kq4Signatures[] = {
 
 // ===========================================================================
 // At least during the harpy scene, export 29 of script 0 is called and has an
-//  issue where temp[3] won't get inititialized, but is later used to set
+//  issue where temp[3] won't get initialized, but is later used to set
 //  master volume. This makes SSCI set the volume to max. We fix the procedure,
 //  so volume won't get modified in those cases.
 //


Commit: e4f8b6a4567542bb3f123b903069475b65d35733
    https://github.com/scummvm/scummvm/commit/e4f8b6a4567542bb3f123b903069475b65d35733
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-11-13T11:37:46-08:00

Commit Message:
AGI: Fix AGIv1 sound detection

- Fixes Winnie the Pooh wind sounds, bug #14454
- Fixes Donald Duck's Playground sound 5
- Fixes various sounds in KQ2 and BC

The sound loading code attempted to detect AGIv1 sounds by the first
two bytes, but this dind't work beause AGIv1 sounds have no header.
Each AGIv1 game has at least one sound that failed this heuristic.

Now we use the interpreter version instead of attempting detection,
which is what the sound playback code in SoundGenPCJr does anyway.

Changed paths:
    engines/agi/agi.cpp
    engines/agi/preagi/winnie.cpp
    engines/agi/sound.cpp
    engines/agi/sound.h


diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index e49ad5960d6..16bf6246d32 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -246,7 +246,8 @@ int AgiEngine::loadResource(int16 resourceType, int16 resourceNr) {
 			data = _loader->loadVolumeResource(&_game.dirSound[resourceNr]);
 
 			// "data" is freed by objects created by createFromRawResource on success
-			_game.sounds[resourceNr] = AgiSound::createFromRawResource(data, _game.dirSound[resourceNr].len, resourceNr, _soundemu);
+			const bool isAgiV1 = (getVersion() <= 0x2001);
+			_game.sounds[resourceNr] = AgiSound::createFromRawResource(data, _game.dirSound[resourceNr].len, resourceNr, _soundemu, isAgiV1);
 			if (_game.sounds[resourceNr] != nullptr) {
 				_game.dirSound[resourceNr].flags |= RES_LOADED;
 			} else {
diff --git a/engines/agi/preagi/winnie.cpp b/engines/agi/preagi/winnie.cpp
index 039ae263e07..95742fd84d6 100644
--- a/engines/agi/preagi/winnie.cpp
+++ b/engines/agi/preagi/winnie.cpp
@@ -1149,7 +1149,8 @@ bool WinnieEngine::playSound(ENUM_WTP_SOUND iSound) {
 	file.read(data, size);
 	file.close();
 
-	_game.sounds[0] = AgiSound::createFromRawResource(data, size, 0, _soundemu);
+	const bool isAgiV1 = true; // DOS uses AGIv1 sounds
+	_game.sounds[0] = AgiSound::createFromRawResource(data, size, 0, _soundemu, isAgiV1);
 	if (_game.sounds[0] == nullptr) {
 		return false;
 	}
diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp
index 38db3d2dbad..1231968d97c 100644
--- a/engines/agi/sound.cpp
+++ b/engines/agi/sound.cpp
@@ -46,7 +46,7 @@ SoundGen::~SoundGen() {
 // TODO: add support for variable sampling rate in the output device
 //
 
-AgiSound *AgiSound::createFromRawResource(uint8 *data, uint32 len, int resnum, int soundemu) {
+AgiSound *AgiSound::createFromRawResource(uint8 *data, uint32 len, int resnum, int soundemu, bool isAgiV1) {
 	if (data == nullptr || len < 2) // Check for too small resource or no resource at all
 		return nullptr;
 
@@ -54,16 +54,18 @@ AgiSound *AgiSound::createFromRawResource(uint8 *data, uint32 len, int resnum, i
 	// These formats have no headers or predictable first bytes.
 	if (soundemu == SOUND_EMU_APPLE2) {
 		return new AgiSound(resnum, data, len, AGI_SOUND_APPLE2);
-	} else if (soundemu == SOUND_EMU_COCO3) {
+	}
+	if (soundemu == SOUND_EMU_COCO3) {
 		return new AgiSound(resnum, data, len, AGI_SOUND_COCO3);
 	}
 
-	uint16 type = READ_LE_UINT16(data);
-
-	// For V1 sound resources
-	if (type != AGI_SOUND_SAMPLE && (type & 0xFF) == AGI_SOUND_SAMPLE)
+	// Handle AGIv1; this format has no header or predictable first bytes.
+	// Must occur after platform check; Apple II always uses its format.
+	if (isAgiV1) {
 		return new PCjrSound(resnum, data, len, AGI_SOUND_4CHN);
+	}
 
+	uint16 type = READ_LE_UINT16(data);
 	switch (type) { // Create a sound object based on the type
 	case AGI_SOUND_SAMPLE:
 		return new IIgsSample(resnum, data, len, type);
diff --git a/engines/agi/sound.h b/engines/agi/sound.h
index 2c6803e2548..c9f67621bfb 100644
--- a/engines/agi/sound.h
+++ b/engines/agi/sound.h
@@ -42,7 +42,7 @@ namespace Agi {
 /**
  * AGI sound resource types.
  * These values are the first 16-bit LE words of each resource's header,
- * except for Apple II and CoCo3, which do not have headers.
+ * except for AGIv1, Apple II, and CoCo3, which do not have headers.
  */
 enum AgiSoundEmuType {
 	AGI_SOUND_SAMPLE    = 0x0001,
@@ -96,7 +96,7 @@ public:
 	 * A named constructor for creating different types of AgiSound objects
 	 * from a raw sound resource.
 	 */
-	static AgiSound *createFromRawResource(uint8 *data, uint32 len, int resnum, int soundemu);
+	static AgiSound *createFromRawResource(uint8 *data, uint32 len, int resnum, int soundemu, bool isAgiV1);
 
 protected:
 	byte _resourceNr;




More information about the Scummvm-git-logs mailing list