Skip to content

GameInput: size PlayStation HID reads for the collection - #2525

Open
loyodea wants to merge 1 commit into
xcl-dev:mainfrom
loyodea:gameinput-ds4-hid-report-length
Open

loyodea wants to merge 1 commit into
xcl-dev:mainfrom
loyodea:gameinput-ds4-hid-report-length

Conversation

@loyodea

@loyodea loyodea commented Nov 25, 2026

Copy link
Copy Markdown

Fixes #2465. XCL used a fixed 128-byte buffer for Windows HID reads. A DualShock 4 Bluetooth HID collection can advertise a 547-byte maximum. Size the read buffer from the collection capabilities and keep the previous fallback when the capability is unavailable.

What is in it

  • playstation.rs queries the existing HID handle, releases the preparsed data, and uses the advertised input report length. A synthetic regression covers Bluetooth, USB, fallback sizing, and parsing.
  • Cargo.toml enables the required bindings in the existing windows-sys dependency. The README describes the input behavior.

Tested

  • Windows 11 Pro build 26300, Ryzen 7 5700X3D, RX 9060 XT driver 32.0.32029.2010, Rust 1.100.0 GNU x64, DXC 1.9.2609.5, debug.
  • cargo +stable-x86_64-pc-windows-gnu test -j 4 -p xcl --lib hle::playstation::tests: 3 passed, 0 failed, 0 ignored. The regression failed before the fix with a 128-byte buffer where it expected 547 bytes.
  • Workspace build passed. cargo +stable-x86_64-pc-windows-gnu test -j 4 --workspace --no-fail-fast -- --test-threads=4: 1,420 passed, 4 failed, 46 ignored. The four GPU failures also appeared on an independent checkout of the same base and earlier clean upstream. Eight SKIPPED notices covered six unsupported per-lane paths, driver-cache measurement without Developer Mode, and the opt-in heap-window path.
  • Verified all three HID imports in the built executable. The synthetic end-to-end title passed.

Regression run

Paired real-title smoke runs are pending. This draft remains blocked on those runs.

Not tested

Physical DualShock 4 Bluetooth, retail titles, MSVC, release, and other GPU vendors.

AI use

OpenAI Codex with GPT-6.2 Sol (extra-high reasoning for the implementation and final checks) updated the code and regression and ran the tests.

Use the Windows HID collection's maximum input report length for ReadFile. A DualShock 4 Bluetooth collection can advertise 547 bytes, while the old fixed buffer holds 128. Add synthetic coverage for Bluetooth, USB and fallback sizes.

Fixes xcl-dev#2465.

Assisted-by: OpenAI Codex (GPT-6.2 Sol)
@loyodea
loyodea marked this pull request as ready for review November 25, 2026 21:36
@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@xpatfussy69x

Copy link
Copy Markdown

Test run on exact head 09dda60 (09dda60869b741c6193277fe7f5d7dc4ab12d428, on its base 6d12f58), clean tree.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (driver 32.0.16.2124, 32-lane waves only), AMD Ryzen 5 7500F, Windows 11, Rust 1.100.0; debug build for the tests, release for the smoke runs
  • cargo test --workspace -- --test-threads=4: 1424 passed, 0 failed, 46 ignored
  • SKIPPED (25): 21 × no wave64; 1 × no heap windows; 3 × per-lane form refused V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32 (on main too)
  • cargo test -p xcl --lib read_buffer_matches_the_hid: 1 passed, 0 failed
  • This PR's new tests in the workspace run:
    • read_buffer_matches_the_hid_collection_input_report_length: ok

Regression run (60 s, default settings, a retail title)

main:

xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 3060
title: c3f791f3
seconds: 60
exit: 0x0
frames shown: 1091 (PresentX 1091)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14814 MB

this PR:

xcl-smoke v1
commit: 09dda60869b741c6193277fe7f5d7dc4ab12d428
gpu: NVIDIA GeForce RTX 3060
title: c3f791f3
seconds: 60
exit: 0x0
frames shown: 1098 (PresentX 1098)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14790 MB

No crash or device removal; frames 101 % of main's, peak commit 100 %.

Not tested

  • No PlayStation controller was connected (the smoke run has no controller input), so the HID read path did not run: a regression check only
  • The PR merged into current main (tested on its own base; it merges into e1d84b7 without conflicts)
  • AMD / native wave64

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and both smoke runs on the machine above and wrote this report.

@SlopTart

Copy link
Copy Markdown

Tested: current PR head merged onto current origin/main (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).

gpu_ suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.
Targeted run of read_buffer_matches_the_hid_collection_input_report_length: passed. GameInput, CPU-side, fine under the Wine lane. Note the test drives the size computation from the HID report descriptor, not a real pad, so it verifies the parsing path rather than device input.

Not tested: retail titles (no title data on this lane, counts only).

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

@throny

throny commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Two contributors checked independently and found that #2546 solves the same problem (for #2465) in a different way: #1607, group D120. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.

This is a hint from the community triage in #1607, not a maintainer decision.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GameInput: DualShock 4 over Bluetooth fails immediately on ReadFile (128-byte buffer < 547-byte HIDP_CAPS.InputReportByteLength)

5 participants