Honor XMA loop-end subframes across linked packets #1999

Merged
leonida/mandy
lgr123 merged 1 commit from lgr123/runtime-xma-loop-end into main 2026-11-28 09:49:39 +00:00

Pull request successfully merged and closed

lgr123 commented 2026-11-25 17:54:58 +00:00

Claimed as RT-XMA-LOOP-END-SUBFRAME.

A generated two-packet mono loop wrote 12 decoded blocks for every end subframe. Selectable end subframes should produce 9, 10, 11 and 12 blocks. At subframe 0 the extra 384 samples extend a repeat by 8 ms at 48 kHz. A separate loop-end frame split across linked packets wrote 8 blocks instead of 10 with the pinned decoder.

Respect the frame bit offsets and 128-sample end boundary on repeating passes. Account for frame PCM returned by a following linked packet and rewind to the selected frame. Keep the normal end-of-loop pass and packet-based fallback. A decoder rejection while checking a continuation still resets the codec before the rewind.

Reviewer check

Build and run the Windows CMake target acphal_test with the pinned Rust XMA decoder. All input is generated by the test. It exercises subframes 0–3, multiple frames per packet, linked continuations including a split prefix, two input buffers, decoder rejection and PCM order.

Tested

  • Native Windows x64 MSVC, exact pinned Rust decoder. Same test against parent shim: 9 failures in 203 checks. Patched: 203 of 203 pass.
  • Native CPU fallback: 193 of 193 pass.
  • No game files. The tests check decoded PCM and timing, with no in-title listen test.
  • Source-only check and git diff --check passed on public main b9320a1.

GPUs tested: n/a.

AI-assisted: yes.

Checklist

  • Based on public main.
  • One topic.
  • No game data, keys or protection workarounds.
Claimed as [RT-XMA-LOOP-END-SUBFRAME](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7169629800). A generated two-packet mono loop wrote 12 decoded blocks for every end subframe. Selectable end subframes should produce 9, 10, 11 and 12 blocks. At subframe 0 the extra 384 samples extend a repeat by 8 ms at 48 kHz. A separate loop-end frame split across linked packets wrote 8 blocks instead of 10 with the pinned decoder. Respect the frame bit offsets and 128-sample end boundary on repeating passes. Account for frame PCM returned by a following linked packet and rewind to the selected frame. Keep the normal end-of-loop pass and packet-based fallback. A decoder rejection while checking a continuation still resets the codec before the rewind. ### Reviewer check Build and run the Windows CMake target `acphal_test` with the pinned Rust XMA decoder. All input is generated by the test. It exercises subframes 0–3, multiple frames per packet, linked continuations including a split prefix, two input buffers, decoder rejection and PCM order. ### Tested - Native Windows x64 MSVC, exact pinned Rust decoder. Same test against parent shim: 9 failures in 203 checks. Patched: 203 of 203 pass. - Native CPU fallback: 193 of 193 pass. - No game files. The tests check decoded PCM and timing, with no in-title listen test. - Source-only check and `git diff --check` passed on public main `b9320a1`. GPUs tested: n/a. AI-assisted: yes. ### Checklist - [x] Based on public main. - [x] One topic. - [x] No game data, keys or protection workarounds.
MoonEyes commented 2026-11-28 09:49:34 +00:00

Red/green: the PR's test fails on main and passes with this PR (checked by OreoFR).
Runtime batch of 20 PRs tested by OreoFR (full build, ctest without the game, Python suite, translator): same results as main 09c153948, RTX 4070 Laptop / Windows 11.
AI-assisted (Claude Code, Claude Opus 5.5)

Red/green: the PR's test fails on main and passes with this PR (checked by OreoFR). Runtime batch of 20 PRs tested by OreoFR (full build, ctest without the game, Python suite, translator): same results as main 09c153948, RTX 4070 Laptop / Windows 11. AI-assisted (Claude Code, Claude Opus 5.5)
OreoFR commented 2026-11-28 21:57:41 +00:00

Verified by OreoFR

  • Base: main 09c153948 + PR head 2624c78e4; integration package 1 of 6 (20 PRs, merged without conflict)
  • Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; full Python suite; translator suite
  • Red on main: n/a (integration test; main baseline: xbox_present and d3d12_set_descriptor_heaps)
  • Green with the PR: ctest: only xbox_present and d3d12_set_descriptor_heaps fail, as on main; Python: the same 7 failing files as main, the PRs' 11 test files pass; translator: 0 failures
  • Verdict: CLEAN PACKAGE (no new failure vs main)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

**Verified by OreoFR** - Base: main `09c153948` + PR head `2624c78e4`; integration package 1 of 6 (20 PRs, merged without conflict) - Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; full Python suite; translator suite - Red on main: n/a (integration test; main baseline: xbox_present and d3d12_set_descriptor_heaps) - Green with the PR: ctest: only xbox_present and d3d12_set_descriptor_heaps fail, as on main; Python: the same 7 failing files as main, the PRs' 11 test files pass; translator: 0 failures - Verdict: CLEAN PACKAGE (no new failure vs main) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No description provided.