victory: pin shader::sources (SGD5 records + raw DXBC scan) with unit tests #469

Open
opened 2026-11-27 21:25:35 +00:00 by github-bot · 5 comments
Owner

@⁠AnastasisKon on GitHub · 2026-11-27 21:24 UTC · original

What

apps/victory/src/shader.rs's sources() is the entry point behind victory shader and the pre-build: it lists an SGD5 file's packed records (sgd5::records) and every raw DXBC container found by magic whose Container::parse accepts it. It has no tests; the survey/prebuild counts rest on its exact behavior.

What this pins

  • empty / non-shader input yields no sources;
  • a raw DXBC at an offset is found with that offset, and a DXBC magic whose container does not parse (truncated size) is skipped;
  • an SGD5 record found by marker is listed as Source::Packed, its label carries offset and name, bytes() returns None for a corrupt (non-deflate) stream, and a well-formed stored-deflate record unpacks to the container bytes;
  • a file that is SGD5 gets both its packed records and any raw containers in the same scan.

Test-only change: synthetic bytes (hand-built DXBC header, hand-built stored-deflate record), no game data, no new dependencies.

How it was tested

  • cargo test -p victory (new unit tests in apps/victory/src/shader.rs)
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings
  • cargo xtask policy
  • Game run: not needed (test-only).
**@⁠AnastasisKon** on GitHub · 2026-11-27 21:24 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/465) ## What `apps/victory/src/shader.rs`'s `sources()` is the entry point behind `victory shader` and the pre-build: it lists an SGD5 file's packed records (`sgd5::records`) and every raw `DXBC` container found by magic whose `Container::parse` accepts it. It has no tests; the survey/prebuild counts rest on its exact behavior. ## What this pins - empty / non-shader input yields no sources; - a raw `DXBC` at an offset is found with that offset, and a `DXBC` magic whose container does not parse (truncated size) is skipped; - an SGD5 record found by marker is listed as `Source::Packed`, its label carries offset and name, `bytes()` returns `None` for a corrupt (non-deflate) stream, and a well-formed stored-deflate record unpacks to the container bytes; - a file that is SGD5 gets both its packed records and any raw containers in the same scan. Test-only change: synthetic bytes (hand-built DXBC header, hand-built stored-deflate record), no game data, no new dependencies. ## How it was tested - `cargo test -p victory` (new unit tests in `apps/victory/src/shader.rs`) - `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` - `cargo xtask policy` - Game run: not needed (test-only).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:25:35 +00:00
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-27 21:24 UTC · original

/claim

**@⁠AnastasisKon** on GitHub · 2026-11-27 21:24 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/465#issuecomment-7228419394) /claim
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-27 21:24 UTC · original

Claimed by @⁠AnastasisKon. Open a draft pull request with Refs #465 in its description within 24 hours, or the claim expires.

**@⁠github-actions[bot]** on GitHub · 2026-11-27 21:24 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/465#issuecomment-7228421911) Claimed by @⁠AnastasisKon. Open a draft pull request with `Refs #465` in its description within 24 hours, or the claim expires.
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-27 21:38 UTC · original

Work is up in draft PR #471 (branch vibe/shader-sources-tests-1705ac). Note: a second session of this account opened #472 for the same issue; I closed #472 as a duplicate — #471 covers its cases too.

**@⁠AnastasisKon** on GitHub · 2026-11-27 21:38 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/465#issuecomment-7228619507) Work is up in draft PR #471 (branch vibe/shader-sources-tests-1705ac). Note: a second session of this account opened #472 for the same issue; I closed #472 as a duplicate — #471 covers its cases too.
github-bot referenced this issue from a commit 2026-11-28 00:42:29 +00:00
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 12:43 UTC · original

/release - done without a PR (upstream is paused, so none was opened): the work is on branch vibe/shader-sources-tests-1705ac and is in my fork's main. input_without_shaders_yields_nothing in apps/victory/src/shader.rs now also checks that the SGD5 magic alone is no record and that a "DXBC" with no header behind it is no container (shader.rs:451-455), and an_sgd5_record_is_listed_and_unpacks_to_its_container (shader.rs:507) covers the record path.

**@⁠AnastasisKon** on GitHub · 2026-11-28 12:43 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/465#issuecomment-7239427587) /release - done without a PR (upstream is paused, so none was opened): the work is on branch `vibe/shader-sources-tests-1705ac` and is in my fork's `main`. `input_without_shaders_yields_nothing` in `apps/victory/src/shader.rs` now also checks that the SGD5 magic alone is no record and that a "DXBC" with no header behind it is no container (`shader.rs:451-455`), and `an_sgd5_record_is_listed_and_unpacks_to_its_container` (`shader.rs:507`) covers the record path.
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-28 12:44 UTC · original

Released. This issue is free to claim.

**@⁠github-actions[bot]** on GitHub · 2026-11-28 12:44 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/465#issuecomment-7239429474) Released. This issue is free to claim.
This discussion has been locked. Commenting is limited to contributors.
No description provided.