WASM build of the parser libraries #301
Labels
No labels
area/ci-release
area/cli
area/docs
area/dungeon
area/ftl
area/graphics
area/gui
area/music
area/saves
area/tooling
port/amiga
port/dos
port/fm-towns
port/mac
port/pc98
port/sega-cd
priority/high
priority/low
priority/medium
type/bug
type/chore
type/docs
type/feature
type/research
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jqueuniet/dm2-tools#301
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The parsers are pure-Rust and
&[u8]-driven, so a WASM target should be mostly free. Exposes graphics/dungeon/saves/music decoding to the browser and underpins a future web viewer.Investigated feasibility and scoped the work.
WASM readiness — confirmed. All four parser crates cross-compile cleanly to
wasm32-unknown-unknown(verified —libdm2_{graphics,dungeon,saves,music}.rliballbuild). No C / FFI /
-sysdeps in the parser chain;getrandom/libc/tempfileare dev-only via
dm2-cliand never reach the libraries. The audio chain(
sms-audio/opl-audio/xmrs/xmrsplayer) also builds:xmrsplayer'sthread/time usage is confined to its
cpal_playerbinary, andxmrs'sstd::fsloadersare never called (
mod-audiofeeds&[u8]). So thedm2-wasmcdylib wrapper itself issmall.
(One unrelated aside surfaced:
binrw 0.15.1throws a future-incompat warning on everybuild, host and wasm alike — worth its own tracking issue for a version bump, not a
blocker here.)
But the useful boundary is JSON, and the current JSON isn't ready. A browser
viewer/editor needs to hand structured data across the wasm boundary.
dm2-dungeon'sjson::skprojectdump is one-way and lossy (retired-C#-tool interop;start_maphardcoded to 0), and
dm2-saveshas no JSON at all. To avoid baking a lossy contractinto the web API, the plan is lossless-JSON-first, then wrap:
first) and #309 (dungeon). The parsers already round-trip byte-exact at the binary
level, so this is mostly a faithful serde projection guarded by a round-trip test.
assumes a filesystem with sidecar binaries (PNGs / sounds), which the browser lacks.
dm2-wasmcdylib exposing the settled JSON, graphics as PNGbytes, and music as PCM (via
wasm-pack --target web).Keeping this open as the wrapper/exposure step; it is now gated on #307 / #308 / #309.