src/haptic/windows/SDL_dinputhaptic.c
changeset 9147 6bf589c8d549
parent 9071 8e04e17c7af3
child 9619 b94b6d0bff0f
     1.1 --- a/src/haptic/windows/SDL_dinputhaptic.c	Wed Sep 17 14:47:42 2014 -0400
     1.2 +++ b/src/haptic/windows/SDL_dinputhaptic.c	Wed Sep 17 14:49:36 2014 -0400
     1.3 @@ -21,6 +21,7 @@
     1.4  #include "../../SDL_internal.h"
     1.5  
     1.6  #include "SDL_error.h"
     1.7 +#include "SDL_stdinc.h"
     1.8  #include "SDL_haptic.h"
     1.9  #include "SDL_timer.h"
    1.10  #include "SDL_windowshaptic_c.h"
    1.11 @@ -714,9 +715,10 @@
    1.12          SDL_memset(periodic, 0, sizeof(DIPERIODIC));
    1.13  
    1.14          /* Specifics */
    1.15 -        periodic->dwMagnitude = CONVERT(hap_periodic->magnitude);
    1.16 +        periodic->dwMagnitude = CONVERT(SDL_abs(hap_periodic->magnitude));
    1.17          periodic->lOffset = CONVERT(hap_periodic->offset);
    1.18 -        periodic->dwPhase = hap_periodic->phase;
    1.19 +        periodic->dwPhase = 
    1.20 +                (hap_periodic->phase + (hap_periodic->magnitude < 0 ? 18000 : 0)) % 36000;
    1.21          periodic->dwPeriod = hap_periodic->period * 1000;
    1.22          dest->cbTypeSpecificParams = sizeof(DIPERIODIC);
    1.23          dest->lpvTypeSpecificParams = periodic;