Rémi Bernon
6ae7e808bd
winebus.sys: Use HID descriptor helpers in bus_sdl.c.
...
And remove old helpers.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-12 17:30:21 +02:00
Rémi Bernon
b36b2999c8
hid: Return HIDP_STATUS_SUCCESS even if no usages are found.
...
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-12 17:30:21 +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
7a571127e4
xinput1_3/tests: Add some HID report tests.
...
This adds tests to validate the bogus HID devices exposed native XInput
driver. Interactive tests are also included to validate the HID report
values, and more specifically the weird combined triggers, which is
currently not implemented correctly in Wine.
Some third-party libraries, such as SDL, are known to rely on this bogus
HID devices and hardcode the expected report structure.
This has been tested on Windows 10 with XBox 360 controllers as well
as Xbox One S controllers.
The latter are detected as 045e:02ea on Linux, but as 045e:02ff on
Windows for some reason, and their descriptor seems a little bit
different.
Their exposed HID device also doesn't seem to work at all and ReadFile
never succeeds, so the interactive tests are skipped for these devices.
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
Rémi Bernon
db11606728
xinput1_3: Access controller list in HID code directly.
...
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-05 23:11:23 +02:00
Rémi Bernon
1371bcf3ad
xinput1_3: Continue enumeration until there's no more slot.
...
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-05 23:11:23 +02:00
Rémi Bernon
47ac0b0bdc
xinput1_3: Statically allocate SP_DEVICE_INTERFACE_DETAIL_DATA_W.
...
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-05 23:11:23 +02:00
Rémi Bernon
828b9b8cc4
xinput1_3: Introduce new find_opened_device helper.
...
To look for already opened device, or available device index.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-05 23:11:23 +02:00
Rémi Bernon
2bd3c9703d
xinput1_3: Allocate output report buffer on the heap.
...
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-07 21:26:25 +02:00
Rémi Bernon
cfb24768d1
xinput1_3: Use input report length from HIDP_CAPS.
...
And swap input report buffers instead of adding an index.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-07 21:26:21 +02:00
Rémi Bernon
11a25dec95
xinput1_3: Store HIDP_CAPS in hid_platform_private struct.
...
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-07 21:26:18 +02:00
Rémi Bernon
27069286b1
xinput1_3: Check for HID failures and print warnings.
...
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-07 21:26:13 +02:00
Rémi Bernon
506c13c7d6
xinput1_3: Use msvcrt allocation functions.
...
And handle allocation failures.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-07 21:26:07 +02:00
Michael Stefaniuc
f6e7f00010
xinput1_3: Use wide-char string literals.
...
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-05 12:33:31 +02:00
Michael Cronenworth
44e69405ad
xinput: Global variable compatibility update for gcc 10.
...
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-24 18:19:52 +01:00
Andrew Eikum
c1d51031ef
xinput: Implement XInputGetKeystroke.
...
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-24 17:15:54 +01:00
Andrew Eikum
aa482426dc
xinput: Get rid of redundant connected boolean.
...
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-22 23:04:27 +02:00
Andrew Eikum
b3cc2542cb
xinput: Clear instance data when a controller is hotplugged.
...
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-22 23:04:27 +02:00
Andrew Eikum
5417c3bfa4
xinput: Consolidate new device setup.
...
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-22 23:04:27 +02:00
Andrew Eikum
4d3db6d2d7
xinput: Make device hotplugging thread-safe.
...
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-22 23:04:27 +02:00
Andrew Eikum
b84a4aa53b
xinput: Check for NULL argument in XInputGetState.
...
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-30 22:24:27 +02:00
Alexey Prokhin
9855fbe252
xinput: Fix vibration capabilities.
...
wLeftMotorSpeed and wRightMotorSpeed returned by XInputGetCapabilities
are supposed to be resolutions rather than current motor speeds.
This fixes rumble in Far Cry 5.
Signed-off-by: Alexey Prokhin <alexey@prokhin.ru>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-07 22:35:02 +02:00
Alexandre Julliard
0115cba69d
xinput1: Build with msvcrt.
...
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-27 22:20:05 +02:00
Rémi Bernon
d636cc18ba
xinput: Fix rumble amount value rounding.
...
XINPUT_VIBRATION structure documentation says that wLeftMotorSpeed and
wRightMotorSpeed can range from 0 to 65535. The values were
incorrectly divided by 255 in HID_set_state, which made the value
range overflow one byte.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-29 16:21:32 +02:00
Andrew Eikum
ba79a14369
winebus.sys: Report SDL controller buttons in the right order.
...
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-07 15:20:11 -05:00
Andrew Eikum
564e7b4db9
winebus.sys: Report SDL controller dpad as hatswitch.
...
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-07 15:20:02 -05:00
Alistair Leslie-Hughes
72e62952db
xinput: Check that we actually received a value before assignment.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46999
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-24 21:55:24 +02:00
Zebediah Figura
7fd8ae1e4f
xinput: Fix axis scaling arithmetic.
...
Cast difference to ULONGLONG to ensure unsigned division, and correct
off-by-one error present when inverting axes (previously hidden by signed
division bug).
Fixes a regression introduced by bd9e130ee5
.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46623
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-15 21:01:48 +01:00
Zebediah Figura
c1c6ca2e94
xinput: Use a struct instead of an array to store axis information.
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-15 21:01:41 +01:00
Zebediah Figura
681414400e
xinput: Use HidP_GetScaledUsageValue().
...
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-15 21:01:36 +01:00
Zebediah Figura
69e0e1cf3f
xinput: Make exported functions hot-patchable.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46142
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-21 17:05:27 +01:00
Zebediah Figura
b72da1fdef
xinput: Avoid calling XInputGetStateEx() in XInputGetState().
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46142
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-19 22:42:38 +01:00
Beren Minor
186d107e4d
xinput1_3: Report SUCCESS from XInputSetState when FFB isn't available.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45992
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-15 13:43:20 +01:00
Zebediah Figura
8343099ff5
xinput: Use DIGCF_PRESENT.
...
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-19 17:46:34 +02:00
Michael Stefaniuc
4fbd3a7c3a
xinput/tests: Use the available ARRAY_SIZE() macro.
...
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-30 09:11:31 +02:00
Louis Lenders
2a4fb48583
xinput1_3: Quiet a noisy fixme.
...
Signed-off-by: Louis Lenders <xerox.xerox2000x@gmail.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-03-13 13:24:33 +01:00
Aric Stewart
50e5364330
xinput: Implement XInputEnable.
...
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-15 08:06:38 +01:00
Aric Stewart
f3391311f3
xinput: Implement XInputSetState.
...
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-15 08:06:31 +01:00