add cooldown on ok/back buttons in menu, fixes weird wii bug with load core menu

This commit is contained in:
Toad King 2015-07-04 17:11:24 -05:00
parent b0b9ff8d8d
commit 5e6840a9a5

View File

@ -970,6 +970,7 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
unsigned ret = 0;
static bool initial_held = true;
static bool first_held = false;
static int cooldown = 0;
static const retro_input_t input_repeat =
(1UL << RETRO_DEVICE_ID_JOYPAD_UP)
| (1UL << RETRO_DEVICE_ID_JOYPAD_DOWN)
@ -1041,10 +1042,16 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
ret = MENU_ACTION_SCROLL_UP;
else if (trigger_input & (1ULL << settings->menu_scroll_down_btn))
ret = MENU_ACTION_SCROLL_DOWN;
else if (trigger_input & (1ULL << settings->menu_cancel_btn))
else if (trigger_input & (1ULL << settings->menu_cancel_btn) && !cooldown)
{
ret = MENU_ACTION_CANCEL;
else if (trigger_input & (1ULL << settings->menu_ok_btn))
cooldown = 20;
}
else if (trigger_input & (1ULL << settings->menu_ok_btn) && !cooldown)
{
ret = MENU_ACTION_OK;
cooldown = 20;
}
else if (trigger_input & (1ULL << settings->menu_search_btn))
ret = MENU_ACTION_SEARCH;
else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_Y))
@ -1064,6 +1071,9 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
if (settings->menu.pointer.enable)
menu_input_pointer(&ret);
if (cooldown > 0)
cooldown--;
if (trigger_input &&
menu_ctx_driver_get_ptr()->perform_action &&
menu_ctx_driver_get_ptr()->perform_action(menu->userdata, ret))