Input: read PlayStation and generic HID pads XInput does not list #5

Open
github-bot wants to merge 2 commits from github-bot/gh-5 into main AGit
Owner

@⁠delacor on GitHub · 2026-11-30 21:40 UTC · original
delacor:hid-gamepad-pads → main · +1044 −4 · 3 files · 2 commits · open

Only XInput pads reached the title: a DualSense, a DualShock 4 or any other
pad without an XInput driver did nothing unless something like Steam Input
turned it into an XInput pad. Pads XInput does not list are now read over the
HID API and fill the XInput slots it leaves empty:

  • DualShock 4 and DualSense (and Edge), USB and Bluetooth, by their own
    report layouts, with rumble through their output reports;
  • any other HID gamepad or joystick by its usages: X/Y left stick, Z/Rz or
    Rx/Ry right stick, the hat as the D-pad, buttons in the usual DirectInput
    order, VICTORY_PAD_BUTTONS for other orders, VICTORY_PAD_SECONDS for
    the rescan period.

XInput's own HID devices are skipped. An XInput pad keeps its slot; a HID pad
in a slot XInput takes moves to a free one. Host::pad() reads XInput first
and falls back to a HID pad in the same slot; Host::rumble() reaches the HID
pad's output reports. The existing focus gating (VICTORY_PAD_FOCUS) and the
scripted key overlay now cover HID pads too. victory-hle gains the
Win32_Devices_DeviceAndDriverInstallation and Win32_Devices_HumanInterfaceDevice
windows-sys features for the enumeration.

Where it comes from

Ported from the delacor/VIctory fork, commit a9553ae72
("Input: read PlayStation and generic HID pads that XInput does not list", by
marquezini) and the hid module that grew out of it. The source fork checked
it with a DualSense on USB: every button, the triggers and both sticks over
their whole range, and the rumble.

The two trees' gameinput.rs differ around the host pad path (mouse look,
scripted input, focus gating), so only the integration is adapted;
gameinput/hid.rs itself is carried over unchanged.

Verified on this branch

  • cargo check --target x86_64-pc-windows-msvc -p victory-hle --tests clean
    (clang-cl + lld-link + the xwin-splatted SDK, as build.sh sets up).
  • Clippy: no warnings in the touched files.
  • HID unit tests under Wine (cargo test -p victory-hle --lib hid::):
    10 passed, 0 failed, 1 ignored (the one needs a real pad).
    The report layouts, the button map, trigger axes, normalisation, the
    rumble output report and the IEEE CRC are exercised.
  • cargo test -p xtask (asset policy + switch documentation): 9/9 pass.

Not yet run: a live pad check on this tree's full application build. On the
source fork the same module was exercised with a physical DualSense.

**@⁠delacor** on GitHub · 2026-11-30 21:40 UTC · [original](https://github.com/Skrills68/Valhalla-xmem/pull/5) `delacor:hid-gamepad-pads` → `main` · +1044 −4 · 3 files · 2 commits · open Only XInput pads reached the title: a DualSense, a DualShock 4 or any other pad without an XInput driver did nothing unless something like Steam Input turned it into an XInput pad. Pads XInput does not list are now read over the HID API and fill the XInput slots it leaves empty: - DualShock 4 and DualSense (and Edge), USB and Bluetooth, by their own report layouts, with rumble through their output reports; - any other HID gamepad or joystick by its usages: X/Y left stick, Z/Rz or Rx/Ry right stick, the hat as the D-pad, buttons in the usual DirectInput order, `VICTORY_PAD_BUTTONS` for other orders, `VICTORY_PAD_SECONDS` for the rescan period. XInput's own HID devices are skipped. An XInput pad keeps its slot; a HID pad in a slot XInput takes moves to a free one. `Host::pad()` reads XInput first and falls back to a HID pad in the same slot; `Host::rumble()` reaches the HID pad's output reports. The existing focus gating (`VICTORY_PAD_FOCUS`) and the scripted key overlay now cover HID pads too. `victory-hle` gains the `Win32_Devices_DeviceAndDriverInstallation` and `Win32_Devices_HumanInterfaceDevice` windows-sys features for the enumeration. ## Where it comes from Ported from the delacor/VIctory fork, commit `a9553ae72` ("Input: read PlayStation and generic HID pads that XInput does not list", by marquezini) and the `hid` module that grew out of it. The source fork checked it with a DualSense on USB: every button, the triggers and both sticks over their whole range, and the rumble. The two trees' `gameinput.rs` differ around the host pad path (mouse look, scripted input, focus gating), so only the integration is adapted; `gameinput/hid.rs` itself is carried over unchanged. ## Verified on this branch - `cargo check --target x86_64-pc-windows-msvc -p victory-hle --tests` clean (clang-cl + lld-link + the xwin-splatted SDK, as `build.sh` sets up). - Clippy: no warnings in the touched files. - HID unit tests under Wine (`cargo test -p victory-hle --lib hid::`): 10 passed, 0 failed, 1 ignored (the one needs a real pad). The report layouts, the button map, trigger axes, normalisation, the rumble output report and the IEEE CRC are exercised. - `cargo test -p xtask` (asset policy + switch documentation): 9/9 pass. Not yet run: a live pad check on this tree's full application build. On the source fork the same module was exercised with a physical DualSense.
Ported from delacor/VIctory commit a9553ae72 (author marquezini) and its
hid module. Only XInput pads reached the title, so an unrecognized pad
did nothing unless something like Steam Input turned it into an XInput
pad. Pads XInput does not list now fill the XInput slots left empty:

- DualShock 4 and DualSense (and Edge), USB and Bluetooth, by their own
  report layouts, with rumble through their output reports;
- any other HID gamepad or joystick by its usages: X/Y left stick,
  Z/Rz or Rx/Ry right stick, the hat as the D-pad, buttons in the usual
  DirectInput order, VICTORY_PAD_BUTTONS for other orders.

XInput's own HID devices are skipped. An XInput pad keeps its slot; a
HID pad in a slot XInput takes moves to a free one. Host::pad reads
XInput first and falls back to a HID pad in the same slot, Host::rumble
reaches the HID pad's output reports. The focus gating
(VICTORY_PAD_FOCUS) and the scripted key overlay now cover HID pads
too. windows-sys gains the device-and-driver-installation and HID
features for the enumeration.

Checked on the source fork with a DualSense on USB: every button, the
triggers and both sticks over their whole range, and the rumble. Still
needs a build and a pad check on this tree.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 12:38:02 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
The changes on this branch are already on the target branch. This will be an empty commit.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/5/head:github-bot/gh-5'
git switch 'github-bot/gh-5'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-5'
git switch 'github-bot/gh-5'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-5'
git switch 'github-bot/gh-5'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-5'
git switch 'main'
git merge --squash 'github-bot/gh-5'
git switch 'main'
git merge --ff-only 'github-bot/gh-5'
git switch 'main'
git merge 'github-bot/gh-5'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.