The triggers should be expanded out to the full range to match DirectInput behavior.
authorSam Lantinga <slouken@libsdl.org>
Thu, 06 Jun 2013 17:59:01 -0700
changeset 7293341d22fe9044
parent 7292 fdf42e4cdcec
child 7294 0923de98a63a
The triggers should be expanded out to the full range to match DirectInput behavior.
The game controller code will scale them back to 0 - 32767 when it converts the triggers axes.
src/joystick/windows/SDL_dxjoystick.c
     1.1 --- a/src/joystick/windows/SDL_dxjoystick.c	Thu Jun 06 07:25:41 2013 -0700
     1.2 +++ b/src/joystick/windows/SDL_dxjoystick.c	Thu Jun 06 17:59:01 2013 -0700
     1.3 @@ -1499,8 +1499,8 @@
     1.4          SDL_PrivateJoystickAxis(joystick, 1, (Sint16)(-1*pXInputState->Gamepad.sThumbLY-1) );
     1.5          SDL_PrivateJoystickAxis(joystick, 2, (Sint16)pXInputState->Gamepad.sThumbRX );
     1.6          SDL_PrivateJoystickAxis(joystick, 3, (Sint16)(-1*pXInputState->Gamepad.sThumbRY-1) );
     1.7 -        SDL_PrivateJoystickAxis(joystick, 4, (Sint16)((int)pXInputState->Gamepad.bLeftTrigger*32767/255) );
     1.8 -        SDL_PrivateJoystickAxis(joystick, 5, (Sint16)((int)pXInputState->Gamepad.bRightTrigger*32767/255) );
     1.9 +        SDL_PrivateJoystickAxis(joystick, 4, (Sint16)(((int)pXInputState->Gamepad.bLeftTrigger*65535/255) - 32768));
    1.10 +        SDL_PrivateJoystickAxis(joystick, 5, (Sint16)(((int)pXInputState->Gamepad.bRightTrigger*65535/255) - 32768));
    1.11  
    1.12          if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_UP ) )
    1.13              SDL_PrivateJoystickButton(joystick, 0, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP ? SDL_PRESSED :  SDL_RELEASED );