mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
Move core info list to runloop_ctl
This commit is contained in:
parent
eda9009df5
commit
159fe58926
@ -851,9 +851,9 @@ static void event_main_state(unsigned cmd)
|
||||
static bool event_update_system_info(struct retro_system_info *_info,
|
||||
bool *load_no_content)
|
||||
{
|
||||
core_info_t *core_info = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
core_info_list_t *core_info_list = NULL;
|
||||
core_info_t *core_info = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
#if defined(HAVE_DYNAMIC)
|
||||
if (!(*settings->libretro))
|
||||
@ -862,12 +862,13 @@ static bool event_update_system_info(struct retro_system_info *_info,
|
||||
libretro_get_system_info(settings->libretro, _info,
|
||||
load_no_content);
|
||||
#endif
|
||||
if (!global->core_info.list)
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_GET, &core_info);
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &core_info_list);
|
||||
|
||||
if (!core_info_list)
|
||||
return false;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_GET, &core_info);
|
||||
|
||||
if (!core_info_list_get_info(global->core_info.list,
|
||||
if (!core_info_list_get_info(core_info_list,
|
||||
core_info, settings->libretro))
|
||||
return false;
|
||||
|
||||
@ -1219,7 +1220,7 @@ bool event_command(enum event_command cmd)
|
||||
event_command(EVENT_CMD_CORE_INFO_DEINIT);
|
||||
|
||||
if (*settings->libretro_directory)
|
||||
global->core_info.list = core_info_list_new();
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_INIT, NULL);
|
||||
break;
|
||||
case EVENT_CMD_CORE_DEINIT:
|
||||
{
|
||||
|
@ -473,8 +473,8 @@ bool core_info_does_support_file(const core_info_t *core, const char *path)
|
||||
|
||||
const char *core_info_list_get_all_extensions(void)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
core_info_list_t *list = global ? global->core_info.list : NULL;
|
||||
core_info_list_t *list = NULL;
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||
if (!list)
|
||||
return NULL;
|
||||
return list->all_ext;
|
||||
|
@ -1033,9 +1033,12 @@ static void menu_action_setting_disp_set_label(file_list_t* list,
|
||||
strlcpy(s, "N/A", len);
|
||||
else
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
char buf[PATH_MAX_LENGTH];
|
||||
if (core_info_list_get_display_name(global->core_info.list, s, buf, sizeof(buf)))
|
||||
core_info_list_t *list = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||
|
||||
if (core_info_list_get_display_name(list, s, buf, sizeof(buf)))
|
||||
strlcpy(s, buf, len);
|
||||
}
|
||||
}
|
||||
|
@ -291,10 +291,12 @@ static int playlist_association_left(unsigned type, const char *label,
|
||||
struct string_list *stcores = NULL;
|
||||
char core_path[PATH_MAX_LENGTH] = {0};
|
||||
char new_playlist_cores[PATH_MAX_LENGTH] = {0};
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *path = path_basename(label);
|
||||
core_info_list_t *list = global ? global->core_info.list : NULL;
|
||||
core_info_list_t *list = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||
|
||||
if (!list)
|
||||
return -1;
|
||||
|
||||
|
@ -381,7 +381,7 @@ static int rarch_defer_core_wrapper(size_t idx, size_t entry_idx, const char *pa
|
||||
const char *menu_label = NULL;
|
||||
int ret = 0;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
core_info_list_t *list = NULL;
|
||||
|
||||
if (!menu)
|
||||
return -1;
|
||||
@ -403,7 +403,9 @@ static int rarch_defer_core_wrapper(size_t idx, size_t entry_idx, const char *pa
|
||||
sizeof(menu_path_new));
|
||||
}
|
||||
|
||||
ret = rarch_defer_core(global->core_info.list,
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||
|
||||
ret = rarch_defer_core(list,
|
||||
menu_path_new, path, menu_label, menu->deferred_path,
|
||||
sizeof(menu->deferred_path));
|
||||
|
||||
@ -539,12 +541,14 @@ static int action_ok_playlist_entry(const char *path,
|
||||
{
|
||||
char new_core_path[PATH_MAX_LENGTH];
|
||||
core_info_t *core_info = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
core_info_list_t *list = NULL;
|
||||
const char *path_base = path_basename(menu->db_playlist_file);
|
||||
bool found_associated_core = menu_playlist_find_associated_core(
|
||||
path_base, new_core_path, sizeof(new_core_path));
|
||||
|
||||
if (!(core_info = core_info_find(global->core_info.list, new_core_path)))
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||
|
||||
if (!(core_info = core_info_find(list, new_core_path)))
|
||||
found_associated_core = false;
|
||||
|
||||
if (found_associated_core)
|
||||
@ -1777,7 +1781,7 @@ static int action_ok_load_archive_detect_core(const char *path,
|
||||
{
|
||||
size_t selection;
|
||||
int ret = 0;
|
||||
global_t *global = global_get_ptr();
|
||||
core_info_list_t *list = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
const char *menu_path = menu ? menu->scratch2_buf : NULL;
|
||||
const char *content_path = menu ? menu->scratch_buf : NULL;
|
||||
@ -1788,7 +1792,9 @@ static int action_ok_load_archive_detect_core(const char *path,
|
||||
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
||||
return false;
|
||||
|
||||
ret = rarch_defer_core(global->core_info.list, menu_path, content_path, label,
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||
|
||||
ret = rarch_defer_core(list, menu_path, content_path, label,
|
||||
menu->deferred_path, sizeof(menu->deferred_path));
|
||||
|
||||
fill_pathname_join(detect_content_path, menu_path, content_path,
|
||||
|
@ -307,10 +307,11 @@ static int playlist_association_right(unsigned type, const char *label,
|
||||
struct string_list *stnames = NULL;
|
||||
struct string_list *stcores = NULL;
|
||||
char new_playlist_cores[PATH_MAX_LENGTH] = {0};
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *path = path_basename(label);
|
||||
core_info_list_t *list = global ? global->core_info.list : NULL;
|
||||
core_info_list_t *list = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||
if (!list)
|
||||
return -1;
|
||||
|
||||
|
@ -264,10 +264,11 @@ static int action_start_playlist_association(unsigned type, const char *label)
|
||||
char new_playlist_cores[PATH_MAX_LENGTH] = {0};
|
||||
struct string_list *stnames = NULL;
|
||||
struct string_list *stcores = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
core_info_list_t *list = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *path = path_basename(label);
|
||||
core_info_list_t *list = global ? global->core_info.list : NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||
if (!list)
|
||||
return -1;
|
||||
|
||||
|
@ -1235,9 +1235,10 @@ static void mui_list_cache(void *data, menu_list_type_t type, unsigned action)
|
||||
static int mui_list_push(void *data, void *userdata,
|
||||
menu_displaylist_info_t *info, unsigned type)
|
||||
{
|
||||
int ret = -1;
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
global_t *global = global_get_ptr();
|
||||
int ret = -1;
|
||||
core_info_list_t *list = NULL;
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
(void)userdata;
|
||||
|
||||
@ -1250,7 +1251,8 @@ static int mui_list_push(void *data, void *userdata,
|
||||
menu_hash_to_str(MENU_LABEL_LOAD_CONTENT),
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
|
||||
if (core_info_list_num_info_files(global->core_info.list))
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||
if (core_info_list_num_info_files(list))
|
||||
{
|
||||
menu_entries_push(info->list,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_DETECT_CORE_LIST),
|
||||
|
@ -660,8 +660,8 @@ static void zarch_zui_render_lay_root_load_set_new_path(zui_t *zui, const char *
|
||||
static int zarch_zui_render_lay_root_load(zui_t *zui, zui_tabbed_t *tabbed)
|
||||
{
|
||||
char parent_dir[PATH_MAX_LENGTH];
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
core_info_list_t *list = NULL;
|
||||
|
||||
if (zarch_zui_tab(zui, tabbed, "Load", 1))
|
||||
{
|
||||
@ -749,7 +749,10 @@ static int zarch_zui_render_lay_root_load(zui_t *zui, zui_tabbed_t *tabbed)
|
||||
zui->pick_cores = NULL;
|
||||
zui->pick_supported = 0;
|
||||
strncpy(zui->pick_content, path, sizeof(zui->pick_content)-1);
|
||||
core_info_list_get_supported_cores(global->core_info.list, path,
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||
|
||||
core_info_list_get_supported_cores(list, path,
|
||||
&zui->pick_cores, &zui->pick_supported);
|
||||
layout = LAY_PICK_CORE;
|
||||
break;
|
||||
|
@ -258,8 +258,11 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
|
||||
|
||||
if (core_info->firmware_count > 0)
|
||||
{
|
||||
core_info_list_update_missing_firmware(
|
||||
global->core_info.list, core_info->path,
|
||||
core_info_list_t *list = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||
|
||||
core_info_list_update_missing_firmware(list, core_info->path,
|
||||
settings->system_directory);
|
||||
|
||||
strlcpy(tmp, menu_hash_to_str(MENU_LABEL_VALUE_CORE_INFO_FIRMWARE), sizeof(tmp));
|
||||
@ -2099,6 +2102,9 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool ho
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
uint32_t hash_label = menu_hash_calculate(info->label);
|
||||
core_info_list_t *list = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||
|
||||
(void)device;
|
||||
|
||||
@ -2311,7 +2317,7 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool ho
|
||||
|
||||
fill_pathname_join(core_path, dir, path, sizeof(core_path));
|
||||
|
||||
if (core_info_list_get_display_name(global->core_info.list,
|
||||
if (core_info_list_get_display_name(list,
|
||||
core_path, display_name, sizeof(display_name)))
|
||||
menu_entries_set_alt_at_offset(info->list, i, display_name);
|
||||
}
|
||||
@ -2420,7 +2426,9 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = NULL;
|
||||
core_info_list_t *list = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (menu_driver_list_push(info, type))
|
||||
@ -2790,7 +2798,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
menu_hash_to_str(MENU_LABEL_LOAD_CONTENT),
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
|
||||
if (core_info_list_num_info_files(global->core_info.list))
|
||||
if (core_info_list_num_info_files(list))
|
||||
{
|
||||
menu_entries_push(info->list,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_DETECT_CORE_LIST),
|
||||
|
@ -533,7 +533,6 @@ int menu_common_load_content(
|
||||
**/
|
||||
void menu_free(menu_handle_t *menu)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
@ -548,9 +547,7 @@ void menu_free(menu_handle_t *menu)
|
||||
|
||||
event_command(EVENT_CMD_HISTORY_DEINIT);
|
||||
|
||||
if (global->core_info.list)
|
||||
core_info_list_free(global->core_info.list);
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_FREE, NULL);
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_FREE, NULL);
|
||||
|
||||
free(menu);
|
||||
|
23
runloop.c
23
runloop.c
@ -479,6 +479,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
static slock_t *runloop_msg_queue_lock = NULL;
|
||||
#endif
|
||||
static core_info_t *core_info_current = NULL;
|
||||
static core_info_list_t *core_info_curr_list= NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
switch (state)
|
||||
@ -523,16 +524,20 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
case RUNLOOP_CTL_HAS_CORE_OPTIONS:
|
||||
return runloop_system.core_options;
|
||||
case RUNLOOP_CTL_CURRENT_CORE_LIST_FREE:
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!global)
|
||||
return false;
|
||||
if (global->core_info.list)
|
||||
core_info_list_free(global->core_info.list);
|
||||
global->core_info.list = NULL;
|
||||
}
|
||||
if (core_info_curr_list)
|
||||
core_info_list_free(core_info_curr_list);
|
||||
core_info_curr_list = NULL;
|
||||
return true;
|
||||
case RUNLOOP_CTL_CURRENT_CORE_LIST_INIT:
|
||||
core_info_curr_list = core_info_list_new();
|
||||
return true;
|
||||
case RUNLOOP_CTL_CURRENT_CORE_LIST_GET:
|
||||
{
|
||||
core_info_list_t **core = (core_info_list_t**)data;
|
||||
if (!core)
|
||||
return false;
|
||||
*core = core_info_curr_list;
|
||||
}
|
||||
case RUNLOOP_CTL_CURRENT_CORE_FREE:
|
||||
if (core_info_current)
|
||||
free(core_info_current);
|
||||
|
@ -71,6 +71,8 @@ enum runloop_ctl_state
|
||||
RUNLOOP_CTL_UNSET_PERFCNT_ENABLE,
|
||||
RUNLOOP_CTL_IS_PERFCNT_ENABLE,
|
||||
RUNLOOP_CTL_CURRENT_CORE_LIST_FREE,
|
||||
RUNLOOP_CTL_CURRENT_CORE_LIST_INIT,
|
||||
RUNLOOP_CTL_CURRENT_CORE_LIST_GET,
|
||||
RUNLOOP_CTL_CURRENT_CORE_FREE,
|
||||
RUNLOOP_CTL_CURRENT_CORE_INIT,
|
||||
RUNLOOP_CTL_CURRENT_CORE_GET,
|
||||
@ -155,11 +157,6 @@ typedef struct rarch_resolution
|
||||
|
||||
typedef struct global
|
||||
{
|
||||
struct
|
||||
{
|
||||
core_info_list_t *list;
|
||||
} core_info;
|
||||
|
||||
uint32_t content_crc;
|
||||
|
||||
rarch_path_t path;
|
||||
|
@ -43,9 +43,9 @@ struct string_list *string_list_new_special(enum string_list_type type,
|
||||
{
|
||||
union string_list_elem_attr attr;
|
||||
unsigned i;
|
||||
const core_info_t *core_info = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
struct string_list *s = string_list_new();
|
||||
core_info_list_t *core_info_list = NULL;
|
||||
const core_info_t *core_info = NULL;
|
||||
struct string_list *s = string_list_new();
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
@ -157,7 +157,9 @@ struct string_list *string_list_new_special(enum string_list_type type,
|
||||
}
|
||||
break;
|
||||
case STRING_LIST_SUPPORTED_CORES_PATHS:
|
||||
core_info_list_get_supported_cores(global->core_info.list,
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &core_info_list);
|
||||
|
||||
core_info_list_get_supported_cores(core_info_list,
|
||||
(const char*)data, &core_info, list_size);
|
||||
|
||||
if (*list_size == 0)
|
||||
@ -177,10 +179,12 @@ struct string_list *string_list_new_special(enum string_list_type type,
|
||||
}
|
||||
break;
|
||||
case STRING_LIST_CORES_PATHS:
|
||||
for (i = 0; i < core_info_list_num_info_files(global->core_info.list); i++)
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &core_info_list);
|
||||
|
||||
for (i = 0; i < core_info_list_num_info_files(core_info_list); i++)
|
||||
{
|
||||
const char *opt = NULL;
|
||||
core_info = (const core_info_t*)&global->core_info.list->list[i];
|
||||
core_info = (const core_info_t*)&core_info_list->list[i];
|
||||
opt = core_info ? core_info->path : NULL;
|
||||
|
||||
if (!opt)
|
||||
@ -191,7 +195,8 @@ struct string_list *string_list_new_special(enum string_list_type type,
|
||||
}
|
||||
break;
|
||||
case STRING_LIST_SUPPORTED_CORES_NAMES:
|
||||
core_info_list_get_supported_cores(global->core_info.list,
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &core_info_list);
|
||||
core_info_list_get_supported_cores(core_info_list,
|
||||
(const char*)data, &core_info, list_size);
|
||||
|
||||
if (*list_size == 0)
|
||||
@ -211,10 +216,11 @@ struct string_list *string_list_new_special(enum string_list_type type,
|
||||
}
|
||||
break;
|
||||
case STRING_LIST_CORES_NAMES:
|
||||
for (i = 0; i < core_info_list_num_info_files(global->core_info.list); i++)
|
||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &core_info_list);
|
||||
for (i = 0; i < core_info_list_num_info_files(core_info_list); i++)
|
||||
{
|
||||
const char *opt = NULL;
|
||||
core_info = (const core_info_t*)&global->core_info.list->list[i];
|
||||
core_info = (const core_info_t*)&core_info_list->list[i];
|
||||
opt = core_info ? core_info->display_name : NULL;
|
||||
|
||||
if (!opt)
|
||||
|
Loading…
x
Reference in New Issue
Block a user