Commit Graph

1277 Commits

Author SHA1 Message Date
Rémi Bernon 7ccf07ae8f dinput: Add a release callback for internal refcount handling.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 16:16:07 +02:00
Rémi Bernon 89c59e77c1 dinput: Factor all GetDeviceState implementations together.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 16:16:07 +02:00
Rémi Bernon 59fad29102 dinput: Check for mouse warping in the poll callback.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 16:16:07 +02:00
Rémi Bernon aebd03f070 dinput: Factor all Poll implementations together.
With a new internal poll callback for mouse and keyboard Wine-specific
message peeking behavior.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 16:16:07 +02:00
Rémi Bernon ec3e51bb10 dinput: Factor object enumeration checks and offset mapping.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 16:16:07 +02:00
Michael Stefaniuc 1431608e61 dinput: Avoid negating FAILED().
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 16:16:07 +02:00
Rémi Bernon 47a821400a dinput: Factor all SetProperty implementations together.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 10:50:22 +02:00
Rémi Bernon d94ad65f98 dinput: Use the base device state in the keyboard device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 10:50:20 +02:00
Rémi Bernon 50d60884b5 dinput: Use the base device state in the mouse device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 10:50:18 +02:00
Rémi Bernon 7402568a45 dinput: Implement GetProperty with DIPROP_FFGAIN stub.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 10:50:15 +02:00
Rémi Bernon 3ec4ae8390 dinput: Factor all GetProperty implementations together.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 10:50:13 +02:00
Rémi Bernon f091aeae50 dinput: Use object instance offset to access extra value caps.
Value objects are always enumerated first, so offset / sizeof(LONG) can
be safely used to index input_extra_caps array.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 10:50:11 +02:00
Rémi Bernon 9f493b0ed8 dinput: Factor all GetObjectInfo implementations together.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-18 16:03:42 +02:00
Rémi Bernon 71ecc179aa dinput: Implement internal enum_objects for the keyboard device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-18 16:03:39 +02:00
Rémi Bernon d2aa45329d dinput: Implement internal enum_objects for the mouse device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-18 16:03:36 +02:00
Rémi Bernon 34f66a0cec dinput: Implement EnumObjects through the internal vtable.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-18 16:03:32 +02:00
Rémi Bernon be9a36c4ff dinput: Introduce new direct_input_device_init helper.
To initialize the device data format by enumerating its objects.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-18 16:03:30 +02:00
Rémi Bernon b905ea81aa dinput: Add support for more HID axes usages.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40658
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-15 18:31:51 +02:00
Ivo Ivanov eb223bf58d dinput: Ignore input caps from the PID usage page.
Prevents PID usage page input reports from being parsed and listed in
the device objects, increasing the total number of buttons or axes.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51873
Signed-off-by: Ivo Ivanov <logos128@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-14 18:59:52 +02:00
Rémi Bernon 1d4fdb5aca dinput: Correctly parse instance numbers for joystick semantics.
This should fix the last BuildActionMap / EnumDevicesBySemantics test
failures when a joystick is plugged in.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 13:05:24 +02:00
Rémi Bernon 947e6ee5b4 dinput: Wait for the internal thread to complete unacquiring.
Otherwise we may close HID read event before it has finished removing it
from the wait handles, causing MsgWaitForMultipleObjectsEx to return an
error and terminate.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 13:05:23 +02:00
Rémi Bernon 29fae9a776 dinput: Introduce new dinput_device_internal_unacquire helper.
And use it from within the internal hook critical section, to unacquire
the device and remove it from the acquired device list directly.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 13:05:23 +02:00
Rémi Bernon 77f5edda30 dinput: Factor all (Un)Acquire implementations together.
And introduce new internal acquire / unacquire callbacks.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 13:05:23 +02:00
Rémi Bernon 7908d25f23 dinput: Move mouse (Un)Acquire functions around.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 13:05:23 +02:00
Rémi Bernon 18981330c5 dinput: Factor all SetActionMap wrappers together.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 13:05:23 +02:00
Rémi Bernon 30ea1876db dinput: Factor all BuildActionMap wrappers together.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 13:05:23 +02:00
Rémi Bernon daed18a816 dinput: Factor all GetCapabilities implementations together.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 13:05:23 +02:00
Rémi Bernon fc7f430afb dinput: Factor all GetDeviceInfo implementations together.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 13:05:23 +02:00
Rémi Bernon 50f889fd19 dinput: Fix invalid use of post-incremented device_count value.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-12 23:10:44 +02:00
Rémi Bernon cb8bc378c2 dinput: Only dump the HID report data that has been read.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-12 18:29:22 +02:00
Rémi Bernon f5b32121b1 dinput: Use msvcrt memory allocation functions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-11 10:58:51 +02:00
Rémi Bernon 87c7f1bdce dinput: Use wide char string literals.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-11 10:58:46 +02:00
Rémi Bernon e4f6ec7d3d dinput: Build with msvcrt.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-11 10:58:38 +02:00
Rémi Bernon adfee25b45 dinput: Remove legacy joystick backends.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-11 10:58:29 +02:00
Rémi Bernon 7011685e1e dinput: Move PIDVID internal guid to device.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-11 10:58:10 +02:00
Rémi Bernon 46d3521120 dinput: Move device_instance_is_disabled to device.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-11 10:58:03 +02:00
Rémi Bernon 022076532f dinput: Check for ReadFile errors and return DIERR_INPUTLOST.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 16:56:05 +02:00
Rémi Bernon c93813e11f dinput: Call device read_callback while holding the internal CS.
And remove the device from the list of acquired devices if the callback
indicates a read error.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 16:56:03 +02:00
Rémi Bernon bbb68aeaae dinput: Wait for CancelIoEx completion when unacquiring HID joysticks.
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 woken up on cancel.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 16:56:01 +02:00
Rémi Bernon 2b61d8dd97 dinput: Hold the HID joystick CS when updating the device state.
The read buffer is only used by the reading thread but the device state
is not, we should only update it while holding the CS.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 16:55:58 +02:00
Rémi Bernon 1014cfcff8 dinput: Do not wait for internal hooks inside the HID joystick CS.
This can cause some deadlocks as the internal thread will acquire the
device CS when reading the state.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 16:55:55 +02:00
Rémi Bernon bbcee5c23d dinput: Look for the PID set ramp force output report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 15:27:25 +02:00
Rémi Bernon 25a86e4668 dinput: Look for the PID set constant force output report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 15:27:25 +02:00
Rémi Bernon a971b48b32 dinput: Implement support for the PID effect set condition report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 15:27:25 +02:00
Rémi Bernon c8b3e9b262 dinput: Implement support for the PID effect set envelope report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 15:27:25 +02:00
Rémi Bernon 1b3e6b0239 dinput: Implement support for the PID effect set periodic report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 15:27:25 +02:00
Rémi Bernon 9aad438057 dinput: Implement HID joystick IDirectInputEffect_(Download|Unload).
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 10:53:02 +02:00
Rémi Bernon 453940f571 dinput: Look for PID direction collection and set DIEP_DIRECTION if found.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 10:53:00 +02:00
Rémi Bernon 83bc89f41f dinput: Partially implement HID joystick IDirectInputEffect_SetParameters.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 10:52:58 +02:00
Rémi Bernon 35ea577409 dinput: Partially implement HID joystick IDirectInputEffect_GetParameters.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 10:52:56 +02:00
Rémi Bernon 33dc3db01e dinput: Implement HID joystick IDirectInputEffect_(Start|Stop).
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 10:52:53 +02:00
Rémi Bernon 40e9092437 dinput: Implement HID joystick IDirectInputEffect_GetEffectGuid.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 10:52:47 +02:00
Rémi Bernon cbd9fe2586 dinput: Implement HID joystick IDirectInputEffect_Initialize.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 10:52:44 +02:00
Rémi Bernon 20b55e8748 dinput: Allocate buffers for the effect control and update reports.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 10:52:41 +02:00
Rémi Bernon 099d649434 dinput: Remove "stub!" from HID joystick IDirectInputDevice8_EnumCreatedEffectObjects.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 10:52:38 +02:00
Rémi Bernon 4ce7ae4af1 dinput: Fill the HID joystick object instance exponent and dimension.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Rémi Bernon 489c62f9eb dinput: Add DIDFT_FFEFFECTTRIGGER flag on trigger buttons.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Rémi Bernon 1285bbfa43 dinput: Add DIDFT_FFACTUATOR flag on PID effect axes.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Rémi Bernon b725ccbd65 dinput: Look for PID axes enable collection and set DIEP_AXES if found.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-05 11:33:45 +02:00
Rémi Bernon 994fd9f761 dinput: Implement more of HID joystick IDirectInputDevice8_GetEffectInfo.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-05 11:33:40 +02:00
Rémi Bernon c436b54673 dinput: Look for the PID effect update output report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-05 11:33:25 +02:00
Rémi Bernon ac0353653d dinput: Look for the PID effect control output report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-04 11:01:58 +02:00
Rémi Bernon 4310b5accf dinput: Implement HID joystick IDirectInputDevice8_EnumCreatedEffectObjects.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-04 11:01:54 +02:00
Rémi Bernon f0c93375ef dinput: Keep a private ref to the device on created effects.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-04 11:01:52 +02:00
Rémi Bernon 4961876804 dinput: Implement HID joystick IDirectInputDevice8_CreateEffect stub.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-01 12:37:39 +02:00
Rémi Bernon 5b8daecabf dinput: Implement HID joystick IDirectInputDevice8_EnumEffects.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-01 12:37:35 +02:00
Rémi Bernon 84e586124c dinput: Send DISFFC_RESET command on HID joystick (Un)Acquire.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-01 12:37:32 +02:00
Rémi Bernon 9a9a1656c1 dinput: Start and cancel reading HID reports while holding the CS.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-01 12:37:28 +02:00
Rémi Bernon a382646e38 dinput: Implement hid_joystick_SendForceFeedbackCommand.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-01 12:37:24 +02:00
Rémi Bernon ff7685dea4 dinput: Look for the PID device control output report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-01 12:37:20 +02:00
Rémi Bernon b33bece87e dinput: Stub hid_joystick force feedback methods.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-01 12:37:14 +02:00
Rémi Bernon 5d782424d8 dinput: Fix HID joystick DIDFT_POV enumeration.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-30 21:24:13 +02:00
Rémi Bernon e69f27d2ee dinput8/tests: Add some HID joystick IDirectInputDevice8_CreateEffect tests.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-30 21:23:23 +02:00
Tim Clem 5853f356b8 dinput: Lock around polling a HID device in joystick_osx.
If multiple threads try to read IOHIDElements and IOHIDValues from
the same IOHIDDevice simultaneously, we sometimes crash deep in
IOKit.

Fixes a crash in GTA 4 when using a PS4 controller.

Signed-off-by: Tim Clem <tclem@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-30 10:16:05 +02:00
Tim Clem c52645807b dinput: Factor out HID value retrieval in joystick_osx.
Signed-off-by: Tim Clem <tclem@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-30 10:16:03 +02:00
Rémi Bernon 8f1f061349 dinput: Simplify object enumeration by removing special cases.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-29 21:38:13 +02:00
Rémi Bernon 78207cf4d2 dinput: Enumerate output button objects in their declaration order.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-29 21:38:13 +02:00
Rémi Bernon b468349ec2 dinput: Enumerate HID joystick DIDFT_OUTPUT objects.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-29 21:38:13 +02:00
Rémi Bernon 58b632b863 dinput: Enumerate HID joystick objects using internal HID caps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-29 21:38:13 +02:00
Rémi Bernon 81bef14324 dinput: Improve filtering of HID device state input report.
Make sure we only read input object from the device state input report
and only look for generic and button usage pages to find the report.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-29 21:38:13 +02:00
Rémi Bernon e4766cad6d dinput: Remove unusual HID joystick button count FIXMEs.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-28 10:06:46 +02:00
Rémi Bernon 5732347cbe dinput: Implement HID joystick DIPROP_AUTOCENTER property.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-28 10:06:44 +02:00
Rémi Bernon 5eb65418eb dinput: Implement HID joystick DIPROP_(DEADZONE|SATURATION|GRANULARITY).
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-28 10:06:42 +02:00
Rémi Bernon 9646873d63 dinput: Scale HID joystick axis values according to their center point.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-28 10:06:39 +02:00
Rémi Bernon 3886634c82 dinput: Reset the HID joystick state values on DIPROP_RANGE changes.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-28 10:06:36 +02:00
Rémi Bernon 844db6e53e dinput: Check that DIPROP_RANGE lMin and lMax are ordered.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-28 10:06:32 +02:00
Rémi Bernon 5d1f3baacd dinput: Return DIERR_UNSUPPORTED when reading DIPROP_RANGE with DIPH_DEVICE mode.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-28 10:06:27 +02:00
Rémi Bernon 50c1f45441 dinput: Return DIERR_NOTFOUND when DIPROP_RANGE object isn't found.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-28 10:06:22 +02:00
Rémi Bernon 42ba8f605d dinput: Compute HID joystick object offsets dynamically.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:34:43 +02:00
Rémi Bernon 85d7c56a83 dinput: Convert DIPH_BYOFFSET filter to use current data format offsets.
Instead of hardcoded DIJOYSTATE2 offsets.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:34:43 +02:00
Rémi Bernon e990e4b232 dinput: Return proper error status from HID joystick GetObjectInfo.
When no object matched the enumeration or when DIPH_DEVICE is used.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:34:43 +02:00
Rémi Bernon 1f8487e2f0 dinput: Enumerate all HID joystick objects at once.
Instead of using individual helpers.

The force-feedback EnumObjects test shows that we should enumerate the
output objects in their original order in the HID report descriptor, not
depending on their button/value nature.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:34:43 +02:00
Rémi Bernon d682b3a9d3 dinput: Use a custom HID joystick state instead of DIJOYSTATE2.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:34:43 +02:00
Rémi Bernon 6217705391 dinput: Open the WINEXINPUT interface when the override key is set.
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 5c18aa58d3 dinput: Report HID joystick wheel usage as a Z axis.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 18:11:43 +02:00
Rémi Bernon a12b2dec4f dinput: Count all HID joystick button objects.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 18:11:33 +02:00
Rémi Bernon 1316142b62 dinput: Use fixed axis object instance number for common axes.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 18:11:29 +02:00
Rémi Bernon eab7819d7a dinput: Add an instance number to HID joystick collection objects.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 18:11:23 +02:00
Rémi Bernon aa60766259 dinput: Set HID joystick objects wCollectionNumber field.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 18:11:19 +02:00
Rémi Bernon 0686815ff6 dinput: Check acquired state in IDirectInputDevice2WImpl_SetCooperativeLevel.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 18:11:15 +02:00
Rémi Bernon 0e75722971 dinput: Check data format dwObjSize in IDirectInputDevice2WImpl_SetDataFormat.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 18:11:09 +02:00
Rémi Bernon 54b2fc3553 dinput: Return correct errors from HID joystick IDirectInputDevice8_Poll.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 11:41:47 +02:00
Rémi Bernon aa43d24cd8 dinput: Return correct errors from HID joystick IDirectInputDevice8_GetDeviceState.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 11:41:44 +02:00
Rémi Bernon 78f04ca082 dinput: Return correct errors from HID joystick IDirectInputDevice8_SetProperty.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 11:41:42 +02:00
Rémi Bernon b4dfa8ff7b dinput: Check sizes in HID joystick IDirectInputDevice8_GetProperty.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 11:41:37 +02:00
Rémi Bernon 0daf841712 dinput: Fix HID joystick DIPH_BYUSAGE object enumeration.
This adds some todo_wine because we now get the correct object, but it
has incorrect offset and instance number.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 11:41:30 +02:00
Rémi Bernon 7c4941d0ec dinput: Implement more accurate HID joystick device subtypes.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:49 +02:00
Rémi Bernon d47ec6502b dinput: Pass output instance to get_object_info HID joystick callback.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:49 +02:00
Alexandre Julliard 6ba7773121 makefiles: Add a -mcygwin flag to specify the inverse of -mno-cygwin.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:48 +02:00
Rémi Bernon 91d9819c95 dinput: Fire the notification only after all events have been queued.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-17 10:48:34 +02:00
Rémi Bernon df0e491cb1 dinput: Don't disable HID joysticks by default.
Although not completely correct it should be usable already, and running
the tests would require setting the registry key before and cleaning it
up after otherwise.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-15 19:34:21 +02:00
Rémi Bernon d1e0c5a732 dinput: Read HID reports from the internal thread.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 20:25:05 +02:00
Rémi Bernon 1117f9f072 dinput: Implement HID joystick IDirectInputDevice8_EnumObjects.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 20:25:05 +02:00
Rémi Bernon ef7432d86e dinput: Implement HID joystick IDirectInputDevice8_GetObjectInfo.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 20:25:05 +02:00
Rémi Bernon 2681caa3f8 dinput: Implement HID joystick IDirectInputDevice8_SetProperty.
For DIPROP_RANGE property on POVs and Axes, and initialize it on
creation.

This uses the value caps physical range, as it's exactly the purpose and
we don't use it for anything else otherwise.

We'll scale values from their logical range directly anyway to save a
conversion.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 20:25:05 +02:00
Rémi Bernon 81c15d2d81 dinput: Enumerate HID collections, input buttons and values.
And initialize data format from them.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 20:25:05 +02:00
Rémi Bernon 10a812fb7d dinput: Implement HID joystick IDirectInputDevice8_GetCapabilities.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 20:25:05 +02:00
Rémi Bernon 91f4af3418 dinput: Implement HID joystick IDirectInputDevice8_GetDeviceState.
Removing the trace as it can get pretty verbose otherwise.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 20:25:05 +02:00
Rémi Bernon 6ba3a54842 dinput: Implement HID joystick IDirectInputDevice8_GetProperty.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 20:25:05 +02:00
Rémi Bernon 787d4af53b dinput: Implement HID joystick IDirectInputDevice8_GetDeviceInfo.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 20:25:05 +02:00
Rémi Bernon b36c6ae0e8 dinput: Add read event and callback for file-based devices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 20:25:05 +02:00
Rémi Bernon afa1e60b27 dinput: Introduce new HID joystick backend.
This adds a new joystick backend, implemented on top of HID and without
any host dependencies. This will be progressively implementated, and
it's not going to be usable until at least a few more patches.

Because of that, and because it may also introduce regressions compared
to the existing backends, it is disabled by default and is optionally
enabled using the following global registry key:

  [HKCU\\Software\\Wine\\DirectInput\\Joysticks]
  "HID"="enabled"

Or using the corresponding AppDefaults registry key:

  [HKCU\\Software\\Wine\\AppDefaults\\<app.exe>\\DirectInput\\Joysticks]
  "HID"="enabled"

This setting will be removed later, when it becomes usable enough, to
use the individual device disable mechanism available in joy.cpl.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-26 21:49:09 +02:00
Rémi Bernon 0ba137e36d dinput: Support disabled by default option in device_disabled_registry.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-26 21:49:09 +02:00
Rémi Bernon 2726644124 dinput: Allocate data format on device creation.
It's accessed on Release, and this will make it easier to handle device
creation failure cleanup.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-26 21:49:09 +02:00
Arkadiusz Hiler 5cb70e73f0 dinput/tests: Make overlapped format tests more robust.
Both Acquire() and event processing with DirectInput seem to be
asynchronous. In most cases we can just keep hammering GetDeviceData()
until the event gets processed.

Things get pretty racy around Acquire() though. If we fire event right
after the device is acquired we can find ourselves in one of the three
situations:

1. Event happened after acquiring has completed - the wait will suffice.

2. Event happened before acquiring did any real work - the device will
   pick up the state as if the event was processed, but there's nothing
   in GetDeviceData(). Because of that we cannot fail on wait.

3. Event happened somewhere in the middle of acquiring - we ended up
   both missing the event for GetDeviceData() and we have outdated
   state. Sending event again will register as if the button was not
   already pressed.

This change covers all three scenarios.

Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-05 20:43:28 +02:00
Michael Stefaniuc e35ea310a6 dinput: Use SUCCEEDED instead of !FAILED.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-22 13:15:15 +02:00
Arkadiusz Hiler d10887b8f5 dinput: Don't add 'default value 0' entries to the data transform.
This helps when dealing with the quirky c_dfDIJoystick2 format,
which defines all the sliders as overlapping, i.e. rglSlider[2],
rglVSlider[2], rglASlider[2] and rglFSlider[2] all share the same
offset.

With the Linux backends, if the device exposes enough axes (e.g. some
HOTAS) we end up using rglSlider.

Let's make sure we don't unnecessarily override the values there.

Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-08 21:13:54 +02:00
Rémi Bernon 2d629228dd dinput: Rename wReserved to wReportId in DIDEVICEOBJECTINSTANCE.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-31 11:31:46 +02:00
Rémi Bernon 5cf67f00d0 dinput: Free axis_map when joystick device is freed.
Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=36263
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-31 11:31:42 +02:00
Rémi Bernon 52aacd2377 dinput: Prevent a device interface leak when enumerating.
Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=36263
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-31 11:31:36 +02:00
Rémi Bernon d666aea360 dinput: Remove the need for ANSI enum_device callback.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-31 11:31:28 +02:00
Rémi Bernon 17958bc863 dinput: Factor out device creation interface queries.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-31 11:31:21 +02:00
Rémi Bernon a6d3d74ff2 dinput: Move IDirectInput7 WtoA wrappers to ansi.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-28 21:53:07 +02:00
Rémi Bernon bfc805194f dinput: Move IDirectInput8 WtoA wrappers to ansi.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-28 21:53:07 +02:00
Rémi Bernon 5ef24d1281 dinput: Prefer IDirectInputW interfaces over IDirectInputA.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-28 21:53:07 +02:00
Rémi Bernon f3a07c5cae dinput: Factor out IDirectInputDevice ansi vtable.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-28 21:53:07 +02:00
Rémi Bernon 8d7914962b dinput: Introduce direct_input_device_alloc helper.
To factor out device allocation and initialization.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-28 21:53:07 +02:00
Rémi Bernon ad8e3727c1 dinput: Make device creation error handling consistent.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-28 21:53:07 +02:00
Rémi Bernon 5f4ee79149 dinput: Factor out IDirectInputDevice_SetActionMap WtoA conversions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-27 16:14:24 +02:00
Rémi Bernon 8109f8398a dinput: Factor out IDirectInputDevice_BuildActionMap WtoA conversions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-27 16:14:19 +02:00
Rémi Bernon 27ea33baf9 dinput: Factor out IDirectInputDevice_GetDeviceInfo WtoA conversions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-27 16:14:13 +02:00
Rémi Bernon 7713050c77 dinput: Factor out IDirectInputDevice_GetDeviceState WtoA conversions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-27 16:14:08 +02:00
Rémi Bernon 5eb5f94fc0 dinput: Factor out IDirectInputDevice_GetCapabilities WtoA conversions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-27 16:14:03 +02:00
Rémi Bernon 5df60ff2ba dinput: Implement IDirectInputDevice_GetImageInfo WtoA conversion.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-27 16:13:58 +02:00
Rémi Bernon 06fa39cd76 dinput: Implement IDirectInputDevice_WriteEffectToFile WtoA conversion.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-26 21:29:38 +02:00
Rémi Bernon aa2da27e52 dinput: Implement IDirectInputDevice_EnumEffectsInFile WtoA conversion.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-26 21:29:38 +02:00
Rémi Bernon 6340a29680 dinput: Implement IDirectInputDevice_EnumEffects WtoA conversion.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-26 21:29:38 +02:00
Rémi Bernon 70b25ccfaa dinput: Implement IDirectInputDevice_GetEffectInfo WtoA conversion.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-26 21:29:38 +02:00
Rémi Bernon 08d07c4cc2 dinput: Factor out IDirectInputDevice_GetObjectInfo WtoA conversions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-26 21:29:37 +02:00
Rémi Bernon 49c66a3a94 dinput/tests: Check IDirectInputDevice2AImpl_GetObjectInfo error codes.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-26 21:29:37 +02:00
Rémi Bernon 9b834bb8bf dinput: Implement IDirectInputDevice_EnumObjects WtoA conversion.
Instead of a separate duplicate implementation.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-25 21:13:01 +02:00
Rémi Bernon ab8e416787 dinput/tests: Check IDirectInputDevice_EnumObjects error codes.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-25 21:13:01 +02:00
Rémi Bernon 740f8dc6d8 dinput: Move IDirectInputDeviceA wrappers to ansi.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-25 21:13:01 +02:00
Rémi Bernon 90ef30828e dinput: Use generic WtoA wrappers when possible.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-25 21:13:01 +02:00
Rémi Bernon 5fe103107a dinput: Use IDirectInputDevice8W interface consistently.
Instead of sometimes using IDirectInputDevice8A.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-25 21:13:01 +02:00
Rémi Bernon 15beabe071 dinput8/tests: Flush events after creating window.
To make it more likely it gets focused on X11 and fix spurious failures.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-25 21:13:01 +02:00
Alexandre Julliard 5d82baf974 winecrt0: Add a default implementation DllRegisterServer()/DllUnregisterServer().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-30 22:59:50 +02:00
Alexandre Julliard bd6b53740c winecrt0: Add a default implementation for DllCanUnloadNow().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-30 22:59:50 +02:00
Rémi Bernon b71cea76ed dinput: Wait for the hook thread to exit when stopping it.
FlatOut2 demo calls FreeLibrary on the dinput8 module more times than
it has loaded it, and the module reference that the internal thread has
is getting decremented before its exit.

Having an internal window to destroy also makes it more likely to crash
as it takes more time to exit calls the window procedure function.

Waiting for the thread to complete when all the dinput instances are
destroyed ensures that the thread isn't alive when the game frees the
DLL, and prevents the thread from crashing.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50673
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-29 09:40:54 +02:00
Arkadiusz Hiler 0a82d891fc dinput: Implement device creation using product GUID.
This fixes Far Cry Primal controller discovery.

Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-23 22:16:12 +01:00
Arkadiusz Hiler 8d206333fd dinput: Implement DIPROP_APPDATA.
This fixes not working analog inputs on game controllers in Slay the Spire.

Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-10 20:44:41 +01:00
Arkadiusz Hiler 542f613456 dinput: Clear action mapping with SetDataFormat().
Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-10 20:44:18 +01:00
Brendan Shanks e9dda86273 dinput: Map Xbox One controller triggers (accelerator/brake) to Rx/Ry on Mac.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-11 22:26:35 +01:00
Brendan Shanks e8332dece8 dinput: On Mac, always use both HID usage page and usage for comparisons.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-11 22:26:35 +01:00
Brendan Shanks 4cec31aaad dinput: Enable Xbox One controller View and Xbox buttons on Mac.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-10 09:14:14 +01:00
Brendan Shanks 46980e799b dinput: Fix Xbox One controller D-pad on Mac.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-10 09:14:10 +01:00
Michael Stefaniuc 64ee238016 dinput/tests: Use wide-char string literals.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-07 11:24:12 +02:00
Rémi Bernon 447bce4117 dinput8: Stop using LL hooks for mouse devices.
LL hooks are heavy and using them cause performance hit with high
polling rate mice. We don't need them anymore since we now use rawinput
API for mouse device.

This also uses a separate list for rawinput mouse devices.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-13 21:17:19 +02:00
Rémi Bernon 81d1c79dcd dinput8: Use rawinput interface for mouse device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-13 21:17:17 +02:00
Rémi Bernon 225be12999 dinput8: Add support for rawinput based devices.
This adds a message window that will be used as the rawinput target
window for WM_INPUT messages.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-13 21:17:15 +02:00
Rémi Bernon 306c40e673 dinput: Use dedicated list for mouse and keyboard.
Instead of using function pointer, which is also not very CPU friendly.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Rémi Bernon 26c1131201 dinput: Use a single list for all acquired devices.
Instead of going through devices list of dinputs list, and checking
their acquired field, which is not CPU friendly.

This also removes the now unused IDirectInputImpl critical section and
devices list.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Rémi Bernon 9463684d55 dinput: Stop sending WM_WINE_NOTIFY_ACTIVITY on every input.
This message triggers screensaver notification in the user drivers, but
it is not useful to send it on every input message, and it even hurts
performance when high polling mouse is used.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=33643
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46976
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Brendan Shanks 1832dc3df3 dinput: Fix IDirectInputEffect::SetParameters() when called with flags=0.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-24 10:15:30 +02:00
Brendan Shanks 23a55927af dinput/tests: Test IDirectInputEffect::SetParameters() with a zeroed DIEFFECT and flags=0.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-24 10:15:28 +02:00
Brendan Shanks cf40880c69 dinput: Fix crash in dump_DIEFFECT() when lpvTypeSpecificParams is unexpectedly NULL.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-24 10:15:26 +02:00
Brendan Shanks f65cfbfe9b dinput: Fix DInput8 keyboard behavior for injected events with scancode=0.
Grand Theft Auto IV injects VK_F8 and scancode=0, and expects DirectInput not
to report that F8 is pressed.

Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-21 22:54:26 +02:00
Brendan Shanks d5fd3c8a38 dinput: Block Acquire() until hooks are installed to prevent input being lost.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-21 22:54:26 +02:00
Brendan Shanks f66517b5a2 dinput: Fix IDirectInputEffect::SetParameters() behavior with NULL effect parameters.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-26 09:23:30 +01:00
Brendan Shanks f00b59f597 dinput/tests: Test IDirectInputEffect::SetParameters() with NULL effect parameters.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-26 09:23:28 +01:00
Brendan Shanks f925becd4a dinput: Fix crash in dump_DIEFFECT() when rglDirection is unexpectedly NULL.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-25 20:58:47 +01:00
Rémi Bernon 50440e28bb dinput: Increase device buffer size to 1024.
The buffer size was previously limited to 20 in:

  8d05256172

Testing shows that it is somewhere around 1024 on Windows, and using a
smaller buffer causes some input data to be lost with high polling rate
mouses. It can be spotted in Wolfenstein II: New Colossus menus.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-17 18:49:59 +01:00
Jacek Caban 3ad95e03b8 makedep: Link importlib object files into module only when it's explicitly imported.
To prevent msvcrt linking its own importlib into DLL.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-23 21:11:29 +01:00
Andrew Eikum b58a6ce7c5 dinput: Add missing ASPECT flags to c_dfDIJoystick.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-21 20:58:01 +01:00
Andrew Eikum e2e100272f dinput: Add missing ASPECT flags for c_dfDIJoystick2.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-21 20:57:56 +01:00
Andrew Eikum af2f419426 dinput: Fix V/A/FSlider dwOfs values in c_dfDIJoystick2.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-21 20:57:52 +01:00
Alistair Leslie-Hughes 8d05256172 dinput: Cap the buffer size to 20.
When a program calls SetProperty with DIPROP_BUFFERSIZE, dinput records
this value for GetProperty but only uses it when the device can support
that number of buffers otherwise a max value.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45732
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-13 19:41:02 +01:00
Bernat Arlandis 5d07cdf54f dinput: Log effect directions, and use effective flags.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-11 21:51:28 +01:00
Alistair Leslie-Hughes d61d710121 dinput: Mouse device doesn't support property DIPROP_VIDPID.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-11 12:48:11 +01:00
Alistair Leslie-Hughes f10f98cfa2 dinput: Keyboard device doesn't support property DIPROP_VIDPID.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-11 12:48:08 +01:00
Alistair Leslie-Hughes 1dfc36c379 dinput: Detect more buttons as non-joysticks.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-22 23:04:27 +02:00
Alistair Leslie-Hughes 61a85a6031 dinput/tests: Remove unrequired pointer checks (Coverity).
Also fixes a few test strings.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-21 17:11:43 +02:00
Alistair Leslie-Hughes db07ff83b3 dinput: Don't treat Stylus devices as joysticks.
Tablet/Stylus devices have a js* entry which we are
treating as a joystick.  Any testbox VM that is configured
with a tablet is currently failing the joystick tests.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-09 16:14:38 +02:00
Alistair Leslie-Hughes 0555209757 dinput/tests: Add checks for Acquire/Unacquire.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-08 10:57:50 +02:00
Rémi Bernon d7916cdf4f dinput/tests: Add test to validate interactions between dinput and raw input devices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-27 21:54:47 +02:00
Brendan Shanks d2d3959d3d dinput: Add "PIDVID" guidProduct and use for non-keyboards/mice.
Windows uses an undocumented GUID (ending in ASCII "PIDVID") for
non-keyboard/mouse devices. Various games (DiRT Rally 2) and libraries
(SDL, GLFW) look for this GUID to match specific devices or know that
the PID/VID can be extracted.

Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-20 21:29:37 +02:00
Brendan Shanks 50785992d0 dinput/tests: Test for correct guidProduct.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-20 21:29:37 +02:00
Alistair Leslie-Hughes 55edfc8837 dinput: Ensure buffer doesn't overflow (Coverity).
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-17 21:34:04 +02:00
Alexey Prokhin 1235ad1932 dinput/tests: Check path format of DIPROP_GUIDANDPATH property.
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-06-10 20:25:40 +02:00
Alexey Prokhin e2465fdb0a dinput/tests: Remove todo from DIPROP_GUIDANDPATH test.
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-06-10 20:25:38 +02:00
Alexey Prokhin f55ce610b2 dinput: Return fake DIPROP_GUIDANDPATH property for OSX joysticks.
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-06-10 20:25:35 +02:00
Alexey Prokhin 2bcdf8b73b dinput: Return fake DIPROP_GUIDANDPATH property for linux input joysticks.
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-06-10 20:25:33 +02:00
Alexey Prokhin 16a11d0c90 dinput: Return fake DIPROP_GUIDANDPATH property for linux joysticks.
Some Ubisoft titles use the property to check if a dinput gamepad is
also an xinput device.

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-06-10 20:25:29 +02:00
Alistair Leslie-Hughes dba4428b6d dinput: Trace reference count in a consistent way.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-10 12:25:25 +02:00
Alistair Leslie-Hughes e29effc633 dinput: Return correct value in IDirectInputDevice2 Release.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-10 12:25:02 +02:00
Aric Stewart c5283300e1 dinput: Handle case where IOHIDDeviceGetValue fails.
This prevents crashes if a controller disconnects from OS/X.

Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-04 23:05:26 +02:00
Tim Schumacher 5d51d8a25e dinput/linuxinput: Remap wheel axes to X, Y, and Z.
Signed-off-by: Tim Schumacher <timschumi@gmx.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-03 22:33:30 +02:00
Tim Schumacher 66462cb7dc dinput: Check for wheel axes/buttons when finding joysticks.
Signed-off-by: Tim Schumacher <timschumi@gmx.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-31 21:31:34 +02:00
Alistair Leslie-Hughes 87a8622ffe dinput/tests: Remove unrequired if (Coverity).
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-27 14:39:34 +02:00
Alistair Leslie-Hughes ab5d9e43cb dinput: Support DIDEVICEINSTANCE_DX3 for keyboard GetDeviceInfo.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-21 18:08:37 +02:00
Alistair Leslie-Hughes c4debff5db dinput: Improve returned flags in Mouse GetObjectInfo.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-17 20:42:22 +02:00
Alexandre Julliard 1d399dba61 dinput/tests: Remove duplicate const.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-14 20:37:34 +02:00
Alexandre Julliard d5a372abbb include: Move inline assembly definitions to a new wine/asm.h header.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-14 13:45:07 +02:00
Alistair Leslie-Hughes 132cf25ed6 dinput: Handle setting DIPROP_CALIBRATIONMODE mode in generic implementation.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47183
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-14 10:29:22 +02:00
Alistair Leslie-Hughes fe4db5309e dinput: Allow enumeration of joysticks with DirectX 3.
Star Wars: Rogue 3D requests a DirectX 3.0 version
0108:trace:dinput:DirectInputCreateEx (0x400000,0300,{9a4cb684-236d-11d3-8e9d-00c04f6844ae},0x7acfa0,(nil))
and then tries to interate over all Joysticks.

When using modern windows, the current tests show that this is the correct behaviour.

However, it's possible to use a shim to allow older games, like the
one above, to interate over joysticks.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-13 13:29:43 +02:00
Alistair Leslie-Hughes 9bcaf9769c dinput: Ensure Cursor is visible on config dialog.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-09 11:39:58 -05:00
Alistair Leslie-Hughes 52deca4900 dinput: Trace This pointer in a consistent way.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-09 11:39:52 -05:00
Andrew Eikum ae84957916 dinput: Use heuristics to guess if a device is a gamepad or a joystick.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47123
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-07 09:21:21 -05:00
Alistair Leslie-Hughes 1daeef7332 dinput: Use a helper function to get device type.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-06 09:15:34 -05:00
Alistair Leslie-Hughes 381fa00b6a dinput: Support DIDEVICEINSTANCE_DX3 for Mouse GetDeviceInfo.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-06 07:13:53 -05:00
Alistair Leslie-Hughes f3259ba66c dinput: Improve EnumDevice tracing.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-06 07:13:53 -05:00
Alistair Leslie-Hughes b59f8c0c50 dinput: Don't report that we cannot open a device.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-06 07:13:53 -05:00
Alistair Leslie-Hughes 9e6afc62b3 dinput: Return E_NOINTERFACE from IDirectInputDevice2 QueryInterface.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-06 07:13:53 -05:00
Alistair Leslie-Hughes a2c10f4dca dinput: Don't return unsupported interfaces.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-03 21:51:08 +02:00
Tim Schumacher 1a6458bad8 dinput: Map wheel, gas, and brake axes as well.
The axes wheel, gas, and brake are just differently named replacements
for X, Y, and Z when using wheel-like joysticks.

Make those accessible by remapping them to X, Y, and Z internally.

Signed-off-by: Tim Schumacher <timschumi@gmx.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-01 11:22:51 +02:00
Alistair Leslie-Hughes b3c5062f36 dinput: Don't report SysMouse/Keyboard devices as supporting Force Feedback.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-26 21:05:08 +02:00
Andrew Eikum 085e58878f dinput: Report controllers as gamepads, not joysticks.
This matches what Windows does with common controllers like xbox 360.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-18 23:37:55 +02:00
Zhiyi Zhang 886d28de97 dinput: Fix a possible deadlock at exit.
This fix another deadlock issue with dinput.

The old implementation of dinput waits for a hook thread to exit
during its uninitialization, which will never return during DLL_THREAD_DETACH.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-11 19:29:41 +02:00
Piotr Caban e7d1107f32 dinput: Don't use strcasecmp.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-08 19:50:40 +02:00
Sebastian Lackner 02f0342833 dinput: Avoid deadlock when CS are acquired in different order.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43356
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-08 09:55:23 +02:00
Sebastian Lackner 890d1b812a dinput: Do not wait for hook thread startup in IDirectInput8::Initialize.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=21403
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-03 09:40:57 +02:00
Alexandre Julliard 6925fb0bb6 dinput: Add error check to silence a compiler warning.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-13 19:45:24 +01:00
Sven Baars cf1b9fe2c7 dinput: Free the device after a callback (Valgrind).
Signed-off-by: Sven Baars <sven.wine@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-01-29 21:39:20 +01:00
Sven Baars 2543295a15 dinput/tests: Fix some memory leaks (Valgrind).
Signed-off-by: Sven Baars <sven.wine@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-01-29 21:38:32 +01:00
Zebediah Figura d507549038 dinput: Use the global module instance handle to load resources.
This fixes a regression introduced by 56345c8757.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46323
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-20 15:34:01 +01:00
Zebediah Figura a8ce68333c dinput: Move the version resource to a separate file.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-20 15:34:01 +01:00
Alexandre Julliard d62ac319d2 dinput/tests: Try harder to avoid spurious keyboard input.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-10 14:58:57 +01:00
Alex Henrie 2ad7ecc6cd dinput: Turn two variables into static constants.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-04 16:13:10 +01:00
Brendan McGrath 3a2834b3a4 dinput: Use the same GUID for Instance and Product.
Signed-off-by: Brendan McGrath <brendan@redmandi.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-31 17:22:36 +01:00
Brendan McGrath c357f3670f dinput/tests: Test that the GUID is the same for Instance and Product.
Signed-off-by: Brendan McGrath <brendan@redmandi.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-31 17:22:33 +01:00
Michael Stefaniuc 6710a0485d dinput: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-15 13:56:16 +02:00
Alistair Leslie-Hughes 56345c8757 dinput8: Share source with dinput.
Based on a patch by Andrew Wesie.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45568
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-21 23:21:52 +02:00
Akihiro Sagawa 966b3b20de dinput: Correct key name mappings on Japanese 106 keyboard.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:03 +02:00
Akihiro Sagawa 6be7d14fb9 dinput: Fix DIK code mappings on Japanese 106 keyboard.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45475
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:03 +02:00
Akihiro Sagawa d88a2086d1 dinput/tests: Add DIK code tests for symbols and punctuations.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:03 +02:00
Akihiro Sagawa 93b0080ba3 dinput/tests: Skip DIK code tests if the keyboard type doesn't match.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:03 +02:00
Akihiro Sagawa b735a42f1c dinput/tests: Peek messages for the target window only.
This fixes "keyboard.c:365: Tests skipped: failed to queue keyboard event"
message on my Win10 PC (real hardware).
Since some thread messages and window messages, including IME related,
are observed on the thread, they sometimes confuse the message handler.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:03 +02:00
Akihiro Sagawa 8001dda117 dinput: Return DIDEVTYPEKEYBOARD_JAPAN106 subtype when it is used.
For the further improvments, subtype is a member of SysKeyboardImpl structure.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:03 +02:00
Akihiro Sagawa 937dcde349 dinput/tests: Add more tests for keyboard subtypes.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:02 +02:00
Akihiro Sagawa 75a2893fca dinput/tests: Use GET_DIDEVICE_SUBTYPE macro in keyboard type tests.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:02 +02:00