startup: report pending results for an empty XApu queue #1960

Merged
avt0m4t48 merged 1 commit from upstream-pr/1967 into main 2026-11-24 22:25:56 +00:00
avt0m4t48 commented 2026-11-24 22:16:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by avt0m4t48 on 2026-11-24T22:16:33Z.


Refs #1887. Return the documented XAPU_E_PENDING_RESULTS (0x8AC81001) when XApuDequeueResult finds no result on a valid connection. The source-built fixture checks that a fresh and a drained queue report that status and preserve a sentinel-filled result buffer. Microsoft XApu error codes

Built the Windows x64 stand-in and startup_xapu_queue_check with LLVM-MinGW Clang 23.1.6 and ran them under Wine 10.0. The original code failed three status checks. The patch passed the queue lifecycle and strict trap control. A mutation that writes the result buffer on empty failed both sentinel checks. Documentation links, bidi controls and git diff --check passed. The native MSVC reproduction is ctest --preset release --no-tests=error -R '^startup_xapu_queue$' -V after building the stand-in and fixture.

Native MSVC CTest and application audio remain unverified. Source-built inputs only. AI-assisted using Codex.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6592504415 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1967). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-24T22:16:33Z. --- Refs #1887. Return the documented `XAPU_E_PENDING_RESULTS` (`0x8AC81001`) when `XApuDequeueResult` finds no result on a valid connection. The source-built fixture checks that a fresh and a drained queue report that status and preserve a sentinel-filled result buffer. [Microsoft XApu error codes](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/errorcodes?view=gdk-2604#xapu) Built the Windows x64 stand-in and `startup_xapu_queue_check` with LLVM-MinGW Clang 23.1.6 and ran them under Wine 10.0. The original code failed three status checks. The patch passed the queue lifecycle and strict trap control. A mutation that writes the result buffer on empty failed both sentinel checks. Documentation links, bidi controls and `git diff --check` passed. The native MSVC reproduction is `ctest --preset release --no-tests=error -R '^startup_xapu_queue$' -V` after building the stand-in and fixture. Native MSVC CTest and application audio remain unverified. Source-built inputs only. AI-assisted using Codex.
upstream-sync closed this pull request 2026-11-24 23:03:19 +00:00
ChazY11 commented 2026-11-24 23:03:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T22:22:22Z.


I ran the item the description lists as unverified: native MSVC

Windows 11 build 26300.9974, MSVC 19.44, dev preset — not clang/Wine:

cmake --build --preset dev --target startup_xapu_queue_check startup_stub_xapu
build exit 0

ctest --preset dev -R '^startup_xapu_queue$' -V
102: x2w-trap xapu.dll!XApuConnect rcx=0xdab40feff8 rdx=0xdab40ff028 r8=0xdab40ff058 r9=0x1 ret=startup_xapu_queue_check.exe+0x1c43 exit=0xe2570300
102: startup_xapu_queue_check: ok
startup_xapu_queue ... Passed

(Note for anyone repeating this: the CTest target is startup_xapu_queue_check, not startup_xapu_queue — the latter is the test
name, and --target startup_xapu_queue fails with unknown target.)

Three mutations, all caught

Each rebuilt into xapu.dll with the timestamp checked, then reverted:

mutation result
empty path returns the old 0x80004005 inline caught
empty path returns hr_ok (success with no result) caught
the result buffer is zeroed on the empty path too (sentinel broken) caught

The third is the one the description says it added a mutation for, and it is the interesting one: a stand-in that returns the right
status but still writes the caller's buffer is how a "no results" path quietly corrupts a caller's structure. The sentinel-filled
buffer catches it.

The status code is the documented one

0x8AC81001 matches the XAPU_E_PENDING_RESULTS row of the GDK error-code table, and the neighbouring XApu codes in this file
(0x8AC81000 area) are consistent with it. Returning E_FAIL for "no results yet" was the wrong class of status: a caller that
retries on PENDING and gives up on E_FAIL would abort a healthy drain.

What remains unverified, and it is the same as before

Nothing about a real title: this is a stand-in exercised by a source-built fixture. The trap control firing on XApuConnect shows
the shim's permissive gate is still in place, which is the right default for a fixture run.

Verdict

Reviewed. The status code is correct to the documentation, the three behaviours are pinned by mutations, and the MSVC/CTest path
the author could not run passes here.

Notes

  • AI-assisted review.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7146148249 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1967#issuecomment-7146148249). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T22:22:22Z. --- ## I ran the item the description lists as unverified: native MSVC Windows 11 build 26300.9974, MSVC 19.44, `dev` preset — not clang/Wine: ```powershell cmake --build --preset dev --target startup_xapu_queue_check startup_stub_xapu build exit 0 ctest --preset dev -R '^startup_xapu_queue$' -V 102: x2w-trap xapu.dll!XApuConnect rcx=0xdab40feff8 rdx=0xdab40ff028 r8=0xdab40ff058 r9=0x1 ret=startup_xapu_queue_check.exe+0x1c43 exit=0xe2570300 102: startup_xapu_queue_check: ok startup_xapu_queue ... Passed ``` (Note for anyone repeating this: the CTest target is `startup_xapu_queue_check`, not `startup_xapu_queue` — the latter is the test name, and `--target startup_xapu_queue` fails with `unknown target`.) ## Three mutations, all caught Each rebuilt into `xapu.dll` with the timestamp checked, then reverted: | mutation | result | |---|---| | empty path returns the old `0x80004005` inline | **caught** | | empty path returns `hr_ok` (success with no result) | **caught** | | the result buffer is zeroed on the empty path too (sentinel broken) | **caught** | The third is the one the description says it added a mutation for, and it is the interesting one: a stand-in that returns the right status but still writes the caller's buffer is how a "no results" path quietly corrupts a caller's structure. The sentinel-filled buffer catches it. ## The status code is the documented one `0x8AC81001` matches the `XAPU_E_PENDING_RESULTS` row of the GDK error-code table, and the neighbouring XApu codes in this file (`0x8AC81000` area) are consistent with it. Returning `E_FAIL` for "no results yet" was the wrong class of status: a caller that retries on `PENDING` and gives up on `E_FAIL` would abort a healthy drain. ## What remains unverified, and it is the same as before Nothing about a real title: this is a stand-in exercised by a source-built fixture. The trap control firing on `XApuConnect` shows the shim's permissive gate is still in place, which is the right default for a fixture run. ## Verdict Reviewed. The status code is correct to the documentation, the three behaviours are pinned by mutations, and the MSVC/CTest path the author could not run passes here. ## Notes - AI-assisted review.
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
R0Y00/Xbox2Windows!1960
No description provided.