Files
fs2open.github.com/code/io
Goober5000 870e567fe4 Move SDL joystick scanning off the main thread
Setting SDL_HINT_JOYSTICK_THREAD=1 before SDL_InitSubSystem(SDL_INIT_JOYSTICK)
tells SDL2 to run joystick polling and HID device-detection on a dedicated
background thread, rather than processing them inline inside SDL_PollEvent
on the main thread.

Without this hint, every WM_DEVICECHANGE broadcast (which Windows sends when
*any* HID device wakes, sleeps, or pulses the USB bus) causes SDL to walk
every HID device class via SetupAPI / cfgmgr32 from inside SDL_PollEvent,
stalling the frame loop for multiple seconds on machines with many HID
peripherals - especially wireless Logitech mice and keyboards that
periodically pulse the bus. Diagnosed via ProcMon stack capture on one
affected user's machine, with the slow frame's call chain ending in
SDL2.dll -> SETUPAPI.dll -> cfgmgr32.dll -> kernel registry queries against
HKLM\System\CurrentControlSet\Enum\HID\*.

With the hint enabled, that work happens on SDL's own thread and the main
thread just dequeues already-collected events.
2026-06-01 02:14:08 -04:00
..
2025-03-17 00:31:59 -04:00
2026-04-08 10:33:51 -04:00
2024-07-01 16:01:31 -04:00
2026-03-29 08:04:03 -04:00
2026-03-29 08:04:03 -04:00
2026-05-09 10:50:30 -04:00
2026-05-09 10:50:30 -04:00
2026-01-21 00:06:25 -05:00