diff --git a/command.h b/command.h index 6b257d1896..86efe07bb0 100644 --- a/command.h +++ b/command.h @@ -273,7 +273,6 @@ void command_playlist_update_write( const char *label, const char *path); - RETRO_END_DECLS #endif diff --git a/content.h b/content.h index 8ba2f8425d..eca57fa833 100644 --- a/content.h +++ b/content.h @@ -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 diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 72fc176f60..1a2f147a24 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -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; } diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 90b22d2d31..2e3af1ffa9 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -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, diff --git a/menu/widgets/menu_filebrowser.c b/menu/widgets/menu_filebrowser.c index 5b641a11ac..d401c23c5c 100644 --- a/menu/widgets/menu_filebrowser.c +++ b/menu/widgets/menu_filebrowser.c @@ -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); } diff --git a/tasks/task_content.c b/tasks/task_content.c index 22f84ce643..9df179147b 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -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;