From 3fcaf5b4b30841d3d7a7e18348838d89d6c9e25f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 25 May 2021 10:33:30 -0700 Subject: [PATCH] Fixed incorrect axis scaling for Nintendo Switch controllers --- src/joystick/hidapi/SDL_hidapi_switch.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index fe527aa12..5df45fa34 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -717,11 +717,7 @@ static Sint16 ApplyStickCalibrationCentered(SDL_DriverSwitch_Context *ctx, int n ctx->m_StickExtents[nStick].axis[nAxis].sMin = sRawValue; } - if (sRawValue > 0) { - return (Sint16)HIDAPI_RemapVal(sRawValue, 0, ctx->m_StickExtents[nStick].axis[nAxis].sMax, 0, SDL_MAX_SINT16); - } else { - return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_StickExtents[nStick].axis[nAxis].sMin, 0, SDL_MIN_SINT16, 0); - } + return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_StickExtents[nStick].axis[nAxis].sMin, ctx->m_StickExtents[nStick].axis[nAxis].sMax, SDL_MIN_SINT16, SDL_MAX_SINT16); } static Sint16 ApplyStickCalibration(SDL_DriverSwitch_Context *ctx, int nStick, int nAxis, Sint16 sRawValue)