From 5ac8cc0b6a0652d6b27213ec13429d5252eb08c7 Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Fri, 6 Jan 2023 21:21:31 +0100 Subject: [PATCH] * Rename retroarch_path_set_redirect to runloop_path_set_redirect * move more retroarch path functions to runloop.c - because they are related to the runloop state instead of retroarch state --- paths.h | 2 - retroarch.c | 288 ++----------------------------------------- retroarch.h | 2 - runloop.c | 283 +++++++++++++++++++++++++++++++++++++++++- runloop.h | 11 +- tasks/task_content.c | 2 +- 6 files changed, 298 insertions(+), 290 deletions(-) diff --git a/paths.h b/paths.h index 3e0134e701..becab68332 100644 --- a/paths.h +++ b/paths.h @@ -71,8 +71,6 @@ void path_deinit_savefile(void); bool path_set(enum rarch_path_type type, const char *path); -void path_set_special(char **argv, unsigned num_content); - size_t path_get_realsize(enum rarch_path_type type); struct string_list *path_get_subsystem_list(void); diff --git a/retroarch.c b/retroarch.c index 84c5020a77..6184822316 100644 --- a/retroarch.c +++ b/retroarch.c @@ -689,275 +689,6 @@ const char *char_list_new_special(enum string_list_type type, void *data) return options; } -void retroarch_path_set_redirect(settings_t *settings) -{ - char content_dir_name[PATH_MAX_LENGTH]; - char new_savefile_dir[PATH_MAX_LENGTH]; - char new_savestate_dir[PATH_MAX_LENGTH]; - struct rarch_state *p_rarch = &rarch_st; - const char *old_savefile_dir = p_rarch->dir_savefile; - const char *old_savestate_dir = p_rarch->dir_savestate; - runloop_state_t *runloop_st = runloop_state_get_ptr(); - struct retro_system_info *system = &runloop_st->system.info; - bool sort_savefiles_enable = settings->bools.sort_savefiles_enable; - bool sort_savefiles_by_content_enable = settings->bools.sort_savefiles_by_content_enable; - bool sort_savestates_enable = settings->bools.sort_savestates_enable; - bool sort_savestates_by_content_enable = settings->bools.sort_savestates_by_content_enable; - bool savefiles_in_content_dir = settings->bools.savefiles_in_content_dir; - bool savestates_in_content_dir = settings->bools.savestates_in_content_dir; - - content_dir_name[0] = '\0'; - - /* Initialize current save directories - * with the values from the config. */ - strlcpy(new_savefile_dir, old_savefile_dir, sizeof(new_savefile_dir)); - strlcpy(new_savestate_dir, old_savestate_dir, sizeof(new_savestate_dir)); - - /* Get content directory name, if per-content-directory - * saves/states are enabled */ - if ((sort_savefiles_by_content_enable || - sort_savestates_by_content_enable) && - !string_is_empty(runloop_st->runtime_content_path_basename)) - fill_pathname_parent_dir_name(content_dir_name, - runloop_st->runtime_content_path_basename, - sizeof(content_dir_name)); - - if (system && !string_is_empty(system->library_name)) - { -#ifdef HAVE_MENU - if (!string_is_equal(system->library_name, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE))) -#endif - { - /* Per-core and/or per-content-directory saves */ - if ((sort_savefiles_enable || sort_savefiles_by_content_enable) - && !string_is_empty(old_savefile_dir)) - { - /* Append content directory name to save location */ - if (sort_savefiles_by_content_enable) - fill_pathname_join_special( - new_savefile_dir, - old_savefile_dir, - content_dir_name, - sizeof(new_savefile_dir)); - - /* Append library_name to the save location */ - if (sort_savefiles_enable) - fill_pathname_join( - new_savefile_dir, - new_savefile_dir, - system->library_name, - sizeof(new_savefile_dir)); - - /* If path doesn't exist, try to create it, - * if everything fails revert to the original path. */ - if (!path_is_directory(new_savefile_dir)) - if (!path_mkdir(new_savefile_dir)) - { - RARCH_LOG("%s %s\n", - msg_hash_to_str(MSG_REVERTING_SAVEFILE_DIRECTORY_TO), - old_savefile_dir); - - strlcpy(new_savefile_dir, old_savefile_dir, sizeof(new_savefile_dir)); - } - } - - /* Per-core and/or per-content-directory savestates */ - if ((sort_savestates_enable || sort_savestates_by_content_enable) - && !string_is_empty(old_savestate_dir)) - { - /* Append content directory name to savestate location */ - if (sort_savestates_by_content_enable) - fill_pathname_join_special( - new_savestate_dir, - old_savestate_dir, - content_dir_name, - sizeof(new_savestate_dir)); - - /* Append library_name to the savestate location */ - if (sort_savestates_enable) - { - fill_pathname_join( - new_savestate_dir, - new_savestate_dir, - system->library_name, - sizeof(new_savestate_dir)); - } - - /* If path doesn't exist, try to create it. - * If everything fails, revert to the original path. */ - if (!path_is_directory(new_savestate_dir)) - if (!path_mkdir(new_savestate_dir)) - { - RARCH_LOG("%s %s\n", - msg_hash_to_str(MSG_REVERTING_SAVESTATE_DIRECTORY_TO), - old_savestate_dir); - strlcpy(new_savestate_dir, - old_savestate_dir, - sizeof(new_savestate_dir)); - } - } - } - } - - /* Set savefile directory if empty to content directory */ - if (string_is_empty(new_savefile_dir) || savefiles_in_content_dir) - { - strlcpy(new_savefile_dir, - runloop_st->runtime_content_path_basename, - sizeof(new_savefile_dir)); - path_basedir(new_savefile_dir); - - if (string_is_empty(new_savefile_dir)) - RARCH_LOG("Cannot resolve save file path.\n"); - else if (sort_savefiles_enable || sort_savefiles_by_content_enable) - RARCH_LOG("Saving files in content directory is set. This overrides other save file directory settings.\n"); - } - - /* Set savestate directory if empty based on content directory */ - if (string_is_empty(new_savestate_dir) || savestates_in_content_dir) - { - strlcpy(new_savestate_dir, - runloop_st->runtime_content_path_basename, - sizeof(new_savestate_dir)); - path_basedir(new_savestate_dir); - - if (string_is_empty(new_savestate_dir)) - RARCH_LOG("Cannot resolve save state file path.\n"); - else if (sort_savestates_enable || sort_savestates_by_content_enable) - RARCH_LOG("Saving save states in content directory is set. This overrides other save state file directory settings.\n"); - } - -#ifdef HAVE_NETWORKING - /* Special save directory for netplay clients. */ - if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) && - !netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL)) - { - fill_pathname_join(new_savefile_dir, new_savefile_dir, ".netplay", - sizeof(new_savefile_dir)); - - if (!path_is_directory(new_savefile_dir) && - !path_mkdir(new_savefile_dir)) - path_basedir(new_savefile_dir); - } -#endif - - if (system && !string_is_empty(system->library_name)) - { - bool savefile_is_dir = path_is_directory(new_savefile_dir); - bool savestate_is_dir = path_is_directory(new_savestate_dir); - if (savefile_is_dir) - strlcpy(runloop_st->name.savefile, new_savefile_dir, - sizeof(runloop_st->name.savefile)); - else - savefile_is_dir = path_is_directory(runloop_st->name.savefile); - - if (savestate_is_dir) - strlcpy(runloop_st->name.savestate, new_savestate_dir, - sizeof(runloop_st->name.savestate)); - else - savestate_is_dir = path_is_directory(runloop_st->name.savestate); - - if (savefile_is_dir) - { - fill_pathname_dir(runloop_st->name.savefile, - !string_is_empty(runloop_st->runtime_content_path_basename) - ? runloop_st->runtime_content_path_basename - : system->library_name, - FILE_PATH_SRM_EXTENSION, - sizeof(runloop_st->name.savefile)); - RARCH_LOG("[Overrides]: %s \"%s\".\n", - msg_hash_to_str(MSG_REDIRECTING_SAVEFILE_TO), - runloop_st->name.savefile); - } - - if (savestate_is_dir) - { - fill_pathname_dir(runloop_st->name.savestate, - !string_is_empty(runloop_st->runtime_content_path_basename) - ? runloop_st->runtime_content_path_basename - : system->library_name, - FILE_PATH_STATE_EXTENSION, - sizeof(runloop_st->name.savestate)); - RARCH_LOG("[Overrides]: %s \"%s\".\n", - msg_hash_to_str(MSG_REDIRECTING_SAVESTATE_TO), - runloop_st->name.savestate); - } - -#ifdef HAVE_CHEATS - if (path_is_directory(runloop_st->name.cheatfile)) - { - fill_pathname_dir(runloop_st->name.cheatfile, - !string_is_empty(runloop_st->runtime_content_path_basename) - ? runloop_st->runtime_content_path_basename - : system->library_name, - FILE_PATH_CHT_EXTENSION, - sizeof(runloop_st->name.cheatfile)); - RARCH_LOG("[Overrides]: %s \"%s\".\n", - msg_hash_to_str(MSG_REDIRECTING_CHEATFILE_TO), - runloop_st->name.cheatfile); - } -#endif - } - - dir_set(RARCH_DIR_CURRENT_SAVEFILE, new_savefile_dir); - dir_set(RARCH_DIR_CURRENT_SAVESTATE, new_savestate_dir); -} - -void path_set_special(char **argv, unsigned num_content) -{ - unsigned i; - char str[PATH_MAX_LENGTH]; - union string_list_elem_attr attr; - bool is_dir = false; - struct string_list subsystem_paths = {0}; - runloop_state_t *runloop_st = runloop_state_get_ptr(); - const char *savestate_dir = runloop_st->savestate_dir; - - /* First content file is the significant one. */ - runloop_path_set_basename(argv[0]); - - string_list_initialize(&subsystem_paths); - - runloop_st->subsystem_fullpaths = string_list_new(); - retro_assert(runloop_st->subsystem_fullpaths); - - attr.i = 0; - - for (i = 0; i < num_content; i++) - { - string_list_append(runloop_st->subsystem_fullpaths, argv[i], attr); - strlcpy(str, argv[i], sizeof(str)); - path_remove_extension(str); - string_list_append(&subsystem_paths, path_basename(str), attr); - } - - str[0] = '\0'; - string_list_join_concat(str, sizeof(str), &subsystem_paths, " + "); - string_list_deinitialize(&subsystem_paths); - - /* We defer SRAM path updates until we can resolve it. - * It is more complicated for special content types. */ - is_dir = path_is_directory(savestate_dir); - - if (is_dir) - strlcpy(runloop_st->name.savestate, savestate_dir, - sizeof(runloop_st->name.savestate)); /* TODO/FIXME - why are we setting this string here but then later overwriting it later with fil_pathname_dir? */ - else - is_dir = path_is_directory(runloop_st->name.savestate); - - if (is_dir) - { - fill_pathname_dir(runloop_st->name.savestate, - str, - ".state", - sizeof(runloop_st->name.savestate)); - RARCH_LOG("%s \"%s\".\n", - msg_hash_to_str(MSG_REDIRECTING_SAVESTATE_TO), - runloop_st->name.savestate); - } -} - char *path_get_ptr(enum rarch_path_type type) { struct rarch_state *p_rarch = &rarch_st; @@ -1075,7 +806,8 @@ bool path_set(enum rarch_path_type type, const char *path) case RARCH_PATH_NAMES: runloop_path_set_basename(path); runloop_path_set_names(); - retroarch_path_set_redirect(config_get_ptr()); + runloop_path_set_redirect(config_get_ptr(), p_rarch->dir_savefile, + p_rarch->dir_savestate); break; case RARCH_PATH_CORE: strlcpy(p_rarch->path_libretro, path, @@ -1297,13 +1029,6 @@ enum rarch_content_type path_is_media_type(const char *path) return RARCH_CONTENT_NONE; } -static void path_deinit_subsystem(runloop_state_t *runloop_st) -{ - if (runloop_st->subsystem_fullpaths) - string_list_free(runloop_st->subsystem_fullpaths); - runloop_st->subsystem_fullpaths = NULL; -} - /* get size functions */ size_t dir_get_size(enum rarch_dir_type type) @@ -2400,7 +2125,8 @@ bool command_event(enum event_command cmd, void *data) audio_st->callback.callback = NULL; audio_st->callback.set_state = NULL; - if (!type || !runloop_event_init_core(settings, input_st, *type)) + if (!type || !runloop_event_init_core(settings, input_st, *type, + p_rarch->dir_savefile, p_rarch->dir_savestate)) { /* If core failed to initialise, audio callback * interface may be assigned invalid function @@ -3628,7 +3354,7 @@ static void global_free(struct rarch_state *p_rarch) content_deinit(); - path_deinit_subsystem(runloop_st); + runloop_path_deinit_subsystem(); command_event(CMD_EVENT_RECORD_DEINIT, NULL); retro_main_log_file_deinit(); @@ -5172,7 +4898,7 @@ static bool retroarch_parse_input_and_config( if (subsystem_path_is_empty) path_set(RARCH_PATH_NAMES, (const char*)argv[optind]); else - path_set_special(argv + optind, argc - optind); + runloop_path_set_special(argv + optind, argc - optind); /* Register that content has been set via the * command line interface */ @@ -5696,7 +5422,7 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data) content_deinit(); - path_deinit_subsystem(runloop_st); + runloop_path_deinit_subsystem(); path_deinit_savefile(); runloop_st->flags &= ~RUNLOOP_FLAG_IS_INITED; diff --git a/retroarch.h b/retroarch.h index 4489246bd5..76dbe60c60 100644 --- a/retroarch.h +++ b/retroarch.h @@ -121,8 +121,6 @@ int content_get_subsystem(void); void retroarch_menu_running(void); -void retroarch_path_set_redirect(settings_t *settings); - void retroarch_menu_running_finished(bool quit); enum retro_language rarch_get_language_from_iso(const char *lang); diff --git a/runloop.c b/runloop.c index d6ca03b47b..9f8f72d7f4 100644 --- a/runloop.c +++ b/runloop.c @@ -1090,7 +1090,6 @@ static bool validate_per_core_options(char *s, return true; } - static bool validate_game_options( const char *core_name, char *s, size_t len, bool mkdir) @@ -5617,7 +5616,9 @@ static bool runloop_event_load_core(runloop_state_t *runloop_st, bool runloop_event_init_core( settings_t *settings, void *input_data, - enum rarch_core_type type) + enum rarch_core_type type, + const char *old_savefile_dir, + const char *old_savestate_dir) { size_t len; runloop_state_t *runloop_st = &runloop_state; @@ -5754,7 +5755,7 @@ bool runloop_event_init_core( #endif /* Per-core saves: reset redirection paths */ - retroarch_path_set_redirect(settings); + runloop_path_set_redirect(settings, old_savefile_dir, old_savestate_dir); video_driver_set_cached_frame_ptr(NULL); @@ -8747,3 +8748,279 @@ void runloop_path_set_names(void) } #endif } + +void runloop_path_set_redirect(settings_t *settings, + const char *old_savefile_dir, + const char *old_savestate_dir) +{ + char content_dir_name[PATH_MAX_LENGTH]; + char new_savefile_dir[PATH_MAX_LENGTH]; + char new_savestate_dir[PATH_MAX_LENGTH]; + runloop_state_t *runloop_st = &runloop_state; + struct retro_system_info *system = &runloop_st->system.info; + bool sort_savefiles_enable = settings->bools.sort_savefiles_enable; + bool sort_savefiles_by_content_enable = settings->bools.sort_savefiles_by_content_enable; + bool sort_savestates_enable = settings->bools.sort_savestates_enable; + bool sort_savestates_by_content_enable = settings->bools.sort_savestates_by_content_enable; + bool savefiles_in_content_dir = settings->bools.savefiles_in_content_dir; + bool savestates_in_content_dir = settings->bools.savestates_in_content_dir; + + content_dir_name[0] = '\0'; + + /* Initialize current save directories + * with the values from the config. */ + strlcpy(new_savefile_dir, old_savefile_dir, sizeof(new_savefile_dir)); + strlcpy(new_savestate_dir, old_savestate_dir, sizeof(new_savestate_dir)); + + /* Get content directory name, if per-content-directory + * saves/states are enabled */ + if ((sort_savefiles_by_content_enable || + sort_savestates_by_content_enable) && + !string_is_empty(runloop_st->runtime_content_path_basename)) + fill_pathname_parent_dir_name(content_dir_name, + runloop_st->runtime_content_path_basename, + sizeof(content_dir_name)); + + if (system && !string_is_empty(system->library_name)) + { +#ifdef HAVE_MENU + if (!string_is_equal(system->library_name, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE))) +#endif + { + /* Per-core and/or per-content-directory saves */ + if ((sort_savefiles_enable || sort_savefiles_by_content_enable) + && !string_is_empty(old_savefile_dir)) + { + /* Append content directory name to save location */ + if (sort_savefiles_by_content_enable) + fill_pathname_join_special( + new_savefile_dir, + old_savefile_dir, + content_dir_name, + sizeof(new_savefile_dir)); + + /* Append library_name to the save location */ + if (sort_savefiles_enable) + fill_pathname_join( + new_savefile_dir, + new_savefile_dir, + system->library_name, + sizeof(new_savefile_dir)); + + /* If path doesn't exist, try to create it, + * if everything fails revert to the original path. */ + if (!path_is_directory(new_savefile_dir)) + if (!path_mkdir(new_savefile_dir)) + { + RARCH_LOG("%s %s\n", + msg_hash_to_str(MSG_REVERTING_SAVEFILE_DIRECTORY_TO), + old_savefile_dir); + + strlcpy(new_savefile_dir, old_savefile_dir, sizeof(new_savefile_dir)); + } + } + + /* Per-core and/or per-content-directory savestates */ + if ((sort_savestates_enable || sort_savestates_by_content_enable) + && !string_is_empty(old_savestate_dir)) + { + /* Append content directory name to savestate location */ + if (sort_savestates_by_content_enable) + fill_pathname_join_special( + new_savestate_dir, + old_savestate_dir, + content_dir_name, + sizeof(new_savestate_dir)); + + /* Append library_name to the savestate location */ + if (sort_savestates_enable) + { + fill_pathname_join( + new_savestate_dir, + new_savestate_dir, + system->library_name, + sizeof(new_savestate_dir)); + } + + /* If path doesn't exist, try to create it. + * If everything fails, revert to the original path. */ + if (!path_is_directory(new_savestate_dir)) + if (!path_mkdir(new_savestate_dir)) + { + RARCH_LOG("%s %s\n", + msg_hash_to_str(MSG_REVERTING_SAVESTATE_DIRECTORY_TO), + old_savestate_dir); + strlcpy(new_savestate_dir, + old_savestate_dir, + sizeof(new_savestate_dir)); + } + } + } + } + + /* Set savefile directory if empty to content directory */ + if (string_is_empty(new_savefile_dir) || savefiles_in_content_dir) + { + strlcpy(new_savefile_dir, + runloop_st->runtime_content_path_basename, + sizeof(new_savefile_dir)); + path_basedir(new_savefile_dir); + + if (string_is_empty(new_savefile_dir)) + RARCH_LOG("Cannot resolve save file path.\n"); + else if (sort_savefiles_enable || sort_savefiles_by_content_enable) + RARCH_LOG("Saving files in content directory is set. This overrides other save file directory settings.\n"); + } + + /* Set savestate directory if empty based on content directory */ + if (string_is_empty(new_savestate_dir) || savestates_in_content_dir) + { + strlcpy(new_savestate_dir, + runloop_st->runtime_content_path_basename, + sizeof(new_savestate_dir)); + path_basedir(new_savestate_dir); + + if (string_is_empty(new_savestate_dir)) + RARCH_LOG("Cannot resolve save state file path.\n"); + else if (sort_savestates_enable || sort_savestates_by_content_enable) + RARCH_LOG("Saving save states in content directory is set. This overrides other save state file directory settings.\n"); + } + +#ifdef HAVE_NETWORKING + /* Special save directory for netplay clients. */ + if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) && + !netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL)) + { + fill_pathname_join(new_savefile_dir, new_savefile_dir, ".netplay", + sizeof(new_savefile_dir)); + + if (!path_is_directory(new_savefile_dir) && + !path_mkdir(new_savefile_dir)) + path_basedir(new_savefile_dir); + } +#endif + + if (system && !string_is_empty(system->library_name)) + { + bool savefile_is_dir = path_is_directory(new_savefile_dir); + bool savestate_is_dir = path_is_directory(new_savestate_dir); + if (savefile_is_dir) + strlcpy(runloop_st->name.savefile, new_savefile_dir, + sizeof(runloop_st->name.savefile)); + else + savefile_is_dir = path_is_directory(runloop_st->name.savefile); + + if (savestate_is_dir) + strlcpy(runloop_st->name.savestate, new_savestate_dir, + sizeof(runloop_st->name.savestate)); + else + savestate_is_dir = path_is_directory(runloop_st->name.savestate); + + if (savefile_is_dir) + { + fill_pathname_dir(runloop_st->name.savefile, + !string_is_empty(runloop_st->runtime_content_path_basename) + ? runloop_st->runtime_content_path_basename + : system->library_name, + FILE_PATH_SRM_EXTENSION, + sizeof(runloop_st->name.savefile)); + RARCH_LOG("[Overrides]: %s \"%s\".\n", + msg_hash_to_str(MSG_REDIRECTING_SAVEFILE_TO), + runloop_st->name.savefile); + } + + if (savestate_is_dir) + { + fill_pathname_dir(runloop_st->name.savestate, + !string_is_empty(runloop_st->runtime_content_path_basename) + ? runloop_st->runtime_content_path_basename + : system->library_name, + FILE_PATH_STATE_EXTENSION, + sizeof(runloop_st->name.savestate)); + RARCH_LOG("[Overrides]: %s \"%s\".\n", + msg_hash_to_str(MSG_REDIRECTING_SAVESTATE_TO), + runloop_st->name.savestate); + } + +#ifdef HAVE_CHEATS + if (path_is_directory(runloop_st->name.cheatfile)) + { + fill_pathname_dir(runloop_st->name.cheatfile, + !string_is_empty(runloop_st->runtime_content_path_basename) + ? runloop_st->runtime_content_path_basename + : system->library_name, + FILE_PATH_CHT_EXTENSION, + sizeof(runloop_st->name.cheatfile)); + RARCH_LOG("[Overrides]: %s \"%s\".\n", + msg_hash_to_str(MSG_REDIRECTING_CHEATFILE_TO), + runloop_st->name.cheatfile); + } +#endif + } + + dir_set(RARCH_DIR_CURRENT_SAVEFILE, new_savefile_dir); + dir_set(RARCH_DIR_CURRENT_SAVESTATE, new_savestate_dir); +} + +void runloop_path_deinit_subsystem(void) +{ + runloop_state_t *runloop_st = &runloop_state; + if (runloop_st->subsystem_fullpaths) + string_list_free(runloop_st->subsystem_fullpaths); + runloop_st->subsystem_fullpaths = NULL; +} + +void runloop_path_set_special(char **argv, unsigned num_content) +{ + unsigned i; + char str[PATH_MAX_LENGTH]; + union string_list_elem_attr attr; + bool is_dir = false; + struct string_list subsystem_paths = {0}; + runloop_state_t *runloop_st = &runloop_state; + const char *savestate_dir = runloop_st->savestate_dir; + + /* First content file is the significant one. */ + runloop_path_set_basename(argv[0]); + + string_list_initialize(&subsystem_paths); + + runloop_st->subsystem_fullpaths = string_list_new(); + retro_assert(runloop_st->subsystem_fullpaths); + + attr.i = 0; + + for (i = 0; i < num_content; i++) + { + string_list_append(runloop_st->subsystem_fullpaths, argv[i], attr); + strlcpy(str, argv[i], sizeof(str)); + path_remove_extension(str); + string_list_append(&subsystem_paths, path_basename(str), attr); + } + + str[0] = '\0'; + string_list_join_concat(str, sizeof(str), &subsystem_paths, " + "); + string_list_deinitialize(&subsystem_paths); + + /* We defer SRAM path updates until we can resolve it. + * It is more complicated for special content types. */ + is_dir = path_is_directory(savestate_dir); + + if (is_dir) + strlcpy(runloop_st->name.savestate, savestate_dir, + sizeof(runloop_st->name.savestate)); /* TODO/FIXME - why are we setting this string here but then later overwriting it later with fil_pathname_dir? */ + else + is_dir = path_is_directory(runloop_st->name.savestate); + + if (is_dir) + { + fill_pathname_dir(runloop_st->name.savestate, + str, + ".state", + sizeof(runloop_st->name.savestate)); + RARCH_LOG("%s \"%s\".\n", + msg_hash_to_str(MSG_REDIRECTING_SAVESTATE_TO), + runloop_st->name.savestate); + } +} diff --git a/runloop.h b/runloop.h index b243073875..94b4347322 100644 --- a/runloop.h +++ b/runloop.h @@ -389,7 +389,10 @@ void runloop_runahead_clear_variables(runloop_state_t *runloop_st); bool runloop_event_init_core( settings_t *settings, void *input_data, - enum rarch_core_type type); + enum rarch_core_type type, + const char *old_savefile_dir, + const char *old_savestate_dir + ); void runloop_pause_checks(void); @@ -439,6 +442,12 @@ bool runloop_get_current_savestate_path(char *path, size_t len); void runloop_state_free(runloop_state_t *runloop_st); +void runloop_path_set_redirect(settings_t *settings, const char *a, const char *b); + +void runloop_path_set_special(char **argv, unsigned num_content); + +void runloop_path_deinit_subsystem(void); + runloop_state_t *runloop_state_get_ptr(void); RETRO_END_DECLS diff --git a/tasks/task_content.c b/tasks/task_content.c index 9f686bcd11..02a04eb17f 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -2966,7 +2966,7 @@ void content_set_subsystem_info(void) return; path_set(RARCH_PATH_SUBSYSTEM, p_content->pending_subsystem_ident); - path_set_special(p_content->pending_subsystem_roms, + runloop_path_set_special(p_content->pending_subsystem_roms, p_content->pending_subsystem_rom_num); }