Opened 18 years ago

Closed 18 years ago

#2484 closed defect (fixed)

BS2: Crash near beginning of the Game

Reported by: SF/nolange Owned by: eriktorbjorn
Priority: normal Component: Engine: Sword2
Version: Keywords:
Cc: Game: Broken Sword 2


I`m using the German Version of BS2 on WinXP SP2 and ScummVM 0.81. Right when you start the Game you have to squash the spider with the bookshelf and then you have to free yourself "on the hook". Thats as far as the game goes, ScummVM crashes just when the actor freed his hands.

I tried using uncompressed speech & music to make sure I didnt mess something up, still fails. CVS Version 0.90, February 1, 2006, 3:53 pm also fails

Release 0.80 works!

Ticket imported from: #1423140. Ticket imported from: bugs/2484.

Change History (3)

comment:1 by fingolfin, 18 years ago

Summary: Crash near beginning of the GameBS2: Crash near beginning of the Game

comment:2 by eriktorbjorn, 18 years ago

Owner: set to eriktorbjorn
Resolution: fixed
Status: newclosed

comment:3 by eriktorbjorn, 18 years ago

[sigh] It turns out someone made a last-minute change to the way ScummVM handles WAV data, causing the mixer to try to free the audio data automagically as soon as the sound finished. This was apparently to fix a memory leak, but in the case of BS2 it was bad for two reasons:

* The WAV data is part of the game resources. BS2's resource manager needs absolute control of when resources are freed, or its reference-counters won't be worth the bytes they're imprinted on.

* The resource consists of a standard header, followed by the WAV data. Only the pointer to the resource can be freed, not the pointer to the WAV data.

I've added a workaround so that this AUTOFREE flag is always cleared by BS2 (accompanied by a big, grumpy comment). This should fix the problem.

Now we'll just need a 0.8.1a or 0.8.2 or whatever... :-(

Thanks to wjp, who both diagnosed the bug and suggested a workaround while I was still waiting for ScummVM to finish compiling.

Note: See TracTickets for help on using tickets.