mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-25 20:25:42 +00:00
Merge pull request #2468 from fr500/master
add a hint so the user can tell between devices with the same name
This commit is contained in:
commit
5b8661b6b5
@ -229,6 +229,7 @@ typedef struct settings
|
||||
unsigned joypad_map[MAX_USERS];
|
||||
unsigned device[MAX_USERS];
|
||||
char device_names[MAX_USERS][64];
|
||||
unsigned device_name_index[MAX_USERS];
|
||||
bool autodetect_enable;
|
||||
bool netplay_client_swap_input;
|
||||
|
||||
|
@ -29,6 +29,25 @@
|
||||
|
||||
static bool remote_is_bound = false;
|
||||
|
||||
/* adds an index for devices with the same name so they can be identified in the GUI*/
|
||||
static void input_reindex_devices()
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
for(int i=0; i < settings->input.max_users; i++)
|
||||
settings->input.device_name_index[i]=0;
|
||||
for(int i=0; i < settings->input.max_users; i++)
|
||||
{
|
||||
const char *tmp = settings->input.device_names[i];
|
||||
|
||||
int k=1;
|
||||
for(int j=0; j < settings->input.max_users; j++)
|
||||
{
|
||||
if(!strcmp(tmp,settings->input.device_names[j]) && settings->input.device_name_index[i]==0)
|
||||
settings->input.device_name_index[j]=k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void input_autoconfigure_joypad_conf(config_file_t *conf,
|
||||
struct retro_keybind *binds)
|
||||
{
|
||||
@ -149,7 +168,7 @@ static void input_autoconfigure_joypad_add(
|
||||
if (!block_osd_spam)
|
||||
rarch_main_msg_queue_push(msg, 0, 60, false);
|
||||
}
|
||||
|
||||
input_reindex_devices();
|
||||
#if 0
|
||||
RARCH_LOG("Autodetect: %s\n", msg);
|
||||
#endif
|
||||
|
@ -434,7 +434,7 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
|
||||
{
|
||||
if (settings->input.autoconfigured[controller])
|
||||
{
|
||||
snprintf(tmp, sizeof(tmp), "Port #%d device name: %s", controller, settings->input.device_names[controller]);
|
||||
snprintf(tmp, sizeof(tmp), "Port #%d device name: %s (#%d)", controller, settings->input.device_names[controller], settings->input.device_name_index[controller]);
|
||||
menu_entries_push(info->list, tmp, "", MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
snprintf(tmp, sizeof(tmp), "Port #%d device VID/PID: %d/%d", controller, settings->input.vid[controller], settings->input.pid[controller]);
|
||||
menu_entries_push(info->list, tmp, "", MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
|
@ -2648,7 +2648,10 @@ static void get_string_representation_bind_device(void * data, char *s,
|
||||
const char *device_name = settings->input.device_names[map];
|
||||
|
||||
if (*device_name)
|
||||
strlcpy(s, device_name, len);
|
||||
snprintf(s, len,
|
||||
"%s (#%u)",
|
||||
device_name,
|
||||
settings->input.device_name_index[map]);
|
||||
else
|
||||
snprintf(s, len,
|
||||
"%s (%s #%u)",
|
||||
|
Loading…
Reference in New Issue
Block a user