From 8f163e697237dd6edc2ccc2a4bb5a340f9aa1f5f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 1 Oct 2016 08:18:23 +0200 Subject: [PATCH] Revert "Move global->name to paths.c" This reverts commit 6ee7b733aa111eaad549445abf9511c3c6d6412e. --- command.c | 24 +-- configuration.c | 23 +-- input/input_remapping.c | 5 +- menu/cbs/menu_cbs_get_value.c | 7 +- menu/cbs/menu_cbs_start.c | 8 +- patch.c | 16 +- paths.c | 318 +++++++++++----------------------- paths.h | 7 - retroarch.c | 31 +++- runloop.c | 7 - runloop.h | 19 ++ tasks/task_save.c | 6 +- 12 files changed, 192 insertions(+), 279 deletions(-) diff --git a/command.c b/command.c index 1ef6af3d2e..cc4094c601 100644 --- a/command.c +++ b/command.c @@ -1206,9 +1206,9 @@ static void command_event_load_auto_state(void) char msg[128] = {0}; char savestate_name_auto[PATH_MAX_LENGTH] = {0}; settings_t *settings = config_get_ptr(); -#ifdef HAVE_NETWORKING global_t *global = global_get_ptr(); +#ifdef HAVE_NETWORKING if (global->netplay.enable && !global->netplay.is_spectate) return; #endif @@ -1221,7 +1221,7 @@ static void command_event_load_auto_state(void) if (!settings->savestate_auto_load) return; - fill_pathname_noext(savestate_name_auto, path_get(RARCH_PATH_SAVESTATE), + fill_pathname_noext(savestate_name_auto, global->name.savestate, file_path_str(FILE_PATH_AUTO_EXTENSION), sizeof(savestate_name_auto)); @@ -1246,20 +1246,21 @@ static void command_event_set_savestate_auto_index(void) struct string_list *dir_list = NULL; unsigned max_idx = 0; settings_t *settings = config_get_ptr(); + global_t *global = global_get_ptr(); if (!settings->savestate_auto_index) return; - /* Find the file in the same directory as path_get(RARCH_PATH_SAVESTATE) + /* Find the file in the same directory as global->savestate_name * with the largest numeral suffix. * * E.g. /foo/path/content.state, will try to find * /foo/path/content.state%d, where %d is the largest number available. */ - fill_pathname_basedir(state_dir, path_get(RARCH_PATH_SAVESTATE), + fill_pathname_basedir(state_dir, global->name.savestate, sizeof(state_dir)); - fill_pathname_base(state_base, path_get(RARCH_PATH_SAVESTATE), + fill_pathname_base(state_base, global->name.savestate, sizeof(state_base)); if (!(dir_list = dir_list_new_special(state_dir, DIR_LIST_PLAIN, NULL))) @@ -1415,9 +1416,12 @@ static bool command_event_save_auto_state(void) bool ret; char savestate_name_auto[PATH_MAX_LENGTH] = {0}; settings_t *settings = config_get_ptr(); + global_t *global = global_get_ptr(); if (!settings || !settings->savestate_auto_save) return false; + if (!global) + return false; if (rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) return false; if (content_does_not_need_content()) @@ -1428,7 +1432,7 @@ static bool command_event_save_auto_state(void) return false; #endif - fill_pathname_noext(savestate_name_auto, path_get(RARCH_PATH_SAVESTATE), + fill_pathname_noext(savestate_name_auto, global->name.savestate, file_path_str(FILE_PATH_AUTO_EXTENSION), sizeof(savestate_name_auto)); @@ -1707,17 +1711,17 @@ static void command_event_main_state(unsigned cmd) retro_ctx_size_info_t info; char path[PATH_MAX_LENGTH] = {0}; char msg[128] = {0}; + global_t *global = global_get_ptr(); settings_t *settings = config_get_ptr(); if (settings->state_slot > 0) snprintf(path, sizeof(path), "%s%d", - path_get(RARCH_PATH_SAVESTATE), - settings->state_slot); + global->name.savestate, settings->state_slot); else if (settings->state_slot < 0) fill_pathname_join_delim(path, - path_get(RARCH_PATH_SAVESTATE), "auto", '.', sizeof(path)); + global->name.savestate, "auto", '.', sizeof(path)); else - strlcpy(path, path_get(RARCH_PATH_SAVESTATE), sizeof(path)); + strlcpy(path, global->name.savestate, sizeof(path)); core_serialize_size(&info); diff --git a/configuration.c b/configuration.c index b9950a09bf..3461cf9455 100644 --- a/configuration.c +++ b/configuration.c @@ -2125,17 +2125,14 @@ static bool config_load_file(const char *path, bool set_defaults, else if (path_is_directory(tmp_str)) { - char tmp_str_local[PATH_MAX_LENGTH] = {0}; dir_set_savefile(tmp_str); - strlcpy(tmp_str_local, tmp_str, - sizeof(tmp_str_local)); - fill_pathname_dir(tmp_str_local, + strlcpy(global->name.savefile, tmp_str, + sizeof(global->name.savefile)); + fill_pathname_dir(global->name.savefile, path_get(RARCH_PATH_BASENAME), file_path_str(FILE_PATH_SRM_EXTENSION), - sizeof(tmp_str_local)); - - path_set(RARCH_PATH_SAVEFILE, tmp_str_local); + sizeof(global->name.savefile)); } else RARCH_WARN("savefile_directory is not a directory, ignoring ...\n"); @@ -2148,18 +2145,14 @@ static bool config_load_file(const char *path, bool set_defaults, dir_set_savestate(g_defaults.dir.savestate); else if (path_is_directory(tmp_str)) { - char tmp_str_local[PATH_MAX_LENGTH] = {0}; - dir_set_savestate(tmp_str); - strlcpy(tmp_str_local, tmp_str, - sizeof(tmp_str_local)); - fill_pathname_dir(tmp_str_local, + strlcpy(global->name.savestate, tmp_str, + sizeof(global->name.savestate)); + fill_pathname_dir(global->name.savestate, path_get(RARCH_PATH_BASENAME), file_path_str(FILE_PATH_STATE_EXTENSION), - sizeof(tmp_str_local)); - - path_set(RARCH_PATH_SAVESTATE, tmp_str_local); + sizeof(global->name.savestate)); } else RARCH_WARN("savestate_directory is not a directory, ignoring ...\n"); diff --git a/input/input_remapping.c b/input/input_remapping.c index 6624e879d3..19db5783a3 100644 --- a/input/input_remapping.c +++ b/input/input_remapping.c @@ -20,8 +20,6 @@ #include "input_remapping.h" #include "../configuration.h" -#include "../paths.h" -#include "../retroarch.h" #include "../runloop.h" /** @@ -41,7 +39,8 @@ bool input_remapping_load_file(void *data, const char *path) if (!conf || string_is_empty(path)) return false; - path_set(RARCH_PATH_REMAPFILE, path); + strlcpy(global->name.remapfile, path, + sizeof(global->name.remapfile)); for (i = 0; i < MAX_USERS; i++) { diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index a608d21261..47a6c5ed18 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -109,10 +109,13 @@ static void menu_action_setting_disp_set_label_remap_file_load( const char *path, char *s2, size_t len2) { + global_t *global = global_get_ptr(); + *w = 19; strlcpy(s2, path, len2); - fill_pathname_base(s, path_get(RARCH_PATH_REMAPFILE), - len); + if (global) + fill_pathname_base(s, global->name.remapfile, + len); } static void menu_action_setting_disp_set_label_configurations( diff --git a/menu/cbs/menu_cbs_start.c b/menu/cbs/menu_cbs_start.c index f19a3ef947..69ee869d96 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -33,7 +33,6 @@ #include "../../core_info.h" #include "../../managers/core_option_manager.h" #include "../../managers/cheat_manager.h" -#include "../../paths.h" #include "../../retroarch.h" #include "../../runloop.h" #include "../../performance_counters.h" @@ -50,7 +49,12 @@ static int action_start_remap_file_load(unsigned type, const char *label) { - path_clear(RARCH_PATH_REMAPFILE); + global_t *global = global_get_ptr(); + + if (!global) + return -1; + + global->name.remapfile[0] = '\0'; input_remapping_set_defaults(); return 0; } diff --git a/patch.c b/patch.c index 2038d0ea8e..ce2f7c5d86 100644 --- a/patch.c +++ b/patch.c @@ -32,7 +32,6 @@ #include "msg_hash.h" #include "patch.h" -#include "paths.h" #include "retroarch.h" #include "runloop.h" #include "verbosity.h" @@ -556,34 +555,37 @@ error: static bool try_bps_patch(uint8_t **buf, ssize_t *size) { + global_t *global = global_get_ptr(); bool allow_bps = !rarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL) && !rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL); - if (!allow_bps || string_is_empty(path_get(RARCH_PATH_BPS))) + if (!allow_bps || string_is_empty(global->name.bps)) return false; - return apply_patch_content(buf, size, "BPS", path_get(RARCH_PATH_BPS), + return apply_patch_content(buf, size, "BPS", global->name.bps, bps_apply_patch); } static bool try_ups_patch(uint8_t **buf, ssize_t *size) { + global_t *global = global_get_ptr(); bool allow_ups = !rarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL) && !rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL); - if (!allow_ups || string_is_empty(path_get(RARCH_PATH_UPS))) + if (!allow_ups || string_is_empty(global->name.ups)) return false; - return apply_patch_content(buf, size, "UPS", path_get(RARCH_PATH_UPS), + return apply_patch_content(buf, size, "UPS", global->name.ups, ups_apply_patch); } static bool try_ips_patch(uint8_t **buf, ssize_t *size) { + global_t *global = global_get_ptr(); bool allow_ips = !rarch_ctl(RARCH_CTL_IS_UPS_PREF, NULL) && !rarch_ctl(RARCH_CTL_IS_BPS_PREF, NULL); - if (!allow_ips || string_is_empty(path_get(RARCH_PATH_IPS))) + if (!allow_ips || string_is_empty(global->name.ips)) return false; - return apply_patch_content(buf, size, "IPS", path_get(RARCH_PATH_IPS), + return apply_patch_content(buf, size, "IPS", global->name.ips, ips_apply_patch); } diff --git a/paths.c b/paths.c index 2ec68f4453..2b19ccc3b1 100644 --- a/paths.c +++ b/paths.c @@ -51,13 +51,6 @@ /* For --subsystem content. */ static struct string_list *subsystem_fullpaths = NULL; -static char path_savefile[PATH_MAX_LENGTH] = {0}; -static char path_savestate[PATH_MAX_LENGTH] = {0}; -static char path_cheatfile[PATH_MAX_LENGTH] = {0}; -static char path_ups[PATH_MAX_LENGTH] = {0}; -static char path_bps[PATH_MAX_LENGTH] = {0}; -static char path_ips[PATH_MAX_LENGTH] = {0}; -static char path_remapfile[PATH_MAX_LENGTH] = {0}; char subsystem_path[PATH_MAX_LENGTH] = {0}; static char path_default_shader_preset[PATH_MAX_LENGTH] = {0}; @@ -77,6 +70,7 @@ void path_set_redirect(void) uint32_t library_name_hash = 0; bool check_library_name_hash = false; rarch_system_info_t *info = NULL; + global_t *global = global_get_ptr(); const char *old_savefile_dir = dir_get_savefile(); const char *old_savestate_dir = dir_get_savestate(); @@ -172,50 +166,45 @@ void path_set_redirect(void) path_basedir(current_savefile_dir); } - if(path_is_directory(current_savefile_dir)) - path_set(RARCH_PATH_SAVEFILE, current_savefile_dir); - - if(path_is_directory(current_savestate_dir)) - path_set(RARCH_PATH_SAVESTATE, current_savestate_dir); - - if (path_is_directory(path_get(RARCH_PATH_SAVEFILE))) + if (global) { - char savefile_path[PATH_MAX_LENGTH] = {0}; + if(path_is_directory(current_savefile_dir)) + strlcpy(global->name.savefile, current_savefile_dir, + sizeof(global->name.savefile)); - fill_pathname_dir(savefile_path, path_main_basename, - file_path_str(FILE_PATH_SRM_EXTENSION), - sizeof(savefile_path)); + if(path_is_directory(current_savestate_dir)) + strlcpy(global->name.savestate, current_savestate_dir, + sizeof(global->name.savestate)); - path_set(RARCH_PATH_SAVEFILE, savefile_path); - RARCH_LOG("%s \"%s\".\n", - msg_hash_to_str(MSG_REDIRECTING_SAVEFILE_TO), - savefile_path); - } + if (path_is_directory(global->name.savefile)) + { + fill_pathname_dir(global->name.savefile, path_main_basename, + file_path_str(FILE_PATH_SRM_EXTENSION), + sizeof(global->name.savefile)); + RARCH_LOG("%s \"%s\".\n", + msg_hash_to_str(MSG_REDIRECTING_SAVEFILE_TO), + global->name.savefile); + } - if (path_is_directory(path_get(RARCH_PATH_SAVESTATE))) - { - char savestate_path[PATH_MAX_LENGTH] = {0}; + if (path_is_directory(global->name.savestate)) + { + fill_pathname_dir(global->name.savestate, path_main_basename, + file_path_str(FILE_PATH_STATE_EXTENSION), + sizeof(global->name.savestate)); + RARCH_LOG("%s \"%s\".\n", + msg_hash_to_str(MSG_REDIRECTING_SAVESTATE_TO), + global->name.savestate); + } - fill_pathname_dir(savestate_path, path_main_basename, - file_path_str(FILE_PATH_STATE_EXTENSION), - sizeof(savestate_path)); - path_set(RARCH_PATH_SAVESTATE, savestate_path); - RARCH_LOG("%s \"%s\".\n", - msg_hash_to_str(MSG_REDIRECTING_SAVESTATE_TO), - savestate_path); - } - - if (path_is_directory(path_get(RARCH_PATH_CHEATFILE))) - { - char cheatfile_path[PATH_MAX_LENGTH] = {0}; - - fill_pathname_dir(cheatfile_path, path_main_basename, - file_path_str(FILE_PATH_STATE_EXTENSION), - sizeof(cheatfile_path)); - path_set(RARCH_PATH_CHEATFILE, cheatfile_path); - RARCH_LOG("%s \"%s\".\n", - msg_hash_to_str(MSG_REDIRECTING_CHEATFILE_TO), - cheatfile_path); + if (path_is_directory(global->name.cheatfile)) + { + fill_pathname_dir(global->name.cheatfile, path_main_basename, + file_path_str(FILE_PATH_STATE_EXTENSION), + sizeof(global->name.cheatfile)); + RARCH_LOG("%s \"%s\".\n", + msg_hash_to_str(MSG_REDIRECTING_CHEATFILE_TO), + global->name.cheatfile); + } } } @@ -275,6 +264,7 @@ void path_set_special(char **argv, unsigned num_content) { unsigned i; union string_list_elem_attr attr; + global_t *global = global_get_ptr(); /* First content file is the significant one. */ path_set_basename(argv[0]); @@ -289,29 +279,22 @@ void path_set_special(char **argv, unsigned num_content) /* We defer SRAM path updates until we can resolve it. * It is more complicated for special content types. */ - if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL)) + if (global) { - char tmp[PATH_MAX_LENGTH] = {0}; + if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH)) + fill_pathname_noext(global->name.savestate, path_main_basename, + file_path_str(FILE_PATH_STATE_EXTENSION), + sizeof(global->name.savestate)); - fill_pathname_noext(tmp, path_main_basename, - file_path_str(FILE_PATH_STATE_EXTENSION), - sizeof(tmp)); - - path_set(RARCH_PATH_SAVESTATE, tmp); - } - - if (path_is_directory(path_get(RARCH_PATH_SAVESTATE))) - { - char tmp[PATH_MAX_LENGTH] = {0}; - - fill_pathname_dir(tmp, path_main_basename, - file_path_str(FILE_PATH_STATE_EXTENSION), - sizeof(tmp)); - path_set(RARCH_PATH_SAVESTATE, tmp); - - RARCH_LOG("%s \"%s\".\n", - msg_hash_to_str(MSG_REDIRECTING_SAVESTATE_TO), - tmp); + if (path_is_directory(global->name.savestate)) + { + fill_pathname_dir(global->name.savestate, path_main_basename, + file_path_str(FILE_PATH_STATE_EXTENSION), + sizeof(global->name.savestate)); + RARCH_LOG("%s \"%s\".\n", + msg_hash_to_str(MSG_REDIRECTING_SAVESTATE_TO), + global->name.savestate); + } } } @@ -320,6 +303,7 @@ static bool path_init_subsystem(void) unsigned i, j; const struct retro_subsystem_info *info = NULL; rarch_system_info_t *system = NULL; + global_t *global = global_get_ptr(); runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); @@ -378,31 +362,30 @@ static bool path_init_subsystem(void) } } +<<<<<<< HEAD /* Let other relevant paths be inferred from the main SRAM location. */ if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL)) +======= + if (global) +>>>>>>> parent of 6ee7b73... Move global->name to paths.c { - char tmp[PATH_MAX_LENGTH] = {0}; + /* Let other relevant paths be inferred from the main SRAM location. */ + if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH)) + fill_pathname_noext(global->name.savefile, + path_main_basename, + file_path_str(FILE_PATH_SRM_EXTENSION), + sizeof(global->name.savefile)); - fill_pathname_noext(tmp, - path_main_basename, - file_path_str(FILE_PATH_SRM_EXTENSION), - sizeof(tmp)); - path_set(RARCH_PATH_SAVEFILE, tmp); - } - - if (path_is_directory(path_get(RARCH_PATH_SAVEFILE))) - { - char tmp[PATH_MAX_LENGTH] = {0}; - - fill_pathname_dir(tmp, - path_main_basename, - file_path_str(FILE_PATH_SRM_EXTENSION), - sizeof(tmp)); - path_set(RARCH_PATH_SAVEFILE, tmp); - - RARCH_LOG("%s \"%s\".\n", - msg_hash_to_str(MSG_REDIRECTING_SAVEFILE_TO), - tmp); + if (path_is_directory(global->name.savefile)) + { + fill_pathname_dir(global->name.savefile, + path_main_basename, + file_path_str(FILE_PATH_SRM_EXTENSION), + sizeof(global->name.savefile)); + RARCH_LOG("%s \"%s\".\n", + msg_hash_to_str(MSG_REDIRECTING_SAVEFILE_TO), + global->name.savefile); + } } return true; @@ -448,44 +431,32 @@ static void path_init_savefile_internal(void) void path_fill_names(void) { - path_init_savefile_internal(); + global_t *global = global_get_ptr(); - bsv_movie_set_path(path_get(RARCH_PATH_SAVEFILE)); + path_init_savefile_internal(); + + if (global) + bsv_movie_set_path(global->name.savefile); if (string_is_empty(path_main_basename)) return; - if (string_is_empty(path_get(RARCH_PATH_UPS))) + if (global) { - char tmp[PATH_MAX_LENGTH] = {0}; + if (string_is_empty(global->name.ups)) + fill_pathname_noext(global->name.ups, path_main_basename, + file_path_str(FILE_PATH_UPS_EXTENSION), + sizeof(global->name.ups)); - fill_pathname_noext(tmp, path_main_basename, - file_path_str(FILE_PATH_UPS_EXTENSION), - sizeof(tmp)); + if (string_is_empty(global->name.bps)) + fill_pathname_noext(global->name.bps, path_main_basename, + file_path_str(FILE_PATH_BPS_EXTENSION), + sizeof(global->name.bps)); - path_set(RARCH_PATH_UPS, tmp); - } - - if (string_is_empty(path_get(RARCH_PATH_BPS))) - { - char tmp[PATH_MAX_LENGTH] = {0}; - - fill_pathname_noext(tmp, path_main_basename, - file_path_str(FILE_PATH_BPS_EXTENSION), - sizeof(tmp)); - - path_set(RARCH_PATH_BPS, tmp); - } - - if (string_is_empty(path_get(RARCH_PATH_IPS))) - { - char tmp[PATH_MAX_LENGTH] = {0}; - - fill_pathname_noext(tmp, path_main_basename, - file_path_str(FILE_PATH_IPS_EXTENSION), - sizeof(tmp)); - - path_set(RARCH_PATH_IPS, tmp); + if (string_is_empty(global->name.ips)) + fill_pathname_noext(global->name.ips, path_main_basename, + file_path_str(FILE_PATH_IPS_EXTENSION), + sizeof(global->name.ips)); } } @@ -500,20 +471,6 @@ const char *path_get(enum rarch_path_type type) { switch (type) { - case RARCH_PATH_SAVEFILE: - return path_savefile; - case RARCH_PATH_SAVESTATE: - return path_savestate; - case RARCH_PATH_CHEATFILE: - return path_cheatfile; - case RARCH_PATH_REMAPFILE: - return path_remapfile; - case RARCH_PATH_IPS: - return path_ips; - case RARCH_PATH_BPS: - return path_bps; - case RARCH_PATH_UPS: - return path_ups; case RARCH_PATH_BASENAME: return path_main_basename; case RARCH_PATH_CORE_OPTIONS: @@ -548,6 +505,7 @@ size_t path_get_core_size(void) static void path_set_names(const char *path) { +<<<<<<< HEAD path_set_basename(path); if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL)) @@ -566,17 +524,24 @@ static void path_set_names(const char *path) fill_pathname_noext(tmp, path_main_basename, file_path_str(FILE_PATH_STATE_EXTENSION), sizeof(tmp)); +======= + global_t *global = global_get_ptr(); +>>>>>>> parent of 6ee7b73... Move global->name to paths.c - path_set(RARCH_PATH_SAVESTATE, tmp); - } + path_set_basename(path); + if (global) { - char tmp[PATH_MAX_LENGTH] = {0}; + if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH)) + fill_pathname_noext(global->name.savefile, path_main_basename, + file_path_str(FILE_PATH_SRM_EXTENSION), sizeof(global->name.savefile)); - fill_pathname_noext(tmp, path_main_basename, - file_path_str(FILE_PATH_CHT_EXTENSION), sizeof(tmp)); + if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH)) + fill_pathname_noext(global->name.savestate, path_main_basename, + file_path_str(FILE_PATH_STATE_EXTENSION), sizeof(global->name.savestate)); - path_set(RARCH_PATH_CHEATFILE, tmp); + fill_pathname_noext(global->name.cheatfile, path_main_basename, + file_path_str(FILE_PATH_CHT_EXTENSION), sizeof(global->name.cheatfile)); } path_set_redirect(); @@ -592,34 +557,6 @@ bool path_set(enum rarch_path_type type, const char *path) case RARCH_PATH_NAMES: path_set_names(path); break; - case RARCH_PATH_SAVEFILE: - strlcpy(path_savefile, path, - sizeof(path_savefile)); - break; - case RARCH_PATH_SAVESTATE: - strlcpy(path_savestate, path, - sizeof(path_savestate)); - break; - case RARCH_PATH_CHEATFILE: - strlcpy(path_cheatfile, path, - sizeof(path_cheatfile)); - break; - case RARCH_PATH_REMAPFILE: - strlcpy(path_remapfile, path, - sizeof(path_remapfile)); - break; - case RARCH_PATH_IPS: - strlcpy(path_ips, path, - sizeof(path_ips)); - break; - case RARCH_PATH_BPS: - strlcpy(path_bps, path, - sizeof(path_bps)); - break; - case RARCH_PATH_UPS: - strlcpy(path_ups, path, - sizeof(path_ups)); - break; case RARCH_PATH_CORE: strlcpy(path_libretro, path, sizeof(path_libretro)); @@ -660,34 +597,6 @@ bool path_is_empty(enum rarch_path_type type) { switch (type) { - case RARCH_PATH_SAVEFILE: - if (string_is_empty(path_savefile)) - return true; - break; - case RARCH_PATH_SAVESTATE: - if (string_is_empty(path_savestate)) - return true; - break; - case RARCH_PATH_CHEATFILE: - if (string_is_empty(path_cheatfile)) - return true; - break; - case RARCH_PATH_REMAPFILE: - if (string_is_empty(path_remapfile)) - return true; - break; - case RARCH_PATH_IPS: - if (string_is_empty(path_ips)) - return true; - break; - case RARCH_PATH_BPS: - if (string_is_empty(path_bps)) - return true; - break; - case RARCH_PATH_UPS: - if (string_is_empty(path_ups)) - return true; - break; case RARCH_PATH_SUBSYSTEM: if (string_is_empty(subsystem_path)) return true; @@ -725,27 +634,6 @@ void path_clear(enum rarch_path_type type) { switch (type) { - case RARCH_PATH_SAVEFILE: - *path_savefile = '\0'; - break; - case RARCH_PATH_SAVESTATE: - *path_savestate = '\0'; - break; - case RARCH_PATH_CHEATFILE: - *path_cheatfile = '\0'; - break; - case RARCH_PATH_REMAPFILE: - *path_remapfile = '\0'; - break; - case RARCH_PATH_IPS: - *path_ips = '\0'; - break; - case RARCH_PATH_BPS: - *path_bps = '\0'; - break; - case RARCH_PATH_UPS: - *path_ups = '\0'; - break; case RARCH_PATH_SUBSYSTEM: *subsystem_path = '\0'; break; diff --git a/paths.h b/paths.h index ec01bb6091..83043be421 100644 --- a/paths.h +++ b/paths.h @@ -38,13 +38,6 @@ enum rarch_path_type RARCH_PATH_NAMES, RARCH_PATH_CONFIG, RARCH_PATH_CONTENT, - RARCH_PATH_SAVEFILE, - RARCH_PATH_SAVESTATE, - RARCH_PATH_CHEATFILE, - RARCH_PATH_UPS, - RARCH_PATH_IPS, - RARCH_PATH_BPS, - RARCH_PATH_REMAPFILE, RARCH_PATH_CONFIG_APPEND, RARCH_PATH_CORE_OPTIONS, RARCH_PATH_DEFAULT_SHADER_PRESET, diff --git a/retroarch.c b/retroarch.c index 447037a8f3..c823caab2b 100644 --- a/retroarch.c +++ b/retroarch.c @@ -481,9 +481,9 @@ static void retroarch_parse_input(int argc, char *argv[]) rarch_ctl(RARCH_CTL_UNSET_UPS_PREF, NULL); rarch_ctl(RARCH_CTL_UNSET_IPS_PREF, NULL); rarch_ctl(RARCH_CTL_UNSET_BPS_PREF, NULL); - path_clear(RARCH_PATH_UPS); - path_clear(RARCH_PATH_BPS); - path_clear(RARCH_PATH_IPS); + *global->name.ups = '\0'; + *global->name.bps = '\0'; + *global->name.ips = '\0'; runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL); @@ -567,7 +567,8 @@ static void retroarch_parse_input(int argc, char *argv[]) break; case 's': - path_set(RARCH_PATH_SAVEFILE, optarg); + strlcpy(global->name.savefile, optarg, + sizeof(global->name.savefile)); retroarch_override_setting_set( RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL); break; @@ -577,7 +578,8 @@ static void retroarch_parse_input(int argc, char *argv[]) break; case 'S': - path_set(RARCH_PATH_SAVESTATE, optarg); + strlcpy(global->name.savestate, optarg, + sizeof(global->name.savestate)); retroarch_override_setting_set( RARCH_OVERRIDE_SETTING_STATE_PATH, NULL); break; @@ -736,19 +738,22 @@ static void retroarch_parse_input(int argc, char *argv[]) #endif case RA_OPT_BPS: - path_set(RARCH_PATH_BPS, optarg); + strlcpy(global->name.bps, optarg, + sizeof(global->name.bps)); rarch_ctl(RARCH_CTL_SET_BPS_PREF, NULL); retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_BPS_PREF, NULL); break; case 'U': - path_set(RARCH_PATH_UPS, optarg); + strlcpy(global->name.ups, optarg, + sizeof(global->name.ups)); rarch_ctl(RARCH_CTL_SET_UPS_PREF, NULL); retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_UPS_PREF, NULL); break; case RA_OPT_IPS: - path_set(RARCH_PATH_IPS, optarg); + strlcpy(global->name.ips, optarg, + sizeof(global->name.ips)); rarch_ctl(RARCH_CTL_SET_IPS_PREF, NULL); retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_IPS_PREF, NULL); break; @@ -868,6 +873,7 @@ static void retroarch_parse_input(int argc, char *argv[]) content_set_does_not_need_content(); /* Copy SRM/state dirs used, so they can be reused on reentrancy. */ +<<<<<<< HEAD if (retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL) && path_is_directory(path_get(RARCH_PATH_SAVEFILE))) dir_set_savefile(path_get(RARCH_PATH_SAVEFILE)); @@ -875,6 +881,15 @@ static void retroarch_parse_input(int argc, char *argv[]) if (retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL) && path_is_directory(path_get(RARCH_PATH_SAVESTATE))) dir_set_savestate(path_get(RARCH_PATH_SAVESTATE)); +======= + if (retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH) && + path_is_directory(global->name.savefile)) + dir_set_savefile(global->name.savefile); + + if (retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH) && + path_is_directory(global->name.savestate)) + dir_set_savestate(global->name.savestate); +>>>>>>> parent of 6ee7b73... Move global->name to paths.c } static bool retroarch_init_state(void) diff --git a/runloop.c b/runloop.c index fb1ad59d75..cdf2fe2e11 100644 --- a/runloop.c +++ b/runloop.c @@ -744,13 +744,6 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) rarch_ctl(RARCH_CTL_UNSET_UPS_PREF, NULL); rarch_ctl(RARCH_CTL_UNSET_PATCH_BLOCKED, NULL); path_clear(RARCH_PATH_CONTENT); - path_clear(RARCH_PATH_SAVEFILE); - path_clear(RARCH_PATH_SAVESTATE); - path_clear(RARCH_PATH_CHEATFILE); - path_clear(RARCH_PATH_REMAPFILE); - path_clear(RARCH_PATH_IPS); - path_clear(RARCH_PATH_UPS); - path_clear(RARCH_PATH_BPS); runloop_overrides_active = false; core_unset_input_descriptors(); diff --git a/runloop.h b/runloop.h index e289603137..5a68ba563c 100644 --- a/runloop.h +++ b/runloop.h @@ -137,6 +137,25 @@ typedef struct rarch_resolution typedef struct global { +<<<<<<< HEAD +======= + struct + { + bool libretro_device[MAX_USERS]; + } has_set; + + struct + { + char savefile[PATH_MAX_LENGTH]; + char savestate[PATH_MAX_LENGTH]; + char cheatfile[PATH_MAX_LENGTH]; + char ups[PATH_MAX_LENGTH]; + char bps[PATH_MAX_LENGTH]; + char ips[PATH_MAX_LENGTH]; + char remapfile[PATH_MAX_LENGTH]; + } name; + +>>>>>>> parent of 6ee7b73... Move global->name to paths.c #ifdef HAVE_NETWORKING /* Netplay. */ struct diff --git a/tasks/task_save.c b/tasks/task_save.c index 96324d0992..cdffdfe78f 100644 --- a/tasks/task_save.c +++ b/tasks/task_save.c @@ -41,7 +41,6 @@ #include "../file_path_special.h" #include "../configuration.h" #include "../msg_hash.h" -#include "../paths.h" #include "../retroarch.h" #include "../runloop.h" #include "../verbosity.h" @@ -948,14 +947,15 @@ void path_init_savefile_rtc(void) { union string_list_elem_attr attr; char savefile_name_rtc[PATH_MAX_LENGTH] = {0}; + global_t *global = global_get_ptr(); attr.i = RETRO_MEMORY_SAVE_RAM; - string_list_append(task_save_files, path_get(RARCH_PATH_SAVEFILE), attr); + string_list_append(task_save_files, global->name.savefile, attr); /* Infer .rtc save path from save ram path. */ attr.i = RETRO_MEMORY_RTC; fill_pathname(savefile_name_rtc, - path_get(RARCH_PATH_SAVEFILE), + global->name.savefile, file_path_str(FILE_PATH_RTC_EXTENSION), sizeof(savefile_name_rtc)); string_list_append(task_save_files, savefile_name_rtc, attr);