Commit Graph

21 Commits

Author SHA1 Message Date
Rémi Bernon ebc70f78fb xinput1_3: Register for device notifications to update controller list.
Based on a patch from Andrew Eikum <aeikum@codeweavers.com>.

Dark Souls Remasters checks for xinput devices when it receives a
WM_DEVICECHANGE message. We would only poll for new devices if it had
been at least 2 seconds since the last check. So often, DS would receive
the message, but we would refuse to poll for devices, so the game would
think no controller was present.

This commit fixes that by also subscribing to event notifications and
triggering a poll.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 16:55:49 +02:00
Rémi Bernon 65ba91d443 xinput1_3: Initialize the controller list in the update thread.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 16:55:46 +02:00
Rémi Bernon 60db389832 xinput1_3: Destroy controllers when ReadFile fails and I/O is not pending.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 16:55:36 +02:00
Rémi Bernon 54db761040 xinput1_3: Wait for CancelIoEx completion when disabling controllers.
Otherwise we may later write the cancelled status to invalid memory.

Also use a manual-reset event, as it should be for overlapped I/O, so
all waiters are waken up on cancel.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 16:55:33 +02:00
Rémi Bernon 4ba54cb448 xinput1_3: Introduce a new override registry mechanism to force dinput.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-24 21:55:19 +02:00
Rémi Bernon 36749a8f7d xinput1_3: Use new HID haptics rumble report.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51587
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-24 21:55:19 +02:00
Rémi Bernon 04b19a969b winebus.sys: Use report ids in crafted HID reports.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 10:28:39 +02:00
Rémi Bernon f299b42738 xinput1_3: Use the internal WINEXINPUT device interface class.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 21:43:03 +02:00
Rémi Bernon 43f0c8096b xinput1_3: Read the controller state in the update thread.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-11 23:00:50 +02:00
Rémi Bernon 8bf147b990 xinput1_3: Update the controller list in the update thread.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-11 23:00:50 +02:00
Rémi Bernon 40cb5510ae xinput1_3: Create a new background update thread.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-11 23:00:50 +02:00
Rémi Bernon 3d9a6fe660 xinput1_3: Rename controller helper functions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-09 11:41:25 +02:00
Rémi Bernon b94aaa28c1 xinput1_3: Move HID data into struct xinput_controller.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-09 11:41:22 +02:00
Rémi Bernon dfcf5d1290 xinput1_3: Scale axis values only once.
Instead of scaling to HID physical range, then to XInput range. Also
keep and use axis value caps directly.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-09 11:41:18 +02:00
Rémi Bernon f896333c37 xinput1_3: Move device(_path) members to struct xinput_controller.
And use device instead of platform_private to check connection.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-09 11:41:14 +02:00
Rémi Bernon 9146337233 xinput1_3: Consistently name struct xinput_controller variable.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-09 11:41:10 +02:00
Rémi Bernon 419909f418 xinput1_3: Move enabled flag to struct xinput_controller.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-06 20:00:25 +02:00
Rémi Bernon 927ae12abd xinput1_3: Enable controller on init, disable on remove.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-06 20:00:23 +02:00
Rémi Bernon ebf95a0785 xinput1_3: Use a fixed size array for HID device_path.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-06 20:00:21 +02:00
Rémi Bernon 4b9146527a xinput1_3: Rename xinput_controller to struct xinput_controller.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-06 20:00:18 +02:00
Rémi Bernon 01d3527065 xinput1_3: Merge hid.c and xinput_main.c into main.c.
It doesn't seem very useful to keep things separate, the files are
pretty much dependent from each other anyway and it's only 1k LoC.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-06 20:00:16 +02:00