Audio: an XMA write block past the ring's end wraps before the first write #536
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!536
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/536/head"
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?
@AnoHunted on GitHub · 2026-11-24 04:39 UTC · original
AnoHunted:xma-write-block-wrap→main· +172 −2 · 1 files · 2 commits · merged 2026-11-25 00:20 UTCStacked on #248; only the top commit belongs here.
What
In
pump, take the write block (context word 0, bits 27-31) modulo the ring size (word 0, bits 22-26) before the first write of a pass, as #248 does for the read block and asadvance_readdoes.Why
A write block at or past the ring size was used as it was for the first block of a pass: it was written at
output + write * 256, past the end of the ring (possibly into another APU allocation), and only then wrapped with(write + 1) % size.Tested
Windows 11, NVIDIA GeForce RTX 5080, Rust 1.98.1. New test
xma_write_blocks_past_the_ring_end_wrap: a ring of four blocks followed by a guard area filled with a pattern, write block 6 (block 2 of the ring), read block 1, a looping silent stream, one pass. It checks that the guard area is untouched, that blocks 2, 3 and 0 are written and block 1 is left for the title, and that the write block ends at 1 with the ring no longer writable.cargo test -p victory-hle xma_ -- --test-threads=1andcargo test --workspace -- --test-threads=1AMD and other GPUs: not tested (no GPU code is touched).
Not tested
Behaviour against a real title; only the synthetic context above.
No game files were used.
@Exorion1er on GitHub · 2026-11-24 09:33 UTC · original
#248 is fully contained here: the same one-line read-block fix (
write == field(9, 0, 5) % size) and the same test,xma_read_blocks_past_the_ring_end_wrap, with identical code. This PR also adds the write-block wrap and its test. Merging both would give two tests with the same name, so #248 can close if this lands.Checked by reading both diffs against
main. Both merge cleanly. AI-assisted (Claude Code).