diff --git a/console/rarch_console.h b/console/rarch_console.h index 668d8faf67..4d2e180a31 100644 --- a/console/rarch_console.h +++ b/console/rarch_console.h @@ -90,7 +90,6 @@ typedef struct char cache_dir[MAXIMUM_PATH]; #endif char cgp_dir[MAXIMUM_PATH]; - char config_file[MAXIMUM_PATH]; char core_dir[MAXIMUM_PATH]; char executable_extension[MAXIMUM_PATH]; char filebrowser_startup_dir[MAXIMUM_PATH]; diff --git a/console/rarch_console_main_wrap.c b/console/rarch_console_main_wrap.c index ca3f2b67da..22e9f2186e 100644 --- a/console/rarch_console_main_wrap.c +++ b/console/rarch_console_main_wrap.c @@ -79,8 +79,10 @@ static int rarch_main_init_wrap(const struct rarch_main_wrap *args) return ret; } -bool rarch_startup (const char * config_path) +bool rarch_startup (void) { + const char *config_path = g_extern.config_path; + if(g_extern.main_is_init) rarch_main_deinit(); diff --git a/console/rarch_console_main_wrap.h b/console/rarch_console_main_wrap.h index a71a552054..de8d3f28f2 100644 --- a/console/rarch_console_main_wrap.h +++ b/console/rarch_console_main_wrap.h @@ -27,6 +27,6 @@ struct rarch_main_wrap bool verbose; }; -bool rarch_startup (const char * config_path); +bool rarch_startup (void); #endif diff --git a/gx/frontend/main.c b/gx/frontend/main.c index f0e75a7304..bd3dd9a459 100644 --- a/gx/frontend/main.c +++ b/gx/frontend/main.c @@ -419,7 +419,7 @@ static void get_environment_settings(void) snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "%.*s/retroarch", device_end - default_paths.core_dir, default_paths.core_dir); else strlcpy(default_paths.port_dir, "/retroarch", sizeof(default_paths.port_dir)); - snprintf(default_paths.config_file, sizeof(default_paths.config_file), "%s/retroarch.cfg", default_paths.port_dir); + snprintf(g_extern.config_path, sizeof(g_extern.config_path), "%s/retroarch.cfg", default_paths.port_dir); snprintf(default_paths.system_dir, sizeof(default_paths.system_dir), "%s/system", default_paths.port_dir); snprintf(default_paths.savestate_dir, sizeof(default_paths.savestate_dir), "%s/savestates", default_paths.port_dir); strlcpy(default_paths.filesystem_root_dir, "/", sizeof(default_paths.filesystem_root_dir)); @@ -462,7 +462,7 @@ static void make_directories(void) MAKE_DIR(default_paths.sram_dir); MAKE_DIR(default_paths.input_presets_dir); - MAKE_FILE(default_paths.config_file); + MAKE_FILE(g_extern.config_path); } extern void __exception_setreload(int t); @@ -529,11 +529,11 @@ int main(int argc, char *argv[]) snprintf(full_path, sizeof(full_path), "%sCORE%s", path_prefix, extension); bool find_libretro_file = rarch_configure_libretro_core(full_path, path_prefix, path_prefix, - default_paths.config_file, extension); + g_extern.config_path, extension); rarch_settings_set_default(); rarch_input_set_controls_default(input); - rarch_config_load(default_paths.config_file, find_libretro_file); + rarch_config_load(g_extern.config_path, find_libretro_file); char core_name[64]; rarch_console_name_from_id(core_name, sizeof(core_name)); @@ -560,7 +560,7 @@ int main(int argc, char *argv[]) rarch_render_cached_frame(); g_extern.draw_menu = false; - rarch_startup(default_paths.config_file); + rarch_startup(); } else g_extern.console.external_launch.support = EXTERN_LAUNCHER_SALAMANDER; @@ -583,14 +583,14 @@ begin_loop: rmenu_iterate(); if (g_extern.console.rmenu.mode != MODE_EXIT) - rarch_startup(default_paths.config_file); + rarch_startup(); } else goto begin_shutdown; goto begin_loop; begin_shutdown: - config_save_file(default_paths.config_file); + config_save_file(g_extern.config_path); config_save_keybinds(input_path); if(g_extern.main_is_init) diff --git a/gx/salamander/main.c b/gx/salamander/main.c index 9b38b7f20d..c184d1b8fc 100644 --- a/gx/salamander/main.c +++ b/gx/salamander/main.c @@ -38,6 +38,7 @@ #include "../../file.h" char libretro_path[512]; +char config_path[PATH_MAX]; default_paths_t default_paths; @@ -72,13 +73,13 @@ static void init_settings(void) char tmp_str[512] = {0}; bool config_file_exists; - if(!path_file_exists(default_paths.config_file)) + if(!path_file_exists(config_path)) { FILE * f; config_file_exists = false; - RARCH_ERR("Config file \"%s\" doesn't exist. Creating...\n", default_paths.config_file); + RARCH_ERR("Config file \"%s\" doesn't exist. Creating...\n", config_path); MAKE_DIR(default_paths.port_dir); - f = fopen(default_paths.config_file, "w"); + f = fopen(config_path, "w"); fclose(f); } else @@ -98,7 +99,7 @@ static void init_settings(void) { if(config_file_exists) { - config_file_t * conf = config_file_new(default_paths.config_file); + config_file_t * conf = config_file_new(config_path); config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str)); config_file_free(conf); snprintf(libretro_path, sizeof(libretro_path), tmp_str); @@ -115,7 +116,7 @@ static void init_settings(void) { config_file_t *new_conf = config_file_new(NULL); config_set_string(new_conf, "libretro_path", libretro_path); - config_file_write(new_conf, default_paths.config_file); + config_file_write(new_conf, config_path); config_file_free(new_conf); } } @@ -135,7 +136,7 @@ static void get_environment_settings(void) snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "%.*s/retroarch", device_end - default_paths.core_dir, default_paths.core_dir); else snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "/retroarch"); - snprintf(default_paths.config_file, sizeof(default_paths.config_file), "%s/retroarch.cfg", default_paths.port_dir); + snprintf(config_path, sizeof(config_path), "%s/retroarch.cfg", default_paths.port_dir); snprintf(default_paths.system_dir, sizeof(default_paths.system_dir), "%s/system", default_paths.port_dir); snprintf(default_paths.savestate_dir, sizeof(default_paths.savestate_dir), "%s/savestates", default_paths.port_dir); snprintf(default_paths.filesystem_root_dir, sizeof(default_paths.filesystem_root_dir), "/"); diff --git a/ps3/frontend/main.c b/ps3/frontend/main.c index 8d9c83cd09..ef03fbed20 100644 --- a/ps3/frontend/main.c +++ b/ps3/frontend/main.c @@ -220,7 +220,7 @@ static void get_environment_settings(int argc, char *argv[]) snprintf(default_paths.shader_file, sizeof(default_paths.shader_file), "%s/shaders/stock.cg", default_paths.core_dir); snprintf(default_paths.menu_shader_file, sizeof(default_paths.menu_shader_file), "%s/shaders/Borders/Menu/border-only-rarch.cg", default_paths.core_dir); #endif - snprintf(default_paths.config_file, sizeof(default_paths.config_file), "%s/retroarch.cfg", default_paths.port_dir); + snprintf(g_extern.config_path, sizeof(g_extern.config_path), "%s/retroarch.cfg", default_paths.port_dir); snprintf(default_paths.salamander_file, sizeof(default_paths.salamander_file), "EBOOT.BIN"); } @@ -283,14 +283,14 @@ int main(int argc, char *argv[]) #ifdef HAVE_LIBRETRO_MANAGEMENT bool find_libretro_file = rarch_configure_libretro_core(core_exe_path, path_prefix, path_prefix, - default_paths.config_file, extension); + g_extern.config_path, extension); #else bool find_libretro_file = false; #endif rarch_settings_set_default(); rarch_input_set_controls_default(input); - rarch_config_load(default_paths.config_file, find_libretro_file); + rarch_config_load(g_extern.config_path, find_libretro_file); init_libretro_sym(); input_ps3.post_init(); @@ -350,7 +350,7 @@ begin_loop: while(rarch_main_iterate()); } else if (g_extern.console.rmenu.mode == MODE_INIT) - rarch_startup(default_paths.config_file); + rarch_startup(); else if(g_extern.console.rmenu.mode == MODE_MENU) while(rmenu_iterate()); else @@ -359,7 +359,7 @@ begin_loop: goto begin_loop; begin_shutdown: - config_save_file(default_paths.config_file); + config_save_file(g_extern.config_path); if(g_extern.main_is_init) rarch_main_deinit(); diff --git a/ps3/salamander/main.c b/ps3/salamander/main.c index 4d74aca5ae..cde2e34734 100644 --- a/ps3/salamander/main.c +++ b/ps3/salamander/main.c @@ -47,6 +47,7 @@ static uint8_t np_pool[NP_POOL_SIZE]; SYS_PROCESS_PARAM(1001, 0x100000) char libretro_path[PATH_MAX]; +char config_path[PATH_MAX]; default_paths_t default_paths; @@ -72,7 +73,7 @@ static void init_settings(void) char tmp_str[PATH_MAX]; bool config_file_exists = false; - if(path_file_exists(default_paths.config_file)) + if(path_file_exists(config_path)) config_file_exists = true; //try to find CORE executable @@ -89,7 +90,7 @@ static void init_settings(void) { if(config_file_exists) { - config_file_t * conf = config_file_new(default_paths.config_file); + config_file_t * conf = config_file_new(config_path); config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str)); config_file_free(conf); snprintf(libretro_path, sizeof(libretro_path), tmp_str); @@ -108,7 +109,7 @@ static void init_settings(void) { config_file_t *new_conf = config_file_new(NULL); config_set_string(new_conf, "libretro_path", libretro_path); - config_file_write(new_conf, default_paths.config_file); + config_file_write(new_conf, config_path); config_file_free(new_conf); } } @@ -179,7 +180,7 @@ static void get_environment_settings (void) snprintf(default_paths.cgp_dir, sizeof(default_paths.cgp_dir), "%s/presets", default_paths.core_dir); snprintf(default_paths.input_presets_dir, sizeof(default_paths.input_presets_dir), "%s/input", default_paths.cgp_dir); snprintf(default_paths.border_dir, sizeof(default_paths.border_dir), "%s/borders", default_paths.core_dir); - snprintf(default_paths.config_file, sizeof(default_paths.config_file), "%s/retroarch.cfg", default_paths.port_dir); + snprintf(config_path, sizeof(config_path), "%s/retroarch.cfg", default_paths.port_dir); snprintf(default_paths.salamander_file, sizeof(default_paths.salamander_file), "EBOOT.BIN"); } } diff --git a/psp/frontend/main.c b/psp/frontend/main.c index d3f32eeb40..669eacbe9f 100644 --- a/psp/frontend/main.c +++ b/psp/frontend/main.c @@ -65,7 +65,7 @@ static void get_environment_settings(int argc, char *argv[]) snprintf(default_paths.cgp_dir, sizeof(default_paths.cgp_dir), "%s/presets", default_paths.core_dir); snprintf(default_paths.input_presets_dir, sizeof(default_paths.input_presets_dir), "%s/input", default_paths.cgp_dir); snprintf(default_paths.border_dir, sizeof(default_paths.border_dir), "%s/borders", default_paths.core_dir); - snprintf(default_paths.config_file, sizeof(default_paths.config_file), "%s/retroarch.cfg", default_paths.port_dir); + snprintf(g_extern.config_path, sizeof(g_extern.config_path), "%s/retroarch.cfg", default_paths.port_dir); snprintf(default_paths.salamander_file, sizeof(default_paths.salamander_file), "EBOOT.BIN"); } @@ -140,14 +140,14 @@ int main(int argc, char *argv[]) #ifdef HAVE_LIBRETRO_MANAGEMENT bool find_libretro_file = rarch_configure_libretro_core(core_exe_path, path_prefix, path_prefix, - default_paths.config_file, extension); + g_extern.config_path, extension); #else bool find_libretro_file = false; #endif rarch_settings_set_default(); rarch_input_set_controls_default(input); - rarch_config_load(default_paths.config_file, find_libretro_file); + rarch_config_load(g_extern.config_path, find_libretro_file); init_libretro_sym(); input_psp.post_init(); @@ -183,7 +183,7 @@ begin_loop: while(rmenu_iterate()); if (g_extern.console.rmenu.mode != MODE_EXIT) - rarch_startup(default_paths.config_file); + rarch_startup(); } else goto begin_shutdown; @@ -191,7 +191,7 @@ begin_loop: goto begin_loop; begin_shutdown: - config_save_file(default_paths.config_file); + config_save_file(g_extern.config_path); if(g_extern.main_is_init) rarch_main_deinit(); diff --git a/xdk/frontend/main.c b/xdk/frontend/main.c index 3729e052e9..0b24564705 100644 --- a/xdk/frontend/main.c +++ b/xdk/frontend/main.c @@ -103,7 +103,7 @@ static void get_environment_settings (void) #if defined(_XBOX1) strlcpy(default_paths.core_dir, "D:", sizeof(default_paths.core_dir)); - strlcpy(default_paths.config_file, "D:\\retroarch.cfg", sizeof(default_paths.config_file)); + strlcpy(g_extern.config_path, "D:\\retroarch.cfg", sizeof(g_extern.config_path)); strlcpy(default_paths.system_dir, "D:\\system", sizeof(default_paths.system_dir)); strlcpy(default_paths.filesystem_root_dir, "D:", sizeof(default_paths.filesystem_root_dir)); strlcpy(default_paths.executable_extension, ".xbe", sizeof(default_paths.executable_extension)); @@ -117,7 +117,7 @@ static void get_environment_settings (void) strlcpy(default_paths.filesystem_root_dir, "game:\\", sizeof(default_paths.filesystem_root_dir)); strlcpy(default_paths.screenshots_dir, "game:", sizeof(default_paths.screenshots_dir)); strlcpy(default_paths.shader_file, "game:\\media\\shaders\\stock.cg", sizeof(default_paths.shader_file)); - strlcpy(default_paths.config_file, "game:\\retroarch.cfg", sizeof(default_paths.config_file)); + strlcpy(g_extern.config_path, "game:\\retroarch.cfg", sizeof(g_extern.config_path)); strlcpy(default_paths.system_dir, "game:\\system", sizeof(default_paths.system_dir)); strlcpy(default_paths.executable_extension, ".xex", sizeof(default_paths.executable_extension)); strlcpy(default_paths.filebrowser_startup_dir, "game:", sizeof(default_paths.filebrowser_startup_dir)); @@ -160,11 +160,11 @@ int main(int argc, char *argv[]) snprintf(full_path, sizeof(full_path), "%sCORE%s", path_prefix, extension); bool find_libretro_file = rarch_configure_libretro_core(full_path, path_prefix, path_prefix, - default_paths.config_file, extension); + g_extern.config_path, extension); rarch_settings_set_default(); rarch_input_set_controls_default(input); - rarch_config_load(default_paths.config_file, find_libretro_file); + rarch_config_load(g_extern.config_path, find_libretro_file); init_libretro_sym(); input_xinput.post_init(); @@ -196,7 +196,7 @@ begin_loop: while(rmenu_iterate()); if (g_extern.console.rmenu.mode != MODE_EXIT) - rarch_startup(default_paths.config_file); + rarch_startup(); } else goto begin_shutdown; @@ -204,7 +204,7 @@ begin_loop: goto begin_loop; begin_shutdown: - config_save_file(default_paths.config_file); + config_save_file(g_extern.config_path); menu_free(); #if defined(HAVE_D3D8) || defined(HAVE_D3D9) diff --git a/xdk/salamander/main.c b/xdk/salamander/main.c index 982481aa49..3c7737802b 100644 --- a/xdk/salamander/main.c +++ b/xdk/salamander/main.c @@ -39,6 +39,7 @@ DWORD volume_device_type; char libretro_path[PATH_MAX]; +char config_path[PATH_MAX]; default_paths_t default_paths; @@ -74,7 +75,7 @@ static void init_settings(void) char tmp_str[PATH_MAX]; bool config_file_exists = false; - if(path_file_exists(default_paths.config_file)) + if(path_file_exists(config_path)) config_file_exists = true; //try to find CORE executable @@ -95,7 +96,7 @@ static void init_settings(void) { if(config_file_exists) { - config_file_t * conf = config_file_new(default_paths.config_file); + config_file_t * conf = config_file_new(config_path); config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str)); snprintf(libretro_path, sizeof(libretro_path), tmp_str); } @@ -113,7 +114,7 @@ static void init_settings(void) { config_file_t *new_conf = config_file_new(NULL); config_set_string(new_conf, "libretro_path", libretro_path); - config_file_write(new_conf, default_paths.config_file); + config_file_write(new_conf, config_path); config_file_free(new_conf); } } @@ -170,7 +171,7 @@ static void get_environment_settings (void) #if defined(_XBOX1) strlcpy(default_paths.core_dir, "D:", sizeof(default_paths.core_dir)); - strlcpy(default_paths.config_file, "D:\\retroarch.cfg", sizeof(default_paths.config_file)); + strlcpy(config_path, "D:\\retroarch.cfg", sizeof(config_path)); strlcpy(default_paths.system_dir, "D:\\system", sizeof(default_paths.system_dir)); strlcpy(default_paths.filesystem_root_dir, "D:", sizeof(default_paths.filesystem_root_dir)); strlcpy(default_paths.executable_extension, ".xbe", sizeof(default_paths.executable_extension)); @@ -180,7 +181,7 @@ static void get_environment_settings (void) #elif defined(_XBOX360) strlcpy(default_paths.filesystem_root_dir, "game:\\", sizeof(default_paths.filesystem_root_dir)); strlcpy(default_paths.screenshots_dir, "game:", sizeof(default_paths.screenshots_dir)); - strlcpy(default_paths.config_file, "game:\\retroarch.cfg", sizeof(default_paths.config_file)); + strlcpy(config_path, "game:\\retroarch.cfg", sizeof(config_path)); strlcpy(default_paths.system_dir, "game:\\system\\", sizeof(default_paths.system_dir)); strlcpy(default_paths.executable_extension, ".xex", sizeof(default_paths.executable_extension)); snprintf(default_paths.salamander_file, sizeof(default_paths.salamander_file), "default.xex");