Audio: VICTORY_XMA_DUMP and VICTORY_AUDIO_CAPTURE write nothing inside a source tree #294

Open
github-bot wants to merge 1 commit from github-bot/gh-294 into main AGit
Owner

@⁠sharan104 on GitHub · 2026-11-26 14:38 UTC · original
sharan104:fix/hle-dumps-outside-repo → main · +32 −2 · 4 files · 1 commits · open

The same asset-policy gap as #283, in victory-hle. Two diagnostics switches write the title's sound wherever they point, with no check:

  • VICTORY_XMA_DUMP (audio.rs, dump_input): the context words and input buffers (.xma) of the first 32 voices, which are the title's own audio streams.
  • VICTORY_AUDIO_CAPTURE (audio/capture.rs): a WAV recording of what the title plays.

With scripts/play.ps1's working directory (the repository root), a relative name landed in the checkout.

Fix: both go through victory_core::ensure_outside_repo first, via a small outside_repo(name, path) helper in audio.rs. A refused path gets one warn! and nothing is written. The XMA dump folder is checked once and kept in a OnceLock. The capture is checked before the recorder process is started. victory-hle now depends on victory-core directly. There's no cycle: victory-core has no workspace dependencies, and it was already built through victory-gpu. Cargo.lock gains the one edge.

Test: sound_is_not_written_into_the_source_tree (diagnostics): a folder inside the crate is refused, and a temp folder is accepted.

Results:

  • cargo test -p victory-hle --locked --features diagnostics: the audio tests pass.
  • cargo clippy -p victory-hle --all-targets --locked --no-deps -- -D warnings is clean, with and without --all-features.

This touches different lines of audio.rs from #248: the helper and the first lines of dump_input, and a test at the top of the module. The two merge independently.

🤖 Generated with Claude Code

**@⁠sharan104** on GitHub · 2026-11-26 14:38 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/294) `sharan104:fix/hle-dumps-outside-repo` → `main` · +32 −2 · 4 files · 1 commits · open The same asset-policy gap as #283, in `victory-hle`. Two diagnostics switches write the title's sound wherever they point, with no check: - `VICTORY_XMA_DUMP` (`audio.rs`, `dump_input`): the context words and input buffers (`.xma`) of the first 32 voices, which are the title's own audio streams. - `VICTORY_AUDIO_CAPTURE` (`audio/capture.rs`): a WAV recording of what the title plays. With `scripts/play.ps1`'s working directory (the repository root), a relative name landed in the checkout. **Fix:** both go through `victory_core::ensure_outside_repo` first, via a small `outside_repo(name, path)` helper in `audio.rs`. A refused path gets one `warn!` and nothing is written. The XMA dump folder is checked once and kept in a `OnceLock`. The capture is checked before the recorder process is started. `victory-hle` now depends on `victory-core` directly. There's no cycle: `victory-core` has no workspace dependencies, and it was already built through `victory-gpu`. `Cargo.lock` gains the one edge. **Test:** `sound_is_not_written_into_the_source_tree` (diagnostics): a folder inside the crate is refused, and a temp folder is accepted. **Results:** - `cargo test -p victory-hle --locked --features diagnostics`: the audio tests pass. - `cargo clippy -p victory-hle --all-targets --locked --no-deps -- -D warnings` is clean, with and without `--all-features`. This touches different lines of `audio.rs` from #248: the helper and the first lines of `dump_input`, and a test at the top of the module. The two merge independently. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
VICTORY_XMA_DUMP writes the title's XMA streams and context words, and
VICTORY_AUDIO_CAPTURE records what the title plays to a WAV file, both
wherever the variable points; with scripts/play.ps1's working directory
(the repository root) a relative name landed in the checkout. Both now go
through victory_core::ensure_outside_repo first (docs/asset-policy.md),
as the GPU crate's writers do: a refused path is said once and nothing is
written. victory-hle depends on victory-core for it (no cycle; it was
already built through victory-gpu).

Test: sound_is_not_written_into_the_source_tree (a folder inside the
crate is refused, a temp folder taken).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:39:59 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/294/head:github-bot/gh-294'
git switch 'github-bot/gh-294'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-294'
git switch 'github-bot/gh-294'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-294'
git switch 'github-bot/gh-294'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-294'
git switch 'main'
git merge --squash 'github-bot/gh-294'
git switch 'main'
git merge --ff-only 'github-bot/gh-294'
git switch 'main'
git merge 'github-bot/gh-294'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.