Opened 15 years ago

Closed 15 years ago

Last modified 5 years ago

#4298 closed defect (fixed)

SCI: Resource Offset Endian Problem

Reported by: SF/mthreepwood Owned by: wjp
Priority: normal Component: Engine: SCI
Version: Keywords:
Cc: Game: Space Quest 4

Description

I attempted to play SQ4 CD on my Mac OS X (10.4, PPC) with the latest trunk and I had some problems with the game's startup. I got io failed errors, which seemed abnormal to me. Searching a bit more, I found that the offset is read in with no regards to endianness.

Line 999, sci/scicore/resource.cpp: file.read(&off, nEntrySize - 2);

In this game, nEntrySize - 2 == 3. Reading it in in LE order fixes this problem (until the game crashes soon after for other reasons :P). However, I'm not sure what size can appear here so I don't want to commit a fix myself.

Ticket imported from: #2739122. Ticket imported from: bugs/4298.

Attachments (1)

sci_res_endian_fix.diff (603 bytes ) - added by SF/mthreepwood 15 years ago.
Patch against latest trunk

Download all attachments as: .zip

Change History (5)

by SF/mthreepwood, 15 years ago

Attachment: sci_res_endian_fix.diff added

Patch against latest trunk

comment:1 by SF/mthreepwood, 15 years ago

Attached a patch which fixes the problem

comment:2 by wjp, 15 years ago

Thanks for spotting this. I committed a fix together with some extra simplification of that function.

One small extra remark: in your patch in "file.readUint16LE() + (file.readByte() << 16);" the order in which readUint16LE() and readByte() are executed isn't defined.

comment:3 by wjp, 15 years ago

Owner: set to wjp
Resolution: fixed
Status: newclosed

comment:4 by digitall, 5 years ago

Component: Engine: SCI
Game: Space Quest 4
Note: See TracTickets for help on using tickets.