From d81eaf8da5e98d4e3475cbff25a6c62b2bb0569b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 27 Jan 2021 12:43:35 -0800 Subject: [PATCH] Added explicit case from Uint8 to int before subtracting offset --- src/joystick/hidapi/SDL_hidapi_stadia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joystick/hidapi/SDL_hidapi_stadia.c b/src/joystick/hidapi/SDL_hidapi_stadia.c index a8797b7ae..7bf47313e 100644 --- a/src/joystick/hidapi/SDL_hidapi_stadia.c +++ b/src/joystick/hidapi/SDL_hidapi_stadia.c @@ -222,7 +222,7 @@ HIDAPI_DriverStadia_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverStadia_C #define READ_STICK_AXIS(offset) \ (data[offset] == 0x80 ? 0 : \ - (Sint16)HIDAPI_RemapVal((float)(data[offset] - 0x80), 0x01 - 0x80, 0xff - 0x80, SDL_MIN_SINT16, SDL_MAX_SINT16)) + (Sint16)HIDAPI_RemapVal((float)((int)data[offset] - 0x80), 0x01 - 0x80, 0xff - 0x80, SDL_MIN_SINT16, SDL_MAX_SINT16)) { axis = READ_STICK_AXIS(4); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);