docs(save-states): cover SRAM, EEPROM, and diagnostic-exit persistence

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HhfHfHEuzv2AUTd6erW1gU
This commit is contained in:
0xrsydn 2026-10-14 14:28:41 +07:00
commit e0d8464557

View file

@ -1,7 +1,7 @@
# Save states # Save states
A save state freezes the emulated machine at a step boundary and restores it later. A save state freezes the emulated machine at a step boundary and restores it later.
It is separate from the game's own save (Flash) and does not replace it: [Flash persistence](saves.md) still needs the game's SAVE command and a clean exit. It is separate from the game's own save (Flash, SRAM, or EEPROM) and does not replace it: [save-file persistence](saves.md) still needs the game's SAVE command, then a clean exit or a window diagnostic.
## Desktop use ## Desktop use
@ -18,7 +18,7 @@ State files are created with mode `0600`. The option is accepted only with `--wi
A rejected load (missing file, wrong ROM, corrupt or older-format file) is reported in the terminal and the game keeps running unchanged. A rejected load (missing file, wrong ROM, corrupt or older-format file) is reported in the terminal and the game keeps running unchanged.
Loading discards queued host audio and shows the state's last captured frame immediately. Loading discards queued host audio and shows the state's last captured frame immediately.
The Flash image inside the state replaces the running one. It is written to `--save-file` only on a clean exit, and only if it differs from the last persisted bytes. The save image inside the state replaces the running one. It is written to `--save-file` only on a clean exit or a window diagnostic, and only if it differs from the last persisted bytes.
The RTC resumes at the saved calendar value and then follows host elapsed time again. The RTC resumes at the saved calendar value and then follows host elapsed time again.
Quitting with Escape does not write a state. Press F5 first. Quitting with Escape does not write a state. Press F5 first.
@ -27,8 +27,8 @@ Quitting with Escape does not write a state. Press F5 first.
`Machine::save_state` and `Machine::load_state` (`crates/gba-core/src/machine/snapshot.rs`) encode: `Machine::save_state` and `Machine::load_state` (`crates/gba-core/src/machine/snapshot.rs`) encode:
- CPU registers, banks, status, instruction buffer, and retained fetch history. - CPU registers, banks, status, instruction buffer, and retained fetch history.
- All RAMs, VRAM, palette, and OAM, plus the Flash image and its modified flag. - All RAMs, VRAM, palette, and OAM, plus the save image (Flash, SRAM, or EEPROM) and its modified flag.
- Every device: timers and the shared prescaler, DMA channels and latches, display position, interrupts, keypad, serial, audio (FIFOs, PSG channels, wave RAM), Flash and RTC/GPIO state machines. - Every device: timers and the shared prescaler, DMA channels and latches, display position, interrupts, keypad, serial, audio (FIFOs, PSG channels, wave RAM), Flash, SRAM, and EEPROM state, and RTC/GPIO state machines.
- Video latches: affine accumulators, mosaic and window counters, sprite row pipeline, and the double-buffered scanline capture. - Video latches: affine accumulators, mosaic and window counters, sprite row pipeline, and the double-buffered scanline capture.
- Game Pak prefetch, IWRAM bus lanes, BIOS protected-read snapshot, the device cycle count, and the last step timing. - Game Pak prefetch, IWRAM bus lanes, BIOS protected-read snapshot, the device cycle count, and the last step timing.