mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
Move overrides_active variable to runloop_ctl
This commit is contained in:
parent
3965ea8fd6
commit
10f934dc70
@ -362,8 +362,6 @@ static void event_init_controllers(void)
|
||||
|
||||
static void event_deinit_core(bool reinit)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
/* Unload the achievements from memory. */
|
||||
cheevos_unload();
|
||||
@ -376,10 +374,10 @@ static void event_deinit_core(bool reinit)
|
||||
event_command(EVENT_CMD_DRIVERS_DEINIT);
|
||||
|
||||
/* auto overrides: reload the original config */
|
||||
if(global && global->overrides_active)
|
||||
if(runloop_ctl(RUNLOOP_CTL_IS_OVERRIDES_ACTIVE, NULL))
|
||||
{
|
||||
config_unload_override();
|
||||
global->overrides_active = false;
|
||||
runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
|
||||
}
|
||||
|
||||
uninit_libretro_sym();
|
||||
@ -543,9 +541,9 @@ static bool event_init_core(void)
|
||||
if(settings->auto_overrides_enable)
|
||||
{
|
||||
if (config_load_override())
|
||||
global->overrides_active = true;
|
||||
runloop_ctl(RUNLOOP_CTL_SET_OVERRIDES_ACTIVE, NULL);
|
||||
else
|
||||
global->overrides_active = false;
|
||||
runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
|
||||
}
|
||||
|
||||
/* reset video format to libretro's default */
|
||||
@ -688,10 +686,10 @@ static bool event_save_core_config(void)
|
||||
}
|
||||
|
||||
/* Overrides block config file saving, make it appear as overrides weren't enabled for a manual save */
|
||||
if (global->overrides_active)
|
||||
if (runloop_ctl(RUNLOOP_CTL_IS_OVERRIDES_ACTIVE, NULL))
|
||||
{
|
||||
global->overrides_active = false;
|
||||
overrides_active = true;
|
||||
runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
|
||||
overrides_active = true;
|
||||
}
|
||||
|
||||
if ((ret = config_save_file(config_path)))
|
||||
@ -710,7 +708,11 @@ static bool event_save_core_config(void)
|
||||
}
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 180, true);
|
||||
global->overrides_active = overrides_active;
|
||||
|
||||
if (overrides_active)
|
||||
runloop_ctl(RUNLOOP_CTL_SET_OVERRIDES_ACTIVE, NULL);
|
||||
else
|
||||
runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2515,7 +2515,7 @@ bool config_save_file(const char *path)
|
||||
if (!conf)
|
||||
conf = config_file_new(NULL);
|
||||
|
||||
if (!conf || global->overrides_active)
|
||||
if (!conf || runloop_ctl(RUNLOOP_CTL_IS_OVERRIDES_ACTIVE, NULL))
|
||||
return false;
|
||||
|
||||
RARCH_LOG("Saving config at path: \"%s\"\n", path);
|
||||
|
@ -630,7 +630,7 @@ static void parse_input(int argc, char *argv[])
|
||||
*global->name.bps = '\0';
|
||||
*global->name.ips = '\0';
|
||||
|
||||
global->overrides_active = false;
|
||||
runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
|
11
runloop.c
11
runloop.c
@ -482,6 +482,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
static bool runloop_shutdown_initiated = false;
|
||||
static bool runloop_core_shutdown_initiated = false;
|
||||
static bool runloop_perfcnt_enable = false;
|
||||
static bool runloop_overrides_active = false;
|
||||
#ifdef HAVE_THREADS
|
||||
static slock_t *runloop_msg_queue_lock = NULL;
|
||||
#endif
|
||||
@ -557,6 +558,14 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
case RUNLOOP_CTL_UNSET_FRAME_TIME_LAST:
|
||||
runloop_frame_time_last = false;
|
||||
break;
|
||||
case RUNLOOP_CTL_SET_OVERRIDES_ACTIVE:
|
||||
runloop_overrides_active = true;
|
||||
break;
|
||||
case RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE:
|
||||
runloop_overrides_active = false;
|
||||
break;
|
||||
case RUNLOOP_CTL_IS_OVERRIDES_ACTIVE:
|
||||
return runloop_overrides_active;
|
||||
case RUNLOOP_CTL_IS_FRAME_TIME_LAST:
|
||||
return runloop_frame_time_last;
|
||||
case RUNLOOP_CTL_SET_FRAME_LIMIT:
|
||||
@ -844,6 +853,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
runloop_slowmotion = false;
|
||||
runloop_frame_time_last = false;
|
||||
runloop_set_frame_limit = false;
|
||||
runloop_overrides_active = false;
|
||||
runloop_max_frames = 0;
|
||||
break;
|
||||
case RUNLOOP_CTL_GLOBAL_FREE:
|
||||
@ -856,6 +866,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
|
||||
rarch_ctl(RARCH_CTL_UNSET_BLOCK_CONFIG_READ, NULL);
|
||||
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
|
||||
runloop_overrides_active = false;
|
||||
|
||||
global = global_get_ptr();
|
||||
memset(global, 0, sizeof(struct global));
|
||||
|
@ -40,6 +40,9 @@ enum runloop_ctl_state
|
||||
RUNLOOP_CTL_GET_WINDOWED_SCALE,
|
||||
RUNLOOP_CTL_SET_WINDOWED_SCALE,
|
||||
RUNLOOP_CTL_SET_IDLE,
|
||||
RUNLOOP_CTL_IS_OVERRIDES_ACTIVE,
|
||||
RUNLOOP_CTL_SET_OVERRIDES_ACTIVE,
|
||||
RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE,
|
||||
RUNLOOP_CTL_CHECK_IDLE_STATE,
|
||||
RUNLOOP_CTL_GET_CONTENT_PATH,
|
||||
RUNLOOP_CTL_SET_CONTENT_PATH,
|
||||
@ -178,8 +181,6 @@ typedef struct global
|
||||
} has_set;
|
||||
|
||||
|
||||
bool overrides_active;
|
||||
|
||||
struct
|
||||
{
|
||||
char base[PATH_MAX_LENGTH];
|
||||
|
Loading…
x
Reference in New Issue
Block a user