Merge pull request #6358 from fr500/subsystem

subsystem part 4: set savestates properly
This commit is contained in:
Twinaphex 2018-03-04 21:09:56 +01:00 committed by GitHub
commit d51048b0df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

24
paths.c
View File

@ -254,31 +254,41 @@ void path_set_special(char **argv, unsigned num_content)
{
unsigned i;
union string_list_elem_attr attr;
struct string_list* subsystem_paths = NULL;
char str[PATH_MAX_LENGTH];
global_t *global = global_get_ptr();
/* First content file is the significant one. */
path_set_basename(argv[0]);
subsystem_fullpaths = string_list_new();
subsystem_paths = string_list_new();
retro_assert(subsystem_fullpaths);
attr.i = 0;
for (i = 0; i < num_content; i++)
{
string_list_append(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, " + ");
/* We defer SRAM path updates until we can resolve it.
* It is more complicated for special content types. */
if (global)
{
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL))
fill_pathname_noext(global->name.savestate, path_main_basename,
file_path_str(FILE_PATH_STATE_EXTENSION),
if(path_is_directory(dir_get(RARCH_DIR_CURRENT_SAVESTATE)))
strlcpy(global->name.savestate, dir_get(RARCH_DIR_CURRENT_SAVESTATE),
sizeof(global->name.savestate));
if (path_is_directory(global->name.savestate))
{
fill_pathname_dir(global->name.savestate, path_main_basename,
fill_pathname_dir(global->name.savestate,
str,
file_path_str(FILE_PATH_STATE_EXTENSION),
sizeof(global->name.savestate));
RARCH_LOG("%s \"%s\".\n",
@ -286,6 +296,7 @@ void path_set_special(char **argv, unsigned num_content)
global->name.savestate);
}
}
free(subsystem_paths);
}
static bool path_init_subsystem(void)
@ -345,6 +356,9 @@ static bool path_init_subsystem(void)
fill_pathname(path, savename,
ext, path_size);
}
RARCH_LOG("%s \"%s\".\n",
msg_hash_to_str(MSG_REDIRECTING_SAVEFILE_TO),
path);
attr.i = mem->type;
string_list_append((struct string_list*)savefile_ptr_get(), path, attr);