Skip to content

Commit

Permalink
Fixed bug 3935 - Not find joysticks if android run 24-48 days.
Browse files Browse the repository at this point in the history
Alexander Orefkov

In src\joystick\android\SDL_sysjoystick.c in SDL_SYS_JoystickDetect when SDL_GetTicks return number grater 2147483648 (after 24.85 days uptime) SDL_TICKS_PASSED(SDL_GetTicks(), timeout) return FALSE and Android_JNI_PollInputDevices is never calling.
And in JoystickByDeviceId - when search for newly added joystic - after SDL_SYS_JoystickDetect item not reinitilized, and always stay NULL, cause return NULL instead of added joystick.
  • Loading branch information
slouken committed Nov 2, 2017
1 parent 522901b commit c954b53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/joystick/android/SDL_sysjoystick.c
Expand Up @@ -460,7 +460,7 @@ SDL_SYS_JoystickDetect(void)
* Ref: http://developer.android.com/reference/android/hardware/input/InputManager.InputDeviceListener.html
*/
static Uint32 timeout = 0;
if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
if (!timeout || SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
timeout = SDL_GetTicks() + 3000;
Android_JNI_PollInputDevices();
}
Expand Down

0 comments on commit c954b53

Please sign in to comment.