diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 459387dc1b..b722fa14c0 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -4431,9 +4431,34 @@ static int action_ok_option_create(const char *path, int action_ok_close_content(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - /* This line resets the navigation pointer so the active entry will be "Run" */ + int ret; + + /* Reset navigation pointer + * > If we are returning to the quick menu, want + * the active entry to be 'Run' (first item in + * menu list) */ menu_navigation_set_selection(0); - return generic_action_ok_command(CMD_EVENT_UNLOAD_CORE); + + /* Unload core */ + ret = generic_action_ok_command(CMD_EVENT_UNLOAD_CORE); + + /* If close content was selected via 'Main Menu > Quick Menu', + * have to flush the menu stack back to 'Main Menu' + * (otherwise users will be presented with an empty + * 'No items' quick menu, requiring needless backwards + * navigation) */ + if (type == MENU_SETTING_ACTION_CLOSE) + { + menu_entries_flush_stack(msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU), 0); + /* An annoyance - some menu drivers (Ozone...) call + * RARCH_MENU_CTL_SET_PREVENT_POPULATE in awkward + * places, which can cause breakage here when flushing + * the menu stack. We therefore have to force a + * RARCH_MENU_CTL_UNSET_PREVENT_POPULATE */ + menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL); + } + + return ret; } DEFAULT_ACTION_OK_CMD_FUNC(action_ok_cheat_apply_changes, CMD_EVENT_CHEATS_APPLY) diff --git a/menu/drivers/ozone/ozone_texture.c b/menu/drivers/ozone/ozone_texture.c index 4339206cfa..01660e03b8 100644 --- a/menu/drivers/ozone/ozone_texture.c +++ b/menu/drivers/ozone/ozone_texture.c @@ -371,6 +371,7 @@ uintptr_t ozone_entries_icon_get_texture(ozone_handle_t *ozone, case MENU_SETTING_ACTION_RESUME_ACHIEVEMENTS: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_RESUME]; case MENU_SETTING_ACTION_CLOSE: + case MENU_SETTING_ACTION_CLOSE_HORIZONTAL: case MENU_SETTING_ACTION_DELETE_ENTRY: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CLOSE]; case MENU_SETTING_ACTION_SAVESTATE: diff --git a/menu/drivers/stripes.c b/menu/drivers/stripes.c index 79e3421017..d5b17046de 100644 --- a/menu/drivers/stripes.c +++ b/menu/drivers/stripes.c @@ -2245,6 +2245,7 @@ static uintptr_t stripes_icon_get_id(stripes_handle_t *stripes, case MENU_SETTING_ACTION_RUN: return stripes->textures.list[STRIPES_TEXTURE_RUN]; case MENU_SETTING_ACTION_CLOSE: + case MENU_SETTING_ACTION_CLOSE_HORIZONTAL: return stripes->textures.list[STRIPES_TEXTURE_CLOSE]; case MENU_SETTING_ACTION_SAVESTATE: return stripes->textures.list[STRIPES_TEXTURE_SAVESTATE]; diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 93892dbae6..2d6d86a6b3 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2769,6 +2769,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, case MENU_SETTING_ACTION_RESUME_ACHIEVEMENTS: return xmb->textures.list[XMB_TEXTURE_RESUME]; case MENU_SETTING_ACTION_CLOSE: + case MENU_SETTING_ACTION_CLOSE_HORIZONTAL: case MENU_SETTING_ACTION_DELETE_ENTRY: return xmb->textures.list[XMB_TEXTURE_CLOSE]; case MENU_SETTING_ACTION_SAVESTATE: diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 61b1e28f01..df68ae5806 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1974,7 +1974,7 @@ static int menu_displaylist_parse_horizontal_list( } static int menu_displaylist_parse_load_content_settings( - file_list_t *list) + file_list_t *list, bool horizontal) { unsigned count = 0; settings_t *settings = config_get_ptr(); @@ -2004,12 +2004,22 @@ static int menu_displaylist_parse_load_content_settings( MENU_SETTING_ACTION_RUN, 0, 0)) count++; + /* Note: Entry type depends on whether quick menu + * was accessed via a playlist ('horizontal content') + * or the main menu + * > This allows us to identify a close content event + * triggered via 'Main Menu > Quick Menu', which + * subsequently requires the menu stack to be flushed + * in order to prevent the display of an empty + * 'No items' menu */ if (settings->bools.quick_menu_show_close_content) if (menu_entries_append_enum(list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CLOSE_CONTENT), msg_hash_to_str(MENU_ENUM_LABEL_CLOSE_CONTENT), MENU_ENUM_LABEL_CLOSE_CONTENT, - MENU_SETTING_ACTION_CLOSE, 0, 0)) + horizontal ? MENU_SETTING_ACTION_CLOSE_HORIZONTAL : + MENU_SETTING_ACTION_CLOSE, + 0, 0)) count++; if (settings->bools.quick_menu_show_take_screenshot) @@ -2288,7 +2298,7 @@ static int menu_displaylist_parse_horizontal_content_actions( if (content_loaded) { - if (menu_displaylist_parse_load_content_settings(info->list) == 0) + if (menu_displaylist_parse_load_content_settings(info->list, true) == 0) menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ITEMS), msg_hash_to_str(MENU_ENUM_LABEL_NO_ITEMS), @@ -4594,7 +4604,7 @@ unsigned menu_displaylist_build_list( #endif break; case DISPLAYLIST_CONTENT_SETTINGS: - count = menu_displaylist_parse_load_content_settings(list); + count = menu_displaylist_parse_load_content_settings(list, false); if (count == 0) if (menu_entries_append_enum(list, diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 5587380b1f..2de6321c28 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -96,6 +96,7 @@ enum menu_settings_type MENU_SETTING_ACTION, MENU_SETTING_ACTION_RUN, MENU_SETTING_ACTION_CLOSE, + MENU_SETTING_ACTION_CLOSE_HORIZONTAL, MENU_SETTING_ACTION_CORE_OPTIONS, MENU_SETTING_ACTION_CORE_INPUT_REMAPPING_OPTIONS, MENU_SETTING_ACTION_CORE_CHEAT_OPTIONS,