diff --git a/frontend/menu/disp/lakka.c b/frontend/menu/disp/lakka.c index 392455725e..59505acc5f 100644 --- a/frontend/menu/disp/lakka.c +++ b/frontend/menu/disp/lakka.c @@ -892,70 +892,6 @@ void lakka_init_items(int i, menu_category *mcat, core_info_t corenfo, char* gam } } -static void *lakka_init(void) -{ - int i; - gl_t *gl; - rgui_handle_t *rgui = (rgui_handle_t*)calloc(1, sizeof(*rgui)); - if (!rgui) - return NULL; - - gl = (gl_t*)driver.video_data; - - init_font(gl, g_settings.video.font_path, 6, 1440, 900); - - lakka_init_core_info(rgui); - lakka_init_assets(rgui); - - categories = realloc(categories, num_categories * sizeof(menu_category)); - - lakka_init_settings(); - - for (i = 0; i < num_categories-1; i++) - { - char core_id[256], texturepath[256], gametexturepath[256]; - menu_category mcat; - struct font_output_list out; - core_info_t corenfo = rgui->core_info->list[i]; - - strlcpy(core_id, basename(corenfo.path), sizeof(core_id)); - strlcpy(core_id, str_replace(core_id, ".so", ""), sizeof(core_id)); - strlcpy(core_id, str_replace(core_id, ".dll", ""), sizeof(core_id)); - strlcpy(core_id, str_replace(core_id, ".dylib", ""), sizeof(core_id)); - strlcpy(core_id, str_replace(core_id, "-libretro", ""), sizeof(core_id)); - strlcpy(core_id, str_replace(core_id, "_libretro", ""), sizeof(core_id)); - strlcpy(core_id, str_replace(core_id, "libretro-", ""), sizeof(core_id)); - strlcpy(core_id, str_replace(core_id, "libretro_", ""), sizeof(core_id)); - - strlcpy(texturepath, "/usr/share/retroarch/", sizeof(texturepath)); - strlcat(texturepath, core_id, sizeof(texturepath)); - strlcat(texturepath, ".png", sizeof(texturepath)); - - strlcpy(gametexturepath, sizeof(gametexturepath), "/usr/share/retroarch/"); - strlcat(gametexturepath, core_id, sizeof(gametexturepath)); - strlcat(gametexturepath, "-game.png", sizeof(gametexturepath)); - - mcat.name = corenfo.display_name; - mcat.libretro = corenfo.path; - mcat.icon = png_texture_load(texturepath, &dim, &dim); - mcat.alpha = 0.5; - mcat.zoom = C_PASSIVE_ZOOM; - mcat.active_item = 0; - mcat.num_items = 0; - mcat.items = calloc(mcat.num_items, sizeof(menu_item)); - - font_driver->render_msg(font, mcat.name, &out); - mcat.out = out; - - lakka_init_items(i+1, &mcat, corenfo, gametexturepath, g_settings.content_directory); - - categories[i+1] = mcat; - } - - rgui->last_time = rarch_get_time_usec(); - - return rgui; -} static void lakka_free_assets(void *data) { @@ -997,6 +933,71 @@ static void lakka_init_core_info(void *data) num_categories = rgui->core_info ? rgui->core_info->count + 1 : 1; } +static void *lakka_init(void) +{ + int i; + gl_t *gl; + rgui_handle_t *rgui = (rgui_handle_t*)calloc(1, sizeof(*rgui)); + if (!rgui) + return NULL; + + gl = (gl_t*)driver.video_data; + + init_font(gl, g_settings.video.font_path, 6, 1440, 900); + + lakka_init_core_info(rgui); + lakka_init_assets(rgui); + + categories = realloc(categories, num_categories * sizeof(menu_category)); + + lakka_init_settings(); + + for (i = 0; i < num_categories-1; i++) + { + char core_id[256], texturepath[256], gametexturepath[256]; + menu_category mcat; + struct font_output_list out; + core_info_t corenfo = rgui->core_info->list[i]; + + strlcpy(core_id, basename(corenfo.path), sizeof(core_id)); + strlcpy(core_id, str_replace(core_id, ".so", ""), sizeof(core_id)); + strlcpy(core_id, str_replace(core_id, ".dll", ""), sizeof(core_id)); + strlcpy(core_id, str_replace(core_id, ".dylib", ""), sizeof(core_id)); + strlcpy(core_id, str_replace(core_id, "-libretro", ""), sizeof(core_id)); + strlcpy(core_id, str_replace(core_id, "_libretro", ""), sizeof(core_id)); + strlcpy(core_id, str_replace(core_id, "libretro-", ""), sizeof(core_id)); + strlcpy(core_id, str_replace(core_id, "libretro_", ""), sizeof(core_id)); + + strlcpy(texturepath, "/usr/share/retroarch/", sizeof(texturepath)); + strlcat(texturepath, core_id, sizeof(texturepath)); + strlcat(texturepath, ".png", sizeof(texturepath)); + + strlcpy(gametexturepath, "/usr/share/retroarch/", sizeof(gametexturepath)); + strlcat(gametexturepath, core_id, sizeof(gametexturepath)); + strlcat(gametexturepath, "-game.png", sizeof(gametexturepath)); + + mcat.name = corenfo.display_name; + mcat.libretro = corenfo.path; + mcat.icon = png_texture_load(texturepath, &dim, &dim); + mcat.alpha = 0.5; + mcat.zoom = C_PASSIVE_ZOOM; + mcat.active_item = 0; + mcat.num_items = 0; + mcat.items = calloc(mcat.num_items, sizeof(menu_item)); + + font_driver->render_msg(font, mcat.name, &out); + mcat.out = out; + + lakka_init_items(i+1, &mcat, corenfo, gametexturepath, g_settings.content_directory); + + categories[i+1] = mcat; + } + + rgui->last_time = rarch_get_time_usec(); + + return rgui; +} + const menu_ctx_driver_t menu_ctx_lakka = { lakka_set_texture, NULL,