Commit Graph

1297 Commits

Author SHA1 Message Date
Ivo Ivanov b793fb5457 dinput: Add support for DIPROP_(PHYSICAL|LOGICAL)RANGE properties.
Fixes apps like WheelCheck, which rely on some of these properties
(DIPROP_PHYSICALRANGE) to correctly calculate the top center of the
wheel against their permitted range.

In particular the constant force test now works just like in Windows,
directing the wheel to the upper center and resisting any movement to
the left or right. Before that it would pull the steering wheel hard to
the left.

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-11-18 11:12:00 +01:00
Rémi Bernon e8d961b5c7 dinput: Stub support for the DIPROP_CALIBRATIONMODE property.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 11:11:57 +01:00
Rémi Bernon 0c9cac9547 dinput: Move GetProperty implementation for objects to generic device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 11:11:55 +01:00
Rémi Bernon 3834eaf9bd dinput: Move SetProperty implementation to the generic device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 11:11:52 +01:00
Rémi Bernon 801bc147f0 dinput: Factor (Get|Set)Property checks together.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 11:11:50 +01:00
Rémi Bernon 99783e8c8b dinput: Guard (Get|Set)Property logic within the device CS.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 11:11:47 +01:00
Rémi Bernon c918234f71 dinput: Reset axis and pov values on object property change.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 11:11:45 +01:00
Rémi Bernon 1ae1744cb2 dinput: Move HID joystick extra caps to struct dinput_device.
As object properties.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 11:11:42 +01:00
Rémi Bernon 45986545f8 dinput: Write PID device gain reports when necessary.
Based on a patch from Ivo Ivanov <logos128@gmail.com>.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 15:26:09 +01:00
Ivo Ivanov 9dc873ab99 dinput: Move set_parameter_value helper around.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 15:26:03 +01:00
Rémi Bernon 9dafac9eca dinput: Look for the PID device gain output report.
Based on a patch from Ivo Ivanov <logos128@gmail.com>.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 15:25:55 +01:00
Rémi Bernon e7217a3287 dinput: Stub support for the DIPROP_FFGAIN property.
Based on a patch from Ivo Ivanov <logos128@gmail.com>.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 15:25:33 +01:00
Rémi Bernon 3f110402f6 dinput8/tests: Add some HID device gain report tests.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 15:25:29 +01:00
Rémi Bernon 2608a5caa6 dinput: Handle device types and flags directly in EnumDevices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-16 10:09:07 +01:00
Rémi Bernon fb4c45c5da dinput: Implement EnumDevicesBySemantics with EnumDevices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-16 10:09:04 +01:00
Rémi Bernon 5d988edfc6 dinput: Implement IDirectInputJoyConfig8_GetConfig with EnumDevices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-16 10:09:00 +01:00
Rémi Bernon 28364159b8 dinput: Implement IDirectInput_EnumDevices with IDirectInput8_EnumDevices.
Instead of the other way around.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-16 10:08:54 +01:00
Rémi Bernon e6eb909d21 dinput: Stub support for DIPROP_AUTOCENTER property.
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-11-16 10:08:44 +01:00
Rémi Bernon 23194bb047 dinput: Implement HID joystick object names from their usages.
Fixes some issues with apps like WheelCheck from iRacing, which show
detailed info about available objects on the device (such as axes,
buttons, other non-data caps, collections, etc.).

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-16 10:08:40 +01:00
Ivo Ivanov 34b0b4accb dinput: Return DI_OK when HID joystick CreateEffect succeeds.
SetParameters returns DI_DOWNLOADSKIPPED if the device is not acquired
exclusively.

This fixes Assetto Corsa Competizione and Assetto Corsa not having FFB
due to calling CreateEffect before acquiring the device, which skips the
effect download and returns DI_DOWNLOADSKIPPED.

In particular, ACC tries twice to create the effect, and each time they
unacquire the device to turn off the autocenter, and then create the
effect while still in unacquired state, which in turn returns
DI_DOWNLOADSKIPPED, etc.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51922
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 19:54:17 +01:00
Ivo Ivanov ee8015b97a dinput: Return DI_DOWNLOADSKIPPED from SetParameters.
When Download or Start failed because device is not acquired.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51922
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 19:54:17 +01:00
Ivo Ivanov 16bc6b053d dinput: Pass buffer byte length to HidD_GetProductString.
Instead of then number of WCHAR.

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-11-12 22:42:51 +01:00
Rémi Bernon 6501968dd8 dinput: Use a specific buffer for set envelope output report.
Instead of a generic type_specific_buf[1], and factor code for all
effects that use an envelope.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-12 22:42:51 +01:00
Ivo Ivanov 576bf9239f dinput: Set effect block index in the second type specific report.
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-11-12 22:42:51 +01:00
Rémi Bernon ab4bed6775 dinput: Support up to 6 effect conditions.
As we support up to 6 force feedback axes and directions, the number of
condition should match.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-12 22:42:51 +01:00
Ivo Ivanov f486811d5a dinput: Remove redundant check for DIEP_DIRECTION.
It is implied from the complete_mask check above.

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-11-12 22:42:51 +01:00
Ivo Ivanov fbd7356232 dinput: Fix HID joystick set_ramp_force end_caps lookup.
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-11-12 22:42:51 +01:00
Ivo Ivanov eb2e52a9d5 dinput: Always return a valid string from effect_guid_to_string.
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-11-12 22:42:51 +01:00
Ivo Ivanov f2e3de0099 dinput: Remove some extremely verbose traces, and fix typos.
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-11-12 22:42:51 +01:00
Ivo Ivanov 99fc12f9a3 dinput: Unacquire device when last public reference is released.
Avoid crashing in dinput_device_destroy, calling Unacquire while device
resources may be already freed up.

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-11-12 22:42:51 +01:00
Ivo Ivanov dbb735efd1 dinput: Stop calling SendForceFeedbackCommand on device destroy.
It is only relevant for FFB devices, and is already being called by
hid_joystick_unacquire().

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-11-12 22:42:51 +01:00
Rémi Bernon 90ebe524da dinput: Only call internal poll callback when device is acquired.
Fixes a regression from 53fcfe3834.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52022
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51956
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-12 22:42:51 +01:00
Rémi Bernon 0697d1caf1 dinput: Fix DIEFF_CARTESIAN to DIEFF_SPHERICAL conversion.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-10 20:12:52 +01:00
Rémi Bernon bd6d258e33 dinput: Only convert DIEFFECT directions to spherical when needed.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-10 20:12:50 +01:00
Rémi Bernon 4289bae3b4 dinput: Check for DIEFF_POLAR axes count before capacity.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51922
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-10 20:12:47 +01:00
Rémi Bernon bc2ba90bd8 dinput: Allow DIEFF_CARTESIAN directions when cAxes matches.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51922
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-10 20:12:45 +01:00
Rémi Bernon f183f8f946 dinput: Improve object dwOfs values for dinput version <= 0x700.
It's not completely correct yet as dinput version 0x500 and probably
below enumerate objects following the default data format instead of
a device specific one.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:55 +01:00
Rémi Bernon ec3ffba786 dinput: Fix HID joystick GetEffectInfo / GetCapabilities flags.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:55 +01:00
Rémi Bernon 67d38c6991 dinput: Support both DIEFFECT_DX5 and DIEFFECT_DX6 parameters.
Star Wars Episode I Racer force-feedback doesn't work otherwise as it
passes a DIEFFECT_DX5 struct to SetParameters.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 10:28:34 +01:00
Rémi Bernon 869a0ddaca dinput: Check for DIEFFECT_DX6 size when DIEP_STARTDELAY is set.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 10:28:32 +01:00
Rémi Bernon e04cfc0b0a dinput: Pretend that DIPROP_AUTOCENTER is supported.
Star Wars Episode I Racer will ignore force-feedback joystick devices if
we return an error here.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 10:28:30 +01:00
Rémi Bernon 62f5bbf3ed dinput: Enumerate HID joystick with dinput <= 7 and device type 0.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51953
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 10:28:21 +01:00
Rémi Bernon 53fcfe3834 dinput: Always call the device internal poll callback.
We normally should not peek messages here, but because of current
winex11.drv design, we have to call MsgWaitForMultipleObjectsEx from
time to time to pull keyboard or mouse events.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51956
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 10:28:17 +01:00
Rémi Bernon f0cd5c5c3c dinput: Move device data format to struct dinput_device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-29 12:29:58 +02:00
Rémi Bernon 4e56801abd dinput: Rewrite and simplify user data format object matching.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-29 12:29:54 +02:00
Rémi Bernon 621af39c11 dinput: Use user object data format array to keep user offsets.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-29 12:29:49 +02:00
Rémi Bernon f82cce060d dinput: Always use the data format transform.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 13:03:57 +02:00
Rémi Bernon 998b9d8666 dinput: Implement SetProperty DIPROP_APPDATA using enum_objects.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 13:03:54 +02:00
Rémi Bernon 8847de46ec dinput: Move user data format to struct dinput_device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 13:03:51 +02:00
Rémi Bernon 6934e139d1 dinput: Reduce data format trace verbosity.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 13:03:42 +02:00
Rémi Bernon b7e2388491 dinput: Rename SysMouseImpl to struct mouse.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:49 +02:00
Rémi Bernon 80f4cce671 dinput: Rename SysKeyboardImpl to struct keyboard.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:49 +02:00
Rémi Bernon dac2e0b187 dinput: Rename IDirectInputDeviceImpl to struct dinput_device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:49 +02:00
Rémi Bernon 69c9631081 dinput: Trace device entry points calls consistently.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:49 +02:00
Rémi Bernon bbff12381e dinput: Call hid_joystick_enum_device directly in JoyConfig8Impl_GetConfig.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Rémi Bernon 5726c77faa dinput: Call hid_joystick_enum_device directly in EnumDevicesBySemantics.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Rémi Bernon a83e6db353 dinput: Call *_create_device directly in IDirectInput7WImpl_CreateDeviceEx.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Rémi Bernon 8932f53947 dinput: Canonicalize code style of IDirectInput7WImpl_CreateDeviceEx.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Rémi Bernon 591be9d456 dinput: Call *_enum_device directly in IDirectInputWImpl_EnumDevices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Rémi Bernon 8c257d0ca8 dinput: Canonicalize code style of IDirectInputWImpl_EnumDevices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Rémi Bernon b242273482 dinput: Factor all IDirectInputDevice8W vtables together.
And remove "internal" suffix from internal functions.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-22 10:18:30 +02:00
Rémi Bernon e85a530277 dinput: Cleanup keyboard device enumeration and creation.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-22 10:18:28 +02:00
Rémi Bernon 3dcb888a59 dinput: Cleanup mouse device enumeration and creation.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-22 10:18:26 +02:00
Rémi Bernon 7c67ebfd56 dinput: Set high DIK bit for extended scancodes.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51910
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-21 20:32:43 +02:00
Rémi Bernon df08662f84 dinput: Move EnumCreatedEffectObjects checks to device.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-21 11:21:35 +02:00
Rémi Bernon 45d4c253de dinput: Move SendForceFeedbackCommand generic code to device.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-21 11:21:32 +02:00
Rémi Bernon 7c4e91f63b dinput: Move CreateEffect generic implementation to device.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-21 11:21:29 +02:00
Rémi Bernon 4ddd257f06 dinput: Move GetForceFeedbackState stub to device.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-21 11:21:24 +02:00
Rémi Bernon f54210590f dinput: Use the internal vtable for GetEffectInfo.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-21 11:21:21 +02:00
Rémi Bernon 713d71c187 dinput: Replace stub EnumEffects with generic implementation.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-21 11:21:16 +02:00
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