subsystem part 1: proper labels for each entry

This commit is contained in:
radius 2018-02-10 19:46:15 -05:00
parent 597e0ce1ec
commit 788bb4de50
4 changed files with 56 additions and 8 deletions

View File

@ -12,6 +12,7 @@
"files.associations": { "files.associations": {
"frontend_driver.h": "c", "frontend_driver.h": "c",
"*.in": "c", "*.in": "c",
"*.rh": "c" "*.rh": "c",
"menu_driver.h": "c"
}, },
} }

View File

@ -37,6 +37,9 @@
#include "../../network/netplay/netplay_discovery.h" #include "../../network/netplay/netplay_discovery.h"
#endif #endif
#include "../../retroarch.h"
#include "../../content.h"
#define default_sublabel_macro(func_name, lbl) \ #define default_sublabel_macro(func_name, lbl) \
static int (func_name)(file_list_t *list, unsigned type, unsigned i, const char *label, const char *path, char *s, size_t len) \ static int (func_name)(file_list_t *list, unsigned type, unsigned i, const char *label, const char *path, char *s, size_t len) \
{ \ { \
@ -396,6 +399,22 @@ static int action_bind_sublabel_cheevos_entry(
return 0; return 0;
} }
static int action_bind_sublabel_subsystem_add(
file_list_t *list,
unsigned type, unsigned i,
const char *label, const char *path,
char *s, size_t len)
{
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", pending_subsystem == type - MENU_SETTINGS_SUBSYSTEM_ADD ? subsystem->roms[pending_subsystem_rom_id].desc : subsystem->roms[0].desc);
return 0;
}
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
static int action_bind_sublabel_netplay_room( static int action_bind_sublabel_netplay_room(
file_list_t *list, file_list_t *list,
@ -744,6 +763,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_DISK_IMAGE_APPEND: case MENU_ENUM_LABEL_DISK_IMAGE_APPEND:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_disk_image_append); BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_disk_image_append);
break; break;
case MENU_ENUM_LABEL_SUBSYSTEM_ADD:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_subsystem_add);
break;
case MENU_ENUM_LABEL_DISK_CYCLE_TRAY_STATUS: case MENU_ENUM_LABEL_DISK_CYCLE_TRAY_STATUS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_disk_cycle_tray_status); BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_disk_cycle_tray_status);
break; break;

View File

@ -4445,12 +4445,37 @@ static int xmb_list_push(void *data, void *userdata,
for (i = 0; i < system->subsystem.size; i++, subsystem++) for (i = 0; i < system->subsystem.size; i++, subsystem++)
{ {
char s[PATH_MAX_LENGTH]; char s[PATH_MAX_LENGTH];
snprintf(s, sizeof(s), "Load: %s %c", subsystem->desc, i == pending_subsystem ? '*': ' '); if (pending_subsystem == i)
menu_entries_append_enum(info->list, {
s, if (pending_subsystem_rom_id < subsystem->num_roms)
msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_ADD), {
MENU_ENUM_LABEL_SUBSYSTEM_ADD, snprintf(s, sizeof(s), "Load %s %c", subsystem->desc, i == pending_subsystem ? '*': ' ');
MENU_SETTINGS_SUBSYSTEM_ADD + i, 0, 0); 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);
}
else
{
/* To-Do: replace the MENU_ENUM_LABEL_SUBSYSTEM_ADD for the proper labels and trigger the load action */
snprintf(s, sizeof(s), "Start %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);
}
}
else
{
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);
}
} }
} }
} }

View File

@ -89,7 +89,7 @@ void filebrowser_parse(void *data, unsigned type_data)
rarch_system_info_t *system = runloop_get_system_info(); rarch_system_info_t *system = runloop_get_system_info();
const struct retro_subsystem_info* subsystem = NULL; const struct retro_subsystem_info* subsystem = NULL;
subsystem = system->subsystem.data + pending_subsystem; subsystem = system->subsystem.data + pending_subsystem;
if (subsystem) if (subsystem && pending_subsystem_rom_id < subsystem->num_roms)
{ {
RARCH_LOG("[subsystem] valid xtensions: %s\n", subsystem->roms[pending_subsystem_rom_id].valid_extensions); RARCH_LOG("[subsystem] valid xtensions: %s\n", subsystem->roms[pending_subsystem_rom_id].valid_extensions);
str_list = dir_list_new(path, str_list = dir_list_new(path,