diff --git a/controller_patcher.c b/controller_patcher.c index a776cad..cb6d30a 100644 --- a/controller_patcher.c +++ b/controller_patcher.c @@ -1204,10 +1204,17 @@ void setTouch(HID_Data_Struct data,VPADData * buffer){ f32 convertAnalogValue(u8 value, u8 default_val, u8 min, u8 max, u8 invert,u8 deadzone){ s8 new_value = (s8)(value - default_val); u8 range = 0; + if(value >= max){ + return 1.0f; + }else if(value <= min){ + return -1.0f; + } if((value-deadzone) > default_val){ - range = (max - default_val); + new_value -= deadzone; + range = (max - (default_val + deadzone)); }else if((value+deadzone) < default_val){ - range = (default_val - min); + new_value += deadzone; + range = ((default_val - deadzone) - min); }else{ return 0.0f; } diff --git a/pad_const.c b/pad_const.c index 3edec95..af4949d 100644 --- a/pad_const.c +++ b/pad_const.c @@ -61,15 +61,15 @@ const u8 HID_GC_STICK_L_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VAL 0x80, //STICK_CONF_DEFAULT, 0x09, //STICK_CONF_DEADZONE, 0x00, //STICK_CONF_INVERT, - 0x1E, //STICK_CONF_MIN, - 0xE5};//STICK_CONF_MAX, + 0x1A, //STICK_CONF_MIN, + 0xE4};//STICK_CONF_MAX, const u8 HID_GC_STICK_L_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION 0x04, //STICK_CONF_BYTE, 0x80, //STICK_CONF_DEFAULT, 0x09, //STICK_CONF_DEADZONE, 0x00, //STICK_CONF_INVERT, - 0x18, //STICK_CONF_MIN, + 0x11, //STICK_CONF_MIN, 0xE1};//STICK_CONF_MAX, const u8 HID_GC_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION @@ -77,15 +77,15 @@ const u8 HID_GC_STICK_R_X[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VAL 0x80, //STICK_CONF_DEFAULT, 0x09, //STICK_CONF_DEADZONE, 0x00, //STICK_CONF_INVERT, - 0x26, //STICK_CONF_MIN, - 0xE1};//STICK_CONF_MAX, + 0x2B, //STICK_CONF_MIN, + 0xE2};//STICK_CONF_MAX, const u8 HID_GC_STICK_R_Y[STICK_CONF_ENUM_MAXVALUE] = { STICK_CONF_MAGIC_VALUE, //STICK_CONF_MAGIC_VERSION 0x06, //STICK_CONF_BYTE, 0x80, //STICK_CONF_DEFAULT, 0x09, //STICK_CONF_DEADZONE, 0x00, //STICK_CONF_INVERT, - 0x1A, //STICK_CONF_MIN, + 0x1D, //STICK_CONF_MIN, 0xDB};//STICK_CONF_MAX, //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------