Opened 20 years ago

Closed 20 years ago

Last modified 6 years ago

#8348 closed patch

Possible fix for COMI hanging while looking through gunport

Reported by: eriktorbjorn Owned by: eriktorbjorn
Priority: normal Component: Engine: SCUMM
Version: Keywords:
Cc: Game: Monkey Island 3


This bug happens both with 0.6.1 and the CVS version. The patch is against the CVS version.

If I spend too much time looking out through the gunport in LeChuck's ship, ScummVM will hang with 100% CPU usage. The music continues to play, but the animations - even the screen updates - stop.

As far as I can tell, it's the room-11-2016 script that's hanging, waiting for a sound to stop. This is what the relevant part of it looks like:

[0396] (65) if (isSoundRunning(localvar0)) { [03A2] (B2) soundKludge([12,localvar0,1792,127]) [03BC] (B2) soundKludge([12,localvar0,1536,localvar3]) [03D6] (66) jump 397 [03DB] (**) }

I don't understand the purpose of this script yet - it looks stupid to me - but it seems that for as long as a certain sound is running, it will keep setting the panning and volume for it.

I think what may be happening is that as long as this loop is running, flushTracks() is never called, and Digital iMUSE depends on that function to mark the sound as stopped. So the loop never ends.

What the patch does is to make getSoundStatus() check not just track->used but also track->readyToRemove, since that's set by the Digital iMUSE callback, regardless of whether flushTracks() is called or not.

It can take some time for the hang to happen, but usually not that long. In fact, I first thought it had something to do with Murray, because the hang would sometimes happen before I had finished talking to him. (The first two times I saw it, it even happened on the same line of speech!) Thus, I cannot be sure that my patch really does fix the problem, but I did leave the scene running while vacuuming my apartment, and it still wasn't hanging when I returned.

Ticket imported from: #993803. Ticket imported from: patches/453.

Attachments (1)

comi-hang.diff (588 bytes ) - added by eriktorbjorn 20 years ago.
Patch against a July 19 CVS snapshot

Download all attachments as: .zip

Change History (9)

by eriktorbjorn, 20 years ago

Attachment: comi-hang.diff added

Patch against a July 19 CVS snapshot

comment:1 by eriktorbjorn, 20 years ago

Owner: set to aquadran

comment:2 by eriktorbjorn, 20 years ago

Applied, after som discussion with aquadran. Let's hope the cure isn't worse than the disease. :-)

comment:3 by eriktorbjorn, 20 years ago

Owner: changed from aquadran to eriktorbjorn
Status: newclosed

comment:4 by SF/ender, 20 years ago

In case this turns out not to be the best fix, I'm wondering if the removed cannon hack (second change in the diff) here: might be related.

As I said to Kirben at the time, I remember adding this into the cannon scene to fix some kind of freeze or script race. This one sounds familiar in my mind.

comment:5 by eriktorbjorn, 20 years ago

You mean this one, that was removed from o8_getActorChore()?

// FIXME: This is a hack for the cannon scene, as something isn't quite right
// here yet..
if ((_roomResource == 10) && (vm.slot[_currentScript].number == 2021)) { //warning("o8_getActorChore() hack: would have returned %d", a->frame);
push(11); return; }

Wouldn't that be room-10-2021, i.e. the wrong script? Besides, I don't really see the connection between actor chores and busy-waiting for sounds to finish.

comment:6 by SF/ender, 20 years ago

Possibly, but the bugs I fixed around that time were generally the hard-to-fix script interaction bugs where the hack needed was involved in triggering several events (eg, actor chore switches may involve sound event queues or actorsounds spawned from akos embedded commands. Or setting other variables which may control the starting or stopping of a script.

I havn't looked at the script in question, it's just been nagging me whether the hack for that bug is something that has been truely fixed.

comment:7 by eriktorbjorn, 20 years ago

Could you please look at the script then? Because for the life of me I can't figure out why a room where nothing happens except for a few background sounds and some animated waves, could have the kind of complications you describe. :-)

Note that this isn't the battle scene where you have to fire the cannon at LeChuck's longboats -- it's the room where Guybrush is looking out through the gunport and where he will eventually encounter Murray for the first time.

comment:8 by digitall, 6 years ago

Component: Engine: SCUMM
Game: Monkey Island 3
Note: See TracTickets for help on using tickets.