[PR #277] runtime/shims: implement xapu.dll and chad.dll audio processor shims #328

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/277
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: old-pr/10008


📝 Commits (1)

  • 067c048 runtime/shims: implement xapu.dll and chad.dll audio processor shims

📊 Changes

5 files changed (+375 additions, -2 deletions)

View changed files

📝 runtime/CMakeLists.txt (+15 -0)
📝 runtime/shims/registry.cpp (+9 -0)
➕ runtime/shims/xapu_chad.cpp (+227 -0)
➕ runtime/test/xapu_chad_test.cpp (+122 -0)
📝 scripts/build_runtime.ps1 (+2 -2)

📄 Description

Carried over from old PR 10008 by piyonchu in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10008, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
This branch conflicts with the current main and needs a rebase.
piyonchu: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Clean-room shims for the remaining Xbox Series audio hardware DLLs: xapu.dll (5 imports) and chad.dll (5 imports), backed by static ABI inspection of all 13 call sites.

What changed

  • Added runtime/shims/xapu_chad.cpp with constant-initialized SRWLOCK session registries (0 _Init_thread_header TLS guards):
    • xapu.dll: XApuConnect, XApuDisconnect, XApuEnqueueCommand, XApuGetResultCount, XApuDequeueResult. Tracks valid queue handles and echoes FIFO 56-byte result packets (opcode, context_index, and output_bytes for decode commands) so callers advance context states and recycle slots cleanly, failing closed (HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS)) when empty and ERROR_INVALID_HANDLE on stale handles.
    • chad.dll: XDspConnectWithMaximumStreamLimit, XDspActivate, XDspDeactivate, XDspDisconnect, XDspSubmitCommand. Validates handle lifetime, max_streams > 0, and non-null command buffers; returns S_OK (0) so stream setup and command submission succeed cleanly.
  • Added xapu.dll and chad.dll ReturnClass::HResult entries to runtime/shims/registry.cpp.
  • Added unit tests runtime/test/xapu_chad_test.cpp and wired xapu_chad_test / xapu_chad.cpp in runtime/CMakeLists.txt and scripts/build_runtime.ps1.

Verification

  • Built xapu_chad_test (cmake --build runtime/build --target xapu_chad_test): 0 warnings.
  • ctest --test-dir runtime/build -R "^xapu_chad$" --output-on-failure: 1/1 passed.
  • dumpbin /symbols on xapu_chad.cpp.obj: 0 _Init_thread_header references.
  • python -m unittest tests/test_ctest_registration.py: 4/4 OK.
  • python scripts/check_no_game_data.py & git diff --check: clean.

Claim: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116975037


🔄 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/277 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `old-pr/10008` --- ### 📝 Commits (1) - [`067c048`](https://github.com/ubiquitarianism/leonida/commit/067c048e7bf90ededa4d4c1111dad4bc87c7eea1) runtime/shims: implement xapu.dll and chad.dll audio processor shims ### 📊 Changes **5 files changed** (+375 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `runtime/CMakeLists.txt` (+15 -0) 📝 `runtime/shims/registry.cpp` (+9 -0) ➕ `runtime/shims/xapu_chad.cpp` (+227 -0) ➕ `runtime/test/xapu_chad_test.cpp` (+122 -0) 📝 `scripts/build_runtime.ps1` (+2 -2) </details> ### 📄 Description > Carried over from **old PR 10008** by `piyonchu` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10008`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > This branch conflicts with the current `main` and needs a rebase. > `piyonchu`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Clean-room shims for the remaining Xbox Series audio hardware DLLs: `xapu.dll` (5 imports) and `chad.dll` (5 imports), backed by static ABI inspection of all 13 call sites. ### What changed - Added [`runtime/shims/xapu_chad.cpp`](runtime/shims/xapu_chad.cpp) with constant-initialized `SRWLOCK` session registries (`0` `_Init_thread_header` TLS guards): - `xapu.dll`: `XApuConnect`, `XApuDisconnect`, `XApuEnqueueCommand`, `XApuGetResultCount`, `XApuDequeueResult`. Tracks valid queue handles and echoes FIFO 56-byte result packets (`opcode`, `context_index`, and `output_bytes` for decode commands) so callers advance context states and recycle slots cleanly, failing closed (`HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS)`) when empty and `ERROR_INVALID_HANDLE` on stale handles. - `chad.dll`: `XDspConnectWithMaximumStreamLimit`, `XDspActivate`, `XDspDeactivate`, `XDspDisconnect`, `XDspSubmitCommand`. Validates handle lifetime, `max_streams > 0`, and non-null command buffers; returns `S_OK` (`0`) so stream setup and command submission succeed cleanly. - Added `xapu.dll` and `chad.dll` `ReturnClass::HResult` entries to [`runtime/shims/registry.cpp`](runtime/shims/registry.cpp). - Added unit tests [`runtime/test/xapu_chad_test.cpp`](runtime/test/xapu_chad_test.cpp) and wired `xapu_chad_test` / `xapu_chad.cpp` in [`runtime/CMakeLists.txt`](runtime/CMakeLists.txt) and [`scripts/build_runtime.ps1`](scripts/build_runtime.ps1). ### Verification - Built `xapu_chad_test` (`cmake --build runtime/build --target xapu_chad_test`): 0 warnings. - `ctest --test-dir runtime/build -R "^xapu_chad$" --output-on-failure`: `1/1` passed. - `dumpbin /symbols` on `xapu_chad.cpp.obj`: `0` `_Init_thread_header` references. - `python -m unittest tests/test_ctest_registration.py`: `4/4` OK. - `python scripts/check_no_game_data.py` & `git diff --check`: clean. Claim: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116975037 --- <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#328
No description provided.