Skip to content

runtime/shims: implement xapu.dll and chad.dll audio processor shims - #277

Closed
Andretuta wants to merge 1 commit into
mainfrom
old-pr/10008
Closed

Andretuta wants to merge 1 commit into
mainfrom
old-pr/10008

Conversation

@Andretuta

Copy link
Copy Markdown
Collaborator

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

@Andretuta

Copy link
Copy Markdown
Collaborator Author

Closing carried-over draft: the xapu half merged in #1144 (via #2350) and the chad half is carried over in #2363.

@Andretuta Andretuta closed this Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants