mirror of
https://github.com/Maschell/controller_patcher.git
synced 2024-11-21 19:49:16 +01:00
Fixed bug with inveted sticks
-built in not inverted sticks can now be inverted through a config -fixed a typo in the ps4 pad config
This commit is contained in:
parent
e67dc213b5
commit
4c496011da
@ -220,18 +220,22 @@ void init_config_controller(){
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_GC_STICK_L_X[STICK_CONF_BYTE],HID_GC_STICK_L_X[STICK_CONF_DEFAULT]);
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_L_X[STICK_CONF_DEADZONE]);
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_GC_STICK_L_X[STICK_CONF_MIN], HID_GC_STICK_L_X[STICK_CONF_MAX]);
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_L_X[STICK_CONF_INVERT]);
|
||||
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_Y], HID_GC_STICK_L_Y[STICK_CONF_BYTE],HID_GC_STICK_L_Y[STICK_CONF_DEFAULT]);
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_L_Y[STICK_CONF_DEADZONE]);
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX], HID_GC_STICK_L_Y[STICK_CONF_MIN], HID_GC_STICK_L_Y[STICK_CONF_MAX]);
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_L_Y[STICK_CONF_INVERT]);
|
||||
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_X], HID_GC_STICK_R_X[STICK_CONF_BYTE],HID_GC_STICK_R_X[STICK_CONF_DEFAULT]);
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_R_X[STICK_CONF_DEADZONE]);
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX], HID_GC_STICK_R_X[STICK_CONF_MIN], HID_GC_STICK_R_X[STICK_CONF_MAX]);
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_R_X[STICK_CONF_INVERT]);
|
||||
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_Y], HID_GC_STICK_R_Y[STICK_CONF_BYTE],HID_GC_STICK_R_Y[STICK_CONF_DEFAULT]);
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_R_Y[STICK_CONF_DEADZONE]);
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX], HID_GC_STICK_R_Y[STICK_CONF_MIN], HID_GC_STICK_R_Y[STICK_CONF_MAX]);
|
||||
setConfigValue((u8*)&config_controller[gHID_SLOT_GC][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_GC_STICK_R_Y[STICK_CONF_INVERT]);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! DS3
|
||||
@ -263,23 +267,25 @@ void init_config_controller(){
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_DS3_STICK_L_X[STICK_CONF_BYTE],HID_DS3_STICK_L_X[STICK_CONF_DEFAULT]);
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_L_X[STICK_CONF_DEADZONE]);
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_DS3_STICK_L_X[STICK_CONF_MIN], HID_DS3_STICK_L_X[STICK_CONF_MAX]);
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_L_X[STICK_CONF_INVERT]);
|
||||
|
||||
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_DS3_STICK_L_Y[STICK_CONF_BYTE],HID_DS3_STICK_L_Y[STICK_CONF_DEFAULT]);
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_L_Y[STICK_CONF_DEADZONE]);
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_DS3_STICK_L_Y[STICK_CONF_MIN], HID_DS3_STICK_L_Y[STICK_CONF_MAX]);
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET,HID_DS3_STICK_L_Y[STICK_CONF_INVERT]);
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_L_Y[STICK_CONF_INVERT]);
|
||||
|
||||
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_X], HID_DS3_STICK_R_X[STICK_CONF_BYTE],HID_DS3_STICK_R_X[STICK_CONF_DEFAULT]);
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_R_X[STICK_CONF_DEADZONE]);
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX], HID_DS3_STICK_R_X[STICK_CONF_MIN], HID_DS3_STICK_R_X[STICK_CONF_MAX]);
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_R_X[STICK_CONF_INVERT]);
|
||||
|
||||
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y], HID_DS3_STICK_R_Y[STICK_CONF_BYTE],HID_DS3_STICK_R_Y[STICK_CONF_DEFAULT]);
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_R_Y[STICK_CONF_DEADZONE]);
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX], HID_DS3_STICK_R_Y[STICK_CONF_MIN], HID_DS3_STICK_R_Y[STICK_CONF_MAX]);
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET,HID_DS3_STICK_R_Y[STICK_CONF_INVERT]);
|
||||
setConfigValue((u8*)&config_controller[ds3_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS3_STICK_R_Y[STICK_CONF_INVERT]);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! DS4
|
||||
@ -318,23 +324,24 @@ void init_config_controller(){
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_DS4_STICK_L_X[STICK_CONF_BYTE],HID_DS4_STICK_L_X[STICK_CONF_DEFAULT]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_L_X[STICK_CONF_DEADZONE]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_DS4_STICK_L_X[STICK_CONF_MIN], HID_DS4_STICK_L_X[STICK_CONF_MAX]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_L_X[STICK_CONF_INVERT]);
|
||||
|
||||
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X], HID_DS4_STICK_L_Y[STICK_CONF_BYTE],HID_DS4_STICK_L_Y[STICK_CONF_DEFAULT]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_L_Y[STICK_CONF_DEADZONE]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_X_MINMAX], HID_DS4_STICK_L_Y[STICK_CONF_MIN], HID_DS4_STICK_L_Y[STICK_CONF_MAX]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET,HID_DS4_STICK_L_Y[STICK_CONF_INVERT]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y], HID_DS4_STICK_L_Y[STICK_CONF_BYTE],HID_DS4_STICK_L_Y[STICK_CONF_DEFAULT]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_L_Y[STICK_CONF_DEADZONE]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_MINMAX], HID_DS4_STICK_L_Y[STICK_CONF_MIN], HID_DS4_STICK_L_Y[STICK_CONF_MAX]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_L_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_L_Y[STICK_CONF_INVERT]);
|
||||
|
||||
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_X], HID_DS4_STICK_R_X[STICK_CONF_BYTE],HID_DS4_STICK_R_X[STICK_CONF_DEFAULT]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_R_X[STICK_CONF_DEADZONE]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_MINMAX], HID_DS4_STICK_R_X[STICK_CONF_MIN], HID_DS4_STICK_R_X[STICK_CONF_MAX]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_X_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_R_X[STICK_CONF_INVERT]);
|
||||
|
||||
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y], HID_DS4_STICK_R_Y[STICK_CONF_BYTE],HID_DS4_STICK_R_Y[STICK_CONF_DEFAULT]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_DEADZONE], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_R_Y[STICK_CONF_DEADZONE]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_MINMAX], HID_DS4_STICK_R_Y[STICK_CONF_MIN], HID_DS4_STICK_R_Y[STICK_CONF_MAX]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET,HID_DS4_STICK_R_Y[STICK_CONF_INVERT]);
|
||||
setConfigValue((u8*)&config_controller[ds4_slot][CONTRPS_VPAD_BUTTON_R_STICK_Y_INVERT], CONTROLLER_PATCHER_VALUE_SET, HID_DS4_STICK_R_Y[STICK_CONF_INVERT]);
|
||||
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -1205,8 +1212,10 @@ f32 convertAnalogValue(u8 value, u8 default_val, u8 min, u8 max, u8 invert,u8 de
|
||||
s8 new_value = (s8)(value - default_val);
|
||||
u8 range = 0;
|
||||
if(value >= max){
|
||||
if(invert == 0x01) return -1.0f;
|
||||
return 1.0f;
|
||||
}else if(value <= min){
|
||||
if(invert == 0x01) return 1.0f;
|
||||
return -1.0f;
|
||||
}
|
||||
if((value-deadzone) > default_val){
|
||||
|
Loading…
Reference in New Issue
Block a user