gameinput: DualShock 4 pads read from HID beside XInput #210

Closed
github-bot wants to merge 1 commit from github-bot/gh-210 into main AGit
Owner

@⁠YOGESH9139 on GitHub · 2026-11-26 11:45 UTC · original
YOGESH9139:pr/dualshock4 → main · +358 −4 · 3 files · 1 commits · closed without merging

Split out of #134, as asked: only the DualShock 4 part.

What it does. DualShock 4 pads (Sony 054C: 05C4, 09CC, 0BA0, 0BA1), and pads that report themselves as one, are read from HID beside XInput, so they work without DS4Windows or Steam Input. Found with a cheap pad that shows up as a DS4 and gave the title no input at all.

  • New crates/victory-hle/src/modules/gameinput/dualshock.rs: SetupDi enumeration of HID devices, one reader thread per pad (blocking ReadFile), a rescan every 2 s for pads plugged in later. USB report 0x01 and Bluetooth report 0x11 are both parsed.
  • Mapping: cross→A, circle→B, square→X, triangle→Y, options→Menu, share/touchpad→View, the hat to the d-pad, sticks scaled with Y inverted, triggers analog.
  • gameinput.rs: a slot's state is XInput merged with the nth DS4, so an XInput pad in the same slot still works.
  • VICTORY_DUALSHOCK=0 turns it off.
  • Cargo.toml: two windows-sys features (Win32_Devices_DeviceAndDriverInstallation, Win32_Devices_HumanInterfaceDevice).

7 unit tests for the report parser. Rebased on 0dec5dc; cargo check and the tests pass. Tested in the title's menus and in the world on Windows 11.

🤖 Generated with Claude Code

**@⁠YOGESH9139** on GitHub · 2026-11-26 11:45 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/210) `YOGESH9139:pr/dualshock4` → `main` · +358 −4 · 3 files · 1 commits · closed without merging Split out of #134, as asked: only the DualShock 4 part. **What it does.** DualShock 4 pads (Sony 054C: 05C4, 09CC, 0BA0, 0BA1), and pads that report themselves as one, are read from HID beside XInput, so they work without DS4Windows or Steam Input. Found with a cheap pad that shows up as a DS4 and gave the title no input at all. - New `crates/victory-hle/src/modules/gameinput/dualshock.rs`: SetupDi enumeration of HID devices, one reader thread per pad (blocking `ReadFile`), a rescan every 2 s for pads plugged in later. USB report `0x01` and Bluetooth report `0x11` are both parsed. - Mapping: cross→A, circle→B, square→X, triangle→Y, options→Menu, share/touchpad→View, the hat to the d-pad, sticks scaled with Y inverted, triggers analog. - `gameinput.rs`: a slot's state is XInput merged with the nth DS4, so an XInput pad in the same slot still works. - `VICTORY_DUALSHOCK=0` turns it off. - `Cargo.toml`: two `windows-sys` features (`Win32_Devices_DeviceAndDriverInstallation`, `Win32_Devices_HumanInterfaceDevice`). 7 unit tests for the report parser. Rebased on 0dec5dc; `cargo check` and the tests pass. Tested in the title's menus and in the world on Windows 11. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DualShock 4 pads, and the many third-party pads that report themselves as one
(Sony's vendor id 0x054C, products 05C4, 09CC, 0BA0, 0BA1), are not XInput
devices: the title saw no pad and only the keyboard's stand-in. A reader thread
per pad does blocking HID reads (USB and short Bluetooth reports from byte 1,
full Bluetooth reports from byte 3) and hands out the latest state in the
console's layout: cross/circle/square/triangle as A/B/X/Y, Options as Menu,
Share and the touchpad's click as View, sticks up positive, triggers 0 to 1.
The n-th pad shares host slot n with the XInput pad there, and the two are
merged. VICTORY_DUALSHOCK=0 turns it off. Report parsing has tests; tested on
a third-party pad that reports as 054C:09CC.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:48:12 +00:00
github-bot closed this pull request 2026-11-26 12:53:18 +00:00
Author
Owner

@⁠YOGESH9139 on GitHub · 2026-11-26 12:51 UTC · original

Closing: I'm stopping this work for now and taking the fork down. Thanks for the reviews.

**@⁠YOGESH9139** on GitHub · 2026-11-26 12:51 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/210#issuecomment-7192556510) Closing: I'm stopping this work for now and taking the fork down. Thanks for the reviews.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.