mirror of https://github.com/encounter/SDL.git
Fixed bug 4898 - No rumble because of integer overflow in SDL_JoystickRumble
meyraud705 Switch hidapi and xinput also need to check for overflow, attached a patch for them.
This commit is contained in:
parent
5e649983e7
commit
7ea3f5b464
|
@ -480,7 +480,7 @@ SDL_XINPUT_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) {
|
if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) {
|
||||||
joystick->hwdata->rumble_expiration = SDL_GetTicks() + duration_ms;
|
joystick->hwdata->rumble_expiration = SDL_GetTicks() + SDL_min(duration_ms, SDL_MAX_RUMBLE_DURATION_MS);
|
||||||
} else {
|
} else {
|
||||||
joystick->hwdata->rumble_expiration = 0;
|
joystick->hwdata->rumble_expiration = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue