feat(host/windows): ViGEm virtual gamepad backend

Windows GamepadManager via vigem-client (ViGEmBus) — the uinput-xpad analogue: one virtual Xbox 360 controller per client pad index, created lazily on first State. GameStream/Moonlight already uses the XInput conventions (low-16 button bits, sticks -32768..32767 +Y up, triggers 0..255), so the GamepadFrame->XGamepad mapping is 1:1. Replaces the non-Linux GamepadManager stub (same new/handle/pump_rumble API the m3 PadBackend drives, so no m3 change). Graceful when ViGEmBus is absent (gamepad disabled, session continues). Compiles clean on Windows + Linux; live-test needs the ViGEmBus driver + a physical pad. Rumble back-channel is a TODO (ViGEm notification API).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-15 01:46:51 +00:00
parent 3d3b9e8a5f
commit 46faa0dfc9
4 changed files with 110 additions and 2 deletions
+6 -2
View File
@@ -298,8 +298,12 @@ fn gs_button_to_evdev(b: u32) -> Option<u32> {
pub mod dualsense;
#[cfg(target_os = "linux")]
pub mod gamepad;
/// Stub — virtual gamepads need Linux uinput; events are dropped elsewhere.
#[cfg(not(target_os = "linux"))]
/// Windows: virtual Xbox 360 pads via ViGEmBus.
#[cfg(target_os = "windows")]
#[path = "inject/gamepad_windows.rs"]
pub mod gamepad;
/// Stub — virtual gamepads need Linux uinput or Windows ViGEmBus; events are dropped elsewhere.
#[cfg(not(any(target_os = "linux", target_os = "windows")))]
pub mod gamepad {
#[derive(Default)]
pub struct GamepadManager;