gameinput: drive XInput rumble from SetRumbleState #432

Merged
glovepost merged 1 commit from upstream-pr/432 into main 2026-11-29 01:17:45 +00:00
glovepost commented 2026-11-29 00:32:21 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by glovepost on 2026-11-29T00:32:21Z.


Summary

SetRumbleState was unimplemented. The four XInput gamepads now report low- and high-frequency motors and Xbox button labels. A call maps GameInputRumbleParams onto XInputSetState:

  • low frequency is the left motor, high frequency is the right motor
  • a finite speed is clamped to [0, 1] and scaled to a u16 (* 65535)
  • a non-finite speed, or a null parameter list, stops both motors
  • the trigger motors are ignored, because XInput has none
  • keyboard, mouse, and the desktop gamepad have no XInput port, so rumble on those slots does nothing

This is not a shader change.

Tests

cargo test --locked --target x86_64-unknown-linux-gnu -p tuxbox-gameinput — 3 tests OK:

  • rumble_parameters_match_the_sdk_layout
  • rumble_drives_the_xinput_motors
  • rumble_reaches_only_the_xinput_ports

Claude Code wrote the port. This session reran the tests and opened the pull request.

<!-- greyfinch-sync:brcly/TuxBox:issue:5546060073 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/432). Originally posted by [glovepost](https://github.com/glovepost) on 2026-11-29T00:32:21Z. --- ## Summary `SetRumbleState` was unimplemented. The four XInput gamepads now report low- and high-frequency motors and Xbox button labels. A call maps `GameInputRumbleParams` onto `XInputSetState`: - low frequency is the left motor, high frequency is the right motor - a finite speed is clamped to [0, 1] and scaled to a `u16` (`* 65535`) - a non-finite speed, or a null parameter list, stops both motors - the trigger motors are ignored, because XInput has none - keyboard, mouse, and the desktop gamepad have no XInput port, so rumble on those slots does nothing This is not a shader change. ## Tests `cargo test --locked --target x86_64-unknown-linux-gnu -p tuxbox-gameinput` — 3 tests OK: - `rumble_parameters_match_the_sdk_layout` - `rumble_drives_the_xinput_motors` - `rumble_reaches_only_the_xinput_ports` Claude Code wrote the port. This session reran the tests and opened the pull request.
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
brcly/TuxBox!432
No description provided.