[info] use sublabels for controller information

This commit is contained in:
radius 2019-01-01 12:27:02 -05:00
parent 0a6df1743c
commit 88b4ec61e7
3 changed files with 66 additions and 30 deletions

View File

@ -43,6 +43,8 @@
#include "../../dynamic.h"
#include "../../configuration.h"
#include "../../managers/cheat_manager.h"
#include "../input/input_driver.h"
#include "../tasks/tasks_internal.h"
#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) \
@ -499,6 +501,36 @@ default_sublabel_macro(action_bind_sublabel_switch_gpu_profile, MENU
default_sublabel_macro(action_bind_sublabel_switch_backlight_control, MENU_ENUM_SUBLABEL_SWITCH_BACKLIGHT_CONTROL)
#endif
static int action_bind_sublabel_systeminfo_controller_entry(
file_list_t *list,
unsigned type, unsigned i,
const char *label, const char *path,
char *s, size_t len)
{
char tmp[len];
unsigned controller;
for(controller = 0; controller < MAX_USERS; controller++)
{
if (input_is_autoconfigured(controller))
{
snprintf(tmp, sizeof(tmp), "Port #%d device name: %s (#%d)",
controller,
input_config_get_device_name(controller),
input_autoconfigure_get_device_name_index(controller));
if (string_is_equal(path, tmp))
break;
}
}
snprintf(tmp, sizeof(tmp), "Device display name: %s\nDevice config name: %s\nDevice identifiers: %d/%d",
input_config_get_device_display_name(controller) ? input_config_get_device_display_name(controller) : "N/A",
input_config_get_device_display_name(controller) ? input_config_get_device_config_name(controller) : "N/A",
input_config_get_vid(controller), input_config_get_pid(controller));
strlcpy(s, tmp, len);
return 0;
}
static int action_bind_sublabel_cheevos_entry(
file_list_t *list,
unsigned type, unsigned i,
@ -1859,6 +1891,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_CPU_CORES:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_systeminfo_cpu_cores);
break;
case MENU_ENUM_LABEL_SYSTEM_INFO_CONTROLLER_ENTRY:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_systeminfo_controller_entry);
break;
case MENU_ENUM_LABEL_VIDEO_BLACK_FRAME_INSERTION:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_black_frame_insertion);
break;

View File

@ -387,6 +387,7 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
#endif
const char *tmp_string = NULL;
const frontend_ctx_driver_t *frontend = frontend_get_ptr();
settings_t *settings = config_get_ptr();
tmp[0] = feat_str[0] = '\0';
@ -504,40 +505,39 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
MENU_ENUM_LABEL_CPU_CORES, MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
}
for(controller = 0; controller < MAX_USERS; controller++)
{
if (input_is_autoconfigured(controller))
{
if (input_is_autoconfigured(controller))
{
snprintf(tmp, sizeof(tmp), "Port #%d device name: %s (#%d)",
controller,
input_config_get_device_name(controller),
input_autoconfigure_get_device_name_index(controller));
controller,
input_config_get_device_name(controller),
input_autoconfigure_get_device_name_index(controller));
menu_entries_append_enum(info->list, tmp, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY,
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
snprintf(tmp, sizeof(tmp), "Port #%d device display name: %s",
controller,
input_config_get_device_display_name(controller) ?
input_config_get_device_display_name(controller) : "N/A");
menu_entries_append_enum(info->list, tmp, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY,
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
snprintf(tmp, sizeof(tmp), "Port #%d device config name: %s",
controller,
input_config_get_device_display_name(controller) ?
input_config_get_device_config_name(controller) : "N/A");
menu_entries_append_enum(info->list, tmp, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY,
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
snprintf(tmp, sizeof(tmp), "Port #%d device VID/PID: %d/%d",
controller,
input_config_get_vid(controller),
input_config_get_pid(controller));
menu_entries_append_enum(info->list, tmp, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY,
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
}
MENU_ENUM_LABEL_SYSTEM_INFO_CONTROLLER_ENTRY,
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
if (string_is_equal(settings->arrays.menu_driver, "rgui"))
{
snprintf(tmp, sizeof(tmp), " Device display name: %s",
input_config_get_device_display_name(controller) ?
input_config_get_device_display_name(controller) : "N/A");
menu_entries_append_enum(info->list, tmp, "",
MENU_ENUM_LABEL_SYSTEM_INFO_CONTROLLER_ENTRY,
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
snprintf(tmp, sizeof(tmp), " Device config name: %s",
input_config_get_device_display_name(controller) ?
input_config_get_device_config_name(controller) : "N/A");
menu_entries_append_enum(info->list, tmp, "",
MENU_ENUM_LABEL_SYSTEM_INFO_CONTROLLER_ENTRY,
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
snprintf(tmp, sizeof(tmp), " Device VID/PID: %d/%d",
input_config_get_vid(controller),
input_config_get_pid(controller));
menu_entries_append_enum(info->list, tmp, "",
MENU_ENUM_LABEL_SYSTEM_INFO_CONTROLLER_ENTRY,
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
}
}
}
if (frontend)

View File

@ -540,6 +540,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_CORE_OPTION_ENTRY,
MENU_ENUM_LABEL_NETWORK_INFO_ENTRY,
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY,
MENU_ENUM_LABEL_SYSTEM_INFO_CONTROLLER_ENTRY,
MENU_ENUM_LABEL_CORE_INFO_ENTRY,
MENU_ENUM_LABEL_PLAYLIST_ENTRY,