|
|
@ -19,11 +19,15 @@ func readSystemSaveData(uuid []byte) (defs.SystemSaveData, error) {
|
|
|
|
return system, fmt.Errorf("failed to open save file: %s", err)
|
|
|
|
return system, fmt.Errorf("failed to open save file: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defer file.Close()
|
|
|
|
|
|
|
|
|
|
|
|
zstdDecoder, err := zstd.NewReader(file)
|
|
|
|
zstdDecoder, err := zstd.NewReader(file)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return system, fmt.Errorf("failed to create zstd decoder: %s", err)
|
|
|
|
return system, fmt.Errorf("failed to create zstd decoder: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defer zstdDecoder.Close()
|
|
|
|
|
|
|
|
|
|
|
|
err = gob.NewDecoder(zstdDecoder).Decode(&system)
|
|
|
|
err = gob.NewDecoder(zstdDecoder).Decode(&system)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return system, fmt.Errorf("failed to deserialize save: %s", err)
|
|
|
|
return system, fmt.Errorf("failed to deserialize save: %s", err)
|
|
|
@ -45,11 +49,15 @@ func readSessionSaveData(uuid []byte, slotID int) (defs.SessionSaveData, error)
|
|
|
|
return session, fmt.Errorf("failed to open save file: %s", err)
|
|
|
|
return session, fmt.Errorf("failed to open save file: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defer file.Close()
|
|
|
|
|
|
|
|
|
|
|
|
zstdDecoder, err := zstd.NewReader(file)
|
|
|
|
zstdDecoder, err := zstd.NewReader(file)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return session, fmt.Errorf("failed to create zstd decoder: %s", err)
|
|
|
|
return session, fmt.Errorf("failed to create zstd decoder: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defer zstdDecoder.Close()
|
|
|
|
|
|
|
|
|
|
|
|
err = gob.NewDecoder(zstdDecoder).Decode(&session)
|
|
|
|
err = gob.NewDecoder(zstdDecoder).Decode(&session)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return session, fmt.Errorf("failed to deserialize save: %s", err)
|
|
|
|
return session, fmt.Errorf("failed to deserialize save: %s", err)
|
|
|
|