Repository navigation
xapu: decode Opus packets through a Rust sidecar (RT-XAPU-OPUS-DECODE) - #2044
Conversation
…o silent xapu.dll moves out of xapu_chad.cpp into xapu.cpp; chad.dll is unchanged. The signatures, structure layouts, command kinds, option bits and error codes come from Marvisak/VIctory (GPL-3.0-or-later, crates/victory-hle/src/modules/apu.rs at ffe310e), which runs the retail executable through these calls. Only facts are used, no code (docs/related_projects.md). They settle what the old header left open: XApuConnect's first argument is an input (processing kind, streams, commands per stream, memory bytes, frames per output, options), and the dword the title reads at +0x34 of a result is its output byte count. - XApuConnect validates the input, allocates the memory the title asks for (zeroed) and, with option 0x8, an auto-reset result event; any processing kind but Opus decoding is E_NOTIMPL. - Each accepted command gives one result in command order, with the console's error codes; an unknown kind, a stream out of range or a full stream is refused with no result. - A process result carries the frame count of the Opus packet's TOC byte (RFC 6716, section 3.1), clipped from first_frame, to frame_count and to the output, and zeros in the output. Nothing is decoded. - xapu_chad_test covers result order, the full queue, the error codes, frame counts, silence and the event. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o xapu-connect-layouts
…ida#1144) The fallback file list in build_runtime.ps1 must match the gta6rt sources CMake has; xapu.cpp was missing, so test_build_runtime_fallback failed and a build without CMake would have had no xapu.dll shim. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o xapu-connect-layouts main added its own runtime/shims/xapu.cpp: the boot stack's earlier xapu.dll stub, which gta6rt does not link and xapu_test checks. This branch's xapu.dll command queue moves to runtime/shims/xapu_queue.cpp so both stay: gta6rt, xapu_chad_test, the cl.exe fallback list in scripts/build_runtime.ps1 and the references in xapu_chad.cpp, xapu_chad_test.cpp and docs/audio_hal_exe_calls.md name the new file; main's xapu.cpp and xapu_test are unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GnGkjYHUWx92TkwvwCnAMe
|
CI shows |
|
Overlap found after opening: #1144 ( Plan: rebase this onto #1144 and keep only the Opus decode — Holding the current head until that is settled. No game data. |
…DECODE) Builds on ProjectLeonida#1144 (RT-XAPU-CONNECT-LAYOUTS): the queue and layouts stay there; fill() decodes each process packet through a Rust C-ABI crate over BSD-3 opus-pure when cargo builds it, and keeps the table-of-contents silence path otherwise. Adds xapu_opus_test (a generated 440 Hz stereo packet decoded to 960 frames) and the CMake wiring; xapu_chad_test keeps covering the layouts and the silent path. No game data.
4c8bc66 to
4cfbdfc
Compare
|
Rebased onto #1144 and force-pushed (
CTest: |
|
Thank you, @BubsMcgee. This went into AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2) |
Claimed as RT-XAPU-OPUS-DECODE (#1608 (comment)).
Depends on: #1144 (RT-XAPU-CONNECT-LAYOUTS). The branch is stacked on #1144 and also merges
main(b9320a118): the #1144 head predates a slot-133kernel_writesfix and crashed early in a retail boot without it. When #1144 lands, this reduces to the decoder alone.What and why
#1144 keeps the xapu command queue and layouts and leaves
fill_silence()for a decoder; this wires one in:runtime/opus_decoder: a Rust C-ABI crate over BSD-3-Clauseopus-pure, built by cargo likeruntime/xma_decoder(-DLEONIDA_REQUIRE_OPUS_DECODER=ONrequires it;-DLEONIDA_OPUS_DECODER_LIB=<path>links a prebuilt one).xapu_queue.cpp::fill()decodes each process packet into f32 PCM, honouringfirst_frame,frame_count,output_bytesand the deinterleaved option; without cargo it keeps the table-of-contents frame count and silence.The layouts stay #1144's (credited to Marvisak/VIctory
apu.rs, GPL-3.0-or-later); no VIctory source is copied, and the new files use leonida names.Tested
xapu_opus(new): 29/29. A generated 440 Hz stereo packet decodes to 960 frames / 0x1E00 bytes with energy;first_frame/frame_count/output_bytesclipping; empty, null and stray-stream errors; deactivate and reactivate.xapu_chad(runtime: xapu.dll as a command queue with the console's layouts (RT-XAPU-CONNECT-LAYOUTS) #1144's): passes unchanged (layouts + silent path).acphal,acphal_noncached_only,xapu_chad,xapu_opus,xapu: 5/5 CTest.d, 1905 presents, 32/32 non-black, no faults. The runtime logsxapu: connected for Opus decoding, 256 streams; packets decoded. RTX 3080 Ti, NVIDIA 616.64, Windows 11.Notes
mainmerge is only for the slot-133 fix; it can be dropped on rebase after runtime: xapu.dll as a command queue with the console's layouts (RT-XAPU-CONNECT-LAYOUTS) #1144 lands.xapu.cppis the legacy test-only shim; the runtime serves xapu fromxapu_queue.cpp(runtime: xapu.dll as a command queue with the console's layouts (RT-XAPU-CONNECT-LAYOUTS) #1144) and chad fromxapu_chad.cpp.AI-assisted.