mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
The 'connect' task now sets the device name upon completion
This commit is contained in:
parent
62f5b2d3c3
commit
d9def056e7
@ -176,8 +176,7 @@ static void qnx_process_gamepad_event(
|
||||
static void qnx_input_autodetect_gamepad(qnx_input_t *qnx,
|
||||
qnx_input_device_t* controller, int port)
|
||||
{
|
||||
char name_buf[256] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
char name_buf[256];
|
||||
|
||||
if (!qnx)
|
||||
return;
|
||||
@ -210,9 +209,6 @@ static void qnx_input_autodetect_gamepad(qnx_input_t *qnx,
|
||||
{
|
||||
autoconfig_params_t params = {{0}};
|
||||
|
||||
strlcpy(settings->input.device_names[port],
|
||||
name_buf, sizeof(settings->input.device_names[port]));
|
||||
|
||||
strlcpy(params.name, name_buf, sizeof(params.name));
|
||||
|
||||
params.idx = port;
|
||||
|
@ -45,14 +45,13 @@ typedef struct sdl_input
|
||||
|
||||
static void *sdl_input_init(void)
|
||||
{
|
||||
settings_t *settings;
|
||||
sdl_input_t *sdl;
|
||||
input_keymaps_init_keyboard_lut(rarch_key_map_sdl);
|
||||
settings = config_get_ptr();
|
||||
sdl = (sdl_input_t*)calloc(1, sizeof(*sdl));
|
||||
settings_t *settings = config_get_ptr();
|
||||
sdl_input_t *sdl = (sdl_input_t*)calloc(1, sizeof(*sdl));
|
||||
if (!sdl)
|
||||
return NULL;
|
||||
|
||||
input_keymaps_init_keyboard_lut(rarch_key_map_sdl);
|
||||
|
||||
sdl->joypad = input_joypad_init_driver(settings->input.joypad_driver, sdl);
|
||||
|
||||
RARCH_LOG("[SDL]: Input driver initialized.\n");
|
||||
|
@ -237,7 +237,6 @@ static void iohidmanager_hid_device_input_callback(void *data, IOReturn result,
|
||||
static void iohidmanager_hid_device_remove(void *data,
|
||||
IOReturn result, void* sender)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct iohidmanager_hid_adapter *adapter =
|
||||
(struct iohidmanager_hid_adapter*)data;
|
||||
iohidmanager_hid_t *hid = (iohidmanager_hid_t*)
|
||||
@ -304,7 +303,7 @@ static void iohidmanager_hid_device_add_autodetect(unsigned idx,
|
||||
params.vid = dev_vid;
|
||||
params.pid = dev_pid;
|
||||
|
||||
strlcpy(params.name, device_name, sizeof(params.name));
|
||||
strlcpy(params.name, device_name, sizeof(params.name));
|
||||
strlcpy(params.driver, driver_name, sizeof(params.driver));
|
||||
|
||||
input_autoconfigure_connect(¶ms);
|
||||
@ -317,8 +316,6 @@ static void iohidmanager_hid_device_add(void *data, IOReturn result,
|
||||
{
|
||||
IOReturn ret;
|
||||
uint16_t dev_vid, dev_pid;
|
||||
|
||||
settings_t *settings = config_get_ptr();
|
||||
iohidmanager_hid_t *hid = (iohidmanager_hid_t*)
|
||||
hid_driver_get_data();
|
||||
struct iohidmanager_hid_adapter *adapter = (struct iohidmanager_hid_adapter*)
|
||||
@ -368,9 +365,6 @@ static void iohidmanager_hid_device_add(void *data, IOReturn result,
|
||||
if (string_is_empty(adapter->name))
|
||||
goto error;
|
||||
|
||||
strlcpy(settings->input.device_names[adapter->slot],
|
||||
adapter->name, sizeof(settings->input.device_names[adapter->slot]));
|
||||
|
||||
iohidmanager_hid_device_add_autodetect(adapter->slot,
|
||||
adapter->name, iohidmanager_hid.ident, dev_vid, dev_pid);
|
||||
|
||||
|
@ -140,7 +140,6 @@ static void wiiusb_hid_device_add_autodetect(unsigned idx,
|
||||
uint16_t dev_vid, uint16_t dev_pid)
|
||||
{
|
||||
autoconfig_params_t params = {{0}};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
params.idx = idx;
|
||||
params.vid = dev_vid;
|
||||
@ -149,9 +148,6 @@ static void wiiusb_hid_device_add_autodetect(unsigned idx,
|
||||
strlcpy(params.name, device_name, sizeof(params.name));
|
||||
strlcpy(params.driver, driver_name, sizeof(params.driver));
|
||||
|
||||
strlcpy(settings->input.device_names[idx], device_name,
|
||||
sizeof(settings->input.device_names[idx]));
|
||||
|
||||
input_autoconfigure_connect(¶ms);
|
||||
}
|
||||
|
||||
|
@ -45,13 +45,8 @@ static const char *ctr_joypad_name(unsigned pad)
|
||||
|
||||
static void ctr_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
autoconfig_params_t params = {{0}};
|
||||
|
||||
strlcpy(settings->input.device_names[autoconf_pad],
|
||||
ctr_joypad_name(autoconf_pad),
|
||||
sizeof(settings->input.device_names[autoconf_pad]));
|
||||
|
||||
/* TODO - implement VID/PID? */
|
||||
params.idx = autoconf_pad;
|
||||
strlcpy(params.name, ctr_joypad_name(autoconf_pad), sizeof(params.name));
|
||||
|
@ -266,10 +266,6 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
||||
{
|
||||
autoconfig_params_t params = {{0}};
|
||||
|
||||
strlcpy(settings->input.device_names[g_joypad_cnt],
|
||||
dinput_joypad_name(g_joypad_cnt),
|
||||
sizeof(settings->input.device_names[g_joypad_cnt]));
|
||||
|
||||
strlcpy(params.name,
|
||||
dinput_joypad_name(g_joypad_cnt),
|
||||
sizeof(params.name));
|
||||
|
@ -142,17 +142,10 @@ static void handle_hotplug(unsigned port, uint32_t ptype)
|
||||
{
|
||||
pad_type[port] = ptype;
|
||||
|
||||
if (ptype != WPAD_EXP_NOCONTROLLER)
|
||||
if (ptype != WPAD_EXP_NOCONTROLLER
|
||||
&& settings->input.autodetect_enable)
|
||||
{
|
||||
autoconfig_params_t params = {{0}};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!settings->input.autodetect_enable)
|
||||
return;
|
||||
|
||||
strlcpy(settings->input.device_names[port],
|
||||
gx_joypad_name(port),
|
||||
sizeof(settings->input.device_names[port]));
|
||||
|
||||
/* TODO - implement VID/PID? */
|
||||
params.idx = port;
|
||||
|
@ -43,11 +43,7 @@ static const char *ps3_joypad_name(unsigned pad)
|
||||
|
||||
static void ps3_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
autoconfig_params_t params = {{0}};
|
||||
strlcpy(settings->input.device_names[autoconf_pad],
|
||||
"SixAxis Controller",
|
||||
sizeof(settings->input.device_names[autoconf_pad]));
|
||||
|
||||
/* TODO - implement VID/PID? */
|
||||
params.idx = autoconf_pad;
|
||||
|
@ -72,13 +72,8 @@ static const char *psp_joypad_name(unsigned pad)
|
||||
|
||||
static void psp_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
autoconfig_params_t params = {{0}};
|
||||
|
||||
strlcpy(settings->input.device_names[autoconf_pad],
|
||||
psp_joypad_name(autoconf_pad),
|
||||
sizeof(settings->input.device_names[autoconf_pad]));
|
||||
|
||||
/* TODO - implement VID/PID? */
|
||||
params.idx = autoconf_pad;
|
||||
strlcpy(params.name, psp_joypad_name(autoconf_pad), sizeof(params.name));
|
||||
|
@ -28,7 +28,6 @@ static const char *qnx_joypad_name(unsigned pad)
|
||||
static bool qnx_joypad_init(void *data)
|
||||
{
|
||||
unsigned autoconf_pad;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)data;
|
||||
|
||||
@ -36,9 +35,6 @@ static bool qnx_joypad_init(void *data)
|
||||
{
|
||||
autoconfig_params_t params = {{0}};
|
||||
|
||||
strlcpy(settings->input.device_names[autoconf_pad], "None",
|
||||
sizeof(settings->input.device_names[autoconf_pad]));
|
||||
|
||||
/* TODO - implement VID/PID? */
|
||||
params.idx = autoconf_pad;
|
||||
strlcpy(params.name, qnx_joypad_name(autoconf_pad), sizeof(params.name));
|
||||
|
@ -98,7 +98,6 @@ static void sdl_pad_connect(unsigned id)
|
||||
bool success = false;
|
||||
int32_t product = 0;
|
||||
int32_t vendor = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
autoconfig_params_t params = {{0}};
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
@ -131,8 +130,6 @@ static void sdl_pad_connect(unsigned id)
|
||||
return;
|
||||
}
|
||||
|
||||
strlcpy(settings->input.device_names[id], sdl_pad_name(id), sizeof(settings->input.device_names[id]));
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
guid = SDL_JoystickGetGUID(pad->joypad);
|
||||
guid_ptr = (uint16_t*)guid.data;
|
||||
@ -202,7 +199,6 @@ static void sdl_pad_connect(unsigned id)
|
||||
|
||||
static void sdl_pad_disconnect(unsigned id)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
#ifdef HAVE_SDL2
|
||||
if (sdl_pads[id].haptic)
|
||||
SDL_HapticClose(sdl_pads[id].haptic);
|
||||
@ -220,8 +216,6 @@ static void sdl_pad_disconnect(unsigned id)
|
||||
input_autoconfigure_disconnect(id, sdl_joypad.ident);
|
||||
}
|
||||
|
||||
settings->input.device_names[id][0] = '\0';
|
||||
|
||||
memset(&sdl_pads[id], 0, sizeof(sdl_pads[id]));
|
||||
}
|
||||
|
||||
|
@ -289,8 +289,6 @@ static int udev_add_pad(struct udev_device *dev, unsigned p, int fd, const char
|
||||
settings->input.pid[p] = params.pid;
|
||||
settings->input.vid[p] = params.vid;
|
||||
|
||||
strlcpy(settings->input.device_names[p],
|
||||
params.name, sizeof(settings->input.device_names[p]));
|
||||
strlcpy(params.driver, udev_joypad.ident,
|
||||
sizeof(params.driver));
|
||||
input_autoconfigure_connect(¶ms);
|
||||
|
@ -47,16 +47,8 @@ static const char *wiiu_joypad_name(unsigned pad)
|
||||
|
||||
static void wiiu_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
autoconfig_params_t params = {{0}};
|
||||
|
||||
if (!settings->input.autodetect_enable)
|
||||
return;
|
||||
|
||||
strlcpy(settings->input.device_names[autoconf_pad],
|
||||
wiiu_joypad_name(autoconf_pad),
|
||||
sizeof(settings->input.device_names[autoconf_pad]));
|
||||
|
||||
/* TODO - implement VID/PID? */
|
||||
params.idx = autoconf_pad;
|
||||
strlcpy(params.name, wiiu_joypad_name(autoconf_pad), sizeof(params.name));
|
||||
|
@ -47,10 +47,6 @@ static void xdk_joypad_autodetect_add(unsigned autoconf_pad)
|
||||
autoconfig_params_t params = {{0}};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
strlcpy(settings->input.device_names[autoconf_pad],
|
||||
"XInput Controller",
|
||||
sizeof(settings->input.device_names[autoconf_pad]));
|
||||
|
||||
/* TODO - implement VID/PID? */
|
||||
params.idx = autoconf_pad;
|
||||
strlcpy(params.name, xdk_joypad_name(autoconf_pad), sizeof(params.name));
|
||||
|
@ -258,10 +258,6 @@ static bool xinput_joypad_init(void *data)
|
||||
{
|
||||
autoconfig_params_t params = {{0}};
|
||||
|
||||
strlcpy(settings->input.device_names[autoconf_pad],
|
||||
xinput_joypad_name(autoconf_pad),
|
||||
sizeof(settings->input.device_names[autoconf_pad]));
|
||||
|
||||
/* TODO - implement VID/PID? */
|
||||
params.idx = autoconf_pad;
|
||||
strlcpy(params.name, xinput_joypad_name(autoconf_pad), sizeof(params.name));
|
||||
|
@ -169,6 +169,11 @@ static void input_autoconfigure_joypad_add(config_file_t *conf,
|
||||
if (!block_osd_spam)
|
||||
task->title = strdup(msg);
|
||||
}
|
||||
|
||||
strlcpy(settings->input.device_names[params->idx],
|
||||
params->name,
|
||||
sizeof(settings->input.device_names[params->idx]));
|
||||
|
||||
input_autoconfigure_joypad_reindex_devices();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user