the real fix for sdl joystick lag

This commit is contained in:
Isaac0-dev 2025-05-06 09:58:12 +10:00
parent 6d1f533113
commit 2362f67f4a

View file

@ -215,7 +215,7 @@ static void controller_sdl_read(OSContPad *pad) {
sdl_haptic = NULL;
}
if (sdl_cntrl == NULL || last_gamepad != configGamepadNumber) {
if ((!sdl_cntrl && !sdl_joystick) || last_gamepad != configGamepadNumber) {
if (sdl_haptic) { SDL_HapticClose(sdl_haptic); sdl_haptic = NULL; }
if (sdl_cntrl) { SDL_GameControllerClose(sdl_cntrl); sdl_cntrl = NULL; }
if (sdl_joystick) { SDL_JoystickClose(sdl_joystick); sdl_joystick = NULL; }
@ -225,7 +225,7 @@ static void controller_sdl_read(OSContPad *pad) {
if (sdl_cntrl != NULL) {
sdl_haptic = controller_sdl_init_haptics(configGamepadNumber);
}
} else if (!sdl_joystick) {
} else {
sdl_joystick = SDL_JoystickOpen(configGamepadNumber);
if (!sdl_joystick) { return; }
}