[Scummvm-tracker] [ScummVM] #10758: QFG4: Autosave SCI Script Deletes Manual Savegames...
Vhati
trac at scummvm.org
Wed Oct 31 22:50:22 CET 2018
#10758: QFG4: Autosave SCI Script Deletes Manual Savegames...
--------------------------------+-------------------------
Reporter: Vhati | Owner: (none)
Type: defect | Status: new
Priority: high | Component: Engine: SCI
Resolution: | Keywords: SCI32
Game: Quest for Glory 4 |
--------------------------------+-------------------------
Comment (by Vhati):
@digitall:
> I wonder if the original forced you to have only 10 savegames
I think you are correct.
https://github.com/scummvm/scummvm/blob/master/engines/sci/engine/kfile.cpp
bp_kernel GetSaveFiles break
bp_kernel FileIOOpen break
bp_kernel FileIOClose break
bp_kernel FileIOUnlink break
bp_kernel MakeSaveFileName break
\\
\\
Script 0, Glory::save() calls kGetSaveFiles() and localproc_21c5()
procedure in a loop. The procedure is responsible for deleting everything.
Looks like kCheckFreeSpace() is the loop's condition?
{{{
(procedure (localproc_21c5 param1 param2 param3 param4 &tmp temp0 temp1
newFile temp3 newStr)
(= newStr (Str new:))
(MakeSaveCatName (newStr data?) (global1 name?))
# kFileIO(Open): 000f:08b8 ('fake.cat'), 2 = 32100
((= newFile (File new:)) name: (newStr data?) open: 2)
(= temp1 0)
# Loop calls kFileIO(WriteRaw) to write every slot's title to the
catalog.
(while (< temp1 param3)
(if (!= temp1 param1)
(= temp3 (param4 at: temp1))
(newStr
at: 0 (& temp3 $00ff)
at: 1 (& (>> temp3 $0008) $00ff)
at: 2 0
)
(newFile write: (newStr data?) 2)
(= temp0 (Str new: 36))
(temp0 copyToFrom: 0 param2 (* temp1 36) 36)
(newFile write: (temp0 data?) 36)
(temp0 dispose:)
(= temp0 0)
)
(++ temp1)
)
(newStr at: 0 255 at: 1 255)
# kFileIO(Close): 32100 = 1
(newFile write: (newStr data?) 2 close: dispose:)
# kMakeSaveFileName: 000f:08b8 ('sci.033'), 0001:4c0d ('Glory'),
32 = 000f:08b8
(MakeSaveFileName
(newStr data?)
(global1 name?)
(param4 at: param1)
)
# kFileIO(Unlink): 000f:08b8 ('sci.033') = 1
(FileIO fiUNLINK (newStr data?))
(newStr dispose:)
)
}}}
Throughout the loop, my breakpoint reports "kCheckFreeSpace: 000f:0000
('') = 1"
Save has a couple of loops. This might be it?
{{{
(while
(and
(> temp9 0)
(or
(not
(CheckFreeSpace (global29 data?)))
(>= temp9
20)
)
)
(localproc_21c5 (- temp9
1) newStr temp9 temp1)
(= temp9
(GetSaveFiles
(global1
name?)
(newStr
data?)
(temp1
data?)
)
)
)
}}}
The loop has another condition "(>= temp9 20)". That looks suspicious.
After all the deletions, I'm left with 20 files.
\\
\\
A 20 slot cap has been patched away in two other places.
https://github.com/scummvm/scummvm/blob/b749116cbe1f710caa6fa225eef49af33e769e79/engines/sci/engine/script_patches.cpp#L254
--
Ticket URL: <https://bugs.scummvm.org/ticket/10758#comment:14>
ScummVM <https://bugs.scummvm.org>
ScummVM
More information about the Scummvm-tracker
mailing list