[Scummvm-git-logs] scummvm master -> c6280d04a0543a8f126fd90f8c911a5678fa8760
dreammaster
noreply at scummvm.org
Tue Aug 11 02:45:31 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:
c6280d04a0 MADS: DRAGONSPHERE: Implement MT32 driver callback offset for command 32
Commit: c6280d04a0543a8f126fd90f8c911a5678fa8760
https://github.com/scummvm/scummvm/commit/c6280d04a0543a8f126fd90f8c911a5678fa8760
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-11T12:44:52+10:00
Commit Message:
MADS: DRAGONSPHERE: Implement MT32 driver callback offset for command 32
Changed paths:
engines/mads/dragonsphere/sound/rsound.cpp
engines/mads/dragonsphere/sound/rsound.h
engines/mads/dragonsphere/sound/rsound_dragonsphere.cpp
engines/mads/dragonsphere/sound/rsound_dragonsphere.h
engines/mads/phantom/sound/rsound.cpp
engines/mads/phantom/sound/rsound.h
diff --git a/engines/mads/dragonsphere/sound/rsound.cpp b/engines/mads/dragonsphere/sound/rsound.cpp
index ede257e8ffd..4fa5c7f4397 100644
--- a/engines/mads/dragonsphere/sound/rsound.cpp
+++ b/engines/mads/dragonsphere/sound/rsound.cpp
@@ -614,6 +614,10 @@ int RSound::command8() {
return result;
}
+void RSound::callFunction(uint16 offset) {
+ error("Unsupported call to sound driver function at offset %.4x", offset);
+}
+
/*-----------------------------------------------------------------------*/
int RSound::readScriptByte(byte *&pSrc) {
@@ -758,12 +762,8 @@ dispatch:
goto dispatch;
}
case 0xC4: {
- // TODO: NOT PORTABLE AS-IS - see Phantom's identical case for
- // rationale (raw code-address function-pointer call in the
- // original). error() so this is impossible to miss if real
- // game data ever actually triggers it.
- readScriptWord(pSrc);
- error("RSound::pollActiveChannel: opcode 0xC4 (function-pointer call) not portable as-is");
+ uint16 fnOffset = readScriptWord(pSrc);
+ callFunction(fnOffset);
ch->_pSrc += 3;
goto dispatch;
}
diff --git a/engines/mads/dragonsphere/sound/rsound.h b/engines/mads/dragonsphere/sound/rsound.h
index 79fd8d80abf..198d6e21cbf 100644
--- a/engines/mads/dragonsphere/sound/rsound.h
+++ b/engines/mads/dragonsphere/sound/rsound.h
@@ -525,6 +525,12 @@ protected:
int command7();
int command8();
+ /**
+ * Calls a function at a fixed offset within the sound driver.
+ * @param offset Offset of the function
+ */
+ virtual void callFunction(uint16 offset);
+
int nullCommand() {
return 0;
}
diff --git a/engines/mads/dragonsphere/sound/rsound_dragonsphere.cpp b/engines/mads/dragonsphere/sound/rsound_dragonsphere.cpp
index cd17dffd403..41e9623b148 100644
--- a/engines/mads/dragonsphere/sound/rsound_dragonsphere.cpp
+++ b/engines/mads/dragonsphere/sound/rsound_dragonsphere.cpp
@@ -2758,6 +2758,13 @@ int RSound6::command98() {
RSound9::RSound9(Audio::Mixer *mixer) : RSound(mixer, "rsound.dr9", 0x2BC0, 0x52D0, 0x9A) {
}
+void RSound9::callFunction(uint16 offset) {
+ if (offset == 0x23a0)
+ command32();
+ else
+ RSound::callFunction(offset);
+}
+
int RSound9::command1() {
// Must call THIS driver's own command3()/command5() (not virtual in
// the base - see class comment).
diff --git a/engines/mads/dragonsphere/sound/rsound_dragonsphere.h b/engines/mads/dragonsphere/sound/rsound_dragonsphere.h
index 00ff857ce3c..62a28d35e57 100644
--- a/engines/mads/dragonsphere/sound/rsound_dragonsphere.h
+++ b/engines/mads/dragonsphere/sound/rsound_dragonsphere.h
@@ -821,6 +821,13 @@ private:
typedef int (RSound9:: *CommandPtr)();
static const CommandPtr _commandList[96];
+protected:
+ /**
+ * Calls a function at a fixed offset within the sound driver.
+ * @param offset Offset of the function
+ */
+ void callFunction(uint16 offset) override;
+
public:
RSound9(Audio::Mixer *mixer);
diff --git a/engines/mads/phantom/sound/rsound.cpp b/engines/mads/phantom/sound/rsound.cpp
index 35cf66cd6f6..a303d6d1238 100644
--- a/engines/mads/phantom/sound/rsound.cpp
+++ b/engines/mads/phantom/sound/rsound.cpp
@@ -591,6 +591,10 @@ int RSound::command8() {
return result;
}
+void RSound::callFunction(uint16 offset) {
+ error("Unsupported call to sound driver function at offset %.4x", offset);
+}
+
/*-----------------------------------------------------------------------*/
int RSound::readScriptByte(byte *&pSrc) {
@@ -744,15 +748,8 @@ dispatch:
goto dispatch;
}
case 0xC4: {
- // TODO: NOT PORTABLE AS-IS - the disassembly calls the word
- // operand as a raw code-address function pointer
- // ("mov bx,ax; call bx"). There's no equivalent in a C++
- // port without knowing what specific handful of sub_
- // routines this is meant to invoke. error() (not warning())
- // so this is impossible to miss if real game data ever
- // actually triggers it, rather than silently no-opping.
- readScriptWord(pSrc);
- error("RSound::pollActiveChannel: opcode 0xC4 (function-pointer call) not portable as-is");
+ uint16 fnOffset = readScriptWord(pSrc);
+ callFunction(fnOffset);
ch->_pSrc += 3;
goto dispatch;
}
diff --git a/engines/mads/phantom/sound/rsound.h b/engines/mads/phantom/sound/rsound.h
index 173926cb216..6bbc3b8516d 100644
--- a/engines/mads/phantom/sound/rsound.h
+++ b/engines/mads/phantom/sound/rsound.h
@@ -460,6 +460,12 @@ protected:
int command7();
int command8();
+ /**
+ * Calls a function at a fixed offset within the sound driver.
+ * @param offset Offset of the function
+ */
+ virtual void callFunction(uint16 offset);
+
int nullCommand() {
return 0;
}
More information about the Scummvm-git-logs
mailing list