acphal: ACP message queue and background XMA ring decoding with the Rust XMA2 decoder (RT-ACPHAL-XMA2) #404
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!404
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/404/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?
@Andretuta on GitHub · 2026-11-24 04:44 UTC · original
ubiquitarianism:feat/acphal-xma2-decoder→main· +1518 −120 · 10 files · 10 commits · merged 2026-11-24 13:44 UTCClaimed in the coordination issue as:
RT-ACPHAL-XMA2(#14)Depends on: #357
What and why
acphal.dllstub with an ACP command and message queue and a worker that fills SHAPE XMA PCM rings. The worker follows packet skips and refill order, updates shared fields atomically, and bounds each pass to the ring. Repeated enables preserve queued PCM for the same format and reset it when the format changes.runtime/xma_decoderat configure time through Cargo. The shim outputs silence based on each packet's frame count when Cargo is missing, the build fails, or the directcl.exefallback is used. Windows runtime CI explicitly requires the decoder.std::jthreadstop token. A worker memory failure reports an error for the affected voice. SHAPE allocation publishes a complete table or returnsE_OUTOFMEMORY. Release detaches the worker, then frees the process-wide arrays without writing through the opaque HAL handle.Tested
gta6rtandacphal_testin Debug and Release with Rust. A separate CMake configuration builtacphal_testwith the silence fallback in both build types. CTest passed in all four configurations, with 170 checks per normal run with Rust, 166 with silence, and 14 for the separate non-cached-only case in each configuration.4e9407a40.x86_64-pc-windows-msvcandx86_64-pc-windows-gnullvm, including a first-frame test for the hardware constructor. Locked release builds succeeded on both targets.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a — audio decoder & runtime shim only)🤖 Generated with Claude Code
- Add portable C++20 XMA2 packet parser and WMA Pro frame decoder (runtime/src/xma2_decoder.{h,cpp}, following FFmpeg wmaprodec.c / wmaprodata.h LGPL-2.1-or-later under Leonida's GPL-3.0-or-later) with cross-platform xma2_decoder_test. - Implement IAcpHal command/message queue protocol (REGISTER_MESSAGES, UNREGISTER_MESSAGES, LOAD_FLOWGRAPH, COMMAND_COMPLETED, DISCONNECTED, queue-full dropped counters, and APU notification word writes) in runtime/shims/acphal.cpp. - Wire a lazily-started, cleanly-joined background XMA2 decoder thread pumping enabled SHAPE_XMA_CONTEXT output rings in APU memory.@QemmHD on GitHub · 2026-11-24 14:10 UTC · original
Post-merge check of main
d0da7dadeon Windows 11 / RTX 4070 SUPER (VS 2022, Ninja, RelWithDebInfo, cargo 1.98.0): the XMA2 decoder builds and links, the full build succeeds, and full ctest is 304/306 with the same two pre-existing failures as before (d3d12_execute_indirect_validation, d3d12_depth_resolve). The newacphal_noncached_onlypasses. Without cargo on PATH, configure prints "cargo not found" and skips the decoder, andacphal_teststill passes 166/166.Two supply-chain notes now that CMake builds this by default and CI requires it (
LEONIDA_REQUIRE_XMA2_DECODER=ON, runtime.yml:260):xma, is a git dependency on a personal repo created 2026-11-21 (runtime/xma_decoder/Cargo.toml:13, rev 27122f7). Git sources get no checksum in Cargo.lock, so the commit hash is the only integrity check. If that repo is deleted or force-pushed, every cold build loses the decoder and CI fails. I read the pinned crate: it has no build.rs, no proc-macros, nounsafe, and no network or file access outside its tests, so it's fine today. Vendoring it, withcargo vendoror a fork under this org, would make the build reproducible. CMake runs cargo with--lockedbut not--offline(runtime/CMakeLists.txt:112-145), so a cold configure fetches from GitHub.WS2_32.dllimport (getaddrinfo, connect, sendto, WSASocketW…) plus USERENV and bcryptprimitives, which the no-cargo build doesn't. The title can't reach them through the shim tables, so this isn't a leak, but it contradicts the "gta6rt needs no static ws2_32.lib link dependency" note in thews2_offline.cppheader. That note, or the docs, should mention it.AI-assisted (Claude Code, Claude Opus 5.5).