Merge pull request #7864 from fr500/master

[info] use sublabels for controller information
This commit is contained in:
Twinaphex 2019-01-01 18:35:58 +01:00 committed by GitHub
commit e7befaba37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 30 deletions

View File

@ -4937,6 +4937,10 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_CORE_LIST,
"Select which core to use."
)
MSG_HASH(
MENU_ENUM_SUBLABEL_START_CORE,
"Start core without content."
)
MSG_HASH(
MENU_ENUM_SUBLABEL_DOWNLOAD_CORE,
"Install a core from the online updater."

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) \
@ -187,6 +189,7 @@ default_sublabel_macro(action_bind_sublabel_netplay_nickname, MENU_
default_sublabel_macro(action_bind_sublabel_cheevos_username, MENU_ENUM_SUBLABEL_CHEEVOS_USERNAME)
default_sublabel_macro(action_bind_sublabel_cheevos_password, MENU_ENUM_SUBLABEL_CHEEVOS_PASSWORD)
default_sublabel_macro(action_bind_sublabel_video_post_filter_record, MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD)
default_sublabel_macro(action_bind_sublabel_start_core, MENU_ENUM_SUBLABEL_START_CORE)
default_sublabel_macro(action_bind_sublabel_core_list, MENU_ENUM_SUBLABEL_CORE_LIST)
default_sublabel_macro(action_bind_sublabel_download_core, MENU_ENUM_SUBLABEL_DOWNLOAD_CORE)
default_sublabel_macro(action_bind_sublabel_sideload_core_list, MENU_ENUM_SUBLABEL_SIDELOAD_CORE_LIST)
@ -499,6 +502,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,
@ -1672,6 +1705,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_LOAD_CONTENT_SPECIAL:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_content_special);
break;
case MENU_ENUM_LABEL_START_CORE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_start_core);
break;
case MENU_ENUM_LABEL_CORE_LIST:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_core_list);
break;
@ -1859,6 +1895,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,