mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-30 16:14:11 +00:00
Create rarch_main_global_init/rarch_main_global_deinit
This commit is contained in:
parent
80840cac0c
commit
533c5c0eb1
13
retroarch.c
13
retroarch.c
@ -1638,24 +1638,11 @@ static void free_temporary_content(void)
|
|||||||
/* main_clear_state_extern:
|
/* main_clear_state_extern:
|
||||||
*
|
*
|
||||||
* Clears all external state.
|
* Clears all external state.
|
||||||
*
|
|
||||||
* XXX This memset is really dangerous.
|
|
||||||
*
|
|
||||||
* (a) it can leak memory because the pointers
|
|
||||||
* in g_extern aren't freed.
|
|
||||||
* (b) it can zero pointers that the rest of
|
|
||||||
* the code will look at.
|
|
||||||
*/
|
*/
|
||||||
static void main_clear_state_extern(void)
|
static void main_clear_state_extern(void)
|
||||||
{
|
{
|
||||||
rarch_main_command(RARCH_CMD_TEMPORARY_CONTENT_DEINIT);
|
|
||||||
rarch_main_command(RARCH_CMD_SUBSYSTEM_FULLPATHS_DEINIT);
|
|
||||||
rarch_main_command(RARCH_CMD_RECORD_DEINIT);
|
|
||||||
rarch_main_command(RARCH_CMD_LOG_FILE_DEINIT);
|
|
||||||
rarch_main_command(RARCH_CMD_HISTORY_DEINIT);
|
rarch_main_command(RARCH_CMD_HISTORY_DEINIT);
|
||||||
|
|
||||||
memset(&g_extern, 0, sizeof(g_extern));
|
|
||||||
|
|
||||||
rarch_main_clear_state();
|
rarch_main_clear_state();
|
||||||
rarch_main_data_clear_state();
|
rarch_main_data_clear_state();
|
||||||
}
|
}
|
||||||
|
29
runloop.c
29
runloop.c
@ -982,6 +982,32 @@ static void rarch_main_state_deinit(void)
|
|||||||
free(runloop);
|
free(runloop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rarch_main_global_deinit(void)
|
||||||
|
{
|
||||||
|
rarch_main_command(RARCH_CMD_TEMPORARY_CONTENT_DEINIT);
|
||||||
|
rarch_main_command(RARCH_CMD_SUBSYSTEM_FULLPATHS_DEINIT);
|
||||||
|
rarch_main_command(RARCH_CMD_RECORD_DEINIT);
|
||||||
|
rarch_main_command(RARCH_CMD_LOG_FILE_DEINIT);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
global_t *global = &g_extern;
|
||||||
|
|
||||||
|
if (!global)
|
||||||
|
return;
|
||||||
|
|
||||||
|
free(global);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rarch_main_global_init(void)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
g_extern = rarch_main_global_init();
|
||||||
|
#else
|
||||||
|
memset(&g_extern, 0, sizeof(g_extern));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static runloop_t *rarch_main_state_init(void)
|
static runloop_t *rarch_main_state_init(void)
|
||||||
{
|
{
|
||||||
runloop_t *runloop = (runloop_t*)calloc(1, sizeof(runloop_t));
|
runloop_t *runloop = (runloop_t*)calloc(1, sizeof(runloop_t));
|
||||||
@ -996,6 +1022,9 @@ void rarch_main_clear_state(void)
|
|||||||
{
|
{
|
||||||
rarch_main_state_deinit();
|
rarch_main_state_deinit();
|
||||||
g_runloop = rarch_main_state_init();
|
g_runloop = rarch_main_state_init();
|
||||||
|
|
||||||
|
rarch_main_global_deinit();
|
||||||
|
rarch_main_global_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rarch_main_is_idle(void)
|
bool rarch_main_is_idle(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user