Implement menu toggle in a better way

This commit is contained in:
twinaphex 2014-09-25 18:38:35 +02:00
parent d94e8329e8
commit d1d504df6c
2 changed files with 7 additions and 10 deletions

View File

@ -301,8 +301,7 @@ bool menu_custom_bind_keyboard_cb(void *data, unsigned code)
uint64_t menu_input(void)
{
unsigned i;
uint64_t input_state = 0;
retro_input_t input_meta = 0, old_state = 0;
retro_input_t input_state = 0, old_state = 0;
static const struct retro_keybind *binds[] = { g_settings.input.binds[0] };
if (!driver.menu)
@ -318,12 +317,6 @@ uint64_t menu_input(void)
input_state = input_keys_pressed(0, RETRO_DEVICE_ID_JOYPAD_R2, binds);
input_meta = meta_input_keys_pressed(RARCH_MENU_TOGGLE, RARCH_MENU_TOGGLE + 1,
&old_state);
input_state |= BIND_PRESSED(input_meta, RARCH_MENU_TOGGLE)
? (1ULL << RARCH_MENU_TOGGLE) : 0;
input_pop_analog_dpad((struct retro_keybind*)binds[0]);
for (i = 0; i < MAX_PLAYERS; i++)
input_pop_analog_dpad(g_settings.input.autoconf_binds[i]);
@ -337,7 +330,7 @@ uint64_t menu_input(void)
| (1ULL << RETRO_DEVICE_ID_JOYPAD_RIGHT)
| (1ULL << RETRO_DEVICE_ID_JOYPAD_L)
| (1ULL << RETRO_DEVICE_ID_JOYPAD_R)
)) && !(input_state & (1ULL << RARCH_MENU_TOGGLE));
));
return input_state;
}

View File

@ -3220,7 +3220,11 @@ bool rarch_main_iterate(void)
if (g_extern.is_menu)
{
if (!menu_iterate(input, old_input, trigger_input))
if (
!menu_iterate(input, old_input, trigger_input) ||
(check_enter_menu_func(trigger_input) &&
g_extern.main_is_init && !g_extern.libretro_dummy)
)
{
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED);
driver_set_nonblock_state(driver.nonblock_state);