mirror of
https://github.com/Maschell/controller_patcher.git
synced 2024-11-22 03:59:16 +01:00
Added option to copy DPAD input to the stick
This commit is contained in:
parent
54b321ad6e
commit
3008c53e6f
@ -174,6 +174,9 @@ enum Controller_Patcher_Settings
|
|||||||
CONTRPS_VPAD_BUTTON_R_STICK_LEFT,
|
CONTRPS_VPAD_BUTTON_R_STICK_LEFT,
|
||||||
CONTRPS_VPAD_BUTTON_R_STICK_RIGHT,
|
CONTRPS_VPAD_BUTTON_R_STICK_RIGHT,
|
||||||
|
|
||||||
|
CONTRPS_VPAD_STICK_L_COPY_DPAD,
|
||||||
|
CONTRPS_VPAD_STICK_R_COPY_DPAD,
|
||||||
|
|
||||||
CONTRPS_VPAD_BUTTON_TV,
|
CONTRPS_VPAD_BUTTON_TV,
|
||||||
CONTRPS_DOUBLE_USE, //!When used: e.g. CONTROLLER_PATCHER_VALUE_SET, CONTROLLER_PATCHER_GC_DOUBLE_USE
|
CONTRPS_DOUBLE_USE, //!When used: e.g. CONTROLLER_PATCHER_VALUE_SET, CONTROLLER_PATCHER_GC_DOUBLE_USE
|
||||||
CONTRPS_DOUBLE_USE_BUTTON_ACTIVATOR,
|
CONTRPS_DOUBLE_USE_BUTTON_ACTIVATOR,
|
||||||
|
@ -270,6 +270,9 @@ private:
|
|||||||
CONTPRStringToValueSingle["DOUBLE_USE"] = CONTRPS_DOUBLE_USE;
|
CONTPRStringToValueSingle["DOUBLE_USE"] = CONTRPS_DOUBLE_USE;
|
||||||
CONTPRStringToValueSingle["PAD_COUNT"] = CONTRPS_PAD_COUNT;
|
CONTPRStringToValueSingle["PAD_COUNT"] = CONTRPS_PAD_COUNT;
|
||||||
|
|
||||||
|
CONTPRStringToValueSingle["VPAD_L_STICK_COPY_DPAD"] = CONTRPS_VPAD_STICK_L_COPY_DPAD;
|
||||||
|
CONTPRStringToValueSingle["VPAD_R_STICK_COPY_DPAD"] = CONTRPS_VPAD_STICK_R_COPY_DPAD;
|
||||||
|
|
||||||
mouseLeftValues["LEFT_CLICK"] = CONTRPS_VPAD_BUTTON_LEFT;
|
mouseLeftValues["LEFT_CLICK"] = CONTRPS_VPAD_BUTTON_LEFT;
|
||||||
mouseLeftValues["RIGHT_CLICK"] = CONTRPS_VPAD_BUTTON_RIGHT;
|
mouseLeftValues["RIGHT_CLICK"] = CONTRPS_VPAD_BUTTON_RIGHT;
|
||||||
mouseLeftValues["EMULATED_STICK"] = CONTRPS_MOUSE_STICK;
|
mouseLeftValues["EMULATED_STICK"] = CONTRPS_MOUSE_STICK;
|
||||||
|
@ -418,7 +418,6 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H
|
|||||||
|
|
||||||
s32 deviceslot = data->slotdata.deviceslot;
|
s32 deviceslot = data->slotdata.deviceslot;
|
||||||
if (data->type == DEVICE_TYPE_MOUSE){
|
if (data->type == DEVICE_TYPE_MOUSE){
|
||||||
|
|
||||||
if(gHID_Mouse_Mode == HID_MOUSE_MODE_AIM){ // TODO: tweak values
|
if(gHID_Mouse_Mode == HID_MOUSE_MODE_AIM){ // TODO: tweak values
|
||||||
HID_Mouse_Data * ms_data = &data->data_union.mouse.cur_mouse_data;
|
HID_Mouse_Data * ms_data = &data->data_union.mouse.cur_mouse_data;
|
||||||
if(ms_data == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER;
|
if(ms_data == NULL) return CONTROLLER_PATCHER_ERROR_NULL_POINTER;
|
||||||
@ -522,6 +521,39 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::convertAnalogSticks(H
|
|||||||
buffer->rstick.y += stick.y;
|
buffer->rstick.y += stick.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(config_controller[deviceslot][CONTRPS_VPAD_STICK_L_COPY_DPAD][0] != CONTROLLER_PATCHER_INVALIDVALUE){
|
||||||
|
if(config_controller[deviceslot][CONTRPS_VPAD_STICK_L_COPY_DPAD][0] == 1){
|
||||||
|
u8 stick_values = 0;
|
||||||
|
|
||||||
|
if(buffer->btns_h & VPAD_BUTTON_UP){ stick_values |= STICK_VALUE_UP; }
|
||||||
|
if(buffer->btns_h & VPAD_BUTTON_DOWN){ stick_values |= STICK_VALUE_DOWN; }
|
||||||
|
if(buffer->btns_h & VPAD_BUTTON_LEFT){ stick_values |= STICK_VALUE_LEFT; }
|
||||||
|
if(buffer->btns_h & VPAD_BUTTON_RIGHT){ stick_values |= STICK_VALUE_RIGHT; }
|
||||||
|
|
||||||
|
if(stick_values > 0 ){
|
||||||
|
Vec2D stick = getAnalogValueByButtons(stick_values);
|
||||||
|
buffer->lstick.x += stick.x;
|
||||||
|
buffer->lstick.y += stick.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(config_controller[deviceslot][CONTRPS_VPAD_STICK_R_COPY_DPAD][0] != CONTROLLER_PATCHER_INVALIDVALUE){
|
||||||
|
if(config_controller[deviceslot][CONTRPS_VPAD_STICK_R_COPY_DPAD][0] == 1){
|
||||||
|
u8 stick_values = 0;
|
||||||
|
|
||||||
|
if(buffer->btns_h & VPAD_BUTTON_UP){ stick_values |= STICK_VALUE_UP; }
|
||||||
|
if(buffer->btns_h & VPAD_BUTTON_DOWN){ stick_values |= STICK_VALUE_DOWN; }
|
||||||
|
if(buffer->btns_h & VPAD_BUTTON_LEFT){ stick_values |= STICK_VALUE_LEFT; }
|
||||||
|
if(buffer->btns_h & VPAD_BUTTON_RIGHT){ stick_values |= STICK_VALUE_RIGHT; }
|
||||||
|
|
||||||
|
if(stick_values > 0 ){
|
||||||
|
Vec2D stick = getAnalogValueByButtons(stick_values);
|
||||||
|
buffer->rstick.x += stick.x;
|
||||||
|
buffer->rstick.y += stick.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*log_printf("LX %f(%02X) LY %f(%02X) RX %f(%02X) RY %f(%02X)\n",buffer->lstick.x,cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_X][0]],
|
/*log_printf("LX %f(%02X) LY %f(%02X) RX %f(%02X) RY %f(%02X)\n",buffer->lstick.x,cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_X][0]],
|
||||||
buffer->lstick.y,cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_Y][0]],
|
buffer->lstick.y,cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_L_STICK_Y][0]],
|
||||||
buffer->rstick.x,cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_X][0]],
|
buffer->rstick.x,cur_data[config_controller[deviceslot][CONTRPS_VPAD_BUTTON_R_STICK_X][0]],
|
||||||
|
Loading…
Reference in New Issue
Block a user