[PR #2363] runtime: chad.dll with the console's DSP layouts, outputs silent (RT-CHAD-DSP-LAYOUTS) #2366

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2363
Author: @nicoco23
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: chad-dsp-layouts


📝 Commits (1)

  • 3fd9cd4 runtime: chad.dll with the console's DSP layouts, outputs silent (RT-CHAD-DSP-LAYOUTS)

📊 Changes

4 files changed (+303 additions, -45 deletions)

View changed files

📝 docs/audio_hal_exe_calls.md (+6 -0)
📝 docs/runtime_imports.md (+4 -3)
📝 runtime/shims/xapu_chad.cpp (+164 -29)
📝 runtime/test/xapu_chad_test.cpp (+129 -13)

📄 Description

Builds on #1144 (merged via #2350): runtime/shims/xapu_chad.cpp, which now serves only chad.dll, replaces its two HYPOTHESIS (zeroed status owned by the connection, *id left at 0) with the console's layouts. No new file.

This takes over the chad half of draft #277, as #1144 took its xapu half; cc @Andretuta.

Source of the layouts

Signatures, structure layouts, limits and error codes come from Marvisak/VIctory, crates/victory-hle/src/modules/dsp.rs at commit ffe310e (GPL-3.0-or-later, compatible with this project's licence). Facts only, no code copied (see docs/related_projects.md); the top of xapu_chad.cpp lists them. They fit the call shapes measured statically in docs/audio_hal_exe_calls.md: the title's 0x80 is the stream limit, XDspActivate's outputs are a 16-byte status block and the stream, and the title's wait reads the last completed ticket (+4) and its result (+0xc).

What changes

  • XDspConnectWithMaximumStreamLimit: bounds on base, base_bytes (0x10000..0x1F400000), ir_seconds (≤0x80), max_streams (≤0x100), max_channels (≤2) → E_INVALIDARG, then null out → E_POINTER.
  • XDspActivate: description rules (kind, frames, channels, options 0x2/0x4/0x8), stream limit → E_OUTOFMEMORY, a per-stream status block starting zeroed with S_OK.
  • XDspSubmitCommand: completes at once; writes frames × channels zero floats to the output and advances submitted/completed with interlocked stores.
  • XDspDeactivate / XDspDisconnect: released or unknown handles refused with E_INVALIDARG (HYPOTHESIS); disconnect releases streams still active.
  • No convolution is computed (impulse-response layout unknown): reverb returns stay dry.
  • Docs: docs/runtime_imports.md and docs/audio_hal_exe_calls.md.

Tested

Windows 11, scripts/build_runtime.ps1 -FetchSdl3 (CMake + Ninja, MSVC; no cargo). No GPU involved.

  • xapu_chad_test: 108 checks, 0 failures (bounds, description rules, status block, tickets, silence, handle lifetime)
  • xapu_test 18/0, chad_test 12/0, unimplemented_policy_test 104/0
  • tests/test_docs_*.py, tests/test_text_write_line_endings.py, scripts/check_no_game_data.py: OK
  • The cl.exe fallback build was not exercised; not run against the retail package.

Item: RT-CHAD-DSP-LAYOUTS
Depends on: #1144 (merged)

AI-assisted (Claude Code).


🔄 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/2363 **Author:** [@nicoco23](https://github.com/nicoco23) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `chad-dsp-layouts` --- ### 📝 Commits (1) - [`3fd9cd4`](https://github.com/ubiquitarianism/leonida/commit/3fd9cd444e3dc16852dcd9cb976f73a4bb6ffa48) runtime: chad.dll with the console's DSP layouts, outputs silent (RT-CHAD-DSP-LAYOUTS) ### 📊 Changes **4 files changed** (+303 additions, -45 deletions) <details> <summary>View changed files</summary> 📝 `docs/audio_hal_exe_calls.md` (+6 -0) 📝 `docs/runtime_imports.md` (+4 -3) 📝 `runtime/shims/xapu_chad.cpp` (+164 -29) 📝 `runtime/test/xapu_chad_test.cpp` (+129 -13) </details> ### 📄 Description Builds on #1144 (merged via #2350): `runtime/shims/xapu_chad.cpp`, which now serves only `chad.dll`, replaces its two HYPOTHESIS (zeroed status owned by the connection, `*id` left at 0) with the console's layouts. No new file. This takes over the chad half of draft #277, as #1144 took its xapu half; cc @Andretuta. ## Source of the layouts Signatures, structure layouts, limits and error codes come from Marvisak/VIctory, `crates/victory-hle/src/modules/dsp.rs` at commit `ffe310e` (GPL-3.0-or-later, compatible with this project's licence). Facts only, no code copied (see `docs/related_projects.md`); the top of `xapu_chad.cpp` lists them. They fit the call shapes measured statically in `docs/audio_hal_exe_calls.md`: the title's `0x80` is the stream limit, `XDspActivate`'s outputs are a 16-byte status block and the stream, and the title's wait reads the last completed ticket (+4) and its result (+0xc). ## What changes - `XDspConnectWithMaximumStreamLimit`: bounds on base, base_bytes (0x10000..0x1F400000), ir_seconds (≤0x80), max_streams (≤0x100), max_channels (≤2) → `E_INVALIDARG`, then null out → `E_POINTER`. - `XDspActivate`: description rules (kind, frames, channels, options 0x2/0x4/0x8), stream limit → `E_OUTOFMEMORY`, a per-stream status block starting zeroed with S_OK. - `XDspSubmitCommand`: completes at once; writes frames × channels zero floats to the output and advances submitted/completed with interlocked stores. - `XDspDeactivate` / `XDspDisconnect`: released or unknown handles refused with `E_INVALIDARG` (HYPOTHESIS); disconnect releases streams still active. - No convolution is computed (impulse-response layout unknown): reverb returns stay dry. - Docs: `docs/runtime_imports.md` and `docs/audio_hal_exe_calls.md`. ## Tested Windows 11, `scripts/build_runtime.ps1 -FetchSdl3` (CMake + Ninja, MSVC; no cargo). No GPU involved. - `xapu_chad_test`: 108 checks, 0 failures (bounds, description rules, status block, tickets, silence, handle lifetime) - `xapu_test` 18/0, `chad_test` 12/0, `unimplemented_policy_test` 104/0 - `tests/test_docs_*.py`, `tests/test_text_write_line_endings.py`, `scripts/check_no_game_data.py`: OK - The cl.exe fallback build was not exercised; not run against the retail package. Item: RT-CHAD-DSP-LAYOUTS Depends on: #1144 (merged) AI-assisted (Claude Code). --- <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#2366
No description provided.