add hold-select to hardcoded menu gamepad combos (#10827)

* add hold-select to hardcoded menu gamepad combos
This commit is contained in:
hizzlekizzle 2020-06-09 21:54:28 -05:00 committed by GitHub
parent 9e7ca7cbbe
commit db63e0a60a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 2 deletions

View File

@ -60,6 +60,7 @@ enum input_toggle_type
INPUT_TOGGLE_L3_R,
INPUT_TOGGLE_L_R,
INPUT_TOGGLE_HOLD_START,
INPUT_TOGGLE_HOLD_SELECT,
INPUT_TOGGLE_DOWN_SELECT,
INPUT_TOGGLE_LAST
};

View File

@ -6593,6 +6593,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_HOLD_START,
"Hold Start (2 seconds)"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_HOLD_SELECT,
"Hold Select (2 seconds)"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_DOWN_SELECT,
"Down + Select"

View File

@ -5775,6 +5775,9 @@ static void setting_get_string_representation_toggle_gamepad_combo(
case INPUT_TOGGLE_HOLD_START:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_HOLD_START), len);
break;
case INPUT_TOGGLE_HOLD_SELECT:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_HOLD_SELECT), len);
break;
case INPUT_TOGGLE_DOWN_SELECT:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DOWN_SELECT), len);
break;

View File

@ -2745,6 +2745,7 @@ enum msg_hash_enums
MENU_ENUM_SUBLABEL_SWITCH_CPU_PROFILE,
MENU_ENUM_LABEL_VALUE_HOLD_START,
MENU_ENUM_LABEL_VALUE_HOLD_SELECT,
MENU_ENUM_LABEL_VALUE_DOWN_SELECT,
MENU_LABEL(PLAYLIST_USE_OLD_FORMAT),
MENU_LABEL(PLAYLIST_COMPRESSION),

View File

@ -1030,7 +1030,7 @@ static const camera_driver_t *camera_drivers[] = {
#endif
#define SHADER_FILE_WATCH_DELAY_MSEC 500
#define HOLD_START_DELAY_SEC 2
#define HOLD_BTN_DELAY_SEC 2
#define QUIT_DELAY_USEC 3 * 1000000 /* 3 seconds */
@ -35952,7 +35952,7 @@ static bool input_driver_toggle_button_combo(
if (!rarch_timer_is_running(&timer))
{
rarch_timer_begin_new_time_us(&timer,
HOLD_START_DELAY_SEC * 1000000);
HOLD_BTN_DELAY_SEC * 1000000);
timer.timer_begin = true;
timer.timer_end = false;
}
@ -35968,6 +35968,37 @@ static bool input_driver_toggle_button_combo(
return false;
}
case INPUT_TOGGLE_HOLD_SELECT:
{
static rarch_timer_t timer = {0};
if (!BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_SELECT))
{
/* timer only runs while select is held down */
rarch_timer_end(&timer);
return false;
}
/* user started holding down the select button, start the timer */
if (!rarch_timer_is_running(&timer))
{
rarch_timer_begin_new_time_us(&timer,
HOLD_BTN_DELAY_SEC * 1000000);
timer.timer_begin = true;
timer.timer_end = false;
}
rarch_timer_tick(&timer, current_time);
if (!timer.timer_end && rarch_timer_has_expired(&timer))
{
/* select has been held down long enough, stop timer and enter menu */
rarch_timer_end(&timer);
return true;
}
return false;
}
default:
case INPUT_TOGGLE_NONE:
return false;