mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Move more init/deinit code to rarch_main_command
This commit is contained in:
parent
ade2f71662
commit
cc277fcf76
@ -153,6 +153,9 @@ enum basic_event
|
|||||||
RARCH_CMD_COMMAND_DEINIT,
|
RARCH_CMD_COMMAND_DEINIT,
|
||||||
RARCH_CMD_DRIVERS_DEINIT,
|
RARCH_CMD_DRIVERS_DEINIT,
|
||||||
RARCH_CMD_DRIVERS_INIT,
|
RARCH_CMD_DRIVERS_INIT,
|
||||||
|
RARCH_CMD_TEMPORARY_CONTENT_DEINIT,
|
||||||
|
RARCH_CMD_SUBSYSTEM_FULLPATHS_DEINIT,
|
||||||
|
RARCH_CMD_LOG_FILE_DEINIT,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum action_state
|
enum action_state
|
||||||
|
49
retroarch.c
49
retroarch.c
@ -2289,13 +2289,6 @@ static void init_state(void)
|
|||||||
driver.audio_active = true;
|
driver.audio_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deinit_log_file(void)
|
|
||||||
{
|
|
||||||
if (g_extern.log_file)
|
|
||||||
fclose(g_extern.log_file);
|
|
||||||
g_extern.log_file = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void free_temporary_content(void)
|
static void free_temporary_content(void)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@ -2310,20 +2303,6 @@ static void free_temporary_content(void)
|
|||||||
string_list_free(g_extern.temporary_content);
|
string_list_free(g_extern.temporary_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deinit_temporary_content(void)
|
|
||||||
{
|
|
||||||
if (g_extern.temporary_content)
|
|
||||||
free_temporary_content();
|
|
||||||
g_extern.temporary_content = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void deinit_subsystem_fullpaths(void)
|
|
||||||
{
|
|
||||||
if (g_extern.subsystem_fullpaths)
|
|
||||||
string_list_free(g_extern.subsystem_fullpaths);
|
|
||||||
g_extern.subsystem_fullpaths = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void main_clear_state_extern(void)
|
static void main_clear_state_extern(void)
|
||||||
{
|
{
|
||||||
/* XXX This memset is really dangerous.
|
/* XXX This memset is really dangerous.
|
||||||
@ -2333,11 +2312,10 @@ static void main_clear_state_extern(void)
|
|||||||
* (b) it can zero pointers that the rest of
|
* (b) it can zero pointers that the rest of
|
||||||
* the code will look at.
|
* the code will look at.
|
||||||
*/
|
*/
|
||||||
deinit_temporary_content();
|
rarch_main_command(RARCH_CMD_TEMPORARY_CONTENT_DEINIT);
|
||||||
deinit_subsystem_fullpaths();
|
rarch_main_command(RARCH_CMD_SUBSYSTEM_FULLPATHS_DEINIT);
|
||||||
rarch_main_command(RARCH_CMD_RECORD_DEINIT);
|
rarch_main_command(RARCH_CMD_RECORD_DEINIT);
|
||||||
|
rarch_main_command(RARCH_CMD_LOG_FILE_DEINIT);
|
||||||
deinit_log_file();
|
|
||||||
rarch_main_command(RARCH_CMD_HISTORY_DEINIT);
|
rarch_main_command(RARCH_CMD_HISTORY_DEINIT);
|
||||||
|
|
||||||
memset(&g_extern, 0, sizeof(g_extern));
|
memset(&g_extern, 0, sizeof(g_extern));
|
||||||
@ -2372,7 +2350,7 @@ void rarch_main_state_new(void)
|
|||||||
void rarch_main_state_free(void)
|
void rarch_main_state_free(void)
|
||||||
{
|
{
|
||||||
rarch_main_command(RARCH_CMD_MSG_QUEUE_DEINIT);
|
rarch_main_command(RARCH_CMD_MSG_QUEUE_DEINIT);
|
||||||
deinit_log_file();
|
rarch_main_command(RARCH_CMD_LOG_FILE_DEINIT);
|
||||||
|
|
||||||
main_clear_state(false);
|
main_clear_state(false);
|
||||||
|
|
||||||
@ -3177,6 +3155,21 @@ void rarch_main_command(unsigned cmd)
|
|||||||
init_command();
|
init_command();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
case RARCH_CMD_TEMPORARY_CONTENT_DEINIT:
|
||||||
|
if (g_extern.temporary_content)
|
||||||
|
free_temporary_content();
|
||||||
|
g_extern.temporary_content = NULL;
|
||||||
|
break;
|
||||||
|
case RARCH_CMD_SUBSYSTEM_FULLPATHS_DEINIT:
|
||||||
|
if (g_extern.subsystem_fullpaths)
|
||||||
|
string_list_free(g_extern.subsystem_fullpaths);
|
||||||
|
g_extern.subsystem_fullpaths = NULL;
|
||||||
|
break;
|
||||||
|
case RARCH_CMD_LOG_FILE_DEINIT:
|
||||||
|
if (g_extern.log_file)
|
||||||
|
fclose(g_extern.log_file);
|
||||||
|
g_extern.log_file = NULL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3345,8 +3338,8 @@ void rarch_main_deinit(void)
|
|||||||
|
|
||||||
deinit_core();
|
deinit_core();
|
||||||
|
|
||||||
deinit_temporary_content();
|
rarch_main_command(RARCH_CMD_TEMPORARY_CONTENT_DEINIT);
|
||||||
deinit_subsystem_fullpaths();
|
rarch_main_command(RARCH_CMD_SUBSYSTEM_FULLPATHS_DEINIT);
|
||||||
rarch_main_command(RARCH_CMD_SAVEFILES_DEINIT);
|
rarch_main_command(RARCH_CMD_SAVEFILES_DEINIT);
|
||||||
|
|
||||||
g_extern.main_is_init = false;
|
g_extern.main_is_init = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user