Commit Graph

238 Commits

Author SHA1 Message Date
Rémi Bernon ea60e4678c dinput: Return DIERR_INPUTLOST when device is removed.
This fixes hotplug with DS4 and other DInput-compatible controllers in
Tekken 7.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-24 21:44:51 +01:00
Rémi Bernon 3039fd6d5c dinput: Use an enumeration instead of BOOL for acquired status.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-24 21:44:51 +01:00
Rémi Bernon fd46a5aac3 dinput: Introduce new is_exclusively_acquired helper.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-24 21:44:51 +01:00
Rémi Bernon 5499ba3929 dinput: Allow 0xff as a DIDFT_ANYINSTANCE alias with old dinput version.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52267
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-04 11:51:46 +01:00
Rémi Bernon c69c9b55d7 dinput: Return DIERR_UNSUPPORTED for properties with old dinput version.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-04 11:51:41 +01:00
Rémi Bernon 4604b11c25 dinput: Fully implement GetForceFeedbackState / GetEffectStatus.
Using the PID effect state reports.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52062
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-02 20:20:39 +01:00
Rémi Bernon 550511855b dinput: Improve GetForceFeedbackState / GetEffectStatus stubs.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52062
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-01 18:13:54 +01:00
Rémi Bernon 5abf6efcd9 dinput: Stub IDirectInputDevice8_GetForceFeedbackState implementation.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52062
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-24 18:49:03 +01:00
Rémi Bernon 3b2f7433db dinput: Stub support for DIPROP_FFLOAD device property.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52062
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-24 18:49:01 +01:00
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
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 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
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 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 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 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 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 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 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 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
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 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