Cleanup task_save.c

This commit is contained in:
twinaphex 2017-05-07 17:52:48 +02:00
parent 750d404e23
commit 4d20460e6b
4 changed files with 16 additions and 13 deletions

View File

@ -2063,9 +2063,10 @@ bool command_event(enum event_command cmd, void *data)
case CMD_EVENT_AUTOSAVE_INIT:
command_event(CMD_EVENT_AUTOSAVE_DEINIT, NULL);
#ifdef HAVE_THREADS
autosave_init();
#endif
return autosave_init();
#else
break;
#endif
case CMD_EVENT_AUTOSAVE_STATE:
command_event_save_auto_state();
break;

View File

@ -402,7 +402,10 @@ static void path_init_savefile_internal(void)
path_init_savefile_new();
if (!path_init_subsystem())
path_init_savefile_rtc();
{
global_t *global = global_get_ptr();
path_init_savefile_rtc(global->name.savefile);
}
}

View File

@ -1451,21 +1451,20 @@ bool event_load_save_files(void)
return true;
}
void path_init_savefile_rtc(void)
void path_init_savefile_rtc(const char *savefile_path)
{
union string_list_elem_attr attr;
char savefile_name_rtc[PATH_MAX_LENGTH];
global_t *global = global_get_ptr();
savefile_name_rtc[0] = '\0';
attr.i = RETRO_MEMORY_SAVE_RAM;
string_list_append(task_save_files, global->name.savefile, attr);
string_list_append(task_save_files, savefile_path, attr);
/* Infer .rtc save path from save ram path. */
attr.i = RETRO_MEMORY_RTC;
fill_pathname(savefile_name_rtc,
global->name.savefile,
savefile_path,
file_path_str(FILE_PATH_RTC_EXTENSION),
sizeof(savefile_name_rtc));
string_list_append(task_save_files, savefile_name_rtc, attr);

View File

@ -213,7 +213,7 @@ bool event_load_save_files(void);
bool event_save_files(void);
void path_init_savefile_rtc(void);
void path_init_savefile_rtc(const char *savefile_path);
void *savefile_ptr_get(void);