Get rid of global->sram

This commit is contained in:
twinaphex 2016-09-28 07:27:39 +02:00
parent 0104302e18
commit 90af64769d
5 changed files with 11 additions and 21 deletions

11
paths.c
View File

@ -384,14 +384,11 @@ static bool path_init_subsystem(void)
void path_init_savefile(void)
{
bool should_sram_be_used = false;
global_t *global = global_get_ptr();
if (!global)
return;
should_sram_be_used = rarch_ctl(RARCH_CTL_IS_SRAM_USED, NULL) && !global->sram.save_disable;
bool should_sram_be_used = rarch_ctl(RARCH_CTL_IS_SRAM_USED, NULL)
&& !rarch_ctl(RARCH_CTL_IS_SRAM_SAVE_DISABLED, NULL);
#ifdef HAVE_NETPLAY
global_t *global = global_get_ptr();
should_sram_be_used = should_sram_be_used &&
(!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL)
|| !global->netplay.is_client);

View File

@ -652,13 +652,13 @@ static void retroarch_parse_input(int argc, char *argv[])
case 'M':
if (string_is_equal(optarg, "noload-nosave"))
{
global->sram.load_disable = true;
global->sram.save_disable = true;
rarch_ctl(RARCH_CTL_SET_SRAM_LOAD_DISABLED, NULL);
rarch_ctl(RARCH_CTL_SET_SRAM_SAVE_DISABLED, NULL);
}
else if (string_is_equal(optarg, "noload-save"))
global->sram.load_disable = true;
rarch_ctl(RARCH_CTL_SET_SRAM_LOAD_DISABLED, NULL);
else if (string_is_equal(optarg, "load-nosave"))
global->sram.save_disable = true;
rarch_ctl(RARCH_CTL_SET_SRAM_SAVE_DISABLED, NULL);
else if (!string_is_equal(optarg, "load-save"))
{
RARCH_ERR("Invalid argument in --sram-mode.\n");

View File

@ -741,6 +741,8 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
command_event(CMD_EVENT_LOG_FILE_DEINIT, NULL);
rarch_ctl(RARCH_CTL_UNSET_BLOCK_CONFIG_READ, NULL);
rarch_ctl(RARCH_CTL_UNSET_SRAM_LOAD_DISABLED, NULL);
rarch_ctl(RARCH_CTL_UNSET_SRAM_SAVE_DISABLED, NULL);
rarch_ctl(RARCH_CTL_UNSET_SRAM_ENABLE, NULL);
path_clear_content();
runloop_overrides_active = false;

View File

@ -162,12 +162,6 @@ typedef struct global
bool ips_pref;
} patch;
struct
{
bool load_disable;
bool save_disable;
} sram;
#ifdef HAVE_NETPLAY
/* Netplay. */
struct

View File

@ -933,11 +933,8 @@ bool event_save_files(void)
bool event_load_save_files(void)
{
unsigned i;
global_t *global = global_get_ptr();
if (!global)
return false;
if (!task_save_files || global->sram.load_disable)
if (!task_save_files || rarch_ctl(RARCH_CTL_IS_SRAM_LOAD_DISABLED, NULL))
return false;
for (i = 0; i < task_save_files->size; i++)