fix(savedata): write playtime back to binary blob on save

updateSaveDataWithStruct only wrote RP and KQF into the blob, leaving
the playtime field stale. On each reconnect, GetCharacterSaveData read
the old in-game counter from the blob and reset s.playtime to it,
rolling back all progress accumulated during the previous session.

Playtime is now persisted into the blob alongside RP, using the same
S6 mode guard as the read path in updateStructWithSaveData.
This commit is contained in:
Houmgaor
2026-03-23 22:00:06 +01:00
parent e1aa863a1f
commit 72088db4ff
2 changed files with 9 additions and 0 deletions

View File

@@ -148,6 +148,11 @@ func (save *CharacterSaveData) updateSaveDataWithStruct() {
if save.Mode >= cfg.F4 {
copy(save.decompSave[save.Pointers[pRP]:save.Pointers[pRP]+saveFieldRP], rpBytes)
}
if save.Mode >= cfg.S6 {
playtimeBytes := make([]byte, 4)
binary.LittleEndian.PutUint32(playtimeBytes, save.Playtime)
copy(save.decompSave[save.Pointers[pPlaytime]:save.Pointers[pPlaytime]+saveFieldPlaytime], playtimeBytes)
}
if save.Mode >= cfg.G10 {
copy(save.decompSave[save.Pointers[pKQF]:save.Pointers[pKQF]+saveFieldKQF], save.KQF)
}