mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
Don't use global state anymore for dirs
This commit is contained in:
parent
baf2862b85
commit
edb3edfef1
77
dirs.c
77
dirs.c
@ -27,114 +27,73 @@
|
|||||||
|
|
||||||
#include "dirs.h"
|
#include "dirs.h"
|
||||||
|
|
||||||
#include "runloop.h"
|
static char dir_savefile[PATH_MAX_LENGTH] = {0};
|
||||||
|
static char dir_savestate[PATH_MAX_LENGTH] = {0};
|
||||||
|
|
||||||
bool dir_is_savefile_empty(void)
|
bool dir_is_savefile_empty(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
return string_is_empty(dir_savefile);
|
||||||
|
|
||||||
if (!global)
|
|
||||||
return false;
|
|
||||||
return string_is_empty(global->dir.savefile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dir_is_savestate_empty(void)
|
bool dir_is_savestate_empty(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
return string_is_empty(dir_savestate);
|
||||||
|
|
||||||
if (!global)
|
|
||||||
return false;
|
|
||||||
return string_is_empty(global->dir.savestate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t dir_get_savestate_size(void)
|
size_t dir_get_savestate_size(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
return sizeof(dir_savestate);
|
||||||
|
|
||||||
if (!global)
|
|
||||||
return 0;
|
|
||||||
return sizeof(global->dir.savestate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t dir_get_savefile_size(void)
|
size_t dir_get_savefile_size(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
return sizeof(dir_savefile);
|
||||||
|
|
||||||
if (!global)
|
|
||||||
return 0;
|
|
||||||
return sizeof(global->dir.savefile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dir_clear_savefile(void)
|
void dir_clear_savefile(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
*dir_savefile = '\0';
|
||||||
|
|
||||||
if (global)
|
|
||||||
*global->dir.savefile = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dir_clear_savestate(void)
|
void dir_clear_savestate(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
*dir_savestate = '\0';
|
||||||
|
|
||||||
if (global)
|
|
||||||
*global->dir.savestate = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *dir_get_savefile_ptr(void)
|
char *dir_get_savefile_ptr(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
return dir_savefile;
|
||||||
|
|
||||||
if (!global)
|
|
||||||
return NULL;
|
|
||||||
return global->dir.savefile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *dir_get_savefile(void)
|
const char *dir_get_savefile(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
return dir_savefile;
|
||||||
|
|
||||||
if (!global)
|
|
||||||
return NULL;
|
|
||||||
return global->dir.savefile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *dir_get_savestate_ptr(void)
|
char *dir_get_savestate_ptr(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
return dir_savestate;
|
||||||
|
|
||||||
if (!global)
|
|
||||||
return NULL;
|
|
||||||
return global->dir.savestate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *dir_get_savestate(void)
|
const char *dir_get_savestate(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
return dir_savestate;
|
||||||
|
|
||||||
if (!global)
|
|
||||||
return NULL;
|
|
||||||
return global->dir.savestate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dir_set_savestate(const char *path)
|
void dir_set_savestate(const char *path)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
strlcpy(dir_savestate, path,
|
||||||
|
sizeof(dir_savestate));
|
||||||
if (global)
|
|
||||||
strlcpy(global->dir.savestate, global->name.savefile,
|
|
||||||
sizeof(global->dir.savestate));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dir_set_savefile(const char *path)
|
void dir_set_savefile(const char *path)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
strlcpy(dir_savefile, path,
|
||||||
|
sizeof(dir_savefile));
|
||||||
if (global)
|
|
||||||
strlcpy(global->dir.savefile, global->name.savefile,
|
|
||||||
sizeof(global->dir.savefile));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dir_clear_all(void)
|
void dir_clear_all(void)
|
||||||
{
|
{
|
||||||
|
dir_clear_savefile();
|
||||||
|
dir_clear_savestate();
|
||||||
}
|
}
|
||||||
|
@ -143,8 +143,6 @@ enum runloop_ctl_state
|
|||||||
typedef struct rarch_dir
|
typedef struct rarch_dir
|
||||||
{
|
{
|
||||||
/* Used on reentrancy to use a savestate dir. */
|
/* Used on reentrancy to use a savestate dir. */
|
||||||
char savefile[PATH_MAX_LENGTH];
|
|
||||||
char savestate[PATH_MAX_LENGTH];
|
|
||||||
char systemdir[PATH_MAX_LENGTH];
|
char systemdir[PATH_MAX_LENGTH];
|
||||||
#ifdef HAVE_OVERLAY
|
#ifdef HAVE_OVERLAY
|
||||||
char osk_overlay[PATH_MAX_LENGTH];
|
char osk_overlay[PATH_MAX_LENGTH];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user