[Scummvm-devel] SCI file handling revamp

Andre Heider a.heider at gmail.com
Fri Feb 27 13:26:32 CET 2009


On Thu, Feb 26, 2009 at 5:50 PM, Max Horn <max at quendi.de> wrote:

> Actually, I might change the current warning that is produced when
> trying to write to a file opened in read-mode, and vice versa, to an
> error, to ensure I get plenty of reports quickly *ggg*.

Nice plan, here's the first:

starting LSL3 with "LARRY3.DRV" and "RESOURCE.LL3" removed from the gamedir:

kFOpen(LARRY3.DRV,0x1)
WARNING: FSNode::createReadStream: FSNode does not exist!
WARNING: file_open(_K_FILE_MODE_OPEN_OR_FAIL) failed to open file 'LARRY3.DRV'!
file_open() failed
kFClose(65535)
Attempt to use invalid/unused file handle 65535!

Then its game over because of the error() in getFileFromHandle() ;)

Same issue on my SQ3 copy when removing the file "version". This is
SQ3 v0.000.685, not all versions seem to read from that file.

file_open() passes 0xffff to the script as invalid handle.
getFileFromHandle() on the other side only checks for zero.

Passing 0xffff to the script seems right, i tried zero there and then
LSL3 it trying to read from the handle. If its 0xffff it doesn't, but
it still tries to close that invalid handle.
SQ3 on the other side uses kFGets() and kFClose(), no matter what
kFOpen() returned in the 1st place.

When checking for 0xffff in getFileFromHandle() (with just a warning
instead of an error) it works out fine for both games, but i'm not
sure what handle zero is supposed to be in the 1st place. Maybe this
is an inconsistency?

Regards,
Andre




More information about the Scummvm-devel mailing list