subsystem part 3: remove more globals

This commit is contained in:
radius 2018-02-11 10:10:52 -05:00
parent 1b1ec37f36
commit 9a23ee8017
6 changed files with 20 additions and 12 deletions

View File

@ -273,7 +273,6 @@ void command_playlist_update_write(
const char *label,
const char *path);
RETRO_END_DECLS
#endif

View File

@ -39,12 +39,6 @@ typedef struct content_ctx_info
environment_get_t environ_get; /* Function passed for environment_get function */
} content_ctx_info_t;
int pending_subsystem_rom_id;
char pending_subsystem_ident[255];
char pending_subsystem_extensions[PATH_MAX_LENGTH];
char pending_subsystem_roms[RARCH_MAX_SUBSYSTEM_ROMS][PATH_MAX_LENGTH];
/* Load a RAM state from disk to memory. */
bool content_load_ram_file(unsigned slot);
@ -103,6 +97,9 @@ int content_get_subsystem();
/* Add a rom to the subsystem rom buffer */
void content_add_subsystem(const char* path);
/* Get the current subsystem rom id */
int content_get_subsystem_rom_id();
RETRO_END_DECLS

View File

@ -408,8 +408,8 @@ static int action_bind_sublabel_subsystem_add(
rarch_system_info_t *system = runloop_get_system_info();
const struct retro_subsystem_info* subsystem = NULL;
subsystem = system->subsystem.data + (type - MENU_SETTINGS_SUBSYSTEM_ADD);
if (subsystem && pending_subsystem_rom_id < subsystem->num_roms)
snprintf(s, len, " Current Content: %s", content_get_subsystem() == type - MENU_SETTINGS_SUBSYSTEM_ADD ? subsystem->roms[pending_subsystem_rom_id].desc : subsystem->roms[0].desc);
if (subsystem && content_get_subsystem_rom_id() < subsystem->num_roms)
snprintf(s, len, " Current Content: %s", content_get_subsystem() == type - MENU_SETTINGS_SUBSYSTEM_ADD ? subsystem->roms[content_get_subsystem_rom_id()].desc : subsystem->roms[0].desc);
return 0;
}

View File

@ -4448,7 +4448,7 @@ static int xmb_list_push(void *data, void *userdata,
char s[PATH_MAX_LENGTH];
if (content_get_subsystem() == i)
{
if (pending_subsystem_rom_id < subsystem->num_roms)
if (content_get_subsystem_rom_id() < subsystem->num_roms)
{
snprintf(s, sizeof(s), "Load %s %s", subsystem->desc, i == content_get_subsystem() ? "\u2605" : " ");
menu_entries_append_enum(info->list,

View File

@ -89,10 +89,10 @@ void filebrowser_parse(void *data, unsigned type_data)
rarch_system_info_t *system = runloop_get_system_info();
const struct retro_subsystem_info* subsystem = NULL;
subsystem = system->subsystem.data + content_get_subsystem();
if (subsystem && pending_subsystem_rom_id < subsystem->num_roms)
if (subsystem && content_get_subsystem_rom_id() < subsystem->num_roms)
{
str_list = dir_list_new(path,
(filter_ext && info) ? subsystem->roms[pending_subsystem_rom_id].valid_extensions : NULL,
(filter_ext && info) ? subsystem->roms[content_get_subsystem_rom_id()].valid_extensions : NULL,
true, settings->bools.show_hidden_files, true, false);
}

View File

@ -144,6 +144,12 @@ static uint32_t content_rom_crc = 0;
static bool pending_subsystem_init = false;
static int pending_subsystem_rom_num = 0;
static int pending_subsystem_id = 0;
static int pending_subsystem_rom_id = 0;
static char pending_subsystem_ident[255];
static char pending_subsystem_extensions[PATH_MAX_LENGTH];
static char pending_subsystem_roms[RARCH_MAX_SUBSYSTEM_ROMS][PATH_MAX_LENGTH];
static int content_file_read(const char *path, void **buf, ssize_t *length)
{
@ -1776,6 +1782,12 @@ void content_add_subsystem(const char* path)
pending_subsystem_rom_id++;
}
/* Get the current subsystem rom id */
int content_get_subsystem_rom_id()
{
return pending_subsystem_rom_id;
}
void content_set_does_not_need_content(void)
{
core_does_not_need_content = true;