From d3ae49b30b82ed1c66d1b1bd519f952a3ee99da0 Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 13 Jan 2019 15:50:18 -0500 Subject: [PATCH] add sublabels --- CHANGES.md | 1 + menu/cbs/menu_cbs_sublabel.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index a85cc8f7d5..782daae2ed 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -20,6 +20,7 @@ - MENU: User Interface -> Appearance -> 'Menu Font Green/Blue Color' settings now work properly. - MIDI: Add a Linux ALSA driver for MIDI. - NETPLAY: Force fast-save-states when netlay is enabled +- NETPLAY: Allow quick joining subsystem lobbies - PS2: Initial PlayStation2 port. - PS4: Initial PlayStation4 port. - RECORDING: Implement recording options in the menu complete with quality profiles, streaming, and proper file naming diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index accde88aee..1bd69f3765 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -26,6 +26,7 @@ #include #include +#include #ifndef BIND_ACTION_SUBLABEL #define BIND_ACTION_SUBLABEL(cbs, name) \ @@ -580,6 +581,31 @@ static int action_bind_sublabel_subsystem_add( return 0; } +static int action_bind_sublabel_subsystem_load( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) +{ + unsigned j = 0; + char buf[4096]; + + buf[0] = '\0'; + + for (j = 0; j < content_get_subsystem_rom_id(); j++) + { + strlcat(buf, " ", sizeof(buf)); + strlcat(buf, path_basename(content_get_subsystem_rom(j)), sizeof(buf)); + if (j != content_get_subsystem_rom_id() - 1) + strlcat(buf, "\n", sizeof(buf)); + } + + if (!string_is_empty(buf)) + strlcpy(s, buf, len); + + return 0; +} + static int action_bind_sublabel_remap_kbd_sublabel( file_list_t *list, unsigned type, unsigned i, @@ -730,7 +756,7 @@ static int action_bind_sublabel_netplay_room( buf[0] = '\0'; for (i = 0; i < list->size; i++) { - strlcat(buf, " ", sizeof(buf)); + strlcat(buf, " ", sizeof(buf)); strlcat(buf, list->elems[i].data, sizeof(buf)); strlcat(buf, "\n", sizeof(buf)); } @@ -1215,6 +1241,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_SUBSYSTEM_ADD: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_subsystem_add); break; + case MENU_ENUM_LABEL_SUBSYSTEM_LOAD: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_subsystem_load); + break; case MENU_ENUM_LABEL_DISK_CYCLE_TRAY_STATUS: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_disk_cycle_tray_status); break;