Repository navigation
Conversation
…CHAD-DSP-LAYOUTS) The chad.dll shim in xapu_chad.cpp handed out zeroed status memory owned by the connection and left the command id at the title's 0, both marked HYPOTHESIS. The signatures, structure layouts, limits and error codes now come from Marvisak/VIctory (GPL-3.0-or-later, crates/victory-hle/src/modules/dsp.rs at ffe310e), which runs the retail executable through these calls. Only facts are used, no code (docs/related_projects.md). They fit the call shapes measured here: 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 at +4 and its result at +0xc. - XDspConnectWithMaximumStreamLimit checks base, base_bytes, ir_seconds, max_streams and max_channels (E_INVALIDARG), then the out pointer (E_POINTER). - XDspActivate validates the stream description (kind, frames, channels, options), enforces the stream limit (E_OUTOFMEMORY) and hands out a per-stream status block. - XDspSubmitCommand completes at once: it writes frames * channels zero floats to the output and advances the ticket with interlocked stores. - Released or unknown handles are refused with E_INVALIDARG (HYPOTHESIS); XDspDisconnect releases streams still active. No convolution is computed: the impulse response layout is not known, so reverb returns stay dry. xapu_chad_test covers the bounds, the description rules, the status block, tickets, silence and handle lifetime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lixonik
reviewed
Nov 26, 2026
lixonik
left a comment
Contributor
There was a problem hiding this comment.
Windows 11/MSVC: xapu_chad passed all 108 synthetic checks. The suite covers connection and stream boundaries, independent status blocks, silent output and ticket completion, and release/disconnect behavior. Title boot was outside this run.
AI-assisted.
OreoFR
reviewed
Nov 26, 2026
OreoFR
left a comment
Contributor
There was a problem hiding this comment.
Read through on main d1dff7949 (static review, no build, no retail run). The code is clean: live handles tracked and refused once released, interlocked stores on the status block, no throwing new, and 108 checks in xapu_chad_test. Two points before merge:
- New refusals on values the title was never measured passing. Before,
XDspConnectWithMaximumStreamLimitaccepted anything. It now returnsE_INVALIDARGforbase_bytesoutside 0x10000..0x1F400000,ir_secondsabove 0x80 ormax_channelsabove 2.XDspActivatelikewise applies VIctory's description rules. Only the fourth argument (0x80) is measured at the call site (docs/audio_hal_exe_calls.md); the old test passed0, 0for the two before it. If the retail call is outside these bounds, the title takes its failure path for the DSP, which nobody has run yet (the same doc calls that path unmeasured). Suggestion: havenote()record all the arguments (today it only recordsmax_streams), and do one--tracerun with the retail executable before the bounds are enforced. Or log-and-accept until then. XDspSubmitCommand's third argument. The table indocs/audio_hal_exe_calls.mdreads "two arguments, both taken from registers", but the shim now writes*ticketthrough a third one. The shim's own header speaks of an*idthe title zeroes, so it is probably there. If the call site only sets two registers, though, that store goes through whatever is inr8. Could you confirm from the call site and align the doc row?
The rest (completion at once, silent output of frames × channels floats, handle lifetimes) reads right to me. AI-assisted (Claude Code, Claude Opus 5.5).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on #1144 (merged via #2350):
runtime/shims/xapu_chad.cpp, which now serves onlychad.dll, replaces its two HYPOTHESIS (zeroed status owned by the connection,*idleft 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.rsat commitffe310e(GPL-3.0-or-later, compatible with this project's licence). Facts only, no code copied (seedocs/related_projects.md); the top ofxapu_chad.cpplists them. They fit the call shapes measured statically indocs/audio_hal_exe_calls.md: the title's0x80is 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 withE_INVALIDARG(HYPOTHESIS); disconnect releases streams still active.docs/runtime_imports.mdanddocs/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_test18/0,chad_test12/0,unimplemented_policy_test104/0tests/test_docs_*.py,tests/test_text_write_line_endings.py,scripts/check_no_game_data.py: OKItem: RT-CHAD-DSP-LAYOUTS
Depends on: #1144 (merged)
AI-assisted (Claude Code).