startup_stubs/xapu: track handles and retire permissive command completions #1471

Merged
tedin7 merged 3 commits from upstream-pr/1478 into main 2026-11-24 13:14:18 +00:00
tedin7 commented 2026-11-24 12:36:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:36:24Z.


Summary

  • Track active connection handles in src/startup_stubs/xapu.cpp across XApuConnect / XApuDisconnect, returning distinct nonzero handles and refusing null outputs (E_POINTER) and unknown or disconnected handles (E_HANDLE).
  • Under X2W_AUDIO_PERMISSIVE=1, queue one completion entry per XApuEnqueueCommand call so XApuGetResultCount and XApuDequeueResult retire commands cleanly (zeroing the 0x58-byte result buffer without fabricating unmeasured fields, and returning E_FAIL when the queue is empty).
  • Preserve the existing 1 ms mixer timer (timeBeginPeriod(1) / timeEndPeriod(1)) lifecycle on first connect / last disconnect, and keep default non-permissive trapping untouched.
  • Add tests/startup_xapu_queue_check.cpp (startup_xapu_queue in CMakeLists.txt) and update docs/startup-runtime.md.

Verification

AI-assisted; commands listed were executed locally.

  • Linux checks: git diff --check origin/main..HEAD, python3 tests/docs_links_check.py, python3 tests/bidi_controls_check.py
  • Windows Server 2025 (Debug + Release /O2): pending x2w_pipe.py win2025 run on this PR.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6581929313 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1478). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T12:36:24Z. --- ## Summary - Track active connection handles in `src/startup_stubs/xapu.cpp` across `XApuConnect` / `XApuDisconnect`, returning distinct nonzero handles and refusing null outputs (`E_POINTER`) and unknown or disconnected handles (`E_HANDLE`). - Under `X2W_AUDIO_PERMISSIVE=1`, queue one completion entry per `XApuEnqueueCommand` call so `XApuGetResultCount` and `XApuDequeueResult` retire commands cleanly (zeroing the `0x58`-byte result buffer without fabricating unmeasured fields, and returning `E_FAIL` when the queue is empty). - Preserve the existing 1 ms mixer timer (`timeBeginPeriod(1)` / `timeEndPeriod(1)`) lifecycle on first connect / last disconnect, and keep default non-permissive trapping untouched. - Add `tests/startup_xapu_queue_check.cpp` (`startup_xapu_queue` in `CMakeLists.txt`) and update `docs/startup-runtime.md`. ## Verification AI-assisted; commands listed were executed locally. - Linux checks: `git diff --check origin/main..HEAD`, `python3 tests/docs_links_check.py`, `python3 tests/bidi_controls_check.py` - Windows Server 2025 (Debug + Release `/O2`): pending `x2w_pipe.py win2025` run on this PR.
tedin7 commented 2026-11-24 13:00:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:45:11Z.


Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207) at commit bbdd7a1a46613ec2ea4e80ff396e4600f62fe28e:

  • Debug (--preset dev): ctest -R '^(startup_stubs|startup_xapu_queue)$' 2/2 passed.
  • Release /O2 (--preset release): same selection, 2/2 passed.
  • GitHub CI: Linux checks, Windows build and test, gfx1013 fixtures all pass.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7131870873 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1478#issuecomment-7131870873). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T12:45:11Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207) at commit `bbdd7a1a46613ec2ea4e80ff396e4600f62fe28e`: - Debug (`--preset dev`): `ctest -R '^(startup_stubs|startup_xapu_queue)$'` 2/2 passed. - Release `/O2` (`--preset release`): same selection, 2/2 passed. - GitHub CI: Linux checks, Windows build and test, gfx1013 fixtures all pass. AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot commented 2026-11-24 13:00:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T12:45:25Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T12:48:50.828921Z bbdd7a1 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7131876355 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1478#issuecomment-7131876355). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T12:45:25Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"bbdd7a1a46613ec2ea4e80ff396e4600f62fe28e","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T12:48:50.828921Z">2026-11-24T12:48:50.828921Z</relative-time> | `bbdd7a1` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
upstream-sync closed this pull request 2026-11-24 14:02:50 +00:00
R0Y00 commented 2026-11-24 14:03:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T13:10:41Z.


Maintainer update at aa0e90b2 allocates each connection before taking the SRW lock. Allocation failure returns E_OUTOFMEMORY without publishing a handle or changing the mixer timer. The source-built Windows Release startup_xapu_queue check passed, including distinct handles, per-handle retirement and invalid calls. Completion data remains explicitly synthetic.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7132458474 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1478#issuecomment-7132458474). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T13:10:41Z. --- Maintainer update at aa0e90b2 allocates each connection before taking the SRW lock. Allocation failure returns E_OUTOFMEMORY without publishing a handle or changing the mixer timer. The source-built Windows Release startup_xapu_queue check passed, including distinct handles, per-handle retirement and invalid calls. Completion data remains explicitly synthetic.
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!1471
No description provided.