OptionalscrambleKey: stringAdopts a save this SaveSystem never wrote: normalize runs once on externalBytes,
producing state at version 0, which is then carried up through the same migrations
chain an ordinary load already uses to reach the current version - a game supplies
one normalize per external format it wants to accept (an rpg.decodeMarshal-based
one for a Game.rxdata, say), rather than hand-rolling "decode, then call save"
outside the versioned pipeline every migration otherwise goes through.
externalBytes is size-checked before normalize ever sees it - a cheap, structural
guard against a truncated or hostile file, ahead of and distinct from validating
whatever shape normalize itself produces.
Optionalpreview: unknownWrites a payload from this SaveSystem's own exportSlot back as an ordinary save,
migrated up to the current version the same way load migrates an older save found
locally. scrambleKey must match whatever exportSlot scrambled it with, if any.
payload is size- and control-character-checked before it is unscrambled or parsed -
this crossed a device or a server, unlike load's own localStorage, which this same
SaveSystem wrote itself and has no reason to distrust.
OptionalscrambleKey: stringevery slot with a save, and its metadata - for a save-select screen
Reads a slot, migrating it up to the current version if it was saved at an older one.
Returns null for a corrupted or malformed slot the same way it already does for a
missing one - a slot this SaveSystem wrote itself is trusted, but a truncated write
(an interrupted browser storage flush, a quota eviction, a hand-edited value) is still
possible, and a save-select screen should see "no usable save here", not an uncaught
SyntaxError.
Optionalpreview: unknown
Reads a slot back out as a portable string a player can carry to another browser or device, or hand to their own server - the counterpart to
importSlot, formwg's own save shape rather than a foreign one (importExternalcovers that side).scrambleKey, when given, runs the payload throughscramblefirst: not encryption, only enough to stop a save being hand-edited in a text editor. Returns null for a slot with no save.