Author Topic: Old SCI0 Template Save Bug  (Read 2560 times)

0 Members and 1 Guest are viewing this topic.

Offline troflip

Re: Old SCI0 Template Save Bug
« Reply #15 on: July 13, 2020, 02:24:48 PM »
Back to the original issue:

After saving 20 games, A-T, the beginning of gamename.dir will look like:
13 00 73 0a 12 00 72 0a      slot 19 (T), slot 18 (S), ...
That's basically, slot number (in hex) followed by string that appears to be 0a-terminated.

Then I save over S (2nd in the list). And I get:

12 00 72 0a 13 00 73 0a      slot 18 (S), slot 19 (T), ...

Looks great, exactly as it should look.
The time stamp on the file shows gamename.dir and gamename.018 written to, which is correct.

But now if I delete gamename.018, I can still load S (but actually it's not S, see below)

However, if I delete gamename.000, I can no longer load S. Which means loading S is actually trying to load the wrong save.

So what's going on: S is being saved properly (to gamename.018), but when we load we are loading gamename.000. This is despite gamename.dir linking S to slot 18. This isn't some kind of memory corruption, it persists even if I close and reopen the game.
If I rename gamename.000 to gamename.018, then I can load the "missing" S save.

So somehow, it appears the save games get into a state where the first slot number in gamename.dir is always getting treated as 0 by the game, despite the data in gamename.dir.

« Last Edit: July 13, 2020, 02:26:40 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline troflip

Re: Old SCI0 Template Save Bug
« Reply #16 on: July 13, 2020, 02:58:22 PM »
It looks like the values returned by the GetSaveFiles kernel are wrong (or at least don't match the files). It always has 0 in the first slot. These are the contents of strPtrs just after the GetSaveFiles call in SRDialog:init.

Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Doan Sephim

Re: Old SCI0 Template Save Bug
« Reply #17 on: July 13, 2020, 03:20:40 PM »
Troflip, you're investigative skills are top-notch! Very impressive.

I'm just glad the problem is coming into focus!
« Last Edit: July 13, 2020, 03:45:41 PM by Doan Sephim »
Artificial Intelligence Competition

Offline Collector

Re: Old SCI0 Template Save Bug
« Reply #18 on: July 13, 2020, 07:41:19 PM »
Specifically, SRDialog:doit. It can't be decompiled and thus falls back to disassembly. Somewhere in there, something didn't disasemble correctly, resulting in the duplicate saves bug.

Wonder if Omer might have the original SCI0/SCI01 source scripts for this?
KQII Remake Pic

Offline gumby

Re: Old SCI0 Template Save Bug
« Reply #19 on: July 13, 2020, 08:06:46 PM »
Troflip, do you think it might be possible to hack around it with some custom post-processing that would (re)create the .dir file with the correct values?
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Collector

Re: Old SCI0 Template Save Bug
« Reply #20 on: July 13, 2020, 10:13:31 PM »
Sierra had a tool create a new catalog file from all of the save games in a folder. http://sierrahelp.com/Utilities/Misc/SierraSavedGameCatalogFixer.html
KQII Remake Pic

Offline troflip

Re: Old SCI0 Template Save Bug
« Reply #21 on: July 14, 2020, 12:14:18 AM »
Troflip, do you think it might be possible to hack around it with some custom post-processing that would (re)create the .dir file with the correct values?

I think you could hack around it by limiting the save game count to 19 instead of 20.

I haven't tried it, but if you change this to a 19, it should limit the save game count to 19, and then I think the bug doesn't repro:

Code: [Select]
(procedure (CheckForFreeSpace)
(if (< local2 20) (CheckFreeSpace gSaveDirPtr))
)
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline OmerMor

Re: Old SCI0 Template Save Bug
« Reply #22 on: July 14, 2020, 02:12:39 AM »
Specifically, SRDialog:doit. It can't be decompiled and thus falls back to disassembly. Somewhere in there, something didn't disasemble correctly, resulting in the duplicate saves bug.

Wonder if Omer might have the original SCI0/SCI01 source scripts for this?

I published my SCI0 scripts here: https://github.com/OmerMor/SCI0
Unfortunately I don't have any SCI01 scripts.
I do have some SCI1 versions of SAVE.SC which I haven't published yet.
I'll attach all my versions here.

Offline lskovlun

Re: Old SCI0 Template Save Bug
« Reply #23 on: July 14, 2020, 06:52:25 AM »
I've made a test harness for SaveGame/GetSaveFiles. The 'prepare' menu option will make 20 saved games, and the two other options print the information returned by GetSaveFiles. After setting the stage in this manner, you can use the ordinary Save/Restore functionality to stress-test the related code. You just dump the attached file in a newly created game, it should be self-contained.

Offline EricOakford

Re: Old SCI0 Template Save Bug
« Reply #24 on: July 14, 2020, 06:29:52 PM »
I published my SCI0 scripts here: https://github.com/OmerMor/SCI0
Unfortunately I don't have any SCI01 scripts.
I do have some SCI1 versions of SAVE.SC which I haven't published yet.
I'll attach all my versions here.

Just updated my SCI1.0 decompilations and template. Now saving works in all of my templates, and two disassembly blocks are history!

The SCI01 Save script is pretty much the same as the SCI0 one, just with the file kernel functions merged into one, so we're not missing much there.
My SCI templates
SCI0 SCI0.1 SCI1.0 SCI1.1
SCI2.1 planned

Offline Collector

Re: Old SCI0 Template Save Bug
« Reply #25 on: July 14, 2020, 08:25:41 PM »
Are there any other disassembly blocks left in the templates?
KQII Remake Pic

Offline EricOakford

Re: Old SCI0 Template Save Bug
« Reply #26 on: July 14, 2020, 09:47:49 PM »
Are there any other disassembly blocks left in the templates?

SCI0, SCI01, and SCI11 have no disassembly blocks at all.

SCI10 only has three - in Logger, PolyEdit, and Talker. I can resolve Talker and thus allow for talking portraits. PolyEdit and Logger? Probably not needed.
« Last Edit: July 14, 2020, 09:53:13 PM by EricOakford »
My SCI templates
SCI0 SCI0.1 SCI1.0 SCI1.1
SCI2.1 planned

Offline Kawa

Re: Old SCI0 Template Save Bug
« Reply #27 on: July 15, 2020, 06:09:00 AM »
Very much not needed, yeah, much like most of the development tools. Now, debug tools...

Offline OmerMor

Re: Old SCI0 Template Save Bug
« Reply #28 on: July 16, 2020, 11:59:11 AM »
Are there any other disassembly blocks left in the templates?

SCI0, SCI01, and SCI11 have no disassembly blocks at all.

SCI10 only has three - in Logger, PolyEdit, and Talker. I can resolve Talker and thus allow for talking portraits. PolyEdit and Logger? Probably not needed.

Attached are all my Logger/PolyEdit/Talker scripts.



Offline Doan Sephim

Re: Old SCI0 Template Save Bug
« Reply #29 on: July 16, 2020, 10:54:28 PM »
I'm a little confused. It got really technical and I got lost. Did we find a work around using 19 saves instead of 20, or did we figure something else out? Or did we figure nothing out?


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.135 seconds with 25 queries.