mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-22 18:51:34 +00:00
Set device name for xinput/dinput even when autoconfig is
disabled
This commit is contained in:
parent
1f90535c39
commit
add7d26c3d
@ -263,13 +263,14 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
||||
if (!is_xinput_pad)
|
||||
#endif
|
||||
{
|
||||
input_autoconfigure_connect(
|
||||
dinput_joypad_name(g_joypad_cnt),
|
||||
dinput_joypad_friendly_name(g_joypad_cnt),
|
||||
dinput_joypad.ident,
|
||||
g_joypad_cnt,
|
||||
dinput_joypad_vid(g_joypad_cnt),
|
||||
dinput_joypad_pid(g_joypad_cnt));
|
||||
if (!input_autoconfigure_connect(
|
||||
dinput_joypad_name(g_joypad_cnt),
|
||||
dinput_joypad_friendly_name(g_joypad_cnt),
|
||||
dinput_joypad.ident,
|
||||
g_joypad_cnt,
|
||||
dinput_joypad_vid(g_joypad_cnt),
|
||||
dinput_joypad_pid(g_joypad_cnt)))
|
||||
input_config_set_device_name(g_joypad_cnt, dinput_joypad_name(g_joypad_cnt));
|
||||
}
|
||||
|
||||
#ifdef HAVE_XINPUT
|
||||
|
@ -170,7 +170,7 @@ const char *xinput_joypad_name(unsigned pad)
|
||||
|
||||
static bool xinput_joypad_init(void *data)
|
||||
{
|
||||
unsigned i, autoconf_pad;
|
||||
unsigned i, j;
|
||||
XINPUT_STATE dummy_state;
|
||||
const char *version = "1.4";
|
||||
|
||||
@ -262,16 +262,19 @@ static bool xinput_joypad_init(void *data)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (autoconf_pad = 0; autoconf_pad < MAX_USERS; autoconf_pad++)
|
||||
for (j = 0; j < MAX_USERS; j++)
|
||||
{
|
||||
if (pad_index_to_xuser_index(autoconf_pad) > -1)
|
||||
input_autoconfigure_connect(
|
||||
xinput_joypad_name(autoconf_pad),
|
||||
if (pad_index_to_xuser_index(ij) > -1)
|
||||
{
|
||||
if (!input_autoconfigure_connect(
|
||||
xinput_joypad_name(j),
|
||||
NULL,
|
||||
xinput_joypad.ident,
|
||||
autoconf_pad,
|
||||
j,
|
||||
0,
|
||||
0);
|
||||
0))
|
||||
input_config_set_device_name(j, xinput_joypad_name(j));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -476,6 +476,15 @@ void input_config_get_bind_string(char *buf, const struct retro_keybind *bind,
|
||||
#endif
|
||||
}
|
||||
|
||||
void input_config_set_device_name(unsigned port, const char *name)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (!string_is_empty(name))
|
||||
strlcpy(settings->input.device_names[port],
|
||||
name,
|
||||
sizeof(settings->input.device_names[port]));
|
||||
}
|
||||
|
||||
const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned id)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
@ -69,6 +69,8 @@ void input_config_parse_joy_axis(void *data, const char *prefix,
|
||||
|
||||
unsigned input_config_label_to_key(const char *label);
|
||||
|
||||
void input_config_set_device_name(unsigned port, const char *name);
|
||||
|
||||
const struct retro_keybind *input_config_get_bind_auto(unsigned port, unsigned id);
|
||||
|
||||
#endif
|
||||
|
@ -409,10 +409,7 @@ bool input_autoconfigure_connect(
|
||||
state->pid = pid;
|
||||
state->max_users = settings->input.max_users;
|
||||
|
||||
if (!string_is_empty(state->name))
|
||||
strlcpy(settings->input.device_names[state->idx],
|
||||
state->name,
|
||||
sizeof(settings->input.device_names[state->idx]));
|
||||
input_config_set_device_name(state->idx, state->name);
|
||||
settings->input.pid[state->idx] = state->pid;
|
||||
settings->input.vid[state->idx] = state->vid;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user