Audio: keep XMA frames split across rolling inputs #443
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!443
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-443"
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?
@Quat3rnion on GitHub · 2026-11-24 03:28 UTC · original
Quat3rnion:victory-xma-split→main· +257 −6 · 2 files · 2 commits · openWhat
XMA frames can straddle the two rolling input buffers the title gives the APU. The continuation lives in the
first_frame_bitspan of the next packet in the alternate bank.read_frameonly saw one slice, sodecodetreated the bank as spent, switched, and restarted at the alternate bank's first new frame — dropping a valid 512-sample frame and letting the output pump write silence.This adds a bit-level spanning reader in
victory-formatsand uses it before switching banks. The decoded frame is kept and the read position moves to the frame after the continuation in the alternate bank.An AI tool wrote part of this change.
Tested
cargo test --workspace: 166 passed, 0 failed, 3 ignored. Two new hermetic tests — one compares the spanning bit gather against an unsplit frame byte-for-byte, the other drives the CPU output ring with a frame split across two separately allocated banks and asserts the frame is decoded.cargo check --target x86_64-pc-windows-gnu --workspace --testspasses. No Windows host here.cargo xtask policypasses (150 files ok). No game files or data from them were added.Checklist
cargo xtask policypasses. No game files or data from them were added.@DaviTostes on GitHub · 2026-11-24 03:38 UTC · original
Verified
ab68f34on Arch Linux x86_64 (rustc 1.98.1,cargo test -p victory-formats): 21 passed, 0 failed, 3 ignored.Not covered: decoding real title audio streams (no game data) and playback under Wine.
@Quat3rnion on GitHub · 2026-11-24 07:30 UTC · original
Rebased on current main. read_frame_spanning now gathers the head through the packet-aware Cursor, takes exactly the remaining bits from the tail, and requires first_frame_bit to match. Added a regression with a packet header inside the frame. New head f546d65.
@amorcayReal on GitHub · 2026-11-24 20:09 UTC · original
I found a remaining boundary case on head
54f4329932, after the packet-aware Cursor changes.When the first rolling input ends with another stream’s packet, cursor.bit() follows the preceding packet’s skip past the end of the input. The ? then returns None before read_frame_spanning can gather the continuation from the second input.
The attached patch adds a synthetic regression with packets laid out as:
The same frame is read correctly from the unsplit buffer, but the spanning read fails on the current PR head.
The proposed fix breaks out of the head-gathering loop when the cursor reaches the input boundary, allowing the existing continuation-length check to run.
Verification: the regression fails before the fix. Afterward, the standalone XMA suite reports 8 passed, 2 ignored on Windows, Rust 1.98.1.
No game execution or playback improvement was verified. AI-assisted investigation and implementation using Codex/Luna; synthetic data only.
pr443-xma-fix.diff.txt
@Marvisak on GitHub · 2026-11-25 00:30 UTC · original · edited 2026-11-25 01:16 UTC
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-formats/src/xma.rs,crates/victory-hle/src/modules/audio.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.