mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-25 12:20:48 +00:00
Move core_info/core_info_current to global
This commit is contained in:
parent
55aa477232
commit
c92269dedf
@ -21,7 +21,6 @@
|
||||
#include <stdint.h>
|
||||
#include "boolean.h"
|
||||
#include "file_list.h"
|
||||
#include "core_info.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -88,8 +87,6 @@ typedef struct
|
||||
bool msg_force;
|
||||
bool push_start_screen;
|
||||
|
||||
core_info_list_t *core_info;
|
||||
core_info_t *core_info_current;
|
||||
bool defer_core;
|
||||
char deferred_path[PATH_MAX];
|
||||
|
||||
|
@ -1948,7 +1948,7 @@ static int menu_action_ok(const char *dir,
|
||||
if (driver.menu->defer_core)
|
||||
{
|
||||
const core_info_t *info = NULL;
|
||||
int ret = rarch_defer_core(info, driver.menu->core_info,
|
||||
int ret = rarch_defer_core(info, g_extern.core_info,
|
||||
dir, path, driver.menu->deferred_path,
|
||||
sizeof(driver.menu->deferred_path));
|
||||
|
||||
|
@ -869,7 +869,7 @@ static void lakka_context_reset(void *data)
|
||||
fill_pathname_join(iconpath, themepath, icon_dir, sizeof(iconpath));
|
||||
fill_pathname_slash(iconpath, sizeof(iconpath));
|
||||
|
||||
info_list = (core_info_list_t*)menu->core_info;
|
||||
info_list = (core_info_list_t*)g_extern.core_info;
|
||||
info = NULL;
|
||||
|
||||
if (info_list)
|
||||
@ -1024,21 +1024,10 @@ static int lakka_input_postprocess(uint64_t old_state)
|
||||
|
||||
static void lakka_init_core_info(void *data)
|
||||
{
|
||||
core_info_list_t *core;
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
(void)data;
|
||||
|
||||
core_info_list_free(menu->core_info);
|
||||
menu->core_info = NULL;
|
||||
|
||||
menu->core_info = (core_info_list_t*)
|
||||
core_info_list_new(*g_settings.libretro_directory ?
|
||||
g_settings.libretro_directory : "/usr/lib/libretro");
|
||||
|
||||
if (menu->core_info)
|
||||
{
|
||||
core = (core_info_list_t*)menu->core_info;
|
||||
num_categories = menu->core_info ? core->count + 1 : 1;
|
||||
}
|
||||
if (g_extern.core_info)
|
||||
num_categories = g_extern.core_info->count + 1;
|
||||
}
|
||||
|
||||
static void *lakka_init(void)
|
||||
@ -1063,7 +1052,7 @@ static void *lakka_init(void)
|
||||
core_info_list_t *info_list;
|
||||
menu_category_t *category = (menu_category_t*)&categories[i];
|
||||
|
||||
info_list = (core_info_list_t*)menu->core_info;
|
||||
info_list = (core_info_list_t*)g_extern.core_info;
|
||||
info = NULL;
|
||||
|
||||
if (info_list)
|
||||
|
@ -574,16 +574,6 @@ void rgui_set_texture(void *data)
|
||||
menu_framebuf, false, menu->width, menu->height, 1.0f);
|
||||
}
|
||||
|
||||
static void rgui_init_core_info(void *data)
|
||||
{
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
|
||||
core_info_list_free(menu->core_info);
|
||||
menu->core_info = NULL;
|
||||
if (*g_settings.libretro_directory)
|
||||
menu->core_info = core_info_list_new(g_settings.libretro_directory);
|
||||
}
|
||||
|
||||
const menu_ctx_driver_t menu_ctx_rgui = {
|
||||
rgui_set_texture,
|
||||
rgui_render_messagebox,
|
||||
@ -607,7 +597,7 @@ const menu_ctx_driver_t menu_ctx_rgui = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
rgui_init_core_info,
|
||||
NULL,
|
||||
&menu_ctx_backend_common,
|
||||
"rgui",
|
||||
};
|
||||
|
@ -445,16 +445,6 @@ static int rmenu_input_postprocess(uint64_t old_state)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rmenu_init_core_info(void *data)
|
||||
{
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
|
||||
core_info_list_free(menu->core_info);
|
||||
menu->core_info = NULL;
|
||||
if (*g_settings.libretro_directory)
|
||||
menu->core_info = core_info_list_new(g_settings.libretro_directory);
|
||||
}
|
||||
|
||||
const menu_ctx_driver_t menu_ctx_rmenu = {
|
||||
rmenu_set_texture,
|
||||
rmenu_render_messagebox,
|
||||
@ -478,7 +468,7 @@ const menu_ctx_driver_t menu_ctx_rmenu = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
rmenu_init_core_info,
|
||||
NULL,
|
||||
&menu_ctx_backend_common,
|
||||
"rmenu",
|
||||
};
|
||||
|
@ -640,16 +640,6 @@ static void rmenu_xui_list_set_selection(void *data)
|
||||
XuiListSetCurSel(m_menulist, file_list_get_directory_ptr(list));
|
||||
}
|
||||
|
||||
static void rmenu_xui_init_core_info(void *data)
|
||||
{
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
|
||||
core_info_list_free(menu->core_info);
|
||||
menu->core_info = NULL;
|
||||
if (*g_settings.libretro_directory)
|
||||
menu->core_info = core_info_list_new(g_settings.libretro_directory);
|
||||
}
|
||||
|
||||
const menu_ctx_driver_t menu_ctx_rmenu_xui = {
|
||||
NULL,
|
||||
rmenu_xui_render_messagebox,
|
||||
@ -673,7 +663,7 @@ const menu_ctx_driver_t menu_ctx_rmenu_xui = {
|
||||
rmenu_xui_list_delete,
|
||||
rmenu_xui_list_clear,
|
||||
rmenu_xui_list_set_selection,
|
||||
rmenu_xui_init_core_info,
|
||||
NULL,
|
||||
&menu_ctx_backend_common,
|
||||
"rmenu_xui",
|
||||
};
|
||||
|
@ -28,15 +28,15 @@ void menu_update_system_info(menu_handle_t *menu, bool *load_no_content)
|
||||
libretro_get_system_info(g_settings.libretro, &menu->info,
|
||||
load_no_content);
|
||||
#endif
|
||||
if (menu->core_info)
|
||||
if (g_extern.core_info)
|
||||
{
|
||||
/* Keep track of info for the currently selected core. */
|
||||
|
||||
if (core_info_list_get_info(menu->core_info,
|
||||
menu->core_info_current, g_settings.libretro))
|
||||
if (core_info_list_get_info(g_extern.core_info,
|
||||
g_extern.core_info_current, g_settings.libretro))
|
||||
{
|
||||
const core_info_t *info = (const core_info_t*)
|
||||
menu->core_info_current;
|
||||
g_extern.core_info_current;
|
||||
|
||||
RARCH_LOG("[Core Info]:\n");
|
||||
if (info->display_name)
|
||||
@ -95,10 +95,9 @@ static void load_menu_content_prepare(void)
|
||||
}
|
||||
|
||||
content_playlist_push(g_extern.history,
|
||||
*g_extern.fullpath ? g_extern.fullpath : NULL,
|
||||
g_extern.fullpath,
|
||||
g_settings.libretro,
|
||||
driver.menu->info.library_name ?
|
||||
driver.menu->info.library_name : "");
|
||||
driver.menu->info.library_name);
|
||||
}
|
||||
|
||||
/* redraw menu frame */
|
||||
@ -133,10 +132,10 @@ static void menu_update_libretro_info(menu_handle_t *menu)
|
||||
retro_get_system_info(&menu->info);
|
||||
#endif
|
||||
|
||||
core_info_list_free(menu->core_info);
|
||||
menu->core_info = NULL;
|
||||
core_info_list_free(g_extern.core_info);
|
||||
g_extern.core_info = NULL;
|
||||
if (*g_settings.libretro_directory)
|
||||
menu->core_info = core_info_list_new(g_settings.libretro_directory);
|
||||
g_extern.core_info = core_info_list_new(g_settings.libretro_directory);
|
||||
|
||||
menu_update_system_info(menu, NULL);
|
||||
}
|
||||
@ -208,7 +207,7 @@ void *menu_init(const void *data)
|
||||
|
||||
menu->menu_stack = (file_list_t*)calloc(1, sizeof(file_list_t));
|
||||
menu->selection_buf = (file_list_t*)calloc(1, sizeof(file_list_t));
|
||||
menu->core_info_current = (core_info_t*)calloc(1, sizeof(core_info_t));
|
||||
g_extern.core_info_current = (core_info_t*)calloc(1, sizeof(core_info_t));
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
menu->shader = (struct gfx_shader*)calloc(1, sizeof(struct gfx_shader));
|
||||
#endif
|
||||
@ -263,11 +262,11 @@ void menu_free(void *data)
|
||||
|
||||
rarch_main_command(RARCH_CMD_HISTORY_DEINIT);
|
||||
|
||||
if (menu->core_info)
|
||||
core_info_list_free(menu->core_info);
|
||||
if (g_extern.core_info)
|
||||
core_info_list_free(g_extern.core_info);
|
||||
|
||||
if (menu->core_info_current)
|
||||
free(menu->core_info_current);
|
||||
if (g_extern.core_info_current)
|
||||
free(g_extern.core_info_current);
|
||||
|
||||
free(data);
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ int menu_entries_push_list(menu_handle_t *menu,
|
||||
{
|
||||
const core_info_t *info = NULL;
|
||||
file_list_clear(list);
|
||||
core_info_list_get_supported_cores(driver.menu->core_info,
|
||||
core_info_list_get_supported_cores(g_extern.core_info,
|
||||
driver.menu->deferred_path, &info, &list_size);
|
||||
for (i = 0; i < list_size; i++)
|
||||
{
|
||||
@ -313,7 +313,7 @@ int menu_entries_push_list(menu_handle_t *menu,
|
||||
break;
|
||||
case MENU_SETTINGS_CORE_INFO:
|
||||
{
|
||||
core_info_t *info = (core_info_t*)menu->core_info_current;
|
||||
core_info_t *info = (core_info_t*)g_extern.core_info_current;
|
||||
file_list_clear(list);
|
||||
|
||||
if (info->data)
|
||||
@ -352,7 +352,8 @@ int menu_entries_push_list(menu_handle_t *menu,
|
||||
|
||||
if (info->firmware_count > 0)
|
||||
{
|
||||
core_info_list_update_missing_firmware(menu->core_info, info->path,
|
||||
core_info_list_update_missing_firmware(
|
||||
g_extern.core_info, info->path,
|
||||
g_settings.system_directory);
|
||||
|
||||
file_list_push(list, "Firmware: ", "",
|
||||
@ -725,8 +726,8 @@ int menu_parse_and_resolve(file_list_t *list, file_list_t *menu_list)
|
||||
else if (menu_common_type_is(menu_type) == MENU_FILE_DIRECTORY)
|
||||
exts = ""; /* we ignore files anyway */
|
||||
else if (driver.menu->defer_core)
|
||||
exts = driver.menu->core_info ? core_info_list_get_all_extensions(
|
||||
driver.menu->core_info) : "";
|
||||
exts = g_extern.core_info ? core_info_list_get_all_extensions(
|
||||
g_extern.core_info) : "";
|
||||
else if (driver.menu->info.valid_extensions)
|
||||
{
|
||||
exts = ext_buf;
|
||||
@ -795,8 +796,8 @@ int menu_parse_and_resolve(file_list_t *list, file_list_t *menu_list)
|
||||
|
||||
fill_pathname_join(core_path, dir, path, sizeof(core_path));
|
||||
|
||||
if (driver.menu->core_info &&
|
||||
core_info_list_get_display_name(driver.menu->core_info,
|
||||
if (g_extern.core_info &&
|
||||
core_info_list_get_display_name(g_extern.core_info,
|
||||
core_path, display_name, sizeof(display_name)))
|
||||
file_list_set_alt_at_offset(list, i, display_name);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "audio/dsp_filter.h"
|
||||
#include "compat/strl.h"
|
||||
#include "core_options.h"
|
||||
#include "core_info.h"
|
||||
#include "miscellaneous.h"
|
||||
#include "gfx/filter.h"
|
||||
|
||||
@ -411,6 +412,8 @@ struct global
|
||||
struct string_list *temporary_content;
|
||||
|
||||
content_playlist_t *history;
|
||||
core_info_list_t *core_info;
|
||||
core_info_t *core_info_current;
|
||||
|
||||
uint32_t content_crc;
|
||||
|
||||
|
@ -3437,6 +3437,10 @@ void rarch_main_command(unsigned cmd)
|
||||
g_extern.history = NULL;
|
||||
break;
|
||||
case RARCH_CMD_CORE_INFO_INIT:
|
||||
core_info_list_free(g_extern.core_info);
|
||||
g_extern.core_info = NULL;
|
||||
if (*g_settings.libretro_directory)
|
||||
g_extern.core_info = core_info_list_new(g_settings.libretro_directory);
|
||||
#ifdef HAVE_MENU
|
||||
if (driver.menu_ctx && driver.menu_ctx->init_core_info)
|
||||
driver.menu_ctx->init_core_info(driver.menu);
|
||||
|
@ -1948,7 +1948,7 @@ rarch_setting_t *setting_data_get_mainmenu(bool regenerate)
|
||||
{
|
||||
CONFIG_BOOL(lists[1], "history_list", "Load Content (History)", false, "...", "...", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
|
||||
}
|
||||
if (driver.menu && driver.menu->core_info && core_info_list_num_info_files(driver.menu->core_info))
|
||||
if (driver.menu && g_extern.core_info && core_info_list_num_info_files(g_extern.core_info))
|
||||
{
|
||||
CONFIG_BOOL(lists[2], "detect_core_list", "Load Content (Detect Core)", false, "...", "...", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user