Expand description
Save file format, slot management, and the SaveManager.
§File layout
[magic: 4 bytes "SAVE"]
[header length: u32 little-endian]
[header JSON bytes]
[snapshot length: u32 little-endian]
[snapshot JSON bytes]
[checksum: u32 little-endian] — CRC-32-style over header+snapshot bytesThe format is intentionally simple and human-inspectable (the JSON sections are UTF-8 text). No compression or encryption is applied by default.
Structs§
- Save
File - A complete in-memory representation of a save file.
- Save
Header - Metadata stored at the top of a save file.
- Save
Manager - Manages multiple save slots under a single directory.
- Save
Slot - A single numbered save slot.
headerisNoneif the slot is empty.
Enums§
- Save
Error - Errors that can occur during save file operations.
Constants§
- CURRENT_
FORMAT_ VERSION - The current save file format version.
- SAVE_
MAGIC - The four magic bytes at the start of every save file.
Functions§
- compute_
checksum - Compute a simple 32-bit checksum over
data.