diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 6398b9b942..70ebed7bec 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -773,8 +773,7 @@ static void glui_context_reset(void) settings->menu.wallpaper, "cb_menu_wallpaper", 0, 1, true); } -static int glui_environ(void *data, void *data2, - menu_environ_cb_t type) +static int glui_environ(menu_environ_cb_t type, void *data) { switch (type) { diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index cf0ffc8d4e..6eb8ad3d3b 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -736,7 +736,7 @@ static void rgui_populate_entries(const char *path, rgui_navigation_set(true); } -static int rgui_environ(void *data, void *data2, menu_environ_cb_t type) +static int rgui_environ(menu_environ_cb_t type, void *data) { switch (type) { diff --git a/menu/drivers/rmenu.c b/menu/drivers/rmenu.c index 68df30f66e..9b23115b22 100644 --- a/menu/drivers/rmenu.c +++ b/menu/drivers/rmenu.c @@ -312,7 +312,7 @@ static void rmenu_free(void *data) { } -static int rmenu_environ(void *data, void *data2, menu_environ_cb_t type) +static int rmenu_environ(menu_environ_cb_t type, void *data) { switch (type) { diff --git a/menu/drivers/rmenu_xui.cpp b/menu/drivers/rmenu_xui.cpp index 99ea8c5d2a..c1c1638fce 100644 --- a/menu/drivers/rmenu_xui.cpp +++ b/menu/drivers/rmenu_xui.cpp @@ -676,7 +676,7 @@ static void rmenu_xui_list_set_selection(file_list_t *list) XuiListSetCurSel(m_menulist, file_list_get_directory_ptr(list)); } -static int rmenu_xui_environ(void *data, void *data2, menu_environ_cb_t type) +static int rmenu_xui_environ(menu_environ_cb_t type, void *data) { switch (type) { diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index b1f1726177..e1aef6a0dc 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1041,37 +1041,37 @@ static void xmb_list_open_horizontal_list(xmb_handle_t *xmb, menu_handle_t *menu static void xmb_refresh_horizontal_list(xmb_handle_t *xmb, menu_handle_t *menu) { - settings_t *settings = config_get_ptr(); - char mediapath[PATH_MAX_LENGTH] = {0}; char themepath[PATH_MAX_LENGTH] = {0}; + + settings_t *settings = config_get_ptr(); + fill_pathname_join(mediapath, settings->assets_directory, "xmb", sizeof(mediapath)); fill_pathname_join(themepath, mediapath, XMB_THEME, sizeof(themepath)); + xmb_context_destroy_horizontal_list(xmb, menu); if (xmb->horizontal_list) free(xmb->horizontal_list); xmb->horizontal_list = NULL; - xmb_context_destroy_horizontal_list(xmb, menu); + xmb_init_horizontal_list(menu, xmb); xmb_context_reset_horizontal_list(xmb, menu, themepath); } -static int xmb_environ(void *data, void *data2, menu_environ_cb_t type) +static int xmb_environ(menu_environ_cb_t type, void *data) { switch (type) { case MENU_ENVIRON_RESET_HORIZONTAL_LIST: { - char mediapath[PATH_MAX_LENGTH] = {0}; - char themepath[PATH_MAX_LENGTH] = {0}; + menu_handle_t *menu = menu_driver_get_ptr(); + xmb_handle_t *xmb = menu ? + (xmb_handle_t*)menu->userdata : NULL; - xmb_handle_t *xmb = (xmb_handle_t*)data; - menu_handle_t *menu = (menu_handle_t*)data2; - settings_t *settings = config_get_ptr(); + if (!xmb || !menu) + return -1; - fill_pathname_join(mediapath, settings->assets_directory, "xmb", sizeof(mediapath)); - fill_pathname_join(themepath, mediapath, XMB_THEME, sizeof(themepath)); - xmb_context_reset_horizontal_list(xmb, menu, themepath); + xmb_refresh_horizontal_list(xmb, menu); } break; default: @@ -1099,12 +1099,6 @@ static void xmb_list_open(xmb_handle_t *xmb) else if (xmb->depth < xmb->old_depth) dir = -1; - /* TODO, call xmb_refresh_horizontal_list when a new scanning process is - started instead of using this condition. It causes a small lag when comming - back to the main menu from a submenu. */ - if (dir == -1 && xmb->depth == 1 && xmb->categories.selection_ptr == 0) - xmb_refresh_horizontal_list(xmb, menu); - xmb_list_open_horizontal_list(xmb, menu); xmb_list_open_old(xmb, xmb->selection_buf_old, diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 7425df62ec..986499d38a 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -467,3 +467,17 @@ void menu_driver_unset_alive(void) { menu_alive = false; } + +bool menu_environment_cb(menu_environ_cb_t type, void *data) +{ + const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr(); + + if (driver->environ_cb) + { + int ret = driver->environ_cb(type, data); + if (ret == 0) + return true; + } + + return false; +} diff --git a/menu/menu_driver.h b/menu/menu_driver.h index e492eb567e..9060d8d738 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -114,8 +114,7 @@ typedef struct menu_ctx_driver uint32_t label_hash, uint32_t menu_label_hash); bool (*load_image)(void *data, menu_image_type_t type); const char *ident; - int (*environ_cb)(void *data, void *data2, - menu_environ_cb_t type); + int (*environ_cb)(menu_environ_cb_t type, void *data); bool (*perform_action)(void* data, unsigned action); } menu_ctx_driver_t; @@ -221,6 +220,8 @@ void menu_driver_unset_alive(void); size_t menu_driver_list_get_selection(void); +bool menu_environment_cb(menu_environ_cb_t type, void *data); + int menu_driver_bind_init(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, size_t idx, const char *elem0, const char *elem1, diff --git a/tasks/task_database.c b/tasks/task_database.c index 0a202fdfa8..5c54b61e63 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -72,6 +72,7 @@ static int database_info_iterate_start RARCH_LOG("msg: %s\n", msg); #endif + db->status = DATABASE_STATUS_ITERATE; return 0; @@ -410,6 +411,9 @@ void rarch_main_data_db_iterate(bool is_thread, void *data) else { rarch_main_msg_queue_push_new(MSG_SCANNING_OF_DIRECTORY_FINISHED, 0, 180, true); +#ifdef HAVE_MENU + menu_environment_cb(MENU_ENVIRON_RESET_HORIZONTAL_LIST, NULL); +#endif db->status = DATABASE_STATUS_FREE; } break;