Create input_config_autoconfigure_disconnect

This commit is contained in:
twinaphex 2015-06-03 18:55:04 +02:00
parent c24a5de3a8
commit 1a5e16ff99
11 changed files with 24 additions and 35 deletions

View File

@ -217,11 +217,7 @@ static void iohidmanager_hid_device_remove(void *data, IOReturn result, void* se
if (adapter && (adapter->slot < MAX_USERS))
{
char msg[PATH_MAX_LENGTH];
snprintf(msg, sizeof(msg), "Device #%u (%s) disconnected.",
adapter->slot, adapter->name);
rarch_main_msg_queue_push(msg, 0, 60, false);
input_config_autoconfigure_disconnect(adapter->slot, adapter->name);
apple->buttons[adapter->slot] = 0;
memset(apple->axes[adapter->slot], 0, sizeof(apple->axes));

View File

@ -321,13 +321,10 @@ static int remove_adapter(void *data, struct libusb_device *dev)
{
if (adapter->next->device == dev)
{
char msg[PATH_MAX_LENGTH];
struct libusb_adapter *new_next = NULL;
const char *name = (const char*)adapter->next->name;
fprintf(stderr, "Device 0x%p disconnected.\n", adapter->next->device);
snprintf(msg, sizeof(msg), "Device #%u (%s) disconnected.",
adapter->slot, adapter->next->name);
rarch_main_msg_queue_push(msg, 0, 60, false);
input_config_autoconfigure_disconnect(adapter->slot, name);
adapter->next->quitting = true;
sthread_join(adapter->next->thread);

View File

@ -138,7 +138,7 @@ int change_cb(int result, void *usrdata)
void removal_cb(void *usrdata)
{
RARCH_LOG("Device %d disconnected\n", (int)usrdata);
input_config_autoconfigure_disconnect((int)usrdata, gx_joypad.ident);
}
#endif

View File

@ -148,15 +148,9 @@ static void handle_plugged_pad(void)
{
if (linuxraw_pads[idx].fd >= 0)
{
if (g_hotplug)
{
char msg[512];
snprintf(msg, sizeof(msg), "Device #%u (%s) disconnected.", idx, linuxraw_pads[idx].ident);
rarch_main_msg_queue_push(msg, 0, 60, false);
}
input_config_autoconfigure_disconnect(idx, linuxraw_pads[idx].ident);
RARCH_LOG("[Device]: Device %s disconnected.\n", linuxraw_pads[idx].ident);
close(linuxraw_pads[idx].fd);
linuxraw_pads[idx].buttons = 0;
memset(linuxraw_pads[idx].axes, 0, sizeof(linuxraw_pads[idx].axes));

View File

@ -137,13 +137,7 @@ static void ps3_joypad_poll(void)
{
if ( (pad_info.port_status[port] & CELL_PAD_STATUS_CONNECTED) == 0 )
{
char msg[512];
snprintf(msg, sizeof(msg),
"Device #%u (%s) disconnected.", port, ps3_joypad.ident);
rarch_main_msg_queue_push(msg, 0, 60, false);
RARCH_LOG("%s\n", msg);
input_config_autoconfigure_disconnect(port, ps3_joypad.ident);
pads_connected[port] = 0;
}
else if ((pad_info.port_status[port] & CELL_PAD_STATUS_CONNECTED) > 0 )

View File

@ -202,14 +202,14 @@ static void sdl_pad_disconnect(unsigned id)
if (sdl_pads[id].controller)
{
SDL_GameControllerClose(sdl_pads[id].controller);
RARCH_LOG("[SDL]: Device #%u disconnected.\n", id);
input_config_autoconfigure_disconnect(id, sdl_joypad.ident);
}
else
#endif
if (sdl_pads[id].joypad)
{
SDL_JoystickClose(sdl_pads[id].joypad);
RARCH_LOG("[SDL]: Device #%u disconnected.\n", id);
input_config_autoconfigure_disconnect(id, sdl_joypad.ident);
}
settings->input.device_names[id][0] = '\0';

View File

@ -368,10 +368,7 @@ static void udev_joypad_remove_device(const char *path)
{
if (udev_pads[i].path && !strcmp(udev_pads[i].path, path))
{
char msg[512];
snprintf(msg, sizeof(msg), "Device #%u (%s) disconnected.", i, udev_pads[i].ident);
rarch_main_msg_queue_push(msg, 0, 60, false);
RARCH_LOG("[udev]: %s\n", msg);
input_config_autoconfigure_disconnect(i, udev_pads[i].ident);
udev_free_pad(i, true);
break;
}

View File

@ -165,10 +165,7 @@ static void xdk_joypad_poll(void)
gamepads[port] = 0;
pad_state[port] = 0;
char msg[512];
snprintf(msg, sizeof(msg), "Device #%u (%s) disconnected.", port, xdk_joypad.ident);
rarch_main_msg_queue_push(msg, 0, 60, false);
RARCH_LOG("%s\n", msg);
input_config_autoconfigure_disconnect(port, xdk_joypad.ident);
}
/* handle inserted devices. */

View File

@ -258,3 +258,11 @@ const struct retro_keybind *input_get_auto_bind(unsigned port, unsigned id)
return &settings->input.autoconf_binds[joy_idx][id];
return NULL;
}
void input_config_autoconfigure_disconnect(unsigned i, const char *ident)
{
char msg[PATH_MAX_LENGTH];
snprintf(msg, sizeof(msg), "Device #%u (%s) disconnected.", i, ident);
rarch_main_msg_queue_push(msg, 0, 60, false);
RARCH_LOG("%s\n", msg);
}

View File

@ -34,6 +34,8 @@ const struct retro_keybind *input_get_auto_bind(unsigned port,
void input_config_autoconfigure_joypad(autoconfig_params_t *params);
void input_config_autoconfigure_disconnect(unsigned i, const char *ident);
extern const char* const input_builtin_autoconfs[];
#endif

View File

@ -516,3 +516,7 @@ bool video_driver_read_viewport(uint8_t *buffer)
{
return false;
}
void input_config_autoconfigure_disconnect(unsigned id, const char *msg)
{
}