Skip to main content

Module save_state

Module save_state 

Source
Expand description

Save-states — a versioned binary snapshot of an entire System.

System (and everything it owns — Cpu, Bus, Tia, Riot, Cartridge) already derives serde::Serialize/Deserialize, so this module is a thin wrapper: a small header (magic, format version, a caller-supplied ROM identity tag) plus the System itself, encoded with postcard (a compact, no_std+alloc-friendly binary serde format — no hand-rolled tagged-section encoder needed, unlike a codebase that has to avoid serde in its core).

rusty2600-core doesn’t know how a ROM’s identity should be computed (that’s a frontend/tooling concern — a full SHA-256, a fast FNV-1a, or anything else); callers supply an opaque rom_tag: u64 and SaveState::restore simply checks it matches what was captured, so a save file can’t silently be loaded against the wrong cartridge.

See docs/adr/0007-save-state-versioning.md for the version-compatibility policy this header format implements.

Structs§

SaveState
A captured snapshot of a System, ready to be encoded to bytes or restored back into a running system.

Enums§

SaveStateError
Everything that can go wrong loading a save-state.