Support for saving sytem state
Rationale
It's essential to resume the state of the emulator to restore previous accomplishments. It should be possible to save this RAM format in a standard way that is interoperable with other emulators. The BESS file format - SameBoy created by the Sambeboy emulator is a good choice.
Description
The Web version should use localStorage
(which limits storage to 5MB) to store these multiple states.
On top of that allow Memory map battery backup RAM to be used - which should be considered a different and separate feature.
Implementation
If using a struct to serialize the values one must use the #[repr(packed)]
.
Think about using https://lib.rs/crates/bincode for the serialization process (will take into account the endianness). As an alternative implement the endianness by hand and avoid another dependency. Reddit reference
Note: Special care must be taken while handling external RAM from MBCs.