From 97bc2da36c2e4a2c0b5d82843e08f35c67ee145c Mon Sep 17 00:00:00 2001 From: sonninnos Date: Sat, 17 May 2025 18:53:17 +0300 Subject: [PATCH] Fix menu core unload --- menu/cbs/menu_cbs_ok.c | 12 ++++++++++++ menu/cbs/menu_cbs_start.c | 5 +++-- menu/menu_setting.c | 1 - tasks/task_content.c | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 99a5f25b25..101f7f0ef3 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -7785,6 +7785,17 @@ static int action_ok_start_core(const char *path, return 0; } +static int action_ok_unload_core(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + struct menu_state *menu_st = menu_state_get_ptr(); + int ret = generic_action_ok_command(CMD_EVENT_UNLOAD_CORE); + path_clear(RARCH_PATH_CORE_LAST); + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH + | MENU_ST_FLAG_PREVENT_POPULATE; + return 0; +} + static int action_ok_contentless_core_run(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -9030,6 +9041,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, {MENU_ENUM_LABEL_FILE_BROWSER_CORE, action_ok_load_core}, {MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION,action_ok_core_deferred_set}, {MENU_ENUM_LABEL_FILE_BROWSER_CORE_SELECT_FROM_COLLECTION_CURRENT_CORE,action_ok_core_deferred_set}, + {MENU_ENUM_LABEL_CORE_LIST_UNLOAD, action_ok_unload_core}, {MENU_ENUM_LABEL_START_CORE, action_ok_start_core}, {MENU_ENUM_LABEL_START_NET_RETROPAD, action_ok_start_net_retropad_core}, {MENU_ENUM_LABEL_START_VIDEO_PROCESSOR, action_ok_start_video_processor_core}, diff --git a/menu/cbs/menu_cbs_start.c b/menu/cbs/menu_cbs_start.c index 97f50ce12e..3a07faa3b2 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -39,6 +39,7 @@ #endif #include "../../retroarch.h" #include "../../verbosity.h" +#include "../../paths.h" #include "../../performance_counters.h" #include "../../playlist.h" #include "../../manual_content_scan.h" @@ -634,8 +635,8 @@ static int action_start_load_core( unsigned type, size_t idx, size_t entry_idx) { struct menu_state *menu_st = menu_state_get_ptr(); - int ret = generic_action_ok_command( - CMD_EVENT_UNLOAD_CORE); + int ret = generic_action_ok_command(CMD_EVENT_UNLOAD_CORE); + path_clear(RARCH_PATH_CORE_LAST); menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH | MENU_ST_FLAG_PREVENT_POPULATE; return ret; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index c965b56507..f3119835a0 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -9884,7 +9884,6 @@ static bool setting_append_list( &group_info, &subgroup_info, parent_group); - MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_UNLOAD_CORE); } } diff --git a/tasks/task_content.c b/tasks/task_content.c index 6fb9f22f4c..233654820b 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -2114,6 +2114,7 @@ bool task_push_load_content_from_playlist_from_menu( * > Forget manually loaded core */ path_set(RARCH_PATH_CORE, core_path); path_clear(RARCH_PATH_CORE_LAST); + #ifdef HAVE_DYNAMIC command_event(CMD_EVENT_LOAD_CORE, NULL); #else @@ -2469,6 +2470,7 @@ bool task_push_load_content_with_new_core_from_menu( path_set(RARCH_PATH_CONTENT, fullpath); path_set(RARCH_PATH_CORE, core_path); + path_clear(RARCH_PATH_CORE_LAST); #ifdef HAVE_DYNAMIC /* Load core */