Skip to content

Port upstream #96: the frame after an XMA continuation starts in the next packet that has frames - #34

Merged
DesertGamer merged 1 commit into
DesertGamer:mainfrom
lcg007xd-c:port/upstream-96-xma-continuation
Nov 25, 2026
Merged

DesertGamer merged 1 commit into
DesertGamer:mainfrom
lcg007xd-c:port/upstream-96-xma-continuation

Conversation

@lcg007xd-c

@lcg007xd-c lcg007xd-c commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

This ports Marvisak/VIctory#96 by tedin7. It is cherry-picked with -x, so the commit keeps their authorship.

next_frame in crates/viport-formats/src/xma.rs mishandles a frame that runs through a packet with no frame start (a full continuation) and ends inside another such packet, which then holds only padding. It points the next frame into that padding instead of at the next packet that has frames. The reader then decodes padding, or the stream ends early, so the rest of the sound is dropped.

The fix: when the frame ends in a packet with frames == 0, follow each packet's skip until a packet with frames is reached.

VIPort has the upstream merge of #96 in its history, but the change is not in the tree. It was lost in a later merge.

The only conflict was in the test module. VIPort's spanning-frame tests are kept, and #96's test follows them.

Checked

  • No game data of any kind (files, extracts, screenshots, dumps, saves): see docs/asset-policy.md (the test builds its packets by hand)
  • No binary files or archives
  • No new dependency, build.rs, git hook, .cargo config, CI change or script (or an issue explains why)
  • No download, no started program, no network connection added (or an issue explains why)
  • cargo test --workspace passes (only viport-formats on Linux, see below)
  • cargo clippy --workspace --all-targets --locked -- -D warnings passes (for viport-formats)
  • The code I wrote is formatted with rustfmt; I did not reformat lines I did not change

What I ran

On Linux, Rust 1.98.1:

  • cargo test -p viport-formats --locked: 42 passed, 0 failed, 6 ignored.
  • the_frame_after_continuation_packets_starts_in_the_next_packet_with_frames with next_frame as on main fails with left: Some(32864) (inside the padding of packet 2), right: Some(49184) (the first frame of packet 3).
  • cargo clippy -p viport-formats --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings: clean.

Not run: real XMA streams. They are game data and stay out of the repository.

Overlaps

#24 (upstream #183, XMA frame end) also edits xma.rs: decode and the test module. I merged the two branches locally and they merge cleanly.

🤖 Generated with Claude Code

… frames

A frame that ends in a packet where no frame begins (the tail of a frame that crossed packets, then padding) left the next frame pointing into that padding, which ended the stream early. Now the next frame is found by following each packet's skip to the next packet with frames.

(cherry picked from commit ba42db6)
@DesertGamer
DesertGamer merged commit 67b0df5 into DesertGamer:main Nov 25, 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.

3 participants