Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#2198 closed defect (fixed)

ZAK256: Non completable in post 0.7.1 versions

Reported by: SF/vood Owned by: SF/ender
Priority: normal Component: Engine: SCUMM
Keywords: script Cc:
Game: Zak McKracken


In some point between 0.7.1 and lastest CVS Zak256
stopped being completable. When you are in the secret
room at mar´s pyramid if you use the glowing object in
the base the game crashes.

If you don´t have a proper savegame you cant test the
bug easily using the console with:

room 41
object 78 pickup
room 25

Then just use the glowing object at the base and
prepare for crash.


Ticket imported from: #1290485. Ticket imported from: bugs/2198.

Attachments (2)

dumps.rar (82.6 KB ) - added by SF/vood 14 years ago.
Zak glowing object bug dumps
debuglog9.rar (17.5 KB ) - added by SF/vood 14 years ago.
Level 9 debug log

Download all attachments as: .zip

Change History (20)

comment:1 by sev-, 14 years ago

Which error message do you get in console?

comment:2 by SF/vood, 14 years ago

ERRO: (25:171:0x9): o5_resourceRoutines: default case 0

comment:3 by Kirben, 14 years ago

Owner: set to SF/ender

comment:4 by Kirben, 14 years ago

I changed the default case warning in o5_resourceRoutines()
to an error in CVS, since it shouldn't be triggered.

According to the disasm. of the FM-TOWNS version, case 0
of o5_resourceRoutines() isn't valid either. The original game
would just ignore it though, not error out.

Endy, could you check the script been used at this point? to
see if it is script error or a bad decode of the script's opcodes.

comment:5 by SF/vood, 14 years ago

Sorry to bug, but...any progress?



comment:6 by Kirben, 14 years ago

It would help if you could provide a dump of the scripts used
at that location and a debug level 9 log as the error occurs:

1. Create a 'dumps' directory, in the directory where
ScummVM is located.
2. Start ScummVM from the command line, with the dump
scripts option:
ie scummvm -u zaktowns
3. Start game or load saved game, go to room near that
location, since room scripts are only dumped when you enter
a room.
4. Cause the error to occur again.
5. Compress and attached the *.dmp files in the 'dumps'

1. Start ScummVM with a debug level of 9 and redirect output
to file:
ie scummvm -d9 zaktowns > debuglog.txt
2. Cause the error to occur again.
3. Compress and attached the log file.

by SF/vood, 14 years ago

Attachment: dumps.rar added

Zak glowing object bug dumps

comment:7 by SF/vood, 14 years ago

Ok, Zak Mckracken is a very long game, so in order to test
this bug with the lastest CVS I had to use the shortcut that
triggers the error (which I got in first place by normal
methods...playing from beggining).
So to sum up:

1.- I loaded Zak256 , then I went to room 41 to get the
glowing object, and finally to room 25 wheres supposed to be
2.- Then I pulled a lever in that room to open the stairs so zak
could go to the next room.
3.- Finally I did a savegame in that room

Then , I loaded scummvm CVS with -u and then loaded my
previous savegame. Zak entered the "buggy" room, used the
glowing object on the base and...crash :

ERROR: (25:171:0x9): o5_resourceRoutines: default case 0

So heres the dumps


comment:8 by SF/ender, 14 years ago

You forgot the Level 9 debug log, which is an important bit :)

by SF/vood, 14 years ago

Attachment: debuglog9.rar added

Level 9 debug log

comment:9 by SF/vood, 14 years ago

Sorry, heres the log

comment:10 by Kirben, 14 years ago

The problem is that ScummVM is loading a whole room for
script 171, instead of the actual script and tries to use the
room as a script. So the current error is only a side effect.

I'm not sure what is causing the resource loading problem
though. The problem might have just been hidden in the past.

comment:11 by sev-, 14 years ago

Priority: normalhigh

comment:12 by sev-, 14 years ago

Raising priority as it is a release show stopper.

comment:13 by SF/ender, 14 years ago

The current solution is to add back the original workaround
(simply changing the default case error in o5_resourceRoutines
back to a warning), or perhaps something more specific to this
particular bug.

The game can be completed with such a workaround (note:
Played to the end from an 0.7.1 save just prior to having to
insert the object into the base).

There is obviously a real bug here, which I will look into a bit
more... but this workaround has been committed for now, to
enable further testing of the game.

Not changing priority until I've looked into a proper fix.

comment:14 by Kirben, 14 years ago

I added a work around of not starting script 171 instead, since
it is safer. Allowing a room resource to be executed as a
script is just a bad idea...

comment:15 by SF/ender, 14 years ago

Yes, it was a quick and dirty hack until I get a chance to look
into it some more after work :)

comment:16 by SF/ender, 14 years ago

loadResource(rtScript, 171)
scummvm: scumm/resource.cpp:667: int
Scumm::ScummEngine::loadResource(int, int): Assertion
`roomNr > 0' failed.

That certainly doesn't help.

comment:17 by SF/ender, 14 years ago

Ok, the essential problem here is that script 171 doesn't exist.
In fact, there are no scripts past 169, although the script index
in 00.LFL lists more.

These rooms have been stubbed out by setting both the room
number and offset to 0. Currently if the room number is
0 in loadResource(), we set it to the current room. So once we
try and load it, we're loading everything from offset 0 in the
current room.

The question is whats the proper solution... several other
games (Monkey1, etc) also appear to have [0,0] scripts. I have
not found any other instance where a stubbed script is actually

The current workaround of aborting runScript works for this
particular bug, so I'm marking it as fixed and closing it.

It may however be a good idea to make a more generic fix by
enhancing error checking with regards to this type of case.
Abort executing the script somewhere if the roomOffs is 0,
which as far as I know is not valid in ANY scumm game.

comment:18 by SF/ender, 14 years ago

Component: Engine: SCUMM
Game: Zak McKracken
Keywords: script added
Priority: highnormal
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.