feat(bindings): index-addressed GraphicsArchive with options objects #441

Merged
jqueuniet merged 1 commit from feat/440-graphics-api into main 2026-10-30 23:24:21 +01:00
Owner

Part of #440 (1/2). Additive; nothing breaks.

  • entries gains index; find(cls1, cls2, cls3, cls4, {language}) returns one. Records sharing a tuple (language variants of a text or charsheet image) are each addressable. Ent1::find_index, Ent1::find_index_in_language, Archive::decode_image_record in dm2-graphics.
  • GraphicsArchive methods header, entries, find, labels, image, icon, sound, music, font, text, palette.
  • One options struct per method in dm2_convert::graphics, serde(default, deny_unknown_fields), #[non_exhaustive]:
    • wasm: optional JS object, typed in the .d.ts (options?: ImageOptions); routed through a JSON value, since deserializing straight from a JS object ignores unknown keys;
    • C: UTF-8 JSON + length, empty for defaults;
    • Python: keyword arguments.
  • New wasm dependency serde-wasm-bindgen (MIT).

New methods are byte-identical to the tuple-addressed functions on DOS and Amiga (test in this PR).

https://claude.ai/code/session_01SnENBXnZbhNNrojZT5jbJ7

Part of #440 (1/2). Additive; nothing breaks. - `entries` gains `index`; `find(cls1, cls2, cls3, cls4, {language})` returns one. Records sharing a tuple (language variants of a text or charsheet image) are each addressable. `Ent1::find_index`, `Ent1::find_index_in_language`, `Archive::decode_image_record` in dm2-graphics. - `GraphicsArchive` methods `header`, `entries`, `find`, `labels`, `image`, `icon`, `sound`, `music`, `font`, `text`, `palette`. - One options struct per method in `dm2_convert::graphics`, `serde(default, deny_unknown_fields)`, `#[non_exhaustive]`: - wasm: optional JS object, typed in the `.d.ts` (`options?: ImageOptions`); routed through a JSON value, since deserializing straight from a JS object ignores unknown keys; - C: UTF-8 JSON + length, empty for defaults; - Python: keyword arguments. - New wasm dependency `serde-wasm-bindgen` (MIT). New methods are byte-identical to the tuple-addressed functions on DOS and Amiga (test in this PR). https://claude.ai/code/session_01SnENBXnZbhNNrojZT5jbJ7
feat(bindings): index-addressed GraphicsArchive with options objects
Some checks failed
CI / msrv (1.90) (pull_request) Successful in 44s
CI / audit (pull_request) Successful in 18s
CI / python bindings (3.11) (pull_request) Successful in 34s
CI / stable (pull_request) Successful in 1m41s
CI / msrv (1.90) (push) Has been cancelled
CI / audit (push) Has been cancelled
CI / python bindings (3.11) (push) Has been cancelled
CI / stable (push) Has been cancelled
a46f56d995
GraphicsArchive addresses records by their index in entries, with find
by class tuple and language, so records sharing a tuple are each
reachable. Every method takes one options object: a serde struct in
dm2-convert, a JS object in wasm, JSON text in C, keyword arguments in
Python. Unknown options are errors. A new option is a new field; no
signature changes.

The tuple-addressed functions and methods stay for now.

Part of #440

Claude-Session: https://claude.ai/code/session_01SnENBXnZbhNNrojZT5jbJ7
jqueuniet deleted branch feat/440-graphics-api 2026-10-30 23:24:21 +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!441
No description provided.