[Scummvm-git-logs] scummvm master -> ed0122f7a5c9764e85c826a41f005a853c5cbf50
AndywinXp
noreply at scummvm.org
Sun Nov 1 10:48:37 UTC 2026
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
8b4fa6122f GRIM: DEBUGGER: Introduce iMUSE debugger from SCUMM
6a865f107d GRIM: IMUSE: Fix missing cast on map navigation
ed0122f7a5 SCUMM: DiMUSE: Fix missing cast on map navigation
Commit: 8b4fa6122fbfa10c79d2949ab97ab3bc784a1a5f
https://github.com/scummvm/scummvm/commit/8b4fa6122fbfa10c79d2949ab97ab3bc784a1a5f
Author: AndywinXp (andywinxp at gmail.com)
Date: 2026-11-01T11:46:56+01:00
Commit Message:
GRIM: DEBUGGER: Introduce iMUSE debugger from SCUMM
Changed paths:
engines/grim/debugger.cpp
engines/grim/debugger.h
engines/grim/imuse/imuse_engine.cpp
engines/grim/imuse/imuse_engine.h
diff --git a/engines/grim/debugger.cpp b/engines/grim/debugger.cpp
index 450921a1812..48fe6824026 100644
--- a/engines/grim/debugger.cpp
+++ b/engines/grim/debugger.cpp
@@ -26,6 +26,7 @@
#include "engines/grim/debugger.h"
#include "engines/grim/md5check.h"
#include "engines/grim/grim.h"
+#include "engines/grim/imuse/imuse_engine.h"
namespace Grim {
@@ -39,12 +40,20 @@ Debugger::Debugger() :
registerCmd("renderer_get", WRAP_METHOD(Debugger, cmd_renderer_get));
registerCmd("save", WRAP_METHOD(Debugger, cmd_save));
registerCmd("load", WRAP_METHOD(Debugger, cmd_load));
+ registerCmd("imuse", WRAP_METHOD(Debugger, cmd_imuse));
}
Debugger::~Debugger() {
}
+void Debugger::onFrame() {
+ GUI::Debugger::onFrame();
+
+ if (g_imuse)
+ g_imuse->imProcessStreams();
+}
+
bool Debugger::cmd_checkFiles(int argc, const char **argv) {
if (MD5Check::checkFiles()) {
debugPrintf("All files are ok.\n");
@@ -134,4 +143,149 @@ bool Debugger::cmd_load(int argc, const char **argv) {
return true;
}
+bool Debugger::cmd_imuse(int argc, const char **argv) {
+ if (!g_imuse) {
+ debugPrintf("No Digital iMUSE engine is active.\n");
+ return true;
+ }
+
+ if (argc > 1) {
+ if (!strcmp(argv[1], "stop")) {
+ if (argc > 2 && (!strcmp(argv[2], "all") || atoi(argv[2]) != 0)) {
+ if (!strcmp(argv[2], "all")) {
+ g_imuse->imStopAllSounds();
+ debugPrintf("Stopping all sounds.\n");
+ } else {
+ g_imuse->imStopSound(atoi(argv[2]));
+ debugPrintf("Attempted to stop sound %d.\n", atoi(argv[2]));
+ }
+ } else {
+ debugPrintf("Specify a soundId or \"all\".\n");
+ }
+ return true;
+ } else if (!strcmp(argv[1], "stopSpeech")) {
+ debugPrintf("Attempting to stop the currently playing speech file, if any.\n");
+ g_imuse->imStopSound(kTalkSoundID);
+ return true;
+ } else if (!strcmp(argv[1], "list") || !strcmp(argv[1], "tracks")) {
+ g_imuse->listTracks();
+ return true;
+ } else if (!strcmp(argv[1], "playSfx")) {
+ if (argc > 2 && atoi(argv[2]) >= 100 && atoi(argv[2]) < 100 + IMUSE_MAX_CACHED_SOUNDS) {
+ debugPrintf("Attempting to play SFX %d...\n", atoi(argv[2]));
+ g_imuse->imStartSound(atoi(argv[2]), 126);
+ } else {
+ debugPrintf("Specify a SFX soundId from 100-%d.\n", 100 + IMUSE_MAX_CACHED_SOUNDS - 1);
+ }
+ return true;
+ } else if (!strcmp(argv[1], "playState") || !strcmp(argv[1], "setState")) {
+ if (argc > 2 && atoi(argv[2]) >= 0) {
+ debugPrintf("Attempting to play state %d...\n", atoi(argv[2]));
+ g_imuse->imSetState(atoi(argv[2]));
+ } else {
+ debugPrintf("Specify a valid stateId; available states for this game:\n");
+ g_imuse->listStates();
+ }
+ return true;
+ } else if (!strcmp(argv[1], "playSeq") || !strcmp(argv[1], "setSeq")) {
+ if (argc > 2 && atoi(argv[2]) >= 0) {
+ debugPrintf("Attempting to play sequence %d...\n", atoi(argv[2]));
+ g_imuse->imSetSequence(atoi(argv[2]));
+ } else {
+ debugPrintf("Specify a valid seqId; available sequences for this game:\n");
+ g_imuse->listSeqs();
+ }
+ return true;
+ } else if (!strcmp(argv[1], "playCue") || !strcmp(argv[1], "setCue")) {
+ debugPrintf("Cues are not used by this game.\n");
+ return true;
+ } else if (!strcmp(argv[1], "hook")) {
+ if (argc > 3 && atoi(argv[3]) != 0) {
+ debugPrintf("Attempting to set hookId %d for sound %d...\n", atoi(argv[2]), atoi(argv[3]));
+ g_imuse->imSetHook(atoi(argv[3]), atoi(argv[2]));
+ } else {
+ debugPrintf("Specify a hookId and a soundId;\nuse \"list\" to get a list of currently playing sounds.\n");
+ }
+ return true;
+ } else if (!strcmp(argv[1], "states")) {
+ debugPrintf("Available states for this game:\n");
+ g_imuse->listStates();
+ return true;
+ } else if (!strcmp(argv[1], "seqs")) {
+ debugPrintf("Available sequences for this game:\n");
+ g_imuse->listSeqs();
+ return true;
+ } else if (!strcmp(argv[1], "cues")) {
+ debugPrintf("Available cues for this game:\n");
+ g_imuse->listCues();
+ return true;
+ } else if (!strcmp(argv[1], "groups") || !strcmp(argv[1], "vols")) {
+ g_imuse->listGroups();
+ return true;
+ } else if (!strcmp(argv[1], "getParam")) {
+ if (argc > 3) {
+ int result = g_imuse->imGetParam(atoi(argv[2]), strtol(argv[3], nullptr, 16));
+ if (result != -5 && result != -4 && result != -1) {
+ debugPrintf("Parameter value for sound %d: %d\n", atoi(argv[2]), result);
+ return true;
+ }
+ debugPrintf("Invalid parameter id or soundId.\n");
+ }
+ debugPrintf("Usage: getParam <soundId> <param>.\nReadable params (use the hex id):\n");
+ debugPrintf("\tP_SND_TRACK_NUM 0x100 \n");
+ debugPrintf("\tP_MARKER 0x300 \n");
+ debugPrintf("\tP_GROUP 0x400 \n");
+ debugPrintf("\tP_PRIORITY 0x500 \n");
+ debugPrintf("\tP_VOLUME 0x600 \n");
+ debugPrintf("\tP_PAN 0x700 \n");
+ debugPrintf("\tP_DETUNE 0x800 \n");
+ debugPrintf("\tP_TRANSPOSE 0x900 \n");
+ debugPrintf("\tP_MAILBOX 0xA00 \n");
+ debugPrintf("\tP_SND_HAS_STREAM 0x1800\n");
+ debugPrintf("\tP_STREAM_BUFID 0x1900\n");
+ debugPrintf("\tP_SND_POS_IN_MS 0x1A00\n");
+ return true;
+ } else if (!strcmp(argv[1], "setParam")) {
+ if (argc > 4) {
+ int result = g_imuse->imSetParam(atoi(argv[2]), strtol(argv[3], nullptr, 16), atoi(argv[4]));
+ if (result != -5)
+ return true;
+
+ debugPrintf("Invalid parameter id, value or soundId.\n");
+ }
+ debugPrintf("Usage: setParam <soundId> <param> <val>.\nWritable params (use the hex id):\n");
+ debugPrintf("\tP_GROUP 0x400 \n");
+ debugPrintf("\tP_PRIORITY 0x500 \n");
+ debugPrintf("\tP_VOLUME 0x600 \n");
+ debugPrintf("\tP_PAN 0x700 \n");
+ debugPrintf("\tP_DETUNE 0x800 \n");
+ debugPrintf("\tP_TRANSPOSE 0x900 \n");
+ debugPrintf("\tP_MAILBOX 0xA00 \n");
+ debugPrintf("Please note that editing values for some parameters might lead to unexpected behavior.\n\n");
+ return true;
+ }
+
+ debugPrintf("Unknown command. ");
+ }
+
+ debugPrintf("Available Digital iMUSE commands:\n");
+ debugPrintf("\tstates - Display music states available for the current game\n");
+ debugPrintf("\tseqs - Display music sequences available for the current game\n");
+ debugPrintf("\tcues - Display music cues available for the current sequence\n");
+ debugPrintf("\tplaySfx <soundId> - Play a SFX resource by soundId\n");
+ debugPrintf("\tplayState|setState <stateId> - Play a music state resource by soundId\n");
+ debugPrintf("\tplaySeq|setSeq <seqId> - Play a music sequence resource by soundId\n");
+ debugPrintf("\tplayCue|setCue <cueId> - Play a music cue between the ones available\n");
+ debugPrintf("\tstop <soundId>|all - Stop a SFX, speech or music resource by soundId\n");
+ debugPrintf("\tstopSpeech - Stop the current speech file, if any\n");
+ debugPrintf("\thook <hookId> <soundId> - Set hookId for a sound\n");
+ debugPrintf("\tlist|tracks - Display info for every virtual audio track\n");
+ debugPrintf("\tgroups|vols - Show volume groups info\n");
+ debugPrintf("\tgetParam <soundId> <param> - Get parameter info from a sound\n");
+ debugPrintf("\tsetParam <soundId> <param> <val> - Set parameter value for a sound (dangerous!)\n");
+ debugPrintf("\n");
+
+ return true;
+}
+
}
diff --git a/engines/grim/debugger.h b/engines/grim/debugger.h
index 7c4f4120b5a..103dfdfb40d 100644
--- a/engines/grim/debugger.h
+++ b/engines/grim/debugger.h
@@ -33,6 +33,8 @@ public:
Debugger();
virtual ~Debugger();
+ void onFrame() override;
+
bool cmd_checkFiles(int argc, const char **argv);
bool cmd_lua_do(int argc, const char **argv);
bool cmd_jump(int argc, const char **argv);
@@ -40,6 +42,7 @@ public:
bool cmd_renderer_set(int argc, const char **argv);
bool cmd_save(int argc, const char **argv);
bool cmd_load(int argc, const char **argv);
+ bool cmd_imuse(int argc, const char **argv);
};
}
diff --git a/engines/grim/imuse/imuse_engine.cpp b/engines/grim/imuse/imuse_engine.cpp
index b67f3648d00..bb737bfdee0 100644
--- a/engines/grim/imuse/imuse_engine.cpp
+++ b/engines/grim/imuse/imuse_engine.cpp
@@ -22,6 +22,9 @@
#include "common/system.h"
#include "common/timer.h"
+#include "gui/debugger.h"
+
+#include "engines/grim/grim.h"
#include "engines/grim/imuse/imuse_engine.h"
#include "engines/grim/imuse/imuse_defs.h"
#include "engines/grim/imuse/imuse_tables.h"
@@ -592,4 +595,69 @@ int IMuse::imSetAttribute(int attrIndex, int attrVal) {
return scriptParse(IMUSE_C_SCRIPT_SET_ATTRIBUTE, attrIndex, attrVal);
}
+// Debugger utility functions
+
+void IMuse::listStates() {
+ const IMuseStateTable *stateTable = _demo ? _grimDemoStateMusicTable : _grimStateMusicTable;
+ int stateTableSize = _demo ? ARRAYSIZE(_grimDemoStateMusicTable) : ARRAYSIZE(_grimStateMusicTable);
+ GUI::Debugger *debugger = g_grim->getDebugger();
+
+ debugger->debugPrintf("+---------+-------------------------+--------------------------------------+\n");
+ debugger->debugPrintf("| %7s | %-23s | %-36s |\n", "stateId", "internalName", "name");
+ debugger->debugPrintf("+---------+-------------------------+--------------------------------------+\n");
+ for (int i = 0; i < stateTableSize; i++) {
+ debugger->debugPrintf("| %7d | %-23s | %-36s |\n", stateTable[i].soundId, stateTable[i].internalName, stateTable[i].name);
+ }
+ debugger->debugPrintf("+---------+-------------------------+--------------------------------------+\n\n");
+}
+
+void IMuse::listSeqs() {
+ const IMuseStateTable *seqTable = _demo ? _grimDemoSeqMusicTable : _grimSeqMusicTable;
+ int seqTableSize = _demo ? ARRAYSIZE(_grimDemoSeqMusicTable) : ARRAYSIZE(_grimSeqMusicTable);
+ GUI::Debugger *debugger = g_grim->getDebugger();
+
+ debugger->debugPrintf("+---------+-------------------------+--------------------------------------+\n");
+ debugger->debugPrintf("| %7s | %-23s | %-36s |\n", "seqId", "internalName", "name");
+ debugger->debugPrintf("+---------+-------------------------+--------------------------------------+\n");
+ for (int i = 0; i < seqTableSize; i++) {
+ debugger->debugPrintf("| %7d | %-23s | %-36s |\n", seqTable[i].soundId, seqTable[i].internalName, seqTable[i].name);
+ }
+ debugger->debugPrintf("+---------+-------------------------+--------------------------------------+\n\n");
+}
+
+void IMuse::listCues() {
+ g_grim->getDebugger()->debugPrintf("Cue points are not used by this game, no cues available.\n\n");
+}
+
+void IMuse::listTracks() {
+ GUI::Debugger *debugger = g_grim->getDebugger();
+
+ debugger->debugPrintf("Virtual audio tracks currently playing:\n");
+ debugger->debugPrintf("+-------------------------------------------------------------------------+\n");
+ debugger->debugPrintf("| # | soundId | group | hasStream | vol/effVol/pan | priority | jumpHook |\n");
+ debugger->debugPrintf("+---+---------+-------+-----------+-----------------+----------+----------+\n");
+
+ for (int i = 0; i < _trackCount; i++) {
+ IMuseTrack curTrack = _tracks[i];
+ if (curTrack.soundId != 0) {
+ debugger->debugPrintf("| %1d | %5d | %d | %d | %3d/%3d/%3d | %3d | %3d |\n",
+ i, curTrack.soundId, curTrack.group, imGetParam(curTrack.soundId, IMUSE_P_SND_HAS_STREAM),
+ curTrack.vol, curTrack.effVol, curTrack.pan, curTrack.priority, curTrack.jumpHook);
+ } else {
+ debugger->debugPrintf("| %1d | --- | --- | --- | ---/---/--- | --- | --- |\n", i);
+ }
+ }
+ debugger->debugPrintf("+---+---------+-------+-----------+-----------------+----------+----------+\n\n");
+}
+
+void IMuse::listGroups() {
+ GUI::Debugger *debugger = g_grim->getDebugger();
+
+ debugger->debugPrintf("Volume groups:\n");
+ debugger->debugPrintf("\tSFX: %3d\n", _groupsHandler->getGroupVol(IMUSE_GROUP_SFX));
+ debugger->debugPrintf("\tSPEECH: %3d\n", _groupsHandler->getGroupVol(IMUSE_GROUP_SPEECH));
+ debugger->debugPrintf("\tMUSIC: %3d\n", _groupsHandler->getGroupVol(IMUSE_GROUP_MUSIC));
+ debugger->debugPrintf("\tMUSICEFF: %3d\n\n", _groupsHandler->getGroupVol(IMUSE_GROUP_MUSICEFF));
+}
+
} // End of namespace Grim
diff --git a/engines/grim/imuse/imuse_engine.h b/engines/grim/imuse/imuse_engine.h
index f9b362b054e..772169a5ac3 100644
--- a/engines/grim/imuse/imuse_engine.h
+++ b/engines/grim/imuse/imuse_engine.h
@@ -441,6 +441,13 @@ public:
// Script
int scriptTriggerCallback(char *marker);
+
+ // Debugger utility functions
+ void listStates();
+ void listSeqs();
+ void listCues();
+ void listTracks();
+ void listGroups();
};
extern IMuse *g_imuse;
Commit: 6a865f107d7723f1cd753de659e35b0e36039be3
https://github.com/scummvm/scummvm/commit/6a865f107d7723f1cd753de659e35b0e36039be3
Author: AndywinXp (andywinxp at gmail.com)
Date: 2026-11-01T11:48:02+01:00
Commit Message:
GRIM: IMUSE: Fix missing cast on map navigation
Verified from disasm
Changed paths:
engines/grim/imuse/imuse_dispatch.cpp
diff --git a/engines/grim/imuse/imuse_dispatch.cpp b/engines/grim/imuse/imuse_dispatch.cpp
index 340e026235e..8281b40491e 100644
--- a/engines/grim/imuse/imuse_dispatch.cpp
+++ b/engines/grim/imuse/imuse_dispatch.cpp
@@ -916,7 +916,7 @@ int IMuse::dispatchConvertMap(uint8 *rawMap, int32 *destMap) {
// - The 4 bytes string 'MAP '
// - Size of the map
destMap[0] = READ_BE_UINT32(destMap);
- destMap[1] = READ_BE_UINT32(destMap + 4);
+ destMap[1] = READ_BE_UINT32((uint8 *)destMap + 4);
mapCurPos = (uint8 *)destMap + 8;
endOfMapPtr = (uint8 *)destMap + effMapSize;
Commit: ed0122f7a5c9764e85c826a41f005a853c5cbf50
https://github.com/scummvm/scummvm/commit/ed0122f7a5c9764e85c826a41f005a853c5cbf50
Author: AndywinXp (andywinxp at gmail.com)
Date: 2026-11-01T11:48:19+01:00
Commit Message:
SCUMM: DiMUSE: Fix missing cast on map navigation
Verified from disasm
Changed paths:
engines/scumm/imuse_digi/dimuse_dispatch.cpp
diff --git a/engines/scumm/imuse_digi/dimuse_dispatch.cpp b/engines/scumm/imuse_digi/dimuse_dispatch.cpp
index ab57dd9dc97..72d3bffe08a 100644
--- a/engines/scumm/imuse_digi/dimuse_dispatch.cpp
+++ b/engines/scumm/imuse_digi/dimuse_dispatch.cpp
@@ -1173,7 +1173,7 @@ int IMuseDigital::dispatchConvertMap(uint8 *rawMap, int32 *destMap) {
// - The 4 bytes string 'MAP '
// - Size of the map
destMap[0] = READ_BE_UINT32(destMap);
- destMap[1] = READ_BE_UINT32(destMap + 4);
+ destMap[1] = READ_BE_UINT32((uint8 *)destMap + 4);
mapCurPos = (uint8 *)destMap + 8;
endOfMapPtr = (uint8 *)destMap + effMapSize;
More information about the Scummvm-git-logs
mailing list