mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
do not return to game after canceling quit confirm if user toggled the menu manually
This commit is contained in:
parent
4bc837fe77
commit
ef29bc96b0
@ -128,7 +128,8 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
|
||||
{
|
||||
runloop_set_quit_confirm(false);
|
||||
|
||||
if (content_is_inited())
|
||||
if (content_is_inited() &&
|
||||
menu_display_toggle_get_reason() != MENU_TOGGLE_REASON_USER)
|
||||
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,8 @@
|
||||
|
||||
uintptr_t menu_display_white_texture;
|
||||
|
||||
static enum menu_toggle_reason menu_display_toggle_reason = MENU_TOGGLE_REASON_NONE;
|
||||
|
||||
static menu_display_ctx_driver_t *menu_display_ctx_drivers[] = {
|
||||
#ifdef HAVE_D3D
|
||||
&menu_display_ctx_d3d,
|
||||
@ -59,6 +61,16 @@ static menu_display_ctx_driver_t *menu_display_ctx_drivers[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
enum menu_toggle_reason menu_display_toggle_get_reason(void)
|
||||
{
|
||||
return menu_display_toggle_reason;
|
||||
}
|
||||
|
||||
void menu_display_toggle_set_reason(enum menu_toggle_reason reason)
|
||||
{
|
||||
menu_display_toggle_reason = reason;
|
||||
}
|
||||
|
||||
static const char *menu_video_get_ident(void)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
|
@ -167,6 +167,16 @@ typedef struct menu_display_ctx_font
|
||||
|
||||
typedef uintptr_t menu_texture_item;
|
||||
|
||||
enum menu_toggle_reason
|
||||
{
|
||||
MENU_TOGGLE_REASON_NONE = 0,
|
||||
MENU_TOGGLE_REASON_USER,
|
||||
MENU_TOGGLE_REASON_MESSAGE
|
||||
};
|
||||
|
||||
enum menu_toggle_reason menu_display_toggle_get_reason(void);
|
||||
void menu_display_toggle_set_reason(enum menu_toggle_reason reason);
|
||||
|
||||
void menu_display_blend_begin(void);
|
||||
void menu_display_blend_end(void);
|
||||
|
||||
|
@ -70,6 +70,7 @@ static bool menu_driver_pending_quick_menu = false;
|
||||
static bool menu_driver_prevent_populate = false;
|
||||
static bool menu_driver_load_no_content = false;
|
||||
static bool menu_driver_alive = false;
|
||||
static bool menu_driver_toggled = false;
|
||||
static bool menu_driver_data_own = false;
|
||||
static bool menu_driver_pending_quit = false;
|
||||
static bool menu_driver_pending_shutdown = false;
|
||||
@ -222,6 +223,11 @@ static void menu_driver_toggle(bool latch)
|
||||
retro_keyboard_event_t *frontend_key_event = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
menu_driver_toggled = latch;
|
||||
|
||||
if (!latch)
|
||||
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_NONE);
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_TOGGLE, &latch);
|
||||
|
||||
if (latch)
|
||||
@ -509,6 +515,9 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
break;
|
||||
case RARCH_MENU_CTL_IS_PREVENT_POPULATE:
|
||||
return menu_driver_prevent_populate;
|
||||
case RARCH_MENU_CTL_IS_TOGGLE:
|
||||
return menu_driver_toggled;
|
||||
break;
|
||||
case RARCH_MENU_CTL_SET_TOGGLE:
|
||||
menu_driver_toggle(true);
|
||||
break;
|
||||
|
@ -106,6 +106,7 @@ enum rarch_menu_ctl_state
|
||||
RARCH_MENU_CTL_UNSET_PREVENT_POPULATE,
|
||||
RARCH_MENU_CTL_IS_PREVENT_POPULATE,
|
||||
RARCH_MENU_CTL_SET_TEXTURE,
|
||||
RARCH_MENU_CTL_IS_TOGGLE,
|
||||
RARCH_MENU_CTL_SET_TOGGLE,
|
||||
RARCH_MENU_CTL_UNSET_TOGGLE,
|
||||
RARCH_MENU_CTL_SET_ALIVE,
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <compat/strl.h>
|
||||
#include <features/features_cpu.h>
|
||||
|
||||
#include "menu_display.h"
|
||||
#include "menu_driver.h"
|
||||
#include "menu_popup.h"
|
||||
|
||||
@ -273,6 +274,8 @@ void menu_popup_reset(void)
|
||||
menu_popup_current_id = 0;
|
||||
menu_popup_current_type = MENU_POPUP_NONE;
|
||||
menu_popup_current_msg = MSG_UNKNOWN;
|
||||
|
||||
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_NONE);
|
||||
}
|
||||
|
||||
void menu_popup_show_message(
|
||||
@ -280,6 +283,9 @@ void menu_popup_show_message(
|
||||
{
|
||||
menu_popup_current_msg = msg;
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_IS_TOGGLE, NULL))
|
||||
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_MESSAGE);
|
||||
|
||||
menu_popup_push_pending(true, type);
|
||||
menu_popup_push();
|
||||
}
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include "tasks/tasks_internal.h"
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
#include "menu/menu_display.h"
|
||||
#include "menu/menu_driver.h"
|
||||
#include "menu/menu_popup.h"
|
||||
#endif
|
||||
@ -1361,7 +1362,11 @@ static INLINE int runloop_iterate_time_to_exit(bool quit_key_pressed)
|
||||
!runloop_quit_confirm)
|
||||
{
|
||||
if (content_is_inited())
|
||||
{
|
||||
if(menu_display_toggle_get_reason() != MENU_TOGGLE_REASON_USER)
|
||||
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_MESSAGE);
|
||||
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
|
||||
}
|
||||
|
||||
menu_popup_show_message(MENU_POPUP_QUIT_CONFIRM, MENU_ENUM_LABEL_CONFIRM_ON_EXIT);
|
||||
return 1;
|
||||
@ -1521,8 +1526,11 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_USER);
|
||||
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
@ -1546,6 +1554,7 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||
|
||||
if (ret == -1)
|
||||
goto end;
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user