Turn global->content.inited into static local variable
and go through content_ctl
This commit is contained in:
parent
748959c8fc
commit
a5af9b653a
|
@ -1482,7 +1482,7 @@ bool event_command(enum event_command cmd)
|
||||||
input_driver_ctl(RARCH_INPUT_CTL_REMOTE_INIT, NULL);
|
input_driver_ctl(RARCH_INPUT_CTL_REMOTE_INIT, NULL);
|
||||||
break;
|
break;
|
||||||
case EVENT_CMD_TEMPORARY_CONTENT_DEINIT:
|
case EVENT_CMD_TEMPORARY_CONTENT_DEINIT:
|
||||||
content_ctl(CONTENT_CTL_TEMPORARY_FREE, NULL);
|
content_ctl(CONTENT_CTL_DEINIT, NULL);
|
||||||
break;
|
break;
|
||||||
case EVENT_CMD_SUBSYSTEM_FULLPATHS_DEINIT:
|
case EVENT_CMD_SUBSYSTEM_FULLPATHS_DEINIT:
|
||||||
if (!global)
|
if (!global)
|
||||||
|
|
20
content.c
20
content.c
|
@ -753,6 +753,7 @@ bool content_ctl(enum content_ctl_state state, void *data)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
static struct string_list *temporary_content = NULL;
|
static struct string_list *temporary_content = NULL;
|
||||||
|
static bool content_is_inited = false;
|
||||||
|
|
||||||
switch(state)
|
switch(state)
|
||||||
{
|
{
|
||||||
|
@ -770,17 +771,20 @@ bool content_ctl(enum content_ctl_state state, void *data)
|
||||||
return false;
|
return false;
|
||||||
return content_save_state(path);
|
return content_save_state(path);
|
||||||
}
|
}
|
||||||
|
case CONTENT_CTL_IS_INITED:
|
||||||
|
return content_is_inited;
|
||||||
|
case CONTENT_CTL_DEINIT:
|
||||||
|
content_ctl(CONTENT_CTL_TEMPORARY_FREE, NULL);
|
||||||
|
content_is_inited = false;
|
||||||
|
return true;
|
||||||
case CONTENT_CTL_INIT:
|
case CONTENT_CTL_INIT:
|
||||||
|
content_is_inited = false;
|
||||||
|
if (content_init_file(temporary_content))
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
content_is_inited = true;
|
||||||
if (content_init_file(temporary_content))
|
return true;
|
||||||
{
|
|
||||||
global->inited.content = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
global->inited.content = false;
|
|
||||||
/* fall-through */
|
|
||||||
}
|
}
|
||||||
|
/* fall-through */
|
||||||
case CONTENT_CTL_TEMPORARY_FREE:
|
case CONTENT_CTL_TEMPORARY_FREE:
|
||||||
if (!temporary_content)
|
if (!temporary_content)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -31,10 +31,14 @@ enum content_ctl_state
|
||||||
{
|
{
|
||||||
CONTENT_CTL_NONE = 0,
|
CONTENT_CTL_NONE = 0,
|
||||||
|
|
||||||
|
CONTENT_CTL_IS_INITED,
|
||||||
|
|
||||||
/* Initializes and loads a content file for the currently
|
/* Initializes and loads a content file for the currently
|
||||||
* selected libretro core. */
|
* selected libretro core. */
|
||||||
CONTENT_CTL_INIT,
|
CONTENT_CTL_INIT,
|
||||||
|
|
||||||
|
CONTENT_CTL_DEINIT,
|
||||||
|
|
||||||
/* Load a state from disk to memory. */
|
/* Load a state from disk to memory. */
|
||||||
CONTENT_CTL_LOAD_STATE,
|
CONTENT_CTL_LOAD_STATE,
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "../ui/ui_companion_driver.h"
|
#include "../ui/ui_companion_driver.h"
|
||||||
|
|
||||||
#include "../defaults.h"
|
#include "../defaults.h"
|
||||||
|
#include "../content.h"
|
||||||
#include "../driver.h"
|
#include "../driver.h"
|
||||||
#include "../system.h"
|
#include "../system.h"
|
||||||
#include "../driver.h"
|
#include "../driver.h"
|
||||||
|
@ -60,11 +61,10 @@ int rarch_main_async_job_add(async_task_t task, void *payload)
|
||||||
void main_exit(void *args)
|
void main_exit(void *args)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
|
||||||
|
|
||||||
event_command(EVENT_CMD_MENU_SAVE_CURRENT_CONFIG);
|
event_command(EVENT_CMD_MENU_SAVE_CURRENT_CONFIG);
|
||||||
|
|
||||||
if (global->inited.main)
|
if (content_ctl(CONTENT_CTL_IS_INITED, NULL))
|
||||||
{
|
{
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
/* Do not want menu context to live any more. */
|
/* Do not want menu context to live any more. */
|
||||||
|
@ -288,14 +288,12 @@ int rarch_main(int argc, char *argv[], void *data)
|
||||||
if (settings->history_list_enable)
|
if (settings->history_list_enable)
|
||||||
{
|
{
|
||||||
char *fullpath = NULL;
|
char *fullpath = NULL;
|
||||||
global_t *global = global_get_ptr();
|
|
||||||
rarch_system_info_t *system = NULL;
|
rarch_system_info_t *system = NULL;
|
||||||
|
|
||||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||||
|
|
||||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||||
|
|
||||||
if (global->inited.content || system->no_content)
|
if (content_ctl(CONTENT_CTL_IS_INITED, NULL) || system->no_content)
|
||||||
history_playlist_push(
|
history_playlist_push(
|
||||||
g_defaults.history,
|
g_defaults.history,
|
||||||
fullpath,
|
fullpath,
|
||||||
|
|
Loading…
Reference in New Issue