input: enable SDL HIDAPI Xbox driver so Xbox One/Series pads work

The runtime forces SDL HIDAPI (SDL_HINT_JOYSTICK_HIDAPI=1) and disables RAWINPUT
(=0) so Steam's injected virtual Xbox controller enumerates as a GameController.
But HIDAPI's Xbox sub-driver is OFF by default on Windows (Xbox pads are normally
RAWINPUT/XInput there), so with RAWINPUT disabled a PHYSICAL Xbox One/Series
controller was claimed by no GameController driver at all -> SDL_IsGameController
false -> never opened -> zero button input. PS5 DualSense was unaffected (its
HIDAPI driver is on by default), which is why PS5 worked and Xbox did not.

Fix: enable SDL_HINT_JOYSTICK_HIDAPI_XBOX so HIDAPI also claims Xbox pads, keeping
the HIDAPI-preferred design (and avoiding the RAWINPUT+HIDAPI Xbox double-enumerate
the author was avoiding). Additive hint; no effect on the working PS5 path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Matthew Stanley
2026-06-25 13:21:38 -07:00
parent c2a3f6ad79
commit 1915b5c1bf
+6
View File
@@ -2429,6 +2429,12 @@ int main(int argc, char** argv) {
* as a game controller rather than a raw HID device. */
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI, "1");
SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, "0");
/* ...but HIDAPI's Xbox sub-driver is OFF by default on Windows (Xbox pads are
* normally RAWINPUT/XInput there). With RAWINPUT disabled above, a PHYSICAL
* Xbox One/Series controller would be claimed by nobody -> not a GameController
* -> zero input (PS5 DualSense works regardless: its HIDAPI driver is on by
* default). Enable the HIDAPI Xbox driver so HIDAPI handles Xbox pads too. */
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_XBOX, "1");
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER) != 0) {
std::fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError());
return 1;