feat(bindings)!: SaveGame without dungeon.dat and graphics.dat #458

Merged
jqueuniet merged 1 commit from feat/453-save-game-limited into main 2026-10-31 10:24:44 +01:00
Owner

Closes #453. Stacked on #457.

SaveGame.limited(bytes) and SaveGame.limitedFromJson(json) open a save without its files. toJson, toBytes, gameplay, setGameplay and fieldLimits work; item calls refuse with NoContext.

  • attach(dungeon, graphics) decodes the save, as edited so far, against its files. It is refused, leaving the save unchanged, on a mismatch or a second attach.
  • hasContext() tells which state a save is in.
  • fromJson with files also decodes a limited save's dump.
  • Bindings: Python takes optional arguments (SaveGame(data)); C has dm2_save_game_open_limited, dm2_save_game_from_json_limited, dm2_save_game_attach and dm2_save_game_has_context.
  • Removed: the free save_to_json, save_from_json and save_field_limits_json. The fixture limits test now runs through limited handles, so it still covers every committed save in CI.

wasm-bindgen 0.2.129 cannot take Option<&DungeonFile>, hence the separate wasm constructors rather than optional arguments.

save_info_json, the lossy gameplay-only view, stays free; it could become a SaveGame method in a follow-up.

A node smoke test over a dev wasm build covers all four issues.

https://claude.ai/code/session_01SnENBXnZbhNNrojZT5jbJ7

Closes #453. Stacked on #457. `SaveGame.limited(bytes)` and `SaveGame.limitedFromJson(json)` open a save without its files. `toJson`, `toBytes`, `gameplay`, `setGameplay` and `fieldLimits` work; item calls refuse with `NoContext`. - `attach(dungeon, graphics)` decodes the save, as edited so far, against its files. It is refused, leaving the save unchanged, on a mismatch or a second attach. - `hasContext()` tells which state a save is in. - `fromJson` with files also decodes a limited save's dump. - Bindings: Python takes optional arguments (`SaveGame(data)`); C has `dm2_save_game_open_limited`, `dm2_save_game_from_json_limited`, `dm2_save_game_attach` and `dm2_save_game_has_context`. - Removed: the free `save_to_json`, `save_from_json` and `save_field_limits_json`. The fixture limits test now runs through limited handles, so it still covers every committed save in CI. wasm-bindgen 0.2.129 cannot take `Option<&DungeonFile>`, hence the separate wasm constructors rather than optional arguments. `save_info_json`, the lossy gameplay-only view, stays free; it could become a `SaveGame` method in a follow-up. A node smoke test over a dev wasm build covers all four issues. https://claude.ai/code/session_01SnENBXnZbhNNrojZT5jbJ7
feat(bindings)!: SaveGame without dungeon.dat and graphics.dat
All checks were successful
CI / msrv (1.90) (pull_request) Successful in 36s
CI / stable (pull_request) Successful in 59s
CI / audit (pull_request) Successful in 12s
CI / python bindings (3.11) (pull_request) Successful in 27s
CI / msrv (1.90) (push) Successful in 28s
CI / audit (push) Successful in 19s
CI / stable (push) Successful in 56s
CI / python bindings (3.11) (push) Successful in 27s
c08423989b
SaveGame::limited and limited_from_json open a save without its files:
to_json, to_bytes, gameplay, set_gameplay and field_limits work, item
calls refuse with NoContext until attach decodes the save, as edited
so far, against its files. from_json with files decodes a limited
dump. The free save_to_json, save_from_json and save_field_limits_json
go from convert, wasm, FFI and Python.

Closes #453

Claude-Session: https://claude.ai/code/session_01SnENBXnZbhNNrojZT5jbJ7
jqueuniet changed target branch from feat/451-save-game-keeps-graphics to main 2026-10-31 10:24:14 +01:00
jqueuniet deleted branch feat/453-save-game-limited 2026-10-31 10:24:44 +01:00
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!458
No description provided.