GameInput: a DualShock 4 or DualSense is the gamepad without XInput #552

Manually merged
github merged 1 commit from gh-pr/552/head into gh-pr/552/base 2026-11-26 04:25:29 +00:00
Owner

@⁠CIS-C0 on GitHub · 2026-11-24 01:42 UTC · original
CIS-C0:gameinput-playstation-pads → main · +220 −3 · 4 files · 1 commits · merged 2026-11-25 01:07 UTC

A player with a PlayStation controller has no gamepad in XCL: GameInput reads XInput only, and Windows gives a DualShock 4 or DualSense to XInput only through extra software (Steam Input, DS4Windows). This reads them as HID devices and uses one when no XInput controller answers.

I searched open and closed issues and PRs for "dualsense", "dualshock", "playstation controller", "PS4 controller", "PS5 controller" and "controller" first: nothing covers it.

What is in it

  • crates/xcl/src/hle/playstation.rs: a thread finds the first HID interface of a Sony controller (vendor 054C: DualShock 4 05C4 / 09CC / USB adaptor 0BA0, DualSense 0CE6, DualSense Edge 0DF2; CM_Get_Device_Interface_ListW, no new crate features), reads its input report 0x01 and keeps the latest state; it looks again every second while none is connected or after one is unplugged. Cross / Circle / Square / Triangle are A / B / X / Y, Options Menu, Share / Create View, L1 / R1 the shoulders, L3 / R3 the stick clicks, the hat the D-pad, L2 / R2 the triggers. A DualShock 4 over Bluetooth sends the same first bytes as over USB; a DualSense over Bluetooth is left out (its reports are laid out differently). No rumble or light bar. XCL_PLAYSTATION_PAD=0 turns it off. One line when one is read, one when it is unplugged.
  • crates/xcl/src/hle/gameinput.rs: poll uses it when xinput_pad has no controller (xinput_pad().or_else(playstation::pad)), so a controller that is also on XInput (Steam Input) is read once, as before.
  • README.md: the Input row and Controls.
  • Unit tests playstation_reports_read_as_a_gamepad (idle and pressed reports of both layouts give the same states; other report ids and short reports are not read) and playstation_controllers_are_known_by_their_hid_path (USB and Bluetooth paths, upper case, a DualSense over Bluetooth and an Xbox controller left out).

Tested

  • Intel Core i5-11400F, NVIDIA GeForce RTX 2060 (driver 610.88), Windows 11 Enterprise build 28000, Rust 1.100.0 (msvc), DXC 1.9.2609.
  • cargo build --workspace then cargo test --workspace -- --test-threads=4 on 0db1c5a (debug): 682 passed, 0 failed, 41 ignored (lib 642 / 0 / 21).
  • SKIPPED on this adapter: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64).
  • A wired DualShock 4 (054C:05C4), not on XInput here, with the retail title: the log shows GameInput: a DualShock 4 is read as the title's gamepad when no XInput controller answers, and every one of the 14 GameInput buttons (0x1 … 0x2000) arrived in the title as it was pressed (gamepad buttons … pressed for the first time), and the title went on from its first screen. Idle, the sticks read 0 / -0.03 / -0.02 / 0.

Regression run

Standard run, no input, main and this PR's head one after the other:

main:

xcl-smoke v1
commit: 508a0c74d7c0625d6d2de8d24494e69dc2e1926f
gpu: NVIDIA GeForce RTX 2060
title: 9cc6a39e
seconds: 90
exit: 0x0
frames shown: 1173 (PresentX 1174)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14505 MB

this PR's head:

xcl-smoke v1
commit: 0db1c5a1e0573655de694698d2e14f1849e7ae16
gpu: NVIDIA GeForce RTX 2060
title: 9cc6a39e
seconds: 90
exit: 0x0
frames shown: 1020 (PresentX 1021)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 14512 MB

Not tested

  • A DualSense (no hardware here): only the unit test of its USB report layout.
  • A DualShock 4 over Bluetooth, the second DualShock 4 model (09CC) and the USB adaptor.
  • Trigger and stick values in the title beyond the idle reading and the buttons: the log notes only the first press of each button.
  • A PlayStation controller that is also on XInput through Steam Input or DS4Windows (XInput should win, as before).
  • The two runs differ in how long the title takes to compile its shaders at start (it shows nothing for 10 – 25 s, varying from run to run on main too: 2025 and 1173 frames in two runs of main): 1020 frames on the PR against 1173 on main, both at 60 presents per 2 s from then on.
  • AMD GPUs; any other title.

AI use

  • Claude Code with Claude Opus 5.5: wrote the change, the tests and this description, and ran the commands above on my machine.
**@⁠CIS-C0** on GitHub · 2026-11-24 01:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/552) `CIS-C0:gameinput-playstation-pads` → `main` · +220 −3 · 4 files · 1 commits · merged 2026-11-25 01:07 UTC A player with a PlayStation controller has no gamepad in XCL: GameInput reads XInput only, and Windows gives a DualShock 4 or DualSense to XInput only through extra software (Steam Input, DS4Windows). This reads them as HID devices and uses one when no XInput controller answers. I searched open and closed issues and PRs for "dualsense", "dualshock", "playstation controller", "PS4 controller", "PS5 controller" and "controller" first: nothing covers it. **What is in it** - `crates/xcl/src/hle/playstation.rs`: a thread finds the first HID interface of a Sony controller (vendor 054C: DualShock 4 05C4 / 09CC / USB adaptor 0BA0, DualSense 0CE6, DualSense Edge 0DF2; `CM_Get_Device_Interface_ListW`, no new crate features), reads its input report 0x01 and keeps the latest state; it looks again every second while none is connected or after one is unplugged. Cross / Circle / Square / Triangle are A / B / X / Y, Options Menu, Share / Create View, L1 / R1 the shoulders, L3 / R3 the stick clicks, the hat the D-pad, L2 / R2 the triggers. A DualShock 4 over Bluetooth sends the same first bytes as over USB; a DualSense over Bluetooth is left out (its reports are laid out differently). No rumble or light bar. `XCL_PLAYSTATION_PAD=0` turns it off. One line when one is read, one when it is unplugged. - `crates/xcl/src/hle/gameinput.rs`: `poll` uses it when `xinput_pad` has no controller (`xinput_pad().or_else(playstation::pad)`), so a controller that is also on XInput (Steam Input) is read once, as before. - `README.md`: the Input row and Controls. - Unit tests `playstation_reports_read_as_a_gamepad` (idle and pressed reports of both layouts give the same states; other report ids and short reports are not read) and `playstation_controllers_are_known_by_their_hid_path` (USB and Bluetooth paths, upper case, a DualSense over Bluetooth and an Xbox controller left out). **Tested** - Intel Core i5-11400F, NVIDIA GeForce RTX 2060 (driver 610.88), Windows 11 Enterprise build 28000, Rust 1.100.0 (msvc), DXC 1.9.2609. - `cargo build --workspace` then `cargo test --workspace -- --test-threads=4` on `0db1c5a` (debug): 682 passed, 0 failed, 41 ignored (lib 642 / 0 / 21). - SKIPPED on this adapter: `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware` (no wave64). - A wired DualShock 4 (054C:05C4), not on XInput here, with the retail title: the log shows `GameInput: a DualShock 4 is read as the title's gamepad when no XInput controller answers`, and every one of the 14 GameInput buttons (0x1 … 0x2000) arrived in the title as it was pressed (`gamepad buttons … pressed for the first time`), and the title went on from its first screen. Idle, the sticks read 0 / -0.03 / -0.02 / 0. **Regression run** Standard run, no input, main and this PR's head one after the other: main: ``` xcl-smoke v1 commit: 508a0c74d7c0625d6d2de8d24494e69dc2e1926f gpu: NVIDIA GeForce RTX 2060 title: 9cc6a39e seconds: 90 exit: 0x0 frames shown: 1173 (PresentX 1174) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14505 MB ``` this PR's head: ``` xcl-smoke v1 commit: 0db1c5a1e0573655de694698d2e14f1849e7ae16 gpu: NVIDIA GeForce RTX 2060 title: 9cc6a39e seconds: 90 exit: 0x0 frames shown: 1020 (PresentX 1021) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 14512 MB ``` **Not tested** - A DualSense (no hardware here): only the unit test of its USB report layout. - A DualShock 4 over Bluetooth, the second DualShock 4 model (09CC) and the USB adaptor. - Trigger and stick values in the title beyond the idle reading and the buttons: the log notes only the first press of each button. - A PlayStation controller that is also on XInput through Steam Input or DS4Windows (XInput should win, as before). - The two runs differ in how long the title takes to compile its shaders at start (it shows nothing for 10 – 25 s, varying from run to run on main too: 2025 and 1173 frames in two runs of main): 1020 frames on the PR against 1173 on main, both at 60 presents per 2 s from then on. - AMD GPUs; any other title. **AI use** - Claude Code with Claude Opus 5.5: wrote the change, the tests and this description, and ran the commands above on my machine.
Windows gives PlayStation controllers to XInput only through extra
software (Steam Input, DS4Windows), so a player with one had no gamepad.
They are now read as HID devices (input report 0x01) on a thread of
their own, and used when no XInput controller answers: buttons, sticks
and triggers; no rumble or light bar. DualShock 4 over USB or Bluetooth
(the same first bytes), DualSense over USB. XCL_PLAYSTATION_PAD=0 turns
it off.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:25:28 +00:00
github manually merged commit 0db1c5a1e0 into gh-pr/552/base 2026-11-26 04:25:29 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 03:47 UTC · original

Tested exact head 0db1c5a (on its base 508a0c7).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 682 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.

Not tested

  • A DualShock 4 / DualSense (none connected here), a retail title or scripts/smoke.ps1 (no title on this machine), AMD, a release build.

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-24 03:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/552#issuecomment-7121431690) Tested exact head `0db1c5a` (on its base `508a0c7`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **682 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. **Not tested** - A DualShock 4 / DualSense (none connected here), a retail title or `scripts/smoke.ps1` (no title on this machine), AMD, a release build. **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠MesshM on GitHub · 2026-11-24 04:21 UTC · original

Test run of 0db1c5a1e0573655de694698d2e14f1849e7ae16 on AMD RDNA4. I merged it onto current main f4ce27c locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 703 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 662 passed, 0 failed, 21 ignored
  • 0 SKIPPED; playstation_controllers_are_known_by_their_hid_path and playstation_reports_read_as_a_gamepad pass (no Sony controller attached here, so the reader itself did not run).

Review: The reader only takes a Sony HID interface (VID 054C, USB or Bluetooth path) and only when no XInput controller answers, so an Xbox controller keeps priority; Bluetooth DualSense reports are left out on purpose. I found nothing to change.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

**@⁠MesshM** on GitHub · 2026-11-24 04:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/552#issuecomment-7121942626) Test run of `0db1c5a1e0573655de694698d2e14f1849e7ae16` on AMD RDNA4. I merged it onto current `main` `f4ce27c` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **703 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 662 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; `playstation_controllers_are_known_by_their_hid_path` and `playstation_reports_read_as_a_gamepad` pass (no Sony controller attached here, so the reader itself did not run). **Review:** The reader only takes a Sony HID interface (VID 054C, USB or Bluetooth path) and only when no XInput controller answers, so an Xbox controller keeps priority; Bluetooth DualSense reports are left out on purpose. I found nothing to change. **Not tested:** no retail title or regression run (I have no unpacked game), no `XCL_SAMPLE_*` tests, release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
This discussion has been locked. Commenting is limited to contributors.
No description provided.