Parcourir la source

Fixed the right trigger on the Nintendo SNES Controller in simple report mode

Sam Lantinga il y a 10 mois
Parent
commit
6821fb2fe4
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      src/joystick/hidapi/SDL_hidapi_switch.c

+ 1 - 1
src/joystick/hidapi/SDL_hidapi_switch.c

@@ -2132,7 +2132,7 @@ static void HandleSimpleControllerState(SDL_Joystick *joystick, SDL_DriverSwitch
         axis = (packet->rgucButtons[0] & 0x40) ? 32767 : -32768;
         SDL_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
 
-        axis = (packet->rgucButtons[0] & 0x80) ? 32767 : -32768;
+        axis = ((packet->rgucButtons[0] & 0x80) || (packet->rgucButtons[1] & 0x80)) ? 32767 : -32768;
         SDL_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
 
         axis = ApplySimpleStickCalibration(ctx, 0, 0, packet->sJoystickLeft[0]);