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

dreammaster noreply at scummvm.org
Thu Oct 8 00:53:32 UTC 2026


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

Summary:
e4b0361eb7 MADS: PHANTOM: Fix section 2 RSOUND control commands


Commit: e4b0361eb71a2efd5a22237b8ecc90ee01d7a7e1
    https://github.com/scummvm/scummvm/commit/e4b0361eb71a2efd5a22237b8ecc90ee01d7a7e1
Author: fusefib (fibofuse at gmail.com)
Date: 2026-10-07T14:53:27-10:00

Commit Message:
MADS: PHANTOM: Fix section 2 RSOUND control commands

Fixes #17294

Assisted-by: Codex:GPT-5.6-sol

Changed paths:
    engines/mads/phantom/sound/rsound.h
    engines/mads/phantom/sound/rsound_phantom.cpp
    engines/mads/phantom/sound/rsound_phantom.h


diff --git a/engines/mads/phantom/sound/rsound.h b/engines/mads/phantom/sound/rsound.h
index 6dcb4331b41..2faccfbf700 100644
--- a/engines/mads/phantom/sound/rsound.h
+++ b/engines/mads/phantom/sound/rsound.h
@@ -439,8 +439,8 @@ protected:
 
 	/**
 	 * Shared tail of command1() (falls through into it after command3())
-	 * and command5() (jumps straight into it, ungated, in every driver
-	 * confirmed so far): enables channels 5,6,7,8.
+	 * and the drivers that use the standard command5(): enables channels
+	 * 5,6,7,8.
 	 */
 	void enableUpperChannels();
 
@@ -451,16 +451,9 @@ protected:
 	void resetAndGmResetUpperChannels();
 
 	/**
-	 * PURE VIRTUAL, unlike command1-3/6-8. Confirmed (from RSound1 AND
-	 * RSound2, independently) that every driver's command4/command5 are
-	 * gated by isSoundActive() on a driver-specific data offset before
-	 * calling resetAndGmResetUpperChannels()/enableUpperChannels() above
-	 * - a per-driver detail that must not live in the shared base.
-	 * Deliberately NO default implementation, so a new driver subclass
-	 * can't compile without explicitly providing its own gate - silently
-	 * falling back to an ungated version would be wrong (and was, in an
-	 * earlier version of this port, until RSound1/RSound2 confirmed the
-	 * gate is universal even though its offset isn't).
+	 * Pure virtual, unlike command1-3/6-8. The command4 reset range and
+	 * command4/command5 sound-active guards vary by driver, so each driver
+	 * must provide its native form explicitly.
 	 */
 	virtual int command4() = 0;
 	virtual int command5() = 0;
diff --git a/engines/mads/phantom/sound/rsound_phantom.cpp b/engines/mads/phantom/sound/rsound_phantom.cpp
index 2a866e2f111..9c9c079641b 100644
--- a/engines/mads/phantom/sound/rsound_phantom.cpp
+++ b/engines/mads/phantom/sound/rsound_phantom.cpp
@@ -442,22 +442,11 @@ int RSound2::command(int commandId, int param) {
 }
 
 int RSound2::command4() {
-	// Confirmed: same isSoundActive(0x3D98)-gated shape as RSound1's
-	// command4(), though this driver has no equivalent to RSound1's
-	// command39 (its own bucket structure stops at 35, then jumps to
-	// 64+), so this offset can't be "reused ambient-piece target" here -
-	// just a coincidentally identical offset NUMBER, not assumed to hold
-	// the same data.
-	if (isSoundActive(loadData(0x3D98)))
-		return 0;
 	resetAndGmResetUpperChannels();
 	return 0;
 }
 
 int RSound2::command5() {
-	// Confirmed: same isSoundActive(0x3D98) gate as command4() above.
-	if (isSoundActive(loadData(0x3D98)))
-		return 0;
 	enableUpperChannels();
 	return 0;
 }
@@ -653,8 +642,7 @@ int RSound3::command(int commandId, int param) {
 }
 
 int RSound3::command4() {
-	// Confirmed: TWO chained isSoundActive() gates (unlike RSound1/
-	// RSound2's single 0x3D98 gate), then a tail that
+	// Confirmed: two chained isSoundActive() gates, then a tail that
 	// resets only channels 5-9 (indices 4-8) - narrower than the
 	// shared resetChannels4to9()'s 4-9 (indices 3-8) - so it can't
 	// reuse resetAndGmResetUpperChannels() and calls resetChannelRange()
@@ -899,9 +887,7 @@ int RSound4::command(int commandId, int param) {
 }
 
 int RSound4::command4() {
-	// Confirmed: NO isSoundActive() gate in this driver, unlike every
-	// other driver seen so far - unconditionally resets channels 5-8,
-	// then calls sendGmReset(9).
+	// Unconditionally resets channels 6-9, then calls sendGmReset(9).
 	_isDisabled = true;
 	resetChannelRange(5, 8);
 	_isDisabled = false;
diff --git a/engines/mads/phantom/sound/rsound_phantom.h b/engines/mads/phantom/sound/rsound_phantom.h
index 86146e3497e..e814e8ff1b4 100644
--- a/engines/mads/phantom/sound/rsound_phantom.h
+++ b/engines/mads/phantom/sound/rsound_phantom.h
@@ -62,9 +62,7 @@ private:
 
 	int command16();
 
-	// Overrides confirming the isSoundActive(0x3D98) gate the base
-	// class's pure-virtual command4()/command5() require - see
-	// RSound::command4/5.
+	// Both commands use the section-1-specific isSoundActive(0x3D98) gate.
 	int command4() override;
 	int command5() override;
 
@@ -132,10 +130,7 @@ private:
 	typedef int (RSound2:: *CommandPtr)();
 	static const CommandPtr _commandList[74];
 
-	// Overrides confirming the isSoundActive(0x3D98) gate the base
-	// class's pure-virtual command4()/command5() require - see
-	// RSound::command4/5. Same offset NUMBER as RSound1's, but not
-	// assumed to be the same underlying data.
+	// Both commands use the standard ungated reset/enable tails.
 	int command4() override;
 	int command5() override;
 
@@ -189,10 +184,10 @@ public:
  * save/restore wrap that RSound::command0() has, but with no
  * observable behavioral difference, so no override is needed there.
  *
- * command4()/command5() are also a genuinely different shape from
- * RSound1/RSound2: both gate on TWO chained isSoundActive() checks
- * (0x2AA6 then 0x1E30, each an independent early-out per the
- * pop-return-address mechanic) rather than one, and command4()'s tail
+ * command4()/command5() are also driver-specific: both gate on two
+ * chained isSoundActive() checks (0x2AA6 then 0x1E30, each an
+ * independent early-out per the pop-return-address mechanic), while
+ * RSound1 has one guard and RSound2 has none. command4()'s tail
  * resets only channels 5-9 (indices 4-8) - NOT channels
  * 4-9 (indices 3-8) like the shared resetAndGmResetUpperChannels() -
  * so it can't reuse that helper and calls resetChannelRange()
@@ -258,9 +253,9 @@ public:
  * has a genuine, separate rsound_command3 entry matching the base
  * class's command3() exactly.
  *
- * command4() is a genuinely new shape: unlike every driver confirmed so
- * far, it has NO isSoundActive() gate at all - it unconditionally resets
- * channels 6-9 (0-based indices 5-8, confirmed via explicit
+ * Like RSound2, command4() has no isSoundActive() gate. It uses a
+ * different reset range, unconditionally resetting channels 6-9
+ * (0-based indices 5-8, confirmed via explicit
  * Channel._activeCount/_volumeFadeStep-labeled writes) via
  * resetChannelRange(), then sends a full sendGmReset(9). A third distinct
  * channel range for this reset (RSound1/RSound2 used 4-9, RSound3 used




More information about the Scummvm-git-logs mailing list