gameinput: read PlayStation pads (DualSense, DualShock 4) over HID #94

Closed
github-bot wants to merge 0 commits from github-bot/gh-94 into main AGit
Owner

@⁠don-ous on GitHub · 2026-12-01 11:17 UTC · original
don-ous:dualsense-pad → main · +1223 −2 · 3 files · 23 commits · closed without merging

What

A PS5 DualSense (or a PS4 DualShock 4) does nothing in game today: XInput never lists Sony pads unless a remapper (Steam Input, DS4Windows) is running.

This reads them straight over HID:

  • What gets read: DualShock 4 (both revisions and the wireless adapter), DualSense and DualSense Edge, over USB or Bluetooth.
  • When it is used: the first Sony pad stands in for pad 1 only while XInput has no pad 1, so XInput keeps priority and a remapped pad is never seen twice.
  • Keyboard: the scripted keys still add their buttons, as for an XInput pad.
  • Opt out: VICTORY_DUALSENSE=0 turns it off. It is on by default because it only changes anything for a player whose pad 1 is empty in XInput, that is, someone whose Sony pad did nothing before. If you prefer it opt-in per CONTRIBUTING, I will flip it.

Where it comes from

gameinput/playstation.rs is the HID reader from trustno1-coder/VIctory-NVIDIA (v2026.11.30.02). Its DualShock 4 parsing and rumble reports were in turn ported from VIscosity. Both are GPL-3.0 like this repo, and the file header keeps the credit.

The only changes on this side:

  • the hook in Host::pad (sony_pad());
  • two windows-sys features (Win32_Devices_HumanInterfaceDevice, Win32_Devices_DeviceAndDriverInstallation);
  • an unused import dropped.

Not wired yet

  • Rumble: rumble_report / host::rumble.
  • Several Sony pads at once: slots.

The code is there, kept behind #[allow(dead_code)] so this PR stays small. I can follow up with them if you want them.

Tested

  • In game: a DualSense on an RX 7800 XT + Ryzen 7 5700X3D, on v2026.11.30.7, for several hours of play: menus, walking, driving.
  • Tests: cargo test -p victory-hle playstation gives 14 passed, 1 ignored.
  • Build: the release build has no new warnings.

🤖 Generated with Claude Code

**@⁠don-ous** on GitHub · 2026-12-01 11:17 UTC · [original](https://github.com/eikkapine/justanxboxemulator/pull/94) `don-ous:dualsense-pad` → `main` · +1223 −2 · 3 files · 23 commits · closed without merging ## What A PS5 DualSense (or a PS4 DualShock 4) does nothing in game today: XInput never lists Sony pads unless a remapper (Steam Input, DS4Windows) is running. This reads them straight over HID: - **What gets read:** DualShock 4 (both revisions and the wireless adapter), DualSense and DualSense Edge, over USB or Bluetooth. - **When it is used:** the first Sony pad stands in for **pad 1 only while XInput has no pad 1**, so XInput keeps priority and a remapped pad is never seen twice. - **Keyboard:** the scripted keys still add their buttons, as for an XInput pad. - **Opt out:** `VICTORY_DUALSENSE=0` turns it off. It is on by default because it only changes anything for a player whose pad 1 is empty in XInput, that is, someone whose Sony pad did nothing before. If you prefer it opt-in per CONTRIBUTING, I will flip it. ## Where it comes from `gameinput/playstation.rs` is the HID reader from trustno1-coder/VIctory-NVIDIA (v2026.11.30.02). Its DualShock 4 parsing and rumble reports were in turn ported from VIscosity. Both are GPL-3.0 like this repo, and the file header keeps the credit. The only changes on this side: - the hook in `Host::pad` (`sony_pad()`); - two `windows-sys` features (`Win32_Devices_HumanInterfaceDevice`, `Win32_Devices_DeviceAndDriverInstallation`); - an unused import dropped. ## Not wired yet - **Rumble:** `rumble_report` / `host::rumble`. - **Several Sony pads at once:** `slots`. The code is there, kept behind `#[allow(dead_code)]` so this PR stays small. I can follow up with them if you want them. ## Tested - **In game:** a DualSense on an RX 7800 XT + Ryzen 7 5700X3D, on v2026.11.30.7, for several hours of play: menus, walking, driving. - **Tests:** `cargo test -p victory-hle playstation` gives 14 passed, 1 ignored. - **Build:** the release build has no new warnings. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
XInput lists no Sony pad without a remapper, so a DualSense did nothing.
The first Sony pad now stands in for pad 1 while XInput has none there.
The HID reader is trustno1-coder/VIctory-NVIDIA's (v2026.11.30.02);
VICTORY_DUALSENSE=0 turns it off.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 11:21:24 +00:00
github-bot closed this pull request 2026-12-01 19:52:16 +00:00

Pull request closed

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