mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
Create rarch_system_info_free
This commit is contained in:
parent
732d2db40e
commit
c8eca5b06a
3 changed files with 27 additions and 17 deletions
13
dynamic.c
13
dynamic.c
|
@ -515,8 +515,6 @@ void init_libretro_sym(enum rarch_core_type type)
|
|||
void uninit_libretro_sym(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
if (lib_handle)
|
||||
|
@ -524,17 +522,8 @@ void uninit_libretro_sym(void)
|
|||
lib_handle = NULL;
|
||||
#endif
|
||||
|
||||
if (system->core_options)
|
||||
{
|
||||
core_option_flush(system->core_options);
|
||||
core_option_free(system->core_options);
|
||||
}
|
||||
rarch_system_info_free();
|
||||
|
||||
/* No longer valid. */
|
||||
free(system->special);
|
||||
free(system->ports);
|
||||
|
||||
rarch_system_info_clear();
|
||||
driver->camera_active = false;
|
||||
driver->location_active = false;
|
||||
|
||||
|
|
29
retroarch.c
29
retroarch.c
|
@ -317,16 +317,37 @@ static void set_special_paths(char **argv, unsigned num_content)
|
|||
sizeof(settings->system_directory));
|
||||
}
|
||||
|
||||
rarch_system_info_t g_system;
|
||||
static rarch_system_info_t *g_system;
|
||||
|
||||
static rarch_system_info_t *rarch_system_info_new(void)
|
||||
{
|
||||
return (rarch_system_info_t*)calloc(1, sizeof(rarch_system_info_t));
|
||||
}
|
||||
|
||||
rarch_system_info_t *rarch_system_info_get_ptr(void)
|
||||
{
|
||||
return &g_system;
|
||||
if (!g_system)
|
||||
g_system = rarch_system_info_new();
|
||||
return g_system;
|
||||
}
|
||||
|
||||
void rarch_system_info_clear(void)
|
||||
void rarch_system_info_free(void)
|
||||
{
|
||||
memset(&g_system, 0, sizeof(g_system));
|
||||
if (!g_system)
|
||||
return;
|
||||
|
||||
if (g_system->core_options)
|
||||
{
|
||||
core_option_flush(g_system->core_options);
|
||||
core_option_free(g_system->core_options);
|
||||
}
|
||||
|
||||
/* No longer valid. */
|
||||
free(g_system->special);
|
||||
free(g_system->ports);
|
||||
|
||||
free(g_system);
|
||||
g_system = NULL;
|
||||
}
|
||||
|
||||
void set_paths_redirect(const char *path)
|
||||
|
|
2
system.h
2
system.h
|
@ -59,7 +59,7 @@ typedef struct rarch_system_info
|
|||
|
||||
rarch_system_info_t *rarch_system_info_get_ptr(void);
|
||||
|
||||
void rarch_system_info_clear(void);
|
||||
void rarch_system_info_free(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue