subsystem part 2: add a wrapper to set the current subsystem

This commit is contained in:
radius 2018-02-10 21:05:41 -05:00
parent 692c8683b2
commit b212640732
3 changed files with 18 additions and 2 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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++;
}