From 2c98c8af01cf5903bac1ae155adee049e1dacf87 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 26 Sep 2022 18:39:18 -0700 Subject: [PATCH] Use better default values for Switch controller calibration --- src/joystick/hidapi/SDL_hidapi_switch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index 7af640ece..ab02a0147 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -759,13 +759,13 @@ static SDL_bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx, Uint8 input_ for (stick = 0; stick < 2; ++stick) { for (axis = 0; axis < 2; ++axis) { if (ctx->m_StickCalData[stick].axis[axis].sCenter == 0xFFF) { - ctx->m_StickCalData[stick].axis[axis].sCenter = 0; + ctx->m_StickCalData[stick].axis[axis].sCenter = 2048; } if (ctx->m_StickCalData[stick].axis[axis].sMax == 0xFFF) { - ctx->m_StickCalData[stick].axis[axis].sMax = 0; + ctx->m_StickCalData[stick].axis[axis].sMax = (Sint16)(ctx->m_StickCalData[stick].axis[axis].sCenter * 0.7f); } if (ctx->m_StickCalData[stick].axis[axis].sMin == 0xFFF) { - ctx->m_StickCalData[stick].axis[axis].sMin = 0; + ctx->m_StickCalData[stick].axis[axis].sMin = (Sint16)(ctx->m_StickCalData[stick].axis[axis].sCenter * 0.7f); } } }