diff --git a/configuration.c b/configuration.c index 29f85b40a0..16261c133c 100644 --- a/configuration.c +++ b/configuration.c @@ -840,7 +840,10 @@ static void config_set_defaults(void) settings->config_save_on_exit = config_save_on_exit; /* Avoid reloading config on every content load */ - global->block_config_read = default_block_config_read; + if (default_block_config_read) + rarch_ctl(RARCH_CTL_SET_BLOCK_CONFIG_READ, NULL); + else + rarch_ctl(RARCH_CTL_UNSET_BLOCK_CONFIG_READ, NULL); } #ifndef GLOBAL_CONFIG_DIR @@ -2339,7 +2342,7 @@ void config_load(void) /* Flush out some states that could have been set by core environment variables */ global->has_set.input_descriptors = false; - if (!global->block_config_read) + if (!rarch_ctl(RARCH_CTL_IS_BLOCK_CONFIG_READ, NULL)) { config_set_defaults(); parse_config_file(); diff --git a/retroarch.c b/retroarch.c index 3239b96d9b..2d7be8ae62 100644 --- a/retroarch.c +++ b/retroarch.c @@ -88,6 +88,7 @@ enum static char current_savestate_dir[PATH_MAX_LENGTH]; static char current_savefile_dir[PATH_MAX_LENGTH]; +static bool rarch_block_config_read; static bool rarch_force_fullscreen; static bool error_on_init; static char error_string[PATH_MAX_LENGTH]; @@ -1337,6 +1338,15 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) break; case RARCH_CTL_IS_FORCE_FULLSCREEN: return rarch_force_fullscreen; + case RARCH_CTL_SET_BLOCK_CONFIG_READ: + rarch_block_config_read = true; + break; + case RARCH_CTL_UNSET_BLOCK_CONFIG_READ: + rarch_block_config_read = false; + break; + case RARCH_CTL_IS_BLOCK_CONFIG_READ: + return rarch_block_config_read; + break; case RARCH_CTL_REPLACE_CONFIG: { char *path = (char*)data; @@ -1353,7 +1363,9 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) config_save_file(global->path.config); strlcpy(global->path.config, path, sizeof(global->path.config)); - global->block_config_read = false; + + rarch_ctl(RARCH_CTL_UNSET_BLOCK_CONFIG_READ, NULL); + *settings->libretro = '\0'; /* Load core in new config. */ } runloop_ctl(RUNLOOP_CTL_PREPARE_DUMMY, NULL); diff --git a/retroarch.h b/retroarch.h index f9299dca63..52914499be 100644 --- a/retroarch.h +++ b/retroarch.h @@ -97,7 +97,13 @@ enum rarch_ctl_state RARCH_CTL_SET_FORCE_FULLSCREEN, - RARCH_CTL_IS_FORCE_FULLSCREEN + RARCH_CTL_IS_FORCE_FULLSCREEN, + + RARCH_CTL_SET_BLOCK_CONFIG_READ, + + RARCH_CTL_UNSET_BLOCK_CONFIG_READ, + + RARCH_CTL_IS_BLOCK_CONFIG_READ }; enum rarch_content_type diff --git a/runloop.c b/runloop.c index ed4a8ceb8f..eca92ebd05 100644 --- a/runloop.c +++ b/runloop.c @@ -716,6 +716,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) event_command(EVENT_CMD_RECORD_DEINIT); event_command(EVENT_CMD_LOG_FILE_DEINIT); + rarch_ctl(RARCH_CTL_UNSET_BLOCK_CONFIG_READ, NULL); memset(&g_extern, 0, sizeof(g_extern)); break; case RUNLOOP_CTL_CLEAR_STATE: diff --git a/runloop.h b/runloop.h index 091ca74717..1c77f3d3fb 100644 --- a/runloop.h +++ b/runloop.h @@ -259,8 +259,6 @@ typedef struct global cheat_manager_t *cheat; - bool block_config_read; - /* Settings and/or global state that is specific to * a console-style implementation. */ struct