From 7420012721752bbf264d5733414761ad39c54053 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 11 Nov 2013 10:37:39 +0100 Subject: [PATCH] (RARCH_CONSOLE) Remove unneeded variables from default_paths --- console/rarch_console.h | 3 --- frontend/platform/platform_gx.c | 26 +++++++++++++----------- frontend/platform/platform_ps3.c | 32 +++++++++++++++++------------- frontend/platform/platform_psp.c | 2 -- frontend/platform/platform_xdk.c | 34 +++++++++++++++++--------------- settings.c | 3 --- 6 files changed, 50 insertions(+), 50 deletions(-) diff --git a/console/rarch_console.h b/console/rarch_console.h index fb52086b56..129919fd9c 100644 --- a/console/rarch_console.h +++ b/console/rarch_console.h @@ -25,11 +25,8 @@ typedef struct { - char menu_border_file[MAXIMUM_PATH]; char border_dir[MAXIMUM_PATH]; char core_dir[MAXIMUM_PATH]; - char config_path[MAXIMUM_PATH]; - char libretro_path[MAXIMUM_PATH]; char port_dir[MAXIMUM_PATH]; char savestate_dir[MAXIMUM_PATH]; char sram_dir[MAXIMUM_PATH]; diff --git a/frontend/platform/platform_gx.c b/frontend/platform/platform_gx.c index c2ff4be6fb..1a7df2baa8 100644 --- a/frontend/platform/platform_gx.c +++ b/frontend/platform/platform_gx.c @@ -49,6 +49,8 @@ extern void system_exec_wii(const char *path, bool should_load_game); #include #ifdef IS_SALAMANDER +char config_path[512]; +char libretro_path[512]; static void find_and_set_first_file(void) { @@ -60,7 +62,7 @@ static void find_and_set_first_file(void) default_paths.core_dir, "dol"); if(first_file[0]) - strlcpy(default_paths.libretro_path, first_file, sizeof(default_paths.libretro_path)); + strlcpy(libretro_path, first_file, sizeof(libretro_path)); else RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n"); } @@ -70,7 +72,7 @@ static void salamander_init_settings(void) char tmp_str[512] = {0}; bool config_file_exists; - if (path_file_exists(default_paths.config_path)) + if (path_file_exists(config_path)) config_file_exists = true; //try to find CORE executable @@ -80,36 +82,36 @@ static void salamander_init_settings(void) if(path_file_exists(core_executable)) { //Start CORE executable - strlcpy(default_paths.libretro_path, core_executable, sizeof(default_paths.libretro_path)); - RARCH_LOG("Start [%s].\n", default_paths.libretro_path); + strlcpy(libretro_path, core_executable, sizeof(libretro_path)); + RARCH_LOG("Start [%s].\n", libretro_path); } else { if(config_file_exists) { - config_file_t * conf = config_file_new(default_paths.config_path); + config_file_t * conf = config_file_new(config_path); if (!conf) // stupid libfat bug or something; somtimes it says the file is there when it doesn't config_file_exists = false; else { config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str)); config_file_free(conf); - strlcpy(default_paths.libretro_path, tmp_str, sizeof(default_paths.libretro_path)); + strlcpy(libretro_path, tmp_str, sizeof(libretro_path)); } } - if(!config_file_exists || !strcmp(default_paths.libretro_path, "")) + if(!config_file_exists || !strcmp(libretro_path, "")) find_and_set_first_file(); else { - RARCH_LOG("Start [%s] found in retroarch.cfg.\n", default_paths.libretro_path); + RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path); } if (!config_file_exists) { config_file_t *new_conf = config_file_new(NULL); - config_set_string(new_conf, "libretro_path", default_paths.libretro_path); - config_file_write(new_conf, default_paths.config_path); + config_set_string(new_conf, "libretro_path", libretro_path); + config_file_write(new_conf, config_path); config_file_free(new_conf); } } @@ -242,7 +244,7 @@ static void get_environment_settings(int argc, char *argv[], void *args) else strlcpy(default_paths.port_dir, "/retroarch", sizeof(default_paths.port_dir)); #ifdef IS_SALAMANDER - snprintf(default_paths.config_path, sizeof(default_paths.config_path), "%s/retroarch.cfg", default_paths.port_dir); + snprintf(config_path, sizeof(config_path), "%s/retroarch.cfg", default_paths.port_dir); #else snprintf(g_extern.config_path, sizeof(g_extern.config_path), "%s/retroarch.cfg", default_paths.port_dir); #endif @@ -306,7 +308,7 @@ static void system_exec(const char *path, bool should_load_game); static void system_exitspawn(void) { #if defined(IS_SALAMANDER) - system_exec(default_paths.libretro_path, gx_rom_path[0] != '\0' ? true : false); + system_exec(libretro_path, gx_rom_path[0] != '\0' ? true : false); #elif defined(HW_RVL) bool should_load_game = false; if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN_START_GAME)) diff --git a/frontend/platform/platform_ps3.c b/frontend/platform/platform_ps3.c index f3e29f3055..ffda797bf6 100644 --- a/frontend/platform/platform_ps3.c +++ b/frontend/platform/platform_ps3.c @@ -49,6 +49,9 @@ SYS_PROCESS_PARAM(1001, 0x200000) #include #include +char config_path[512]; +char libretro_path[512]; + static void find_and_set_first_file(void) { //Last fallback - we'll need to start the first executable file @@ -59,8 +62,8 @@ static void find_and_set_first_file(void) if(first_file) { - fill_pathname_join(default_paths.libretro_path, default_paths.core_dir, first_file, sizeof(default_paths.libretro_path)); - RARCH_LOG("libretro_path now set to: %s.\n", default_paths.libretro_path); + fill_pathname_join(libretro_path, default_paths.core_dir, first_file, sizeof(libretro_path)); + RARCH_LOG("libretro_path now set to: %s.\n", libretro_path); } else RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n"); @@ -85,7 +88,7 @@ static void salamander_init_settings(void) char tmp_str[PATH_MAX]; bool config_file_exists = false; - if (path_file_exists(default_paths.config_path)) + if (path_file_exists(config_path)) config_file_exists = true; //try to find CORE executable @@ -95,29 +98,29 @@ static void salamander_init_settings(void) if(path_file_exists(core_executable)) { //Start CORE executable - strlcpy(default_paths.libretro_path, core_executable, sizeof(default_paths.libretro_path)); - RARCH_LOG("Start [%s].\n", default_paths.libretro_path); + strlcpy(libretro_path, core_executable, sizeof(libretro_path)); + RARCH_LOG("Start [%s].\n", libretro_path); } else { if (config_file_exists) { - config_file_t * conf = config_file_new(default_paths.config_path); + config_file_t * conf = config_file_new(config_path); config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str)); config_file_free(conf); - strlcpy(default_paths.libretro_path, tmp_str, sizeof(default_paths.libretro_path)); + strlcpy(libretro_path, tmp_str, sizeof(libretro_path)); } - if (!config_file_exists || !strcmp(default_paths.libretro_path, "")) + if (!config_file_exists || !strcmp(libretro_path, "")) find_and_set_first_file(); else - RARCH_LOG("Start [%s] found in retroarch.cfg.\n", default_paths.libretro_path); + RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path); if (!config_file_exists) { config_file_t *new_conf = config_file_new(NULL); - config_set_string(new_conf, "libretro_path", default_paths.libretro_path); - config_file_write(new_conf, default_paths.config_path); + config_set_string(new_conf, "libretro_path", libretro_path); + config_file_write(new_conf, config_path); config_file_free(new_conf); } } @@ -268,15 +271,16 @@ static void get_environment_settings(int argc, char *argv[], void *args) fill_pathname_join(default_paths.system_dir, default_paths.core_dir, "system", sizeof(default_paths.system_dir)); /* now we fill in all the variables */ - fill_pathname_join(default_paths.menu_border_file, default_paths.core_dir, "borders/Menu/main-menu_1080p.png", sizeof(default_paths.menu_border_file)); fill_pathname_join(default_paths.border_dir, default_paths.core_dir, "borders", sizeof(default_paths.border_dir)); #if defined(HAVE_CG) || defined(HAVE_GLSL) fill_pathname_join(g_settings.video.shader_dir, default_paths.core_dir, "shaders", sizeof(g_settings.video.shader_dir)); #endif #ifdef IS_SALAMANDER - fill_pathname_join(default_paths.config_path, default_paths.port_dir, "retroarch.cfg", sizeof(default_paths.config_path)); + fill_pathname_join(config_path, default_paths.port_dir, "retroarch.cfg", sizeof(config_path)); #else + fill_pathname_join(g_extern.menu_texture_path, default_paths.core_dir, "borders/Menu/main-menu_1080p.png", + sizeof(g_extern.menu_texture_path)); fill_pathname_join(g_extern.config_path, default_paths.port_dir, "retroarch.cfg", sizeof(g_extern.config_path)); #endif } @@ -393,7 +397,7 @@ static void system_exitspawn(void) #ifdef HAVE_RARCH_EXEC #ifdef IS_SALAMANDER - system_exec(default_paths.libretro_path, false); + system_exec(libretro_path, false); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); diff --git a/frontend/platform/platform_psp.c b/frontend/platform/platform_psp.c index 36b123e44f..fe32fb2e7d 100644 --- a/frontend/platform/platform_psp.c +++ b/frontend/platform/platform_psp.c @@ -60,11 +60,9 @@ static void get_environment_settings(int argc, char *argv[]) snprintf(default_paths.core_dir, sizeof(default_paths.core_dir), "%s/cores", default_paths.port_dir); snprintf(default_paths.savestate_dir, sizeof(default_paths.savestate_dir), "%s/savestates", default_paths.core_dir); snprintf(default_paths.sram_dir, sizeof(default_paths.sram_dir), "%s/savefiles", default_paths.core_dir); - snprintf(default_paths.system_dir, sizeof(default_paths.system_dir), "%s/system", default_paths.core_dir); /* now we fill in all the variables */ - snprintf(default_paths.menu_border_file, sizeof(default_paths.menu_border_file), "%s/borders/Menu/main-menu.png", default_paths.core_dir); snprintf(default_paths.border_dir, sizeof(default_paths.border_dir), "%s/borders", default_paths.core_dir); snprintf(g_extern.config_path, sizeof(g_extern.config_path), "%s/retroarch.cfg", default_paths.port_dir); } diff --git a/frontend/platform/platform_xdk.c b/frontend/platform/platform_xdk.c index 7b7a623d2c..08ad28a9c7 100644 --- a/frontend/platform/platform_xdk.c +++ b/frontend/platform/platform_xdk.c @@ -31,6 +31,8 @@ #include "../../general.h" #ifdef IS_SALAMANDER +char config_path[512]; +char libretro_path[512]; static void find_and_set_first_file(void) { @@ -49,11 +51,11 @@ static void find_and_set_first_file(void) if(first_file) { #ifdef _XBOX1 - fill_pathname_join(default_paths.libretro_path, "D:", first_file, sizeof(default_paths.libretro_path)); + fill_pathname_join(libretro_path, "D:", first_file, sizeof(libretro_path)); #else - strlcpy(default_paths.libretro_path, first_file, sizeof(default_paths.libretro_path)); + strlcpy(libretro_path, first_file, sizeof(libretro_path)); #endif - RARCH_LOG("libretro_path now set to: %s.\n", default_paths.libretro_path); + RARCH_LOG("libretro_path now set to: %s.\n", libretro_path); } else RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n"); @@ -81,7 +83,7 @@ static void salamander_init_settings(void) char tmp_str[PATH_MAX]; bool config_file_exists = false; - if(path_file_exists(default_paths.config_path)) + if(path_file_exists(config_path)) config_file_exists = true; //try to find CORE executable @@ -95,32 +97,32 @@ static void salamander_init_settings(void) if(path_file_exists(core_executable)) { //Start CORE executable - strlcpy(default_paths.libretro_path, core_executable, sizeof(default_paths.libretro_path)); - RARCH_LOG("Start [%s].\n", default_paths.libretro_path); + strlcpy(libretro_path, core_executable, sizeof(libretro_path)); + RARCH_LOG("Start [%s].\n", libretro_path); } else { if(config_file_exists) { - config_file_t * conf = config_file_new(default_paths.config_path); + config_file_t * conf = config_file_new(config_path); config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str)); - strlcpy(default_paths.libretro_path, tmp_str, sizeof(default_paths.libretro_path)); + strlcpy(libretro_path, tmp_str, sizeof(libretro_path)); } - if(!config_file_exists || !strcmp(default_paths.libretro_path, "")) + if(!config_file_exists || !strcmp(libretro_path, "")) { find_and_set_first_file(); } else { - RARCH_LOG("Start [%s] found in retroarch.cfg.\n", default_paths.libretro_path); + RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path); } if (!config_file_exists) { config_file_t *new_conf = config_file_new(NULL); - config_set_string(new_conf, "libretro_path", default_paths.libretro_path); - config_file_write(new_conf, default_paths.config_path); + config_set_string(new_conf, "libretro_path", libretro_path); + config_file_write(new_conf, config_path); config_file_free(new_conf); } } @@ -224,7 +226,7 @@ static void get_environment_settings(int argc, char *argv[], void *args) #if defined(_XBOX1) strlcpy(default_paths.core_dir, "D:", sizeof(default_paths.core_dir)); #ifdef IS_SALAMANDER - fill_pathname_join(default_paths.config_path, default_paths.core_dir, "retroarch.cfg", sizeof(default_paths.config_path)); + fill_pathname_join(config_path, default_paths.core_dir, "retroarch.cfg", sizeof(config_path)); #else fill_pathname_join(g_extern.config_path, default_paths.core_dir, "retroarch.cfg", sizeof(g_extern.config_path)); #endif @@ -233,12 +235,12 @@ static void get_environment_settings(int argc, char *argv[], void *args) fill_pathname_join(default_paths.system_dir, default_paths.core_dir, "system", sizeof(default_paths.system_dir)); #ifndef IS_SALAMANDER fill_pathname_join(g_settings.screenshot_directory, default_paths.core_dir, "screenshots", sizeof(g_settings.screenshot_directory)); + strlcpy(g_extern.menu_texture_path, "D:\\Media\\main-menu_480p.png", sizeof(g_extern.menu_texture_path)); #endif - strlcpy(default_paths.menu_border_file, "D:\\Media\\main-menu_480p.png", sizeof(default_paths.menu_border_file)); #elif defined(_XBOX360) strlcpy(default_paths.core_dir, "game:", sizeof(default_paths.core_dir)); #ifdef IS_SALAMANDER - strlcpy(default_paths.config_path, "game:\\retroarch.cfg", sizeof(default_paths.config_path)); + strlcpy(config_path, "game:\\retroarch.cfg", sizeof(config_path)); #else strlcpy(g_settings.screenshot_directory, "game:", sizeof(g_settings.screenshot_directory)); strlcpy(g_extern.config_path, "game:\\retroarch.cfg", sizeof(g_extern.config_path)); @@ -305,7 +307,7 @@ static void system_exec(const char *path, bool should_load_game); static void system_exitspawn(void) { #ifdef IS_SALAMANDER - system_exec(default_paths.libretro_path, false); + system_exec(libretro_path, false); #else bool should_load_game = false; if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN_START_GAME)) diff --git a/settings.c b/settings.c index 055b34db87..b736efdaa0 100644 --- a/settings.c +++ b/settings.c @@ -317,9 +317,6 @@ void config_set_defaults(void) g_extern.console.screen.resolutions.current.id = 0; strlcpy(g_extern.savestate_dir, default_paths.savestate_dir, sizeof(g_extern.savestate_dir)); -#ifdef HAVE_RMENU - strlcpy(g_extern.menu_texture_path, default_paths.menu_border_file, sizeof(g_extern.menu_texture_path)); -#endif g_extern.state_slot = 0; g_extern.audio_data.mute = 0;