Skip to main content

Module format

Module format 

Source
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 bytes

The format is intentionally simple and human-inspectable (the JSON sections are UTF-8 text). No compression or encryption is applied by default.

Structs§

SaveFile
A complete in-memory representation of a save file.
SaveHeader
Metadata stored at the top of a save file.
SaveManager
Manages multiple save slots under a single directory.
SaveSlot
A single numbered save slot. header is None if the slot is empty.

Enums§

SaveError
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.