[PR #1999] Honor XMA loop-end subframes across linked packets #2007

Open
opened 2026-11-26 21:19:43 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1999
Author: @lgr123
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: lgr123/runtime-xma-loop-end


📝 Commits (1)

  • 2624c78 runtime: respect XMA loop end subframes (RT-XMA-LOOP-END-SUBFRAME)

📊 Changes

3 files changed (+289 additions, -27 deletions)

View changed files

📝 runtime/shims/acphal.cpp (+162 -17)
📝 runtime/test/acphal_test.cpp (+126 -9)
📝 runtime/xma_decoder/README.md (+1 -1)

📄 Description

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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1999 **Author:** [@lgr123](https://github.com/lgr123) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `lgr123/runtime-xma-loop-end` --- ### 📝 Commits (1) - [`2624c78`](https://github.com/ubiquitarianism/leonida/commit/2624c78e40fa1b54c50381cb32659cc8838a0562) runtime: respect XMA loop end subframes (RT-XMA-LOOP-END-SUBFRAME) ### 📊 Changes **3 files changed** (+289 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/acphal.cpp` (+162 -17) 📝 `runtime/test/acphal_test.cpp` (+126 -9) 📝 `runtime/xma_decoder/README.md` (+1 -1) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2007
No description provided.