Input: add Windows DualSense / DualSense Edge support #2337

Open
github-bot wants to merge 1 commit from github-bot/gh-2337 into main AGit
Owner

@⁠Asem912 on GitHub · 2026-11-25 11:00 UTC · original
Asem912:feat/dualsense-windows → main · +4157 −446 · 18 files · 1 commits · open

Rebased continuation of #1517 onto current main (940d32f), integrating upstream gameinput changes from #197 (VICTORY_KEYS merging into connected host pads) and #361 (cross-device time-ordered next_reading / previous_reading).

Summary

Adds native Windows HLE support for PlayStation 5 DualSense (0x0CE6) and DualSense Edge (0x0DF2) controllers in gameinput.dll, supporting wired USB, Raspberry Pi Pico 2 W DS5Dongle wireless bridges, and native Bluetooth (0x31 enhanced reports) using existing workspace dependencies.

Highlights

  • Dual-transport Win32 HID backend (victory-hle::modules::gameinput::dualsense):
    • Opens UsagePage 0x01 / Usage 0x05 with FILE_SHARE_READ | FILE_SHARE_WRITE so companion tools and DS5Dongle WebHID configurators are never locked out.
    • Supports USB 0x01/0x02 and Bluetooth 0x31 (auto-reads Feature 0x05 to enter enhanced mode, validates 0xA1/0xA2/0xA3 seeded CRC-32).
    • Monitors sensor_timestamp liveness (1.5 s freeze timeout) so an idle/powered-off wireless pad behind a plugged-in DS5Dongle cleanly falls back to keyboard WASD without stuck buttons, and re-fetches 0x05/0x20 on reconnect.
  • Actuators, triggers, haptics, and indicators:
    • Declares 4 rumble motors (0xF) and translates Xbox trigger rumble scalars into DualSense adaptive trigger Vibration / Hybrid / Off modes with ~100 Hz output rate limiting and immediate zero-stop flushes.
    • Reads Feature 0x20 firmware version and sets COMPATIBLE_VIBRATION2 (valid_flag2 bit 2) for firmware >= 0x0224, leaving audio volume bytes untouched for DS5Dongle v0.8+ volume lock compatibility.
    • Optional 4-channel WASAPI voice-coil synthesis (audio_4ch / hybrid) blending rumble carriers with title-scoped VIRTUAL_AUDIO_DEVICE_PROCESS_LOOPBACK low-pass audio while keeping Ch1/2 silent by default.
    • Implements IGameInputDevice::GetBatteryState (0x28) and IGameInput::RegisterSystemButtonCallback (0x50, short-press PS Guide, PS + Touchpad gyro recenter, ignoring >= 600 ms holds for power-off / multi-device slot switching).
  • 6-axis gyro, arbitration, history & safety:
    • High-frequency 3 MHz IMU integration (PlayerSpace Yaw+Roll, AdsOrTouch default, anti-deadzone floor) onto right stick.
    • Expands reading HISTORY to 512 with analog sub-LSB jitter coalescing to prevent REFERENCE_TOO_OLD on slow frames, while preserving cross-device time-ordered next_reading / previous_reading (#361) and VICTORY_KEYS pad merging (#197).
    • Slot arbitrator suppresses duplicate virtual XInput mirrors (e.g. Steam Input VID_28DE / ViGEm) while preserving mixed genuine Xbox + PS5 pads.
    • Lock-free hardware trigger/rumble reset on focus loss, lifecycle::end_title, Ctrl+C, panic, and victory-loader unhandled exceptions.
  • Configuration (victory-core, victory.example.toml, apps/victory):
    • Adds optional [input] and [input.dualsense] TOML sections and VICTORY_* env overrides.

Verification

  • cargo clippy --workspace --all-targets --locked -- -D warnings (pass)
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings (pass)
  • cargo test -p victory-hle --features diagnostics --locked -- modules::gameinput modules::lifecycle (32 passed; synthetic HID report fixtures + VICTORY_KEYS / cross-device walk tests)
  • cargo test -p victory-core -p victory -p victory-loader -p victory-pe -p victory-pipeline -p xtask --locked (all passed, including config, crash, and xtask asset-policy checks)
  • Not yet tested: physical DualSense / DS5Dongle hardware E2E on device (and full cargo test --workspace --locked outside sandbox; in the sandboxed run, unrelated victory-gpu descriptor/memory tests failed).
**@⁠Asem912** on GitHub · 2026-11-25 11:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2337) `Asem912:feat/dualsense-windows` → `main` · +4157 −446 · 18 files · 1 commits · open > Rebased continuation of #1517 onto current `main` (`940d32f`), integrating upstream `gameinput` changes from #197 (`VICTORY_KEYS` merging into connected host pads) and #361 (cross-device time-ordered `next_reading` / `previous_reading`). ## Summary Adds native Windows HLE support for PlayStation 5 **DualSense (`0x0CE6`)** and **DualSense Edge (`0x0DF2`)** controllers in `gameinput.dll`, supporting wired USB, Raspberry Pi Pico 2 W `DS5Dongle` wireless bridges, and native Bluetooth (`0x31` enhanced reports) using existing workspace dependencies. ### Highlights - **Dual-transport Win32 HID backend (`victory-hle::modules::gameinput::dualsense`)**: - Opens `UsagePage 0x01 / Usage 0x05` with `FILE_SHARE_READ | FILE_SHARE_WRITE` so companion tools and `DS5Dongle` WebHID configurators are never locked out. - Supports USB `0x01`/`0x02` and Bluetooth `0x31` (auto-reads Feature `0x05` to enter enhanced mode, validates `0xA1`/`0xA2`/`0xA3` seeded CRC-32). - Monitors `sensor_timestamp` liveness (1.5 s freeze timeout) so an idle/powered-off wireless pad behind a plugged-in `DS5Dongle` cleanly falls back to keyboard `WASD` without stuck buttons, and re-fetches `0x05`/`0x20` on reconnect. - **Actuators, triggers, haptics, and indicators**: - Declares 4 rumble motors (`0xF`) and translates Xbox trigger rumble scalars into DualSense adaptive trigger `Vibration` / `Hybrid` / `Off` modes with ~100 Hz output rate limiting and immediate zero-stop flushes. - Reads Feature `0x20` firmware version and sets `COMPATIBLE_VIBRATION2` (`valid_flag2` bit 2) for firmware `>= 0x0224`, leaving audio volume bytes untouched for `DS5Dongle` v0.8+ volume lock compatibility. - Optional 4-channel WASAPI voice-coil synthesis (`audio_4ch` / `hybrid`) blending rumble carriers with title-scoped `VIRTUAL_AUDIO_DEVICE_PROCESS_LOOPBACK` low-pass audio while keeping Ch1/2 silent by default. - Implements `IGameInputDevice::GetBatteryState` (`0x28`) and `IGameInput::RegisterSystemButtonCallback` (`0x50`, short-press PS Guide, `PS + Touchpad` gyro recenter, ignoring `>= 600 ms` holds for power-off / multi-device slot switching). - **6-axis gyro, arbitration, history & safety**: - High-frequency 3 MHz IMU integration (`PlayerSpace` Yaw+Roll, `AdsOrTouch` default, anti-deadzone floor) onto right stick. - Expands reading `HISTORY` to `512` with analog sub-LSB jitter coalescing to prevent `REFERENCE_TOO_OLD` on slow frames, while preserving cross-device time-ordered `next_reading` / `previous_reading` (#361) and `VICTORY_KEYS` pad merging (#197). - Slot arbitrator suppresses duplicate virtual XInput mirrors (e.g. Steam Input `VID_28DE` / ViGEm) while preserving mixed genuine Xbox + PS5 pads. - Lock-free hardware trigger/rumble reset on focus loss, `lifecycle::end_title`, `Ctrl+C`, panic, and `victory-loader` unhandled exceptions. - **Configuration (`victory-core`, `victory.example.toml`, `apps/victory`)**: - Adds optional `[input]` and `[input.dualsense]` TOML sections and `VICTORY_*` env overrides. ## Verification - `cargo clippy --workspace --all-targets --locked -- -D warnings` (pass) - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` (pass) - `cargo test -p victory-hle --features diagnostics --locked -- modules::gameinput modules::lifecycle` (32 passed; synthetic HID report fixtures + `VICTORY_KEYS` / cross-device walk tests) - `cargo test -p victory-core -p victory -p victory-loader -p victory-pe -p victory-pipeline -p xtask --locked` (all passed, including `config`, `crash`, and `xtask` asset-policy checks) - **Not yet tested**: physical DualSense / `DS5Dongle` hardware E2E on device (and full `cargo test --workspace --locked` outside sandbox; in the sandboxed run, unrelated `victory-gpu` descriptor/memory tests failed).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:02:41 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:23 UTC · original · edited 2026-11-25 22:22 UTC

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main (conflicts in apps/victory/src/main.rs and crates/victory-hle/src/modules/gameinput/mod.rs). It will be reviewed again once it is rebased.

From the earlier needs-work note, still open: dependency changes need the maintainer's decision, evidence for the GameInput behaviour changes, no hardware testing yet, and the PR should be split into smaller changes with shorter docs.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2337#issuecomment-7166780049) · edited 2026-11-25 22:22 UTC <!-- victory-triage v1 head=7e6224ee22f5f6c0d030896b2956ca161ceace33 verdict=needs-rebase at=2026-11-25T22:29:35Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main` (conflicts in `apps/victory/src/main.rs` and `crates/victory-hle/src/modules/gameinput/mod.rs`). It will be reviewed again once it is rebased. From the earlier needs-work note, still open: dependency changes need the maintainer's decision, evidence for the GameInput behaviour changes, no hardware testing yet, and the PR should be split into smaller changes with shorter docs. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • apps/victory/src/main.rs
  • crates/victory-hle/src/modules/gameinput/mod.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2337'
git switch 'github-bot/gh-2337'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2337'
git switch 'github-bot/gh-2337'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2337'
git switch 'main'
git merge --squash 'github-bot/gh-2337'
git switch 'main'
git merge --ff-only 'github-bot/gh-2337'
git switch 'main'
git merge 'github-bot/gh-2337'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2337
No description provided.