We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 434d4fb + 870e567 commit d52ba4eCopy full SHA for d52ba4e
1 file changed
code/io/joy-sdl.cpp
@@ -1036,6 +1036,13 @@ namespace joystick
1036
1037
mprintf(("Initializing Joystick...\n"));
1038
1039
+ // Run joystick polling and HID device-detection on a dedicated SDL thread
1040
+ // instead of the main thread. Without this, WM_DEVICECHANGE broadcasts
1041
+ // (caused by wireless HID peripherals waking/sleeping on the USB bus)
1042
+ // trigger SDL to re-walk every HID device class via SetupAPI / cfgmgr32
1043
+ // from inside SDL_PollEvent, stalling the frame loop for multiple seconds.
1044
+ SDL_SetHint(SDL_HINT_JOYSTICK_THREAD, "1");
1045
+
1046
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0)
1047
{
1048
mprintf((" Could not initialize joystick: %s\n", SDL_GetError()));
0 commit comments