libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.79k stars 1.82k forks source link

Windows: XBox One/Series triggers and rumble not working till other input pressed #5241

Closed gnrlwart closed 2 years ago

gnrlwart commented 2 years ago

For XBox One and Series controllers: Until a button or axis other than the triggers receives input, rumble does not work, and the triggers cannot be pressed at the same time (same DirectInput axis).

I dug into this, and tracked the problem to trigger input not being used to correlate XInput or WGI devices with the raw input device. After working on it for a while, I realized why this hadn't been done yet, 'cause it was a real PITA to catch all the false uncorrelation cases. I've gotten it working reliably now though, but have one question before I submit a pull request (hence entering this issue first)

There is no room in joystick_hwdata.match_state for two more 4 bit axes, so what would be the preference for making room: A. Expand the match_state field from 32 to 64 bits B. Add a separate field for trigger matching state and pass that everywhere match_state goes?

slouken commented 2 years ago

Expanding match state is fine

gnrlwart commented 2 years ago

Cheers!