feat(wasm): full save dump and rebuild against dungeon.dat and graphics.dat #338

Open
jqueuniet wants to merge 1 commit from feat/wasm-full-save-json into main
Owner

Closes #332

Adds saveToJsonFull / saveFromJsonFull (dm2-convert + dm2-wasm), exposing SaveDump::full / SaveDump::reconstruct.

  • Map table of the supplied dungeon.dat must match the save's; otherwise DungeonMismatch (instead of an opaque bitstream error).
  • A dump is emitted only after it rebuilds the input byte-exact; otherwise IncompleteRecordStream.
  • DOS Beta: pass GRAPHICS.DAT + GRAPHIC2.DAT concatenated.

Tests

crates/dm2-convert/tests/full_roundtrip.rs: byte-exact round-trip for all DOS retail, Mac and DOS Beta fixtures; mismatched dungeon rejected on dump and rebuild; self-contained dump rejected by full rebuild. IncompleteRecordStream untested — no fixture triggers it.

Notes

  • A wrong graphics.dat (DOS ↔ Mac) is not detected: it round-trips byte-exact anyway.
  • Bundle size: +39 KB raw / +13.7 KB gzip (+3.6%) on the raw wasm32 cdylib, before wasm-opt -Oz. Not measured on the final npm package.
Closes #332 Adds `saveToJsonFull` / `saveFromJsonFull` (dm2-convert + dm2-wasm), exposing `SaveDump::full` / `SaveDump::reconstruct`. - Map table of the supplied `dungeon.dat` must match the save's; otherwise `DungeonMismatch` (instead of an opaque bitstream error). - A dump is emitted only after it rebuilds the input byte-exact; otherwise `IncompleteRecordStream`. - DOS Beta: pass `GRAPHICS.DAT` + `GRAPHIC2.DAT` concatenated. ## Tests `crates/dm2-convert/tests/full_roundtrip.rs`: byte-exact round-trip for all DOS retail, Mac and DOS Beta fixtures; mismatched dungeon rejected on dump and rebuild; self-contained dump rejected by full rebuild. `IncompleteRecordStream` untested — no fixture triggers it. ## Notes - A wrong `graphics.dat` (DOS ↔ Mac) is not detected: it round-trips byte-exact anyway. - Bundle size: +39 KB raw / +13.7 KB gzip (+3.6%) on the raw wasm32 cdylib, before `wasm-opt -Oz`. Not measured on the final npm package.
feat(wasm): full save dump and rebuild against dungeon.dat and graphics.dat
Some checks failed
CI / msrv (1.90) (pull_request) Failing after 8s
CI / audit (pull_request) Failing after 6s
CI / python bindings (3.11) (pull_request) Failing after 7s
CI / stable (pull_request) Failing after 10m11s
ecf73a09da
saveToJsonFull / saveFromJsonFull expose SaveDump::full and
SaveDump::reconstruct. The dungeon's map table must match the save's,
so another port or version is rejected up front. A dump is only emitted
once it rebuilds the input byte-exact.

Closes #332
Some checks failed
CI / msrv (1.90) (pull_request) Failing after 8s
CI / audit (pull_request) Failing after 6s
CI / python bindings (3.11) (pull_request) Failing after 7s
CI / stable (pull_request) Failing after 10m11s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/wasm-full-save-json:feat/wasm-full-save-json
git switch feat/wasm-full-save-json
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jqueuniet/dm2-tools!338
No description provided.