diff --git a/content.h b/content.h index 495cef8a3f..43b6298418 100644 --- a/content.h +++ b/content.h @@ -42,6 +42,7 @@ typedef struct content_ctx_info int pending_subsystem; 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]; @@ -91,6 +92,9 @@ bool content_undo_save_buf_is_empty(void); /* Clears the pending subsystem rom buffer*/ void content_clear_subsystem(void); +/* Set the current subsystem*/ +void content_set_subsystem(unsigned subsystem); + /* Add a rom to the subsystem rom buffer */ void content_add_subsystem(const char* path); diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 61f5211668..fc227f8247 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -448,7 +448,7 @@ int generic_action_ok_displaylist_push(const char *path, filebrowser_clear_type(); if (pending_subsystem != type - MENU_SETTINGS_SUBSYSTEM_ADD) content_clear_subsystem(); - pending_subsystem = type - MENU_SETTINGS_SUBSYSTEM_ADD; + content_set_subsystem(type - MENU_SETTINGS_SUBSYSTEM_ADD); filebrowser_set_type(FILEBROWSER_SELECT_FILE_SUBSYSTEM); info.type = type; info.directory_ptr = idx; diff --git a/tasks/task_content.c b/tasks/task_content.c index 365ff6936d..a182e88c7a 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -1678,11 +1678,23 @@ void content_clear_subsystem(void) pending_subsystem_roms[i][0] = '\0'; } +/* Set the current subsystem*/ +void content_set_subsystem(unsigned sub) +{ + rarch_system_info_t *system = runloop_get_system_info(); + const struct retro_subsystem_info* subsystem = NULL; + + pending_subsystem = sub; + subsystem = system->subsystem.data + pending_subsystem; + + strlcpy(pending_subsystem_ident, subsystem->ident, sizeof(pending_subsystem_ident)); +} + /* Add a rom to the subsystem rom buffer */ void content_add_subsystem(const char* path) { strlcpy(pending_subsystem_roms[pending_subsystem_rom_id], path, sizeof(pending_subsystem_roms[pending_subsystem_rom_id])); - RARCH_LOG("[subsystem] subsystem id: %d rom id: %d, rom path: %s\n", pending_subsystem, pending_subsystem_rom_id, pending_subsystem_roms[pending_subsystem_rom_id]); + RARCH_LOG("[subsystem] subsystem id: %d subsystem ident: %s rom id: %d, rom path: %s\n", pending_subsystem, pending_subsystem_ident, pending_subsystem_rom_id, pending_subsystem_roms[pending_subsystem_rom_id]); pending_subsystem_rom_id++; }