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)
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"))
return menu_start_screen_iterate(action);
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;
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;
}

View File

@ -1069,11 +1069,7 @@ static int lakka_input_postprocess(uint64_t old_state)
& (1ULL << RARCH_MENU_TOGGLE)) &&
g_extern.main_is_init &&
!g_extern.libretro_dummy)
{
global_alpha = 0;
rarch_main_command(RARCH_CMD_RESUME);
return -1;
}
if (! global_alpha)
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)
{
(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;
}

View File

@ -328,16 +328,7 @@ static void rmenu_free(void *data)
static int rmenu_input_postprocess(uint64_t old_state)
{
menu_handle_t *menu = (menu_handle_t*)driver.menu;
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;
}
(void)old_state;
return 0;
}

View File

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

View File

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

View File

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