Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#12060 closed defect (fixed)

SCI: GK1: Can not restore saved game.

Reported by: vanfanel Owned by: sluicebox
Priority: normal Component: Engine: SCI
Version: Keywords:
Cc: Game: Gabriel Knight 1

Description

Hi there!

Using latest .DEB version of Scummvm, 2.2.0 as of this writting. Also tried stock Ubuntu version, which is currently 2.1.0.
I have tried on both X86_64 and ARM aarch64.

I have been using Scummvm for years, and I have never encountered this bug with any other game.

With the GOG version of GK1, I can save the game but I can not restore it. The engine says: The game was saved under a different game or interpreter version.

With my own spanish CD copy, it says the same, except... well, in spanish.

I can also see this on the console:

WARNING: Save game was created for game version ��4�U, but the current game version is �I�ɮU!

Version numbers look like that. Any idea on what could be happening here?
The game is listed as supported.

Thanks!

Attachments (1)

gk1-cd.001 (43.3 KB ) - added by vanfanel 4 years ago.

Download all attachments as: .zip

Change History (6)

by vanfanel, 4 years ago

Attachment: gk1-cd.001 added

comment:1 by eriktorbjorn, 4 years ago

I know very little about the SCI engine, but it looks to me like the version it's referring to is the one found in the file called VERSION. At least in my copy of the game, this is just a text file (with CRLF line breaks) that contains the text "01.100.000".

If I look at the start of a savefile I just made, I see this:

$ zcat gk1-cd-win.002 | xxd | head -4
00000000: 666f 6f62 6172 002d 0000 0030 312e 3130  foobar.-...01.10
00000010: 302e 3030 3000 e507 010c 0d2f 0800 d51b  0.000....../....
00000020: 1e14 1f38 0000 0000 0000 0054 484d 4200  ...8.......THMB.
00000030: 0096 1602 00a0 0078 0203 0203 080b 0500  .......x........

So the version gets stored there. So I tried removing the VERSION file. The game still starts, but my next savegame looked like this:

$ zcat gk1-cd-win.003 | xxd | head -4
00000000: 626c 7570 7000 2d00 0000 e0a2 10a3 1b56  blupp.-........V
00000010: 00e5 0701 0c18 3208 00d5 1b1e 1402 1c00  ......2.........
00000020: 0000 0000 0000 5448 4d42 0000 9616 0200  ......THMB......
00000030: a000 7802 0302 0308 0b05 0000 0000 0000  ..x.............

Where the version should be stored, there's now only random (?) garbage. And when I try to load this later, I guess it's checking against different random garbage and determines that the save file is incompatible.

Could this be a clue?

comment:2 by vanfanel, 4 years ago

Yes, creating this file manually works. Thanks!

Maybe SCUMMVM should warn about this file being missing at start?

comment:3 by eriktorbjorn, 4 years ago

Maybe SCUMMVM should warn about this file being missing at start?

That's what I would have thought too, but I'm not sure which games actually require it. Hopefully someone more familiar with SCI will be able to tell us.

I noticed that I had missed copying the VERSION file for some of my SCI games that I haven't gotten around to playing yet, which made me a bit worried. But at least for some it didn't seem to make a difference. And for a few - I forget which ones - I couldn't even find such a file on the CD.

comment:4 by digitall, 4 years ago

Component: --Unset--Engine: SCI
Game: Gabriel Knight 1
Summary: [SCI][Gabriel Knight][GNU/Linux/SD:2] Can not restore saved game.SCI: GK1: Can not restore saved game.

comment:5 by sluicebox, 4 years ago

Owner: set to sluicebox
Resolution: fixed
Status: newclosed

SCI games depend on many game-specific and version-specific files and if they're run without them they'll fail in different ways. GK1 has dozens of files that are indirectly relied upon. The SCI instructions are to copy all of the files: https://wiki.scummvm.org/index.php/Datafiles#All_SCI32_.28SCI2.2F3.29_games

The gibberish bytes are because ScummVM returns uninitialized memory when reading a string from an invalid file handle. The GK1 game scripts don't do any error checking when reading VERSION (which Sierra fixed in later SCI32 games) so when there's no VERSION you're getting random bytes. Those random bytes got saved in save-files and then compared to new random bytes upon Restore with unpredictable results. You can see this because ScummVM always logs "WARNING: Attempt to use invalid/unused file handle 65535!" when you start GK1 without VERSION.

I've improved this slightly by changing ScummVM to always initialize kFileIOReadString's output so that the results will be consistent. Now if you save a GK1 game without a VERSION file it will still load if you don't have the VERSION file. But that just keeps a bad situation from getting worse.

The real problem here was missing game files. You gotta have 'em all! =)

https://github.com/scummvm/scummvm/commit/89c67944f4c0d51c1fc6f81c2bbc3c78ca862812

Last edited 4 years ago by sluicebox (previous) (diff)
Note: See TracTickets for help on using tickets.