Opened 16 years ago

Closed 16 years ago

#1633 closed defect (fixed)

COMI: Game crash after retrieval of map

Reported by: SF/johtu203 Owned by: aquadran
Priority: normal Component: Engine: SCUMM
Keywords: Cc:
Game: Monkey Island 3

Description

ScummVM versions : 0.6.0 Mar 15 2004, 0.7.0CVS May 22 2004

Bug details : When I have gotten the map from this dude's back, and I exit to the Island screen, I see the ship starting to move, but then the game crashes with the error message (52:29:0xD44): ImuseDigiSndMgr::prepareSound(): Unknown sound format

Language of game :English Version of game : Talkie Platform and Compiler Win32

Ticket imported from: #958490. Ticket imported from: bugs/1633.

Attachments (1)

comi.s03 (69.5 KB ) - added by SF/johtu203 16 years ago.
save game

Download all attachments as: .zip

Change History (28)

by SF/johtu203, 16 years ago

Attachment: comi.s03 added

save game

comment:1 by fingolfin, 16 years ago

Summary: Game crash after retrieval of mapCOMI: Game crash after retrieval of map

comment:2 by fingolfin, 16 years ago

Yet another iMuseDigital crash :-(

comment:3 by fingolfin, 16 years ago

Owner: set to aquadran
Priority: normalhigh

comment:4 by SF/jbergstrom, 16 years ago

I get this error too, as the ship sails away and the cut scene should start.

comment:5 by aquadran, 16 years ago

i can't reproduce bug

comment:6 by aquadran, 16 years ago

please test with latest cvs

comment:7 by SF/jbergstrom, 16 years ago

Indeed this is is present in the latest CVS (May 31 2004), since that was the only build I have played COMI with...

In my case, the game crashes as I have dug up Elaine from the grave in the theatre, and the cut scene is about to start.

(BTW, I don't get any error message at the crash; though this is probably because ScummVM exits so quickly. I'll do a bit of research...)

comment:8 by SF/jbergstrom, 16 years ago

Okay, now I ran ScummVM from the Console, so the output was left on the screen.

This error message appears as the game crashes:

Assertion failed: soundHandle && checkForProperHandle (soundHandle), file scumm/imuse_digi/dimuse_sndmgr.cpp, line 393

comment:9 by SF/elnonomasa, 16 years ago

I compiled the scummvm-20040530 tarball with mingw and get the following right at the point where the transition should happen:

WARNING: _hasMask mismatch (case A 0) - please report to Fingolfin if you notice any text/graphics glitches related to this!! WARNING: _hasMask mismatch (case A 0) - please report to Fingolfin if you notice any text/graphics glitches related to this!!

After that, you get the Assertion mentioned below.

I also checked the value of the soundHandle pointer and it is indeed NULL.

When running with GDB, the program actually segfaults a little before the assertion on closeFile. Here's a backtrace:

(gdb) bt #0 0x77f9e124 in _libwinmm_a_iname () #1 0x003f0000 in ?? () #2 0x77f85010 in _libwinmm_a_iname () #3 0x77f58b37 in _libwinmm_a_iname () #4 0x77c2ab2e in _libwinmm_a_iname () #5 0x004b07de in Scumm::BundleMgr::closeFile() (this=<incomplete type>) at scumm/imuse_digi/dimuse_bndmgr.cpp:162 #6 0x004b061c in Scumm::BundleMgr::~BundleMgr() (this=<incomplete type>) at scumm/imuse_digi/dimuse_bndmgr.cpp:126 #7 0x0049fb47 in Scumm::ImuseDigiSndMgr::closeSound(Scumm::ImuseDigiSndMgr::soundStruct*) (this=<incomplete type>, soundHandle=0x141c9bc) at scumm/imuse_digi/dimuse_sndmgr.cpp:369 #8 0x0049fa85 in Scumm::ImuseDigiSndMgr::openSound(int, char const*, int, int) (this=<incomplete type>, soundId=1279, soundName=0x141c99c "1279-P~1.IMX", soundType=2, volGroupId=3) at scumm/imuse_digi/dimuse_sndmgr.cpp:353 #9 0x0049fbfd in Scumm::ImuseDigiSndMgr::cloneSound(Scumm::ImuseDigiSndMgr::soundStruct*) (this=<incomplete type>, soundHandle=0x141c970) at scumm/imuse_digi/dimuse_sndmgr.cpp:381 #10 0x0048ae97 in Scumm::IMuseDigital::cloneToFadeOutTrack(int, int) ( this=<incomplete type>, trackId=1, fadeDelay=60) at scumm/imuse_digi/dimuse_track.cpp:299 #11 0x0048aca7 in Scumm::IMuseDigital::fadeOutMusic(int) ( this=<incomplete type>, fadeDelay=60) at scumm/imuse_digi/dimuse_track.cpp:252 #12 0x004a0de9 in Scumm::IMuseDigital::playComiMusic(char const*, Scumm::imuseComiTable const*, int, bool) (this=<incomplete type>, songName=0x4b2db6 "stateDeck", table=0x4b2db2, atribPos=53, sequence=false) at scumm/imuse_digi/dimuse_music.cpp:317 #13 0x004a0ad6 in Scumm::IMuseDigital::setComiMusicState(int) ( this=<incomplete type>, stateId=1305) at scumm/imuse_digi/dimuse_music.cpp:215 #14 0x00477661 in Scumm::IMuseDigital::parseScriptCmds(int, int, int, int, int, int, int, int) (this=0x141c5f8, a=4096, b=1305, c=0, d=0, e=0, f=0, g=0, h=0) at scumm/imuse_digi/dimuse_script.cpp:117 #15 0x0045dde9 in Scumm::Sound::soundKludge(int*, int) ( this=<incomplete type>, list=0x22f2e0, num=2) at scumm/sound.cpp:781 #16 0x0044cc02 in Scumm::ScummEngine_v6::o6_soundKludge() ( this=<incomplete type>) at scumm/script_v6.cpp:2191 #17 0x00453e23 in Scumm::ScummEngine_v8::executeOpcode(unsigned char) ( this=<incomplete type>, i=178) at scumm/script_v8.cpp:371 #18 0x00450697 in Scumm::ScummEngine::executeScript() (this=<incomplete type>) at scumm/script.cpp:425 #19 0x00450121 in Scumm::ScummEngine::runScriptNested(int) ( this=<incomplete type>, script=8) at scumm/script.cpp:317 #20 0x0044fa83 in Scumm::ScummEngine::runScript(int, bool, bool, int*) ( this=0x1a59fe0, script=29, freezeResistant=false, recursive=false, lvarptr=0x22f3e0) at scumm/script.cpp:80 #21 0x004494ff in Scumm::ScummEngine_v6::o6_startScript() ( this=<incomplete type>) at scumm/script_v6.cpp:802 #22 0x00453e23 in Scumm::ScummEngine_v8::executeOpcode(unsigned char) ( this=<incomplete type>, i=121) at scumm/script_v8.cpp:371 #23 0x00450697 in Scumm::ScummEngine::executeScript() (this=<incomplete type>) at scumm/script.cpp:425 #24 0x00450121 in Scumm::ScummEngine::runScriptNested(int) ( this=<incomplete type>, script=7) at scumm/script.cpp:317 #25 0x0044fa83 in Scumm::ScummEngine::runScript(int, bool, bool, int*) ( this=0x1a59fe0, script=11, freezeResistant=false, recursive=false, lvarptr=0x0) at scumm/script.cpp:80 #26 0x00451e43 in Scumm::ScummEngine::runEntryScript() (this=<incomplete type>) at scumm/scumm.h:438 #27 0x0041bcd0 in Scumm::ScummEngine::startScene(int, Scumm::Actor*, int) ( this=<incomplete type>, room=52, a=0x0, objectNr=0) at scumm/scumm.cpp:2097 #28 0x0044a021 in Scumm::ScummEngine_v6::o6_loadRoom() (this=<incomplete type>) at scumm/script_v6.cpp:1087 #29 0x00453e23 in Scumm::ScummEngine_v8::executeOpcode(unsigned char) ( this=<incomplete type>, i=157) at scumm/script_v8.cpp:371 #30 0x00450697 in Scumm::ScummEngine::executeScript() (this=<incomplete type>) at scumm/script.cpp:425 #31 0x00450121 in Scumm::ScummEngine::runScriptNested(int) ( this=<incomplete type>, script=6) at scumm/script.cpp:317 #32 0x0044fa83 in Scumm::ScummEngine::runScript(int, bool, bool, int*) ( this=0x1a59fe0, script=123, freezeResistant=false, recursive=false, lvarptr=0x22f630) at scumm/script.cpp:80 #33 0x0044955e in Scumm::ScummEngine_v6::o6_jumpToScript() ( this=<incomplete type>) at scumm/script_v6.cpp:813 #34 0x00453e23 in Scumm::ScummEngine_v8::executeOpcode(unsigned char) ( this=<incomplete type>, i=125) at scumm/script_v8.cpp:371 #35 0x00450697 in Scumm::ScummEngine::executeScript() (this=<incomplete type>) at scumm/script.cpp:425 #36 0x00451ae3 in Scumm::ScummEngine::runAllScripts() (this=<incomplete type>) at scumm/script.cpp:760 #37 0x00419fd8 in Scumm::ScummEngine::scummLoop(int) (this=<incomplete type>, delta=5) at scumm/scumm.cpp:1482 #38 0x004193b1 in Scumm::ScummEngine::mainRun() (this=<incomplete type>) at scumm/scumm.cpp:1266 #39 0x00417f22 in Scumm::ScummEngine::go() (this=<incomplete type>) at scumm/scumm.cpp:882 #40 0x00406d99 in runGame(GameDetector&, OSystem*) (detector=@0x22fee8, system=0x3fa490) at base/main.cpp:263 #41 0x0040723f in main (argc=1, argv=0x3f2c10) at base/main.cpp:373

My COMI is the american CD version.

comment:10 by SF/elnonomasa, 16 years ago

Update: I tracked it down to:

ImuseDigiSndMgr::openMusicBundle() .... sprintf(musicfile, "musdisk%d.bun", _vm->VAR(_vm->VAR_CURRENTDISK)); ....

if I change it to: sprintf(musicfile, "musdisk%d.bun", _disk);

then I get this warnings: WARNING: BundleMgr::openFile() Can't open bundle file: musdisk0.bun! WARNING: BundleMgr::openFile() Can't open bundle file: music.bun!

and then the game keeps going.

I guess there's something fishy in the disk-change transition there.

comment:11 by SF/elnonomasa, 16 years ago

One more update before going to bed. With the chage I mention below, I crash later on. Again, soundHandle = NULL. So I reverted back to current CVS, and started to track down the issue again.

Turns out the file 1279-P~1.IMX is both on 'musdisk1.bun' and 'musdisk2.bun' (I checked quickly with a Hex editor, its right at the very end of both files).

But the bundle manager doesn't have it on it's table, so you get this error message:

BundleMgr::decompressSampleByName() Failed finding voice 1279-P~1.IMX!

and then the ptr returned is NULL, which causes triggers the assert later on.

comment:12 by aquadran, 16 years ago

i mean use latest dev cvs -> 01 jun changes

comment:13 by SF/jbergstrom, 16 years ago

Sorry, aquadran, but I don't have a compiler, nor have any idea how to compile ScummVM... so I use Win32 daily snapshot binaries.

comment:14 by SF/jbergstrom, 16 years ago

Hm, now that I checked the ScummVM homepage, there IS a June 1 version. As I wrote the previous one there was only the May 31 one (must be the time zone difference?).

Anyway, the June 1 version works fine. The game doesn't crash any more.

comment:15 by SF/johtu203, 16 years ago

I tried with the 0.7.0CVS (jun 2: 12:01:05) build

It still crashes on the same place.

this is some more debug-info:

writeVar(1073741824, 1305) Script 29, offset 0x7bc: [66] o6_jump() Script 29, offset 0xd1a: [2] o6_pushWordVar() readvar(-2147482947) Script 29, offset 0xd1f: [7] o6_not() Script 29, offset 0xd20: [65] o6_ifNot() Script 29, offset 0xd25: [2] o6_pushWordVar() readvar(1073741824) Script 29, offset 0xd2a: [1] o6_pushWord() Script 29, offset 0xd2f: [9] o6_neq() Script 29, offset 0xd30: [65] o6_ifNot() Script 29, offset 0xd35: [1] o6_pushWord() Script 29, offset 0xd3a: [2] o6_pushWordVar() readvar(1073741824) Script 29, offset 0xd3f: [1] o6_pushWord() Script 29, offset 0xd44: [B2] o6_soundKludge() ImuseSetState (1305) Set music state: stateDeck, 1305-D~1.IMX IMuseDigital::fadeOutMusic startMusicBundle(1305-D~1.IMX) IMuseDigital::startSound(1305) Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() (52:29:0xD44): ImuseDigiSndMgr::prepareSound(): Unknown sound format Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback() Locking mutex IMuseDigital::callback() Unlocking mutex IMuseDigital::callback()

comment:16 by SF/elnonomasa, 16 years ago

I think the right solution is to add support for the special PRELOAD entry on the bundle table. I figured out the structure of it, but i still dont know the meaning of a couple of bytes. The actual sound data looks like 16 bit big endian.

Basically, the structure looks like this:

Bundle Entry: PRELOAD for the name, offset, size just like any entry.

then at offset: <byte> - Number of sounds <sound entry 1> <sound entry 2> <sound entry xxx>

each <sound entry> breaks down like this: <char [13]> sound name <uint16 - LE> number of 16 bit samples <byte> seems to be 0x0d every time <byte> unknown 1 <byte> unknown 2 <byte> unknown 3 <array of uint16 (BE?)> actual samples.

comment:17 by aquadran, 16 years ago

i cant match your described structure for exist datas. where exactly there is that structure in file ? that seems to be as you descripbed duplicated mostly structure. what you mean "<array of uint16 (BE?)> actual samples", sound data ? i think not. In bundle exist entries for each sound files inside: name, offset to codec table for sound data, and size (unused currently). Each codec table entry have: offset to compressed data, size of this datas and id used codec. I'm not sure what you searching for ?

comment:18 by SF/elnonomasa, 16 years ago

Grab a Hex editor, and open either musdisk1.bun or musdisk2.bun.

Go to the bundle directory offset (bottom of the file for COMI here). Look for each entry of <name><offset><size>. The last entry is called 'PRELOAD'. No IMX extension or anything.

Now, take the offset for that entry and go there on the file. And you will see the structure Im talking about.

I gather that PRELOAD is a special entry, and means to preload that list of sounds instead of playing them from disk.

comment:19 by aquadran, 16 years ago

i found it. you say: "preload that list of sounds instead of playing them from disk", you always must load list from disk and it's allready once read for each bundle. for that reason that is useless. that PRELOAD entry is about 200KB size, for each sound it has some bytes of sound data(if that is). i tried find code for that PRELOAD entry in original code (IDB), but with no success (yet, if exist).

comment:20 by SF/elnonomasa, 16 years ago

They're pretty small sounds. But as you can see on the backtrace, the game does try to play them. Im also looking here on the IDB to try to spot something.

comment:21 by SF/elnonomasa, 16 years ago

Aquadran, maybe this whole PRELOAD thing is a false alarm. I cant find anything on the original source, and I rechecked the entries on the actual bundle file against the PRELOAD ones, and all the sounds seems to be there. I guess the bug is indeed a switch disk problem. I'll recompile with CVS current and see where I get to.

comment:22 by aquadran, 16 years ago

i never can reproduce it. what is current status of this bug ? if still exist, any one more can reproduce this bug ?

comment:23 by aquadran, 16 years ago

Priority: highnormal

comment:24 by SF/elnonomasa, 16 years ago

Works here. Played to the end.

comment:25 by aquadran, 16 years ago

johtu203, jbergstrom: who it works for you ?

comment:26 by SF/jbergstrom, 16 years ago

It works fine for me using June 1 as I already told some time ago.

comment:27 by aquadran, 16 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.