Keep several saves, with migration, atomic writes and import previews (Closes #37)
Savegames now lists independent save slots made with the loaded ROM: new game, continue, rename, duplicate, export and delete. The native database moves to IndexedDB version 2; the singleton save becomes "Save 1" inside the upgrade transaction, so it migrates exactly once and the old store is left untouched. Each write adds a generation and drops older ones in one transaction, keeping two records with CRC-32 checksums: a damaged newest record falls back to the previous one. Slots and records from a newer player are kept and never written. Imports are checked in a scratch world before anything changes and previewed with the trainer, progress, saved time, game data version and the slots of the same trainer; they go into a new save or replace one, whose previous record stays recoverable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7c12c81a27
commit
7d03f5c5ca
18 files changed
+2079
-56
No files matched your search
@@ -8,9 +8,9 @@ import { encodeSave } from "../src/storage/saves";
|
||||
import { foundationFixture } from "./foundation-fixture";
|
||||
|
||||
// Backups for the manual checks on the project board's "A tester" column,
|
||||
// built from the local ROM and imported through Savegames → Import native
|
||||
// backup. They hold names read from the ROM, so they stay out of the
|
||||
// repository (*.crystal-save.json is ignored).
|
||||
// built from the local ROM and imported through Savegames → Import backup
|
||||
// (then "Add as a new save"). They hold names read from the ROM, so they
|
||||
// stay out of the repository (*.crystal-save.json is ignored).
|
||||
//
|
||||
// MAKE_TEST_SAVES=1 npx vitest run tests/human-test-saves.test.ts
|
||||
const romPath =
|
||||
|
||||
Reference in new issue
Block a user