Check menu toggle before menu event (#15646)

This commit is contained in:
sonninnos 2023-08-28 01:48:47 +03:00 committed by GitHub
parent 01662ec228
commit 600beba18b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 24 deletions

View File

@ -5237,6 +5237,10 @@ unsigned menu_event(
ok_old = ok_current;
/* Menu must be alive */
if (!(menu_st->flags & MENU_ST_FLAG_ALIVE))
return ret;
/* Get pointer (mouse + touchscreen) input
* Note: Must be done regardless of menu screensaver
* state */

View File

@ -5770,6 +5770,31 @@ static enum runloop_state_enum runloop_check_state(
}
}
#ifdef HAVE_MENU
/* Check menu hotkey */
{
static bool old_pressed = false;
char *menu_driver = settings->arrays.menu_driver;
bool pressed = BIT256_GET(current_bits, RARCH_MENU_TOGGLE)
&& !string_is_equal(menu_driver, "null");
bool core_type_is_dummy = runloop_st->current_core_type == CORE_TYPE_DUMMY;
if ( (pressed && !old_pressed)
|| core_type_is_dummy)
{
if (menu_st->flags & MENU_ST_FLAG_ALIVE)
{
if (rarch_is_initialized && !core_type_is_dummy)
retroarch_menu_running_finished(false);
}
else
retroarch_menu_running();
}
old_pressed = pressed;
}
#endif
#if defined(HAVE_MENU) || defined(HAVE_GFX_WIDGETS)
gfx_animation_update(
current_time,
@ -6020,30 +6045,6 @@ static enum runloop_state_enum runloop_check_state(
/* Check close content hotkey */
HOTKEY_CHECK(RARCH_CLOSE_CONTENT_KEY, CMD_EVENT_CLOSE_CONTENT, true, NULL);
#ifdef HAVE_MENU
/* Check menu hotkey */
{
static bool old_pressed = false;
char *menu_driver = settings->arrays.menu_driver;
bool pressed = BIT256_GET(current_bits, RARCH_MENU_TOGGLE)
&& !string_is_equal(menu_driver, "null");
bool core_type_is_dummy = runloop_st->current_core_type == CORE_TYPE_DUMMY;
if ( (pressed && !old_pressed)
|| core_type_is_dummy)
{
if (menu_st->flags & MENU_ST_FLAG_ALIVE)
{
if (rarch_is_initialized && !core_type_is_dummy)
retroarch_menu_running_finished(false);
}
else
retroarch_menu_running();
}
old_pressed = pressed;
}
#endif
/* Check FPS hotkey */
HOTKEY_CHECK(RARCH_FPS_TOGGLE, CMD_EVENT_FPS_TOGGLE, true, NULL);