Move/rename menu_replace_config to retroarch.c (rarch_replace_config)

This commit is contained in:
twinaphex 2014-09-06 22:05:33 +02:00
parent 2c61fdcc7f
commit fface89461
5 changed files with 29 additions and 27 deletions

View File

@ -1728,7 +1728,7 @@ static int menu_action_ok(const char *dir,
fill_pathname_join(config, dir, path, sizeof(config));
menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS);
driver.menu->msg_force = true;
if (menu_replace_config(config))
if (rarch_replace_config(config))
{
menu_clear_navigation(driver.menu);
return -1;

View File

@ -425,30 +425,6 @@ bool menu_iterate(void)
return true;
}
/* Quite intrusive and error prone.
* Likely to have lots of small bugs.
* Cleanly exit the main loop to ensure that all the tiny details
* get set properly.
*
* This should mitigate most of the smaller bugs. */
bool menu_replace_config(const char *path)
{
if (strcmp(path, g_extern.config_path) == 0)
return false;
if (g_settings.config_save_on_exit && *g_extern.config_path)
config_save_file(g_extern.config_path);
strlcpy(g_extern.config_path, path, sizeof(g_extern.config_path));
g_extern.block_config_read = false;
*g_settings.libretro = '\0'; /* Load core in new config. */
rarch_main_command(RARCH_CMD_PREPARE_DUMMY);
return true;
}
/* Save a new config to a file. Filename is based
* on heuristics to avoid typing. */

View File

@ -135,8 +135,6 @@ bool load_menu_content(void);
void load_menu_content_history(unsigned game_index);
bool menu_replace_config(const char *path);
bool menu_save_new_config(void);
void menu_update_system_info(menu_handle_t *menu, bool *load_no_content);

View File

@ -795,6 +795,8 @@ bool config_read_keybinds(const char *path);
void rarch_main_clear_state(void);
int rarch_main(int argc, char *argv[]);
bool rarch_replace_config(const char *path);
void rarch_main_init_wrap(const struct rarch_main_wrap *args, int *argc, char **argv);
int rarch_main_init(int argc, char *argv[]);

View File

@ -3892,3 +3892,29 @@ int rarch_defer_core(core_info_list_t *core_info, const char *dir,
return 0;
}
/* Quite intrusive and error prone.
* Likely to have lots of small bugs.
* Cleanly exit the main loop to ensure that all the tiny details
* get set properly.
*
* This should mitigate most of the smaller bugs. */
bool rarch_replace_config(const char *path)
{
/* If config file to be replaced is the same as the
* current config file, exit. */
if (!strcmp(path, g_extern.config_path))
return false;
if (g_settings.config_save_on_exit && *g_extern.config_path)
config_save_file(g_extern.config_path);
strlcpy(g_extern.config_path, path, sizeof(g_extern.config_path));
g_extern.block_config_read = false;
*g_settings.libretro = '\0'; /* Load core in new config. */
rarch_main_command(RARCH_CMD_PREPARE_DUMMY);
return true;
}