mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-24 08:33:41 +01:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user