[Scummvm-devel] How to debug a music issue

Torbjörn Andersson eriktorbjorn at telia.com
Sun Mar 29 17:23:09 CEST 2015


Oops, I accudentally only replied to sender. Sending again to do it 
properly. (Sorry about the double mail, Miro.)

On 2015-03-29 14:00, Miro Kropáček wrote:
 > When I run ScummVM with Monkey Island 2 (CD) and disable music in the
 > launcher, the game wont progress farther than the dancing monkeys
 > screen. When I press ESC (to skip the intro/credits), I get a black
 > screen. Which looked really scary until I realized that I can freely
 > make the 'F5 menu' appear, go back to launcher etc.
 >
 > So the game is not hung, it looks more like waiting for something --
 > an SDL event maybe? Since this works on Linux/PC, I suspect something
 > is wrong with the SDL port for Atari but I can't prove it because I
 > have no idea where to look.
 >
 > Can you give me a hint where the code could be waiting after I press
 > ESC in the monkey intro screen?

I wasn't able to reproduce it myself, but my guess is that the game 
script is waiting for a music-related event to happen. Since I know that 
Guybrush is supposed to say, "You guys get out of here!", I could tell 
ScummVM to dump script files as it's running and look for that script. 
Running it through the "descumm" tool, it reads in part:

[0251] (4C) soundKludge([13,154]);
[0259] (4C) soundKludge([-1]);
[025E] (44) if (VAR_SOUNDRESULT > 0) {
[0265] (4C)   soundKludge([256,154,7]);
[0270] (4C)   soundKludge([-1]);
[0275] (9A)   Local[8] = VAR_SOUNDRESULT;
[027A] (78)   if (Local[8] < 41) {
[0281] (78)     if (Local[8] < 0) {
[0288] (1A)       Local[8] = 41;
[028D] (18)     } else {
[0290] (80)       breakHere();
[0291] (**)     }
[0291] (**)   }
[0291] (18) } else {
[0294] (1A)   Local[8] = 41;
[0299] (**) }
[0299] (38) unless (Local[8] >= 41) goto 0251;
[02A0] (D8) printEgo([Text("Hey!" + wait() + "You guys get out of here!")]);

It's been a long time since I tried debugging iMUSE-related things, but 
I think this is how it works: Sound::soundKludge() either queues a 
command or, if the first argument is -1, processes the queued commands. 
VAR_SOUNDRESULT is the result of the last command.

I think what the script is saying is something along the lines that as 
long as sound 154 is playing, wait for it to reach beat 41. If at any 
point the commands fail, assume it has reached beat 41 anyway.

So if I wanted to debug further, I'd keep an eye on 
IMuseInternal::doCommand_internal() to see what commands it receives, 
and what it returns.

I don't know where it gets stuck after you press Escape. I'm pretty sure 
that it's the game scripts that define if a scene can be skipped.

Torbjörn Andersson





More information about the Scummvm-devel mailing list