subsystem part 1: get the required data to load content

This commit is contained in:
radius 2018-02-10 19:08:39 -05:00
parent 521433d1c7
commit 597e0ce1ec
10 changed files with 111 additions and 1 deletions

View File

@ -25,6 +25,7 @@
#include <boolean.h>
#include <retro_common_api.h>
#include <retro_miscellaneous.h>
#include "frontend/frontend_driver.h"
@ -38,6 +39,12 @@ typedef struct content_ctx_info
environment_get_t environ_get; /* Function passed for environment_get function */
} content_ctx_info_t;
int pending_subsystem;
int pending_subsystem_rom_id;
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);
@ -81,6 +88,13 @@ bool content_reset_savestate_backups(void);
bool content_undo_load_buf_is_empty(void);
bool content_undo_save_buf_is_empty(void);
/* Clears the pending subsystem rom buffer*/
void content_clear_subsystem(void);
/* Add a rom to the subsystem rom buffer */
void content_add_subsystem(const char* path);
RETRO_END_DECLS
#endif

View File

@ -361,6 +361,8 @@ MSG_HASH(MENU_ENUM_LABEL_DISK_CYCLE_TRAY_STATUS,
"disk_cycle_tray_status")
MSG_HASH(MENU_ENUM_LABEL_DISK_IMAGE_APPEND,
"disk_image_append")
MSG_HASH(MENU_ENUM_LABEL_SUBSYSTEM_ADD,
"subsystem_add")
MSG_HASH(MENU_ENUM_LABEL_DISK_OPTIONS,
"core_disk_options")
MSG_HASH(MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST,

View File

@ -64,6 +64,7 @@ enum
ACTION_OK_LOAD_REMAPPING_FILE,
ACTION_OK_LOAD_CHEAT_FILE,
ACTION_OK_APPEND_DISK_IMAGE,
ACTION_OK_SUBSYSTEM_ADD,
ACTION_OK_LOAD_CONFIG_FILE,
ACTION_OK_LOAD_CORE,
ACTION_OK_LOAD_WALLPAPER,
@ -443,6 +444,18 @@ int generic_action_ok_displaylist_push(const char *path,
info_label = label;
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
break;
case ACTION_OK_DL_SUBSYSTEM_ADD_LIST:
filebrowser_clear_type();
if (pending_subsystem != type - MENU_SETTINGS_SUBSYSTEM_ADD)
content_clear_subsystem();
pending_subsystem = type - MENU_SETTINGS_SUBSYSTEM_ADD;
filebrowser_set_type(FILEBROWSER_SELECT_FILE_SUBSYSTEM);
info.type = type;
info.directory_ptr = idx;
info_path = settings->paths.directory_menu_content;
info_label = label;
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
break;
case ACTION_OK_DL_CHEAT_FILE:
filebrowser_clear_type();
info.type = type;
@ -1168,6 +1181,10 @@ static int generic_action_ok(const char *path,
command_event(CMD_EVENT_DISK_APPEND_IMAGE, action_path);
generic_action_ok_command(CMD_EVENT_RESUME);
break;
case ACTION_OK_SUBSYSTEM_ADD:
flush_type = MENU_SETTINGS;
content_add_subsystem(action_path);
break;
case ACTION_OK_SET_DIRECTORY:
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DIRECTORY_SETTINGS_LIST);
ret = set_path_generic(filebrowser_label, action_path);
@ -1246,6 +1263,7 @@ default_action_ok_set(action_ok_set_path, ACTION_OK_SET_PATH,
default_action_ok_set(action_ok_load_core, ACTION_OK_LOAD_CORE, MSG_UNKNOWN)
default_action_ok_set(action_ok_config_load, ACTION_OK_LOAD_CONFIG_FILE, MSG_UNKNOWN)
default_action_ok_set(action_ok_disk_image_append, ACTION_OK_APPEND_DISK_IMAGE, MSG_UNKNOWN)
default_action_ok_set(action_ok_subsystem_add, ACTION_OK_SUBSYSTEM_ADD, MSG_UNKNOWN)
default_action_ok_set(action_ok_cheat_file_load, ACTION_OK_LOAD_CHEAT_FILE, MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS)
default_action_ok_set(action_ok_record_configfile_load, ACTION_OK_LOAD_RECORD_CONFIGFILE, MENU_ENUM_LABEL_RECORDING_SETTINGS)
default_action_ok_set(action_ok_remap_file_load, ACTION_OK_LOAD_REMAPPING_FILE, MENU_ENUM_LABEL_CORE_INPUT_REMAPPING_OPTIONS )
@ -2972,6 +2990,7 @@ default_action_ok_func(action_ok_core_list, ACTION_OK_DL_CORE_LIST)
default_action_ok_func(action_ok_cheat_file, ACTION_OK_DL_CHEAT_FILE)
default_action_ok_func(action_ok_playlist_collection, ACTION_OK_DL_PLAYLIST_COLLECTION)
default_action_ok_func(action_ok_disk_image_append_list, ACTION_OK_DL_DISK_IMAGE_APPEND_LIST)
default_action_ok_func(action_ok_subsystem_add_list, ACTION_OK_DL_SUBSYSTEM_ADD_LIST)
default_action_ok_func(action_ok_record_configfile, ACTION_OK_DL_RECORD_CONFIGFILE)
default_action_ok_func(action_ok_remap_file, ACTION_OK_DL_REMAP_FILE)
default_action_ok_func(action_ok_shader_preset, ACTION_OK_DL_SHADER_PRESET)
@ -4088,6 +4107,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_DISK_IMAGE_APPEND:
BIND_ACTION_OK(cbs, action_ok_disk_image_append_list);
break;
case MENU_ENUM_LABEL_SUBSYSTEM_ADD:
BIND_ACTION_OK(cbs, action_ok_subsystem_add_list);
break;
case MENU_ENUM_LABEL_CONFIGURATIONS:
BIND_ACTION_OK(cbs, action_ok_configurations_list);
break;
@ -4282,6 +4304,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
case MENU_LABEL_DISK_IMAGE_APPEND:
BIND_ACTION_OK(cbs, action_ok_disk_image_append_list);
break;
case MENU_LABEL_SUBSYSTEM_ADD:
BIND_ACTION_OK(cbs, action_ok_subsystem_add_list);
break;
case MENU_LABEL_SCREEN_RESOLUTION:
BIND_ACTION_OK(cbs, action_ok_video_resolution);
break;
@ -4526,6 +4551,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_DISK_IMAGE_APPEND:
BIND_ACTION_OK(cbs, action_ok_disk_image_append);
break;
case MENU_ENUM_LABEL_SUBSYSTEM_ADD:
BIND_ACTION_OK(cbs, action_ok_subsystem_add);
break;
default:
BIND_ACTION_OK(cbs, action_ok_file_load);
break;
@ -4552,6 +4580,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
case MENU_LABEL_DISK_IMAGE_APPEND:
BIND_ACTION_OK(cbs, action_ok_disk_image_append);
break;
case MENU_LABEL_SUBSYSTEM_ADD:
BIND_ACTION_OK(cbs, action_ok_subsystem_add);
break;
default:
BIND_ACTION_OK(cbs, action_ok_file_load);
break;

View File

@ -4340,6 +4340,8 @@ static int xmb_list_push(void *data, void *userdata,
{
menu_displaylist_ctx_parse_entry_t entry;
int ret = -1;
int i = 0;
int j = 0;
core_info_list_t *list = NULL;
menu_handle_t *menu = (menu_handle_t*)data;
@ -4435,6 +4437,22 @@ static int xmb_list_push(void *data, void *userdata,
{
entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST;
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
const struct retro_subsystem_info* subsystem = NULL;
subsystem = system->subsystem.data;
if (subsystem)
{
for (i = 0; i < system->subsystem.size; i++, subsystem++)
{
char s[PATH_MAX_LENGTH];
snprintf(s, sizeof(s), "Load: %s %c", subsystem->desc, i == pending_subsystem ? '*': ' ');
menu_entries_append_enum(info->list,
s,
msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_ADD),
MENU_ENUM_LABEL_SUBSYSTEM_ADD,
MENU_SETTINGS_SUBSYSTEM_ADD + i, 0, 0);
}
}
}
entry.enum_idx = MENU_ENUM_LABEL_ADD_CONTENT_LIST;

View File

@ -84,6 +84,7 @@ enum
ACTION_OK_DL_REMAP_FILE,
ACTION_OK_DL_RECORD_CONFIGFILE,
ACTION_OK_DL_DISK_IMAGE_APPEND_LIST,
ACTION_OK_DL_SUBSYSTEM_ADD_LIST,
ACTION_OK_DL_PLAYLIST_COLLECTION,
ACTION_OK_DL_CONTENT_COLLECTION_LIST,
ACTION_OK_DL_CHEAT_FILE,

View File

@ -208,6 +208,10 @@ enum menu_settings_type
MENU_SETTINGS_INPUT_DESC_END = MENU_SETTINGS_INPUT_DESC_BEGIN + (MAX_USERS * (RARCH_FIRST_CUSTOM_BIND + 4)),
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN,
MENU_SETTINGS_INPUT_DESC_KBD_END = MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + 135,
MENU_SETTINGS_SUBSYSTEM_ADD,
MENU_SETTINGS_SUBSYSTEM_LAST = MENU_SETTINGS_SUBSYSTEM_ADD + RARCH_MAX_SUBSYSTEMS,
MENU_SETTINGS_LAST
};

View File

@ -35,6 +35,11 @@
#include "../../configuration.h"
#include "../../paths.h"
#include "../../retroarch.h"
#include "../../core.h"
#include "../../content.h"
#include "../../verbosity.h"
static enum filebrowser_enums filebrowser_types = FILEBROWSER_NONE;
enum filebrowser_enums filebrowser_get_type(void)
@ -75,10 +80,24 @@ void filebrowser_parse(void *data, unsigned type_data)
if (info && path_is_compressed)
str_list = file_archive_get_file_list(path, info->exts);
else if (!string_is_empty(path))
else if (!string_is_empty(path) && filebrowser_types != FILEBROWSER_SELECT_FILE_SUBSYSTEM)
str_list = dir_list_new(path,
(filter_ext && info) ? info->exts : NULL,
true, settings->bools.show_hidden_files, true, false);
else if (!string_is_empty(path) && filebrowser_types == FILEBROWSER_SELECT_FILE_SUBSYSTEM)
{
rarch_system_info_t *system = runloop_get_system_info();
const struct retro_subsystem_info* subsystem = NULL;
subsystem = system->subsystem.data + pending_subsystem;
if (subsystem)
{
RARCH_LOG("[subsystem] valid xtensions: %s\n", subsystem->roms[pending_subsystem_rom_id].valid_extensions);
str_list = dir_list_new(path,
(filter_ext && info) ? subsystem->roms[pending_subsystem_rom_id].valid_extensions : NULL,
true, settings->bools.show_hidden_files, true, false);
}
}
switch (filebrowser_types)
{

View File

@ -31,6 +31,7 @@ enum filebrowser_enums
FILEBROWSER_SCAN_DIR,
FILEBROWSER_SCAN_FILE,
FILEBROWSER_SELECT_FILE,
FILEBROWSER_SELECT_FILE_SUBSYSTEM,
FILEBROWSER_SELECT_IMAGE,
FILEBROWSER_SELECT_FONT,
FILEBROWSER_SELECT_COLLECTION

View File

@ -1385,6 +1385,7 @@ enum msg_hash_enums
MENU_LABEL(SHUTDOWN),
MENU_LABEL(REBOOT),
MENU_LABEL(DISK_IMAGE_APPEND),
MENU_LABEL(SUBSYSTEM_ADD),
MENU_LABEL(CORE_LIST),
MENU_LABEL(MANAGEMENT),
MENU_LABEL(ONLINE),
@ -1849,6 +1850,9 @@ enum msg_hash_enums
#define MENU_LABEL_DISK_OPTIONS 0xc61ab5fbU
#define MENU_LABEL_DISK_IMAGE_APPEND 0x5af7d709U
/* Subsystem stuff */
#define MENU_LABEL_SUBSYSTEM_ADD 0x576da67cU
/* Menu settings */
#define MENU_LABEL_MENU_WALLPAPER 0x3b84de01U

View File

@ -1670,6 +1670,22 @@ void content_get_status(
*is_inited = _content_is_inited;
}
/* Clears the pending subsystem rom buffer*/
void content_clear_subsystem(void)
{
pending_subsystem_rom_id = 0;
for (int i = 0; i < RARCH_MAX_SUBSYSTEM_ROMS; i++)
pending_subsystem_roms[i][0] = '\0';
}
/* 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]);
pending_subsystem_rom_id++;
}
void content_set_does_not_need_content(void)
{
core_does_not_need_content = true;