Skip to content

Input: add Windows DualSense / DualSense Edge support - #2337

Open
Asem912 wants to merge 1 commit into
Marvisak:mainfrom
Asem912:feat/dualsense-windows
Open

Asem912 wants to merge 1 commit into
Marvisak:mainfrom
Asem912:feat/dualsense-windows

Conversation

@Asem912

@Asem912 Asem912 commented Nov 25, 2026

Copy link
Copy Markdown

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 (Input: with no device, previous and next readings walk every device in time order #361) and VICTORY_KEYS pad merging (Input: apply VICTORY_KEYS to a connected host pad too #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 Asem912 closed this Nov 25, 2026
@Asem912 Asem912 reopened this Nov 25, 2026

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review only: apps/victory input paths are Windows-only here; not tested on macOS. Big feature (+4157): DualSense/DualSense Edge over wired USB, Pico 2 W DS5Dongle bridge and Bluetooth, with haptics/adaptive triggers/gyro/touchpad/battery, config under [input.dualsense]. Suggest splitting the victory-core parts from the input driver for reviewability; needs Windows hardware validation with an actual DS5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants