Merge pull request #3803 from notnotme/feature/vita_toggle_touch

Feature/vita toggle touch
This commit is contained in:
Francisco José García García 2016-10-15 12:56:14 +01:00 committed by GitHub
commit 579897436d
10 changed files with 61 additions and 16 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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);

View File

@ -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

View File

@ -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 */