mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
xinput: use the full range of the haptic motors (thanks, Trent!).
XInput goes from 0 to 64k; we were feeding it values in the range of 0 to 32k. Fixes Bugzilla #3002.
This commit is contained in:
parent
267dca13fa
commit
d96419c93f
@ -278,8 +278,9 @@ SDL_XINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
|
|||||||
{
|
{
|
||||||
XINPUT_VIBRATION *vib = &effect->hweffect->vibration;
|
XINPUT_VIBRATION *vib = &effect->hweffect->vibration;
|
||||||
SDL_assert(data->type == SDL_HAPTIC_LEFTRIGHT);
|
SDL_assert(data->type == SDL_HAPTIC_LEFTRIGHT);
|
||||||
vib->wLeftMotorSpeed = data->leftright.large_magnitude;
|
/* SDL_HapticEffect has max magnitude of 32767, XInput expects 65535 max, so multiply */
|
||||||
vib->wRightMotorSpeed = data->leftright.small_magnitude;
|
vib->wLeftMotorSpeed = data->leftright.large_magnitude * 2;
|
||||||
|
vib->wRightMotorSpeed = data->leftright.small_magnitude * 2;
|
||||||
SDL_LockMutex(haptic->hwdata->mutex);
|
SDL_LockMutex(haptic->hwdata->mutex);
|
||||||
if (haptic->hwdata->stopTicks) { /* running right now? Update it. */
|
if (haptic->hwdata->stopTicks) { /* running right now? Update it. */
|
||||||
XINPUTSETSTATE(haptic->hwdata->userid, vib);
|
XINPUTSETSTATE(haptic->hwdata->userid, vib);
|
||||||
|
Loading…
Reference in New Issue
Block a user