Opened 18 years ago

Closed 18 years ago

#2597 closed defect (fixed)

BS2: when starting through menu crashes with assertion

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

Description

When starting broken sword 2 (english cd) I get an assertion failure in engines/sword2/resman.cpp on line 442 in the ResourceManager::readCluIndex function. (assert((tableSize % 8)==0).

For some reason if I start the game through the menu it fails to read the tableOffset correctly (comes up with a REALLY large number), thus tableSize ends up having a negative stored in it and underflows.).

But if I start scummvm like this scummvm sword2

it works fine.

Linux FC5 x86

scummvm 0.9.0svn revision 22372 (only just started playing the game on the 29th of april so haven't tested older releases).

I do have the modern skin in my "extra" include directory as well (much better than the old green skin)

Ticket imported from: #1483213. Ticket imported from: bugs/2597.

Change History (12)

comment:1 by fingolfin, 18 years ago

Summary: when starting through menu crashes with assertionBS2: when starting through menu crashes with assertion

comment:2 by fingolfin, 18 years ago

Maybe the game path is set incorrectly. Try removing BS2 from the game list (via the launcher) and then re-add it.

comment:3 by eriktorbjorn, 18 years ago

I can't reproduce it myself. Does it always happened? I just had some problems starting another game, but they went away after a few tries. Valgrind is warning about uninitilized variables in our File class, which has me completely mystified. (I'll file a bug report about that, once I've investigated it a bit further.)

comment:4 by SF/urkle, 18 years ago

It happens every single time I start broken sword 2 through the scummvm game menu. And it never happens if I start scummvm with the sword2 command like parameter. (no matter what directory I am in). I also verified the path in the .scummvmrc file and it has the correct path in it.

When starting from the game menu, it does find and load the resource.inf file in ResourceManager::init(); and *seems* to open the file scripts.clu as it gets a handle back, however when it starts reading the header it ends up with a different number than it should. And I did not see any other reads or seeks in the file that shouldn't have been in there while I was stepping through the program in DDD/gdb.

I'm going to see if I can see anything from my end with valgrind.

comment:5 by SF/urkle, 18 years ago

ok.. well I think I might have found where the issue is tied to.

I have this setup on my filesystem /home/urkle/Games/scummvm/ - broken1 - broken2 - loom - monkey etc. . . and I also have in the main /home/urkle/Games/scummvm/ directory I have the modern.ini and modern.zip files.

I added that directory to the extrapath parameter so scummvm would pick up the modern theme from anywhere. I removed that path and scummvm no longer crashed while launching broken sword 2 from the menu.

comment:6 by SF/urkle, 18 years ago

ok.. if I move the two them files into a new subdir called EXTRA and update the extrapath in the .scummvmrc file then brokensword2 starts up correctly from the game menu. It even failed if I had NO files in the "paret directory" so it seems as though some file code is severely confused about something.

um. ok I think I found it.

it seems as though the file open code traversed the first sub directory in extrapath (broken1) and opened the scripts.clu file from there (as file->size() in readCluIndex just before the failed assetion is the SAME size as the scripts.clu from sword1)

comment:7 by sev-, 18 years ago

Owner: set to fingolfin

comment:8 by sev-, 18 years ago

It seems that the cause of this bug is changed behaviour of AddDefaultDirectory(). Originally it should work as follows:

for files /path/foo/blah /path/Foo/bAr/BAZ /path/file

call to AddDefaultDirectoryRecursive("/path") should produce: foo/blah foo/bar/baz file

Note that these paths are relative to "/path" and contain all subdirectories. Also all components are lowercased.

The reason for such addition were these files in mustard: images/tra-02/tile-8.wiz images/ps2-03/tile-8.wiz images/Atl-04/TILE-26.wiz

Note that filename is the same but path isn't and path components are in mixed case.

Max, may you restore that functionality?

comment:9 by fingolfin, 18 years ago

I'll try to tackle this during the coming weekend.

comment:10 by fingolfin, 18 years ago

I commited a change to SVN addressing this. Please tell me whether it helps.

comment:11 by SF/urkle, 18 years ago

That seemed to fix it.

An odd sideeffect is scummvm picked up my modern.ini/modern.zip from within the EXTRAS subdirectory in the scummvm directory..

comment:12 by fingolfin, 18 years ago

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