Move block_config_read to retroarch.c

This commit is contained in:
twinaphex 2015-11-30 22:09:28 +01:00
parent 6c4557817d
commit 6b92167050
5 changed files with 26 additions and 6 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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

View File

@ -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:

View File

@ -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