Skip to content

Add CascStorage.readFile to read any file from a SC:R install - #12

Closed
ExcalZ wants to merge 1 commit into
mainfrom
casc-read-file
Closed

ExcalZ wants to merge 1 commit into
mainfrom
casc-read-file

Conversation

@ExcalZ

@ExcalZ ExcalZ commented Nov 17, 2026

Copy link
Copy Markdown

CascStorage in the WASM bindings only feeds map rendering. This adds readFile(path), which reads any file out of the install by its catalog path through the same broodcasc Storage, returning a Uint8Array.

ShieldBattery's hotkey editor uses it to show SC:R's command card icons (webui/dist/lib/images/cmdicons.*.png) read from the player's own install, so the app needs no CASC reader of its own and ships no game art.

  • Reads skip the asset cache (it holds render assets); callers keep what they reuse.
  • The size check before allocating is shared with the render path (checked_size).
  • Errors name the path: failed to read <path>: <broodcasc error>, including NotInstalled for files a partial install catalogs but never downloaded.

Tests:

  • pnpm run test:package with BROODMAP_TEST_SCR_DIR set: new install-backed test reads a cmdicons PNG with a mixed-case, backslashed path, checks the cache stays empty and that a missing path throws (10/10 pass).
  • pnpm run test:types covers the new declaration; pnpm test 111/111; cargo clippy -p broodmap-wasm -- -D warnings and cargo fmt --check clean.

Needs a release of @shieldbattery/broodmap for ShieldBattery to depend on it.

🤖 Generated with Claude Code

ShieldBattery's app reads SC:R's command card icons
(webui/dist/lib/images/cmdicons.*.png) for its hotkey editor, and wants
them read through broodcasc rather than a CASC reader of its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tec27 tec27 closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants