gameinput: support PS5 controllers (DualSense, DualSense Edge) without a remapper #42

Open
pawcijo wants to merge 1 commit from upstream-pr/42 into main
pawcijo commented 2026-11-26 18:03:12 +00:00 (Migrated from git.gtahub.st)

Imported from TaynanGT/Vice-Tay-v2. Originally posted by pawcijo on 2026-11-26T18:03:12Z.


@⁠pawcijo on GitHub · 2026-11-26 17:58 UTC · original
pawcijo:feat/dualsense-input → main · +443 −22 · 4 files · 1 commits · open

Summary

PS5 controllers are not XInput devices, so unless Steam Input or DS4Windows remaps them, the title never sees them. This PR reads them directly over HID, on both USB and Bluetooth.

  • New crates/victory-hle/src/modules/gameinput/dualsense.rs:
    • A scan thread looks for Sony DualSense (054C:0CE6) and DualSense Edge (054C:0DF2) every 2 s.
    • Each controller gets a reader thread that keeps its latest state. The controller is dropped when a read fails (disconnect).
    • On Bluetooth, the reader requests feature report 0x05 to switch the controller to full 0x31 reports, as Linux hid-playstation does. The short 0x01 Bluetooth report is parsed too.
  • In gameinput.rs, PS5 controllers fill the host slots XInput leaves empty, so the one-pad merge, connect/disconnect callbacks and the scripted keys work as before.
  • Set VICTORY_DUALSENSE=0 to turn this off when a remapper already presents the controller as an Xbox pad. Otherwise, with VICTORY_ONE_PAD=0, it would appear twice. With the default single merged pad, the duplicate does no harm.
  • Adds the Win32_Devices_DeviceAndDriverInstallation and Win32_Devices_HumanInterfaceDevice features to windows-sys.
  • The README documents the support and the button mapping.

Button mapping

PS5 Console pad
Cross / Circle / Square / Triangle A / B / X / Y
Options Menu
Create, touchpad click View
L1 / R1, L2 / R2, L3 / R3 shoulders, triggers, stick clicks
D-pad, sticks D-pad, sticks (Y flipped so up is positive)

The PS button and the mute button are not mapped.

Not included

  • Rumble on PS5 controllers. XInput rumble is unchanged.
  • DualShock 4, which uses a different report layout.

Testing

  • cargo test -p victory-hle --lib gameinput: 13 tests pass, including 3 new ones that parse USB, full Bluetooth and short Bluetooth reports.
  • clippy reports no warnings in the new code.
  • Not yet tried with a physical controller.

🤖 Generated with Claude Code

<!-- greyfinch-sync:TaynanGT/Vice-Tay-v2:issue:15330 --> Imported from [TaynanGT/Vice-Tay-v2](https://git.gtahub.st/github/TaynanGT--Vice-Tay-v2/pulls/42). Originally posted by [pawcijo](https://github.com/pawcijo) on 2026-11-26T18:03:12Z. --- **@⁠pawcijo** on GitHub · 2026-11-26 17:58 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/42) `pawcijo:feat/dualsense-input` → `main` · +443 −22 · 4 files · 1 commits · open ## Summary PS5 controllers are not XInput devices, so unless Steam Input or DS4Windows remaps them, the title never sees them. This PR reads them directly over HID, on both USB and Bluetooth. - New `crates/victory-hle/src/modules/gameinput/dualsense.rs`: - A scan thread looks for Sony DualSense (`054C:0CE6`) and DualSense Edge (`054C:0DF2`) every 2 s. - Each controller gets a reader thread that keeps its latest state. The controller is dropped when a read fails (disconnect). - On Bluetooth, the reader requests feature report `0x05` to switch the controller to full `0x31` reports, as Linux `hid-playstation` does. The short `0x01` Bluetooth report is parsed too. - In `gameinput.rs`, PS5 controllers fill the host slots XInput leaves empty, so the one-pad merge, connect/disconnect callbacks and the scripted keys work as before. - Set `VICTORY_DUALSENSE=0` to turn this off when a remapper already presents the controller as an Xbox pad. Otherwise, with `VICTORY_ONE_PAD=0`, it would appear twice. With the default single merged pad, the duplicate does no harm. - Adds the `Win32_Devices_DeviceAndDriverInstallation` and `Win32_Devices_HumanInterfaceDevice` features to `windows-sys`. - The README documents the support and the button mapping. ## Button mapping | PS5 | Console pad | |-----|-------------| | Cross / Circle / Square / Triangle | A / B / X / Y | | Options | Menu | | Create, touchpad click | View | | L1 / R1, L2 / R2, L3 / R3 | shoulders, triggers, stick clicks | | D-pad, sticks | D-pad, sticks (Y flipped so up is positive) | The PS button and the mute button are not mapped. ## Not included - Rumble on PS5 controllers. XInput rumble is unchanged. - DualShock 4, which uses a different report layout. ## Testing - `cargo test -p victory-hle --lib gameinput`: 13 tests pass, including 3 new ones that parse USB, full Bluetooth and short Bluetooth reports. - clippy reports no warnings in the new code. - Not yet tried with a physical controller. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/42:upstream-pr/42'
git switch 'upstream-pr/42'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/42'
git switch 'upstream-pr/42'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/42'
git switch 'upstream-pr/42'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/42'
git switch 'main'
git merge --squash 'upstream-pr/42'
git switch 'main'
git merge --ff-only 'upstream-pr/42'
git switch 'main'
git merge 'upstream-pr/42'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
TaynanGT/Vice-Tay-v2!42
No description provided.