mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 07:59:42 +00:00
Move coreinfo_get_ptr internal state back to core_info.c (#13020)
This commit is contained in:
parent
f587d28a0d
commit
cbfa8d6400
40
core_info.c
40
core_info.c
@ -84,6 +84,8 @@ static core_info_cache_list_t *core_info_cache_list_new(void);
|
||||
static void core_info_cache_add(core_info_cache_list_t *list, core_info_t *info,
|
||||
bool transfer);
|
||||
|
||||
static core_info_state_t core_info_st;
|
||||
|
||||
/* JSON Handlers START */
|
||||
|
||||
static bool CCJSONObjectMemberHandler(void *context, const char *pValue, size_t length)
|
||||
@ -1977,7 +1979,7 @@ static bool core_info_does_support_file(
|
||||
|
||||
static int core_info_qsort_cmp(const void *a_, const void *b_)
|
||||
{
|
||||
core_info_state_t *p_coreinfo = coreinfo_get_ptr();
|
||||
core_info_state_t *p_coreinfo = &core_info_st;
|
||||
const core_info_t *a = (const core_info_t*)a_;
|
||||
const core_info_t *b = (const core_info_t*)b_;
|
||||
int support_a = core_info_does_support_file(a,
|
||||
@ -2031,8 +2033,9 @@ static bool core_info_list_update_missing_firmware_internal(
|
||||
return true;
|
||||
}
|
||||
|
||||
void core_info_free_current_core(core_info_state_t *p_coreinfo)
|
||||
void core_info_free_current_core(void)
|
||||
{
|
||||
core_info_state_t *p_coreinfo = &core_info_st;
|
||||
if (p_coreinfo->current)
|
||||
free(p_coreinfo->current);
|
||||
p_coreinfo->current = NULL;
|
||||
@ -2040,7 +2043,7 @@ void core_info_free_current_core(core_info_state_t *p_coreinfo)
|
||||
|
||||
bool core_info_init_current_core(void)
|
||||
{
|
||||
core_info_state_t *p_coreinfo = coreinfo_get_ptr();
|
||||
core_info_state_t *p_coreinfo = &core_info_st;
|
||||
core_info_t *current = (core_info_t*)
|
||||
malloc(sizeof(*current));
|
||||
if (!current)
|
||||
@ -2085,7 +2088,7 @@ bool core_info_init_current_core(void)
|
||||
|
||||
bool core_info_get_current_core(core_info_t **core)
|
||||
{
|
||||
core_info_state_t *p_coreinfo = coreinfo_get_ptr();
|
||||
core_info_state_t *p_coreinfo = &core_info_st;
|
||||
if (!core)
|
||||
return false;
|
||||
*core = p_coreinfo->current;
|
||||
@ -2094,7 +2097,7 @@ bool core_info_get_current_core(core_info_t **core)
|
||||
|
||||
void core_info_deinit_list(void)
|
||||
{
|
||||
core_info_state_t *p_coreinfo = coreinfo_get_ptr();
|
||||
core_info_state_t *p_coreinfo = &core_info_st;
|
||||
if (p_coreinfo->curr_list)
|
||||
core_info_list_free(p_coreinfo->curr_list);
|
||||
p_coreinfo->curr_list = NULL;
|
||||
@ -2104,9 +2107,12 @@ bool core_info_init_list(const char *path_info, const char *dir_cores,
|
||||
const char *exts, bool dir_show_hidden_files,
|
||||
bool enable_cache, bool *cache_supported)
|
||||
{
|
||||
core_info_state_t *p_coreinfo = coreinfo_get_ptr();
|
||||
if (!(p_coreinfo->curr_list = core_info_list_new(dir_cores,
|
||||
!string_is_empty(path_info) ? path_info : dir_cores,
|
||||
core_info_state_t *p_coreinfo = &core_info_st;
|
||||
if (!(p_coreinfo->curr_list = core_info_list_new(
|
||||
dir_cores,
|
||||
!string_is_empty(path_info)
|
||||
? path_info
|
||||
: dir_cores,
|
||||
exts,
|
||||
dir_show_hidden_files,
|
||||
enable_cache,
|
||||
@ -2117,7 +2123,7 @@ bool core_info_init_list(const char *path_info, const char *dir_cores,
|
||||
|
||||
bool core_info_get_list(core_info_list_t **core)
|
||||
{
|
||||
core_info_state_t *p_coreinfo = coreinfo_get_ptr();
|
||||
core_info_state_t *p_coreinfo = &core_info_st;
|
||||
if (!core)
|
||||
return false;
|
||||
*core = p_coreinfo->curr_list;
|
||||
@ -2127,7 +2133,7 @@ bool core_info_get_list(core_info_list_t **core)
|
||||
/* Returns number of installed cores */
|
||||
size_t core_info_count(void)
|
||||
{
|
||||
core_info_state_t *p_coreinfo = coreinfo_get_ptr();
|
||||
core_info_state_t *p_coreinfo = &core_info_st;
|
||||
if (!p_coreinfo || !p_coreinfo->curr_list)
|
||||
return 0;
|
||||
return p_coreinfo->curr_list->count;
|
||||
@ -2136,7 +2142,7 @@ size_t core_info_count(void)
|
||||
bool core_info_list_update_missing_firmware(core_info_ctx_firmware_t *info,
|
||||
bool *set_missing_bios)
|
||||
{
|
||||
core_info_state_t *p_coreinfo = coreinfo_get_ptr();
|
||||
core_info_state_t *p_coreinfo = &core_info_st;
|
||||
if (!info)
|
||||
return false;
|
||||
return core_info_list_update_missing_firmware_internal(
|
||||
@ -2145,9 +2151,9 @@ bool core_info_list_update_missing_firmware(core_info_ctx_firmware_t *info,
|
||||
set_missing_bios);
|
||||
}
|
||||
|
||||
bool core_info_load(const char *core_path,
|
||||
core_info_state_t *p_coreinfo)
|
||||
bool core_info_load(const char *core_path)
|
||||
{
|
||||
core_info_state_t *p_coreinfo = &core_info_st;
|
||||
core_info_t *core_info = NULL;
|
||||
|
||||
if (!p_coreinfo->current)
|
||||
@ -2168,7 +2174,7 @@ bool core_info_load(const char *core_path,
|
||||
bool core_info_find(const char *core_path,
|
||||
core_info_t **core_info)
|
||||
{
|
||||
core_info_state_t *p_coreinfo = coreinfo_get_ptr();
|
||||
core_info_state_t *p_coreinfo = &core_info_st;
|
||||
core_info_t *info = NULL;
|
||||
|
||||
if (!core_info || !p_coreinfo->curr_list)
|
||||
@ -2204,7 +2210,7 @@ void core_info_list_get_supported_cores(core_info_list_t *core_info_list,
|
||||
#ifdef HAVE_COMPRESSION
|
||||
struct string_list *list = NULL;
|
||||
#endif
|
||||
core_info_state_t *p_coreinfo = coreinfo_get_ptr();
|
||||
core_info_state_t *p_coreinfo = &core_info_st;
|
||||
|
||||
if (!core_info_list)
|
||||
return;
|
||||
@ -2287,7 +2293,7 @@ bool core_info_database_match_archive_member(const char *database_path)
|
||||
|
||||
path_remove_extension(database);
|
||||
|
||||
p_coreinfo = coreinfo_get_ptr();
|
||||
p_coreinfo = &core_info_st;
|
||||
|
||||
if (p_coreinfo->curr_list)
|
||||
{
|
||||
@ -2326,7 +2332,7 @@ bool core_info_database_supports_content_path(
|
||||
|
||||
path_remove_extension(database);
|
||||
|
||||
p_coreinfo = coreinfo_get_ptr();
|
||||
p_coreinfo = &core_info_st;
|
||||
|
||||
if (p_coreinfo->curr_list)
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ void core_info_free_core_updater_info(core_updater_info_t *info);
|
||||
|
||||
core_info_t *core_info_get(core_info_list_t *list, size_t i);
|
||||
|
||||
void core_info_free_current_core(core_info_state_t *p_coreinfo);
|
||||
void core_info_free_current_core(void);
|
||||
|
||||
bool core_info_init_current_core(void);
|
||||
|
||||
@ -171,8 +171,7 @@ bool core_info_list_update_missing_firmware(core_info_ctx_firmware_t *info,
|
||||
bool core_info_find(const char *core_path,
|
||||
core_info_t **core_info);
|
||||
|
||||
bool core_info_load(const char *core_path,
|
||||
core_info_state_t *p_coreinfo);
|
||||
bool core_info_load(const char *core_path);
|
||||
|
||||
bool core_info_database_supports_content_path(const char *database_path, const char *path);
|
||||
|
||||
@ -201,8 +200,6 @@ bool core_info_set_core_lock(const char *core_path, bool lock);
|
||||
* must be checked externally */
|
||||
bool core_info_get_core_lock(const char *core_path, bool validate_path);
|
||||
|
||||
core_info_state_t *coreinfo_get_ptr(void);
|
||||
|
||||
bool core_info_core_file_id_is_equal(const char *core_path_a, const char *core_path_b);
|
||||
|
||||
/* When called, generates a temporary file
|
||||
|
12
retroarch.c
12
retroarch.c
@ -345,12 +345,6 @@ char **input_event_get_osk_grid(void)
|
||||
return p_rarch->osk_grid;
|
||||
}
|
||||
|
||||
core_info_state_t *coreinfo_get_ptr(void)
|
||||
{
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
return &p_rarch->core_info_st;
|
||||
}
|
||||
|
||||
gfx_thumbnail_state_t *gfx_thumb_get_ptr(void)
|
||||
{
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
@ -9788,7 +9782,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||
&system_info->load_no_content))
|
||||
return false;
|
||||
|
||||
if (!core_info_load(core_path, &p_rarch->core_info_st))
|
||||
if (!core_info_load(core_path))
|
||||
{
|
||||
#ifdef HAVE_DYNAMIC
|
||||
return false;
|
||||
@ -10322,7 +10316,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||
break;
|
||||
case CMD_EVENT_CORE_INFO_DEINIT:
|
||||
core_info_deinit_list();
|
||||
core_info_free_current_core(&p_rarch->core_info_st);
|
||||
core_info_free_current_core();
|
||||
break;
|
||||
case CMD_EVENT_CORE_INFO_INIT:
|
||||
{
|
||||
@ -26137,7 +26131,7 @@ static void drivers_init(struct rarch_state *p_rarch,
|
||||
static void driver_uninit(struct rarch_state *p_rarch, int flags)
|
||||
{
|
||||
core_info_deinit_list();
|
||||
core_info_free_current_core(&p_rarch->core_info_st);
|
||||
core_info_free_current_core();
|
||||
|
||||
#if defined(HAVE_GFX_WIDGETS)
|
||||
/* This absolutely has to be done before video_driver_free_internal()
|
||||
|
@ -1321,7 +1321,6 @@ struct rarch_state
|
||||
|
||||
gfx_ctx_driver_t current_video_context; /* ptr alignment */
|
||||
content_state_t content_st; /* ptr alignment */
|
||||
core_info_state_t core_info_st; /* ptr alignment */
|
||||
struct retro_hw_render_callback hw_render; /* ptr alignment */
|
||||
#ifdef HAVE_BSV_MOVIE
|
||||
bsv_movie_t *bsv_movie_state_handle; /* ptr alignment */
|
||||
|
Loading…
Reference in New Issue
Block a user