Reimplement menu toggle in menu - now remembers last menu

(Disp) Menu display drivers shouldn't influence control flow
of menu, so take this out and move menu toggle control flow
to menu_backend driver
instead
This commit is contained in:
twinaphex 2014-09-14 18:07:00 +02:00
parent aae73438de
commit eff9bf17a8
8 changed files with 14 additions and 41 deletions

View File

@ -1409,6 +1409,13 @@ static int menu_common_iterate(unsigned action)
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture) if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
driver.menu_ctx->set_texture(driver.menu); driver.menu_ctx->set_texture(driver.menu);
if (action == MENU_ACTION_TOGGLE &&
g_extern.main_is_init && !g_extern.libretro_dummy)
{
rarch_main_command(RARCH_CMD_RESUME);
return -1;
}
if (!strcmp(menu_label, "help")) if (!strcmp(menu_label, "help"))
return menu_start_screen_iterate(action); return menu_start_screen_iterate(action);
else if (!strcmp(menu_label, "info_screen")) else if (!strcmp(menu_label, "info_screen"))

View File

@ -316,14 +316,6 @@ static int glui_input_postprocess(uint64_t old_state)
{ {
(void)old_state; (void)old_state;
if ((driver.menu->trigger_state & (1ULL << RARCH_MENU_TOGGLE)) &&
g_extern.main_is_init &&
!g_extern.libretro_dummy)
{
rarch_main_command(RARCH_CMD_RESUME);
return -1;
}
return 0; return 0;
} }

View File

@ -1069,11 +1069,7 @@ static int lakka_input_postprocess(uint64_t old_state)
& (1ULL << RARCH_MENU_TOGGLE)) && & (1ULL << RARCH_MENU_TOGGLE)) &&
g_extern.main_is_init && g_extern.main_is_init &&
!g_extern.libretro_dummy) !g_extern.libretro_dummy)
{
global_alpha = 0; global_alpha = 0;
rarch_main_command(RARCH_CMD_RESUME);
return -1;
}
if (! global_alpha) if (! global_alpha)
add_tween(LAKKA_DELAY, 1.0, &global_alpha, &inOutQuad, NULL); add_tween(LAKKA_DELAY, 1.0, &global_alpha, &inOutQuad, NULL);

View File

@ -454,16 +454,6 @@ static void rgui_free(void *data)
static int rgui_input_postprocess(uint64_t old_state) static int rgui_input_postprocess(uint64_t old_state)
{ {
(void)old_state;
if ((driver.menu->trigger_state & (1ULL << RARCH_MENU_TOGGLE)) &&
g_extern.main_is_init &&
!g_extern.libretro_dummy)
{
rarch_main_command(RARCH_CMD_RESUME);
return -1;
}
return 0; return 0;
} }

View File

@ -328,16 +328,7 @@ static void rmenu_free(void *data)
static int rmenu_input_postprocess(uint64_t old_state) static int rmenu_input_postprocess(uint64_t old_state)
{ {
menu_handle_t *menu = (menu_handle_t*)driver.menu; (void)old_state;
if ((menu->trigger_state & (1ULL << RARCH_MENU_TOGGLE)) &&
g_extern.main_is_init &&
!g_extern.libretro_dummy)
{
rarch_main_command(RARCH_CMD_RESUME);
return -1;
}
return 0; return 0;
} }

View File

@ -343,12 +343,7 @@ static void rmenu_xui_frame(void)
static int rmenu_xui_input_postprocess(uint64_t old_state) static int rmenu_xui_input_postprocess(uint64_t old_state)
{ {
if ((driver.menu->trigger_state & (1ULL << RARCH_MENU_TOGGLE)) && (void)old_state;
g_extern.main_is_init)
{
rarch_main_command(RARCH_CMD_RESUME);
return -1;
}
return 0; return 0;
} }

View File

@ -295,6 +295,8 @@ static unsigned input_frame(uint64_t trigger_state)
return MENU_ACTION_START; return MENU_ACTION_START;
if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_SELECT)) if (trigger_state & (1ULL << RETRO_DEVICE_ID_JOYPAD_SELECT))
return MENU_ACTION_SELECT; return MENU_ACTION_SELECT;
if (trigger_state & (1ULL << RARCH_MENU_TOGGLE))
return MENU_ACTION_TOGGLE;
return MENU_ACTION_NOOP; return MENU_ACTION_NOOP;
} }
@ -304,7 +306,6 @@ bool menu_iterate(void)
static bool initial_held = true; static bool initial_held = true;
static bool first_held = false; static bool first_held = false;
uint64_t input_state = 0; uint64_t input_state = 0;
int32_t input_entry_ret = 0;
int32_t ret = 0; int32_t ret = 0;
if (!driver.menu) if (!driver.menu)
@ -371,7 +372,7 @@ bool menu_iterate(void)
if (driver.menu_ctx && driver.menu_ctx->backend if (driver.menu_ctx && driver.menu_ctx->backend
&& driver.menu_ctx->backend->iterate) && driver.menu_ctx->backend->iterate)
input_entry_ret = driver.menu_ctx->backend->iterate(action); driver.menu_ctx->backend->iterate(action);
draw_frame(true); draw_frame(true);
throttle_frame(); throttle_frame();
@ -383,7 +384,7 @@ bool menu_iterate(void)
if (ret < 0) if (ret < 0)
menu_flush_stack_type(driver.menu->menu_stack, MENU_SETTINGS); menu_flush_stack_type(driver.menu->menu_stack, MENU_SETTINGS);
if (ret || input_entry_ret) if (ret)
return false; return false;
return true; return true;

View File

@ -94,6 +94,7 @@ typedef enum
MENU_ACTION_MESSAGE, MENU_ACTION_MESSAGE,
MENU_ACTION_SCROLL_DOWN, MENU_ACTION_SCROLL_DOWN,
MENU_ACTION_SCROLL_UP, MENU_ACTION_SCROLL_UP,
MENU_ACTION_TOGGLE,
MENU_ACTION_NOOP MENU_ACTION_NOOP
} menu_action_t; } menu_action_t;