diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 53bc984e58..2834af81f3 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -305,12 +305,19 @@ void menu_driver_list_free(file_list_t *list, size_t idx, size_t list_size) file_list_free_actiondata(list, idx); } -void menu_driver_list_set_selection(file_list_t *list) +static bool menu_driver_list_set_selection(void *data) { + file_list_t *list = (file_list_t*)data; const menu_ctx_driver_t *driver = menu_driver_ctx; - if (driver && driver->list_set_selection) - driver->list_set_selection(menu_userdata ? menu_userdata : NULL, list); + if (!list) + return false; + + if (!driver || !driver->list_set_selection) + return false; + + driver->list_set_selection(menu_userdata ? menu_userdata : NULL, list); + return true; } size_t menu_driver_list_get_selection(void) @@ -760,6 +767,8 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) case RARCH_MENU_CTL_SHADER_MANAGER_INIT: menu_shader_manager_init(menu_driver_data); return true; + case RARCH_MENU_CTL_LIST_SET_SELECTION: + return menu_driver_list_set_selection(data); default: case RARCH_MENU_CTL_NONE: break; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 3763e2c6c1..d052e50ca9 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -133,6 +133,7 @@ enum rarch_menu_ctl_state RARCH_MENU_CTL_CONTEXT_RESET, RARCH_MENU_CTL_CONTEXT_DESTROY, RARCH_MENU_CTL_SHADER_MANAGER_INIT, + RARCH_MENU_CTL_LIST_SET_SELECTION, RARCH_MENU_CTL_POPULATE_ENTRIES }; @@ -362,8 +363,6 @@ void menu_driver_list_free(file_list_t *list, size_t i, size_t list_size); size_t menu_driver_list_get_size(menu_list_type_t type); -void menu_driver_list_set_selection(file_list_t *list); - void *menu_driver_list_get_entry(menu_list_type_t type, unsigned i); bool menu_driver_list_push(menu_displaylist_info_t *info, unsigned type); diff --git a/menu/menu_entries.c b/menu/menu_entries.c index 0f9926346c..1fb90dde7b 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -172,8 +172,7 @@ static bool menu_list_pop_stack(menu_list_t *list, size_t idx, size_t *directory menu_driver_list_free(menu_list, menu_list->size - 1, menu_list->size - 1); file_list_pop(menu_list, directory_ptr); - menu_driver_list_set_selection(menu_list); - + menu_driver_ctl(RARCH_MENU_CTL_LIST_SET_SELECTION, menu_list); menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); return true;