mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 08:30:16 +00:00
global->savefiles only accessed now from task_save.c
This commit is contained in:
parent
2277428f52
commit
8469235005
36
paths.c
36
paths.c
@ -44,6 +44,7 @@
|
||||
#include "retroarch.h"
|
||||
#include "runloop.h"
|
||||
#include "verbosity.h"
|
||||
#include "tasks/tasks_internal.h"
|
||||
|
||||
#define MENU_VALUE_NO_CORE 0x7d5472cbU
|
||||
|
||||
@ -343,7 +344,7 @@ static bool path_init_subsystem(void)
|
||||
}
|
||||
|
||||
attr.i = mem->type;
|
||||
string_list_append(global->savefiles, path, attr);
|
||||
string_list_append((struct string_list*)savefile_ptr_get(), path, attr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,36 +369,6 @@ static bool path_init_subsystem(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
static 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(global->savefiles, global->name.savefile, attr);
|
||||
|
||||
/* Infer .rtc save path from save ram path. */
|
||||
attr.i = RETRO_MEMORY_RTC;
|
||||
fill_pathname(savefile_name_rtc,
|
||||
global->name.savefile,
|
||||
file_path_str(FILE_PATH_RTC_EXTENSION),
|
||||
sizeof(savefile_name_rtc));
|
||||
string_list_append(global->savefiles, savefile_name_rtc, attr);
|
||||
}
|
||||
|
||||
void path_deinit_savefile(void)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!global)
|
||||
return;
|
||||
|
||||
if (global->savefiles)
|
||||
string_list_free(global->savefiles);
|
||||
global->savefiles = NULL;
|
||||
}
|
||||
|
||||
void path_init_savefile(void)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
@ -426,8 +397,7 @@ static void path_init_savefile_internal(void)
|
||||
|
||||
path_deinit_savefile();
|
||||
|
||||
global->savefiles = string_list_new();
|
||||
retro_assert(global->savefiles);
|
||||
path_init_savefile_new();
|
||||
|
||||
if (!path_init_subsystem())
|
||||
path_init_savefile_rtc();
|
||||
|
@ -27,12 +27,14 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
#include <retro_assert.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <streams/file_stream.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <file/file_path.h>
|
||||
|
||||
#include "../core.h"
|
||||
#include "../file_path_special.h"
|
||||
#include "../configuration.h"
|
||||
#include "../msg_hash.h"
|
||||
#include "../runloop.h"
|
||||
@ -866,3 +868,49 @@ bool event_load_save_files(void)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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(global->savefiles, global->name.savefile, attr);
|
||||
|
||||
/* Infer .rtc save path from save ram path. */
|
||||
attr.i = RETRO_MEMORY_RTC;
|
||||
fill_pathname(savefile_name_rtc,
|
||||
global->name.savefile,
|
||||
file_path_str(FILE_PATH_RTC_EXTENSION),
|
||||
sizeof(savefile_name_rtc));
|
||||
string_list_append(global->savefiles, savefile_name_rtc, attr);
|
||||
}
|
||||
|
||||
void path_deinit_savefile(void)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!global)
|
||||
return;
|
||||
|
||||
if (global->savefiles)
|
||||
string_list_free(global->savefiles);
|
||||
global->savefiles = NULL;
|
||||
}
|
||||
|
||||
void path_init_savefile_new(void)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
global->savefiles = string_list_new();
|
||||
retro_assert(global->savefiles);
|
||||
}
|
||||
|
||||
void *savefile_ptr_get(void)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
if (!global)
|
||||
return NULL;
|
||||
return global->savefiles;
|
||||
}
|
||||
|
@ -150,6 +150,12 @@ bool event_load_save_files(void);
|
||||
|
||||
bool event_save_files(void);
|
||||
|
||||
void path_init_savefile_rtc(void);
|
||||
|
||||
void *savefile_ptr_get(void);
|
||||
|
||||
void path_init_savefile_new(void);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user