diff --git a/config.def.h b/config.def.h index 4cc737f89d..f15fe00864 100644 --- a/config.def.h +++ b/config.def.h @@ -603,7 +603,8 @@ static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_NONE; #endif #if defined(VITA) -static unsigned input_backtouch_enable = false; +static unsigned input_backtouch_enable = false; +static unsigned input_backtouch_toggle = false; #endif #ifdef ANDROID diff --git a/configuration.c b/configuration.c index c73fc3aaaa..cfd6cabd90 100644 --- a/configuration.c +++ b/configuration.c @@ -750,6 +750,7 @@ static int populate_settings_bool(settings_t *settings, struct config_bool_setti SETTING_BOOL("camera_allow", &settings->camera.allow, true, false, false); #if defined(VITA) SETTING_BOOL("input_backtouch_enable", &settings->input.backtouch_enable, false, false, false); + SETTING_BOOL("input_backtouch_toggle", &settings->input.backtouch_toggle, false, false, false); #endif #if TARGET_OS_IPHONE SETTING_BOOL("small_keyboard_enable", &settings->input.small_keyboard_enable, true, false, false); diff --git a/configuration.h b/configuration.h index 2a5e23d40f..5e05787409 100644 --- a/configuration.h +++ b/configuration.h @@ -296,6 +296,7 @@ typedef struct settings bool all_users_control_menu; #if defined(VITA) bool backtouch_enable; + bool backtouch_toggle; #endif #if TARGET_OS_IPHONE bool small_keyboard_enable; diff --git a/input/drivers_joypad/psp_joypad.c b/input/drivers_joypad/psp_joypad.c index 1a1cfbb968..905b170a27 100644 --- a/input/drivers_joypad/psp_joypad.c +++ b/input/drivers_joypad/psp_joypad.c @@ -97,6 +97,7 @@ static bool psp_joypad_init(void *data) psp2_model = sceKernelGetModelForCDialog(); if (psp2_model != SCE_KERNEL_MODEL_VITATV) { sceTouchSetSamplingState(SCE_TOUCH_PORT_BACK, SCE_TOUCH_SAMPLING_STATE_START); + sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START); players_count = 1; } sceCtrlGetControllerPortInfo(&curr_ctrl_info); @@ -237,11 +238,11 @@ static void psp_joypad_poll(void) if (psp2_model == SCE_KERNEL_MODEL_VITA && !menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) && settings->input.backtouch_enable) { - SceTouchData back = {0}; - sceTouchPeek(SCE_TOUCH_PORT_BACK, &back, 1); - for (int i = 0; i < back.reportNum; i++) { - int x = LERP(back.report[i].x, TOUCH_MAX_WIDTH, SCREEN_WIDTH); - int y = LERP(back.report[i].y, TOUCH_MAX_HEIGHT, SCREEN_HEIGHT); + SceTouchData touch_surface = {0}; + sceTouchPeek(settings->input.backtouch_toggle ? SCE_TOUCH_PORT_FRONT : SCE_TOUCH_PORT_BACK, &touch_surface, 1); + for (int i = 0; i < touch_surface.reportNum; i++) { + int x = LERP(touch_surface.report[i].x, TOUCH_MAX_WIDTH, SCREEN_WIDTH); + int y = LERP(touch_surface.report[i].y, TOUCH_MAX_HEIGHT, SCREEN_HEIGHT); if (NW_AREA(x, y)) state_tmp.buttons |= PSP_CTRL_L2; if (NE_AREA(x, y)) state_tmp.buttons |= PSP_CTRL_R2; if (SW_AREA(x, y)) state_tmp.buttons |= PSP_CTRL_L3; diff --git a/intl/msg_hash_jp.c b/intl/msg_hash_jp.c index 158f706eab..71ac02746e 100644 --- a/intl/msg_hash_jp.c +++ b/intl/msg_hash_jp.c @@ -1508,6 +1508,12 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len) "Numbers are described in frames." ); break; + case MENU_ENUM_LABEL_INPUT_TOUCH_ENABLE: + snprintf(s, len, "Enable touch support"); + break; + case MENU_ENUM_LABEL_INPUT_PREFER_FRONT_TOUCH: + snprintf(s, len, "Use front instead of back touch"); + break; case MENU_ENUM_LABEL_MOUSE_ENABLE: snprintf(s, len, "Enable mouse input inside the menu."); break; @@ -2036,8 +2042,10 @@ static const char *menu_hash_to_str_jp_label_enum(enum msg_hash_enums msg) return "cheevos_test_unofficial"; case MENU_ENUM_LABEL_CHEEVOS_ENABLE: return "cheevos_enable"; - case MENU_ENUM_LABEL_INPUT_BACKTOUCH_ENABLE: - return "input_backtouch_enable"; + case MENU_ENUM_LABEL_INPUT_TOUCH_ENABLE: + return "input_touch_enable"; + case MENU_ENUM_LABEL_INPUT_PREFER_FRONT_TOUCH: + return "input_prefer_front_touch"; case MENU_ENUM_LABEL_INPUT_ICADE_ENABLE: return "input_icade_enable"; case MENU_ENUM_LABEL_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE: diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c index 2741935c58..5fb7cd3c8a 100644 --- a/intl/msg_hash_us.c +++ b/intl/msg_hash_us.c @@ -2098,8 +2098,10 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg) return "cheevos_test_unofficial"; case MENU_ENUM_LABEL_CHEEVOS_ENABLE: return "cheevos_enable"; - case MENU_ENUM_LABEL_INPUT_BACKTOUCH_ENABLE: - return "input_backtouch_enable"; + case MENU_ENUM_LABEL_INPUT_TOUCH_ENABLE: + return "input_touch_enable"; + case MENU_ENUM_LABEL_INPUT_PREFER_FRONT_TOUCH: + return "input_prefer_front_touch"; case MENU_ENUM_LABEL_INPUT_ICADE_ENABLE: return "input_icade_enable"; case MENU_ENUM_LABEL_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE: @@ -3516,7 +3518,9 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg) case MENU_ENUM_LABEL_VALUE_CHEEVOS_SETTINGS: return "Retro Achievements"; case MENU_ENUM_LABEL_VALUE_INPUT_BACKTOUCH_ENABLE: - return "Backtouch Enable"; + return "Touch Enable"; + case MENU_ENUM_LABEL_VALUE_INPUT_BACKTOUCH_TOGGLE_ENABLE: + return "Prefer Front Touch"; case MENU_ENUM_LABEL_VALUE_INPUT_ICADE_ENABLE: return "Keyboard Gamepad Mapping Enable"; case MENU_ENUM_LABEL_VALUE_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE: diff --git a/intl/msg_hash_uspseudo.c b/intl/msg_hash_uspseudo.c index 3f0defdb4f..99143021d7 100644 --- a/intl/msg_hash_uspseudo.c +++ b/intl/msg_hash_uspseudo.c @@ -2041,8 +2041,10 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg) return "cheëvòs_tëst_ünõffìçial"; case MENU_ENUM_LABEL_CHEEVOS_ENABLE: return "çheévós_enable"; - case MENU_ENUM_LABEL_INPUT_BACKTOUCH_ENABLE: - return "iñput_bâçktõüçh_ènable"; + case MENU_ENUM_LABEL_INPUT_TOUCH_ENABLE: + return "iñput_tõüçh_ènable"; + case MENU_ENUM_LABEL_INPUT_PREFER_FRONT_TOUCH: + return "iñput_prefer_front_tõüçh"; case MENU_ENUM_LABEL_INPUT_ICADE_ENABLE: return "iñput_îçâde_ènable"; case MENU_ENUM_LABEL_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE: diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 96af87a8ee..8b53195c1a 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5227,6 +5227,14 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) ret = menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_INPUT_BACK_AS_MENU_TOGGLE_ENABLE, PARSE_ONLY_BOOL, false); +#endif +#ifdef VITA + ret = menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_INPUT_TOUCH_ENABLE, + PARSE_ONLY_BOOL, false); + ret = menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_INPUT_PREFER_FRONT_TOUCH, + PARSE_ONLY_BOOL, false); #endif ret = menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, PARSE_ONLY_UINT, false); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index b7c20d8209..e48c3171df 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4095,7 +4095,7 @@ static bool setting_append_list( CONFIG_BOOL( list, list_info, &settings->input.backtouch_enable, - msg_hash_to_str(MENU_ENUM_LABEL_INPUT_BACKTOUCH_ENABLE), + msg_hash_to_str(MENU_ENUM_LABEL_INPUT_TOUCH_ENABLE), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_BACKTOUCH_ENABLE), input_backtouch_enable, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), @@ -4107,7 +4107,24 @@ static bool setting_append_list( general_read_handler, SD_FLAG_NONE ); - menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_INPUT_DESCRIPTOR_HIDE_UNBOUND); + menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_INPUT_TOUCH_ENABLE); + + CONFIG_BOOL( + list, list_info, + &settings->input.backtouch_toggle, + msg_hash_to_str(MENU_ENUM_LABEL_INPUT_PREFER_FRONT_TOUCH), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_BACKTOUCH_TOGGLE_ENABLE), + input_backtouch_toggle, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON), + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE + ); + menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_INPUT_PREFER_FRONT_TOUCH); #endif #if TARGET_OS_IPHONE diff --git a/msg_hash.h b/msg_hash.h index 8709ccf830..a54ef3116c 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -434,7 +434,8 @@ enum msg_hash_enums MENU_ENUM_LABEL_INPUT_REMAP_BINDS_ENABLE, MENU_ENUM_LABEL_INPUT_AXIS_THRESHOLD, MENU_ENUM_LABEL_INPUT_SMALL_KEYBOARD_ENABLE, - MENU_ENUM_LABEL_INPUT_BACKTOUCH_ENABLE, + MENU_ENUM_LABEL_INPUT_TOUCH_ENABLE, + MENU_ENUM_LABEL_INPUT_PREFER_FRONT_TOUCH, MENU_ENUM_LABEL_INPUT_ICADE_ENABLE, MENU_ENUM_LABEL_INPUT_USER_1_BINDS, MENU_ENUM_LABEL_INPUT_USER_2_BINDS, @@ -485,6 +486,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_INPUT_BACK_AS_MENU_TOGGLE_ENABLE, MENU_ENUM_LABEL_VALUE_INPUT_SMALL_KEYBOARD_ENABLE, MENU_ENUM_LABEL_VALUE_INPUT_BACKTOUCH_ENABLE, + MENU_ENUM_LABEL_VALUE_INPUT_BACKTOUCH_TOGGLE_ENABLE, MENU_ENUM_LABEL_VALUE_INPUT_ICADE_ENABLE, /* Video */