Commit Graph

1266 Commits

Author SHA1 Message Date
Rémi Bernon 61db4aa66d dinput: Use DIEFT_GETTYPE instead masking bits.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-16 22:05:34 +01:00
Rémi Bernon a3b0cb74cd dinput: Ignore override flag for non-XInput devices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-16 22:05:34 +01:00
Rémi Bernon cd6bab2b2a dinput: Set HID joystick internal ref before trying to open it.
So that an open failure will not decrement it to -1.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-16 22:05:34 +01:00
Francois Gouget 57d342afe5 dinput/tests: Remove an unneeded NULL cast.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-14 21:20:42 +01:00
Francois Gouget c76b617119 dinput/tests: Remove spaces before linefeeds.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-14 21:20:42 +01:00
Rémi Bernon 19a5881b0b dinput/tests: Fix printf warnings with long types.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-08 11:26:48 +01:00
Rémi Bernon 9f472f00d8 dinput: Fix printf warnings with long types.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-08 10:58:55 +01:00
Rémi Bernon be6d33824a dinput: Canonicalize DirectInput(8) instance creation.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-08 10:49:03 +01:00
Rémi Bernon 1591021f53 dinput: Use consistent parameter names and types.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-08 10:48:58 +01:00
Rémi Bernon f0935f850c dinput: Rename IDirectInputImpl to struct dinput.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-08 10:48:54 +01:00
Rémi Bernon 73ba9d3459 dinput: Cleanup IDirectInput8W names and traces.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-07 11:02:31 +01:00
Rémi Bernon d33103bf05 dinput: Cleanup IDirectInput7W names and traces.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-07 11:02:29 +01:00
Rémi Bernon 44f7ccfcd1 dinput: Cleanup IDirectInputJoyConfig8 names and traces.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-07 11:02:27 +01:00
Rémi Bernon ac7ff2611d dinput: Cleanup DllGetClassObject and IClassFactory implementation.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-07 11:02:25 +01:00
Rémi Bernon 2266356542 dinput/tests: Add some CoCreateInstance and aggregation tests.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-07 11:02:22 +01:00
Rémi Bernon 0c3686f549 dinput/tests: Merge dinput8.c tests with dinput.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-07 11:02:20 +01:00
Rémi Bernon c489356d0b ntoskrnl.exe: Enforce path case in WM_DEVICECHANGE notifications.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-28 21:10:21 +01:00
Rémi Bernon 439d126a99 sechost: Support device interface notifications filtering.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-28 21:10:21 +01:00
Rémi Bernon 41ff8effa3 user32: Add a filter member to device_notification_details.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-28 21:10:21 +01:00
Alexandre Julliard f0cd33c69e include: Add support for defining Win32 types as 'long' where possible.
Add -DWINE_NO_LONG_TYPES to modules that still have compilation
warnings with long types.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-27 20:38:22 +01:00
Rémi Bernon 22f9f5caea dinput/tests: Add some RegisterDeviceNotificationA and hotplug tests.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-27 18:02:43 +01:00
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 c232fce6ea dinput/tests: Add some tests for DIERR_INPUTLOST conditions.
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 b5f92fe75a dinput/tests: Load the test driver in the WinePlugPlay group.
So that it shares hidclass.sys with other device drivers. This won't
make all the tests to pass if there's some physical devices, but it'll
avoid a few spurious failures.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-20 16:57:17 +01:00
Arkadiusz Hiler feea75c64b dinput: Implement HID wheel type detection.
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>
2022-01-20 16:57:17 +01:00
Arkadiusz Hiler 389ecae089 dinput/tests: Test HID device with steering wheel and various pedal combinations.
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>
2022-01-20 16:57:16 +01:00
Arkadiusz Hiler 2420f7e188 dinput/tests: Add static asserts for arrays that have to match in size.
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>
2022-01-19 16:19:07 +01:00
Arkadiusz Hiler d397f76338 dinput/tests: Don't consider extra IOCTL_HID_GET_STRING an error.
It's easy to get them on Windows depending what software/services are
running.

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>
2022-01-19 16:19:07 +01:00
Rémi Bernon 3ad4f9f356 dinput: Reset button state for each report read.
As we loop on ReadFile success we may read multiple reports at once, but
we never reset buttons in the enumeration params. The pressed buttons
are returned by HidP_GetUsagesEx and any other button must be cleared.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52387
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-13 17:04:50 +01:00
Rémi Bernon 9479e217b8 hidclass.sys: Always read InputReportByteLength bytes when not polling.
This fixes several games (e.g. ICEY) not working well with DS4 gamepad
over bluetooth, as we fixup the input report sizes, and the game expects
them to be longer.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-12 17:27:54 +01:00
Rémi Bernon 352cfbcf1b dinput/tests: Check that InputReportByteLength bytes are read.
Regardless of how long the driver packet is.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-12 17:27:40 +01:00
Rémi Bernon 7e5eeecdfb dinput: Wait for the internal thread with a timeout.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52263
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-06 11:34:58 +01:00
Rémi Bernon 85148f9ee0 dinput: Return HID class guid in DIPROP_GUIDANDPATH property.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-04 11:51:49 +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 bef9b8a2bf dinput/tests: Test simple joystick with older dinput versions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-04 11:51:28 +01:00
Rémi Bernon 6ac7d042f7 dinput/tests: Remove verbose and redundant tests.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-03 16:46:02 +01:00
Rémi Bernon 4c4dedb941 dinput/tests: Split joystick tests into separate sources.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-03 16:46:02 +01:00
Rémi Bernon d22746fe09 dinput/tests: Move tests from dinput8/tests.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-03 16:46:02 +01:00
Rémi Bernon ea93f283b5 dinput: Return DIERR_INVALIDPARAM instead of DIERR_INPUTLOST from Acquire.
MSDN states that the function can only return one of DIERR_INVALIDPARAM,
DIERR_NOTINITIALIZED, DIERR_OTHERAPPHASPRIO, on error, and DI_OK, or
DI_NOEFFECT, on success.

Some games will try to call Acquire again in a tight loop and block the
main thread if DIERR_INPUTLOST is returned. There's a small chance for
this to happen with Resident Evil 2, whenever a joystick is plugged,
then quickly unplugged.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-22 18:57:44 +01:00
Rémi Bernon ac442a78a1 dinput: Update internal thread events list on every wake up.
Instead of message notifications only. We have to remove the events from
devices that are automatically unacquired whenever a read failed.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-22 18:57:42 +01:00
Rémi Bernon 531297a8b4 dinput: Ignore objects without a collection in init_pid_caps.
This makes sure we don't try to set effect_state report id from objects
without a collection, causing some false warnings.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-20 17:52:37 +01:00
Rémi Bernon e5131028b9 dinput: Convert wide action format back to ansi in ConfigureDevices.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52198
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-20 17:52:33 +01:00
Rémi Bernon a37346c6bb dinput: Ignore NULL callback in IDirectInput_ConfigureDevices.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52198
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-20 17:52:29 +01:00
Rémi Bernon dd1f3434d6 dinput: Keep action names when converting back to ansi.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52198
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-20 17:52:16 +01:00
Rémi Bernon b67cda8975 dinput: Simplify the internal thread and don't require loader lock.
When thread shuts down, instead of holding and releasing a module ref.

This keeps the thread alive until the module is unloaded, instead of
keeping track of live IDirectInput instances.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Rémi Bernon d0fc7c96f3 dinput: Factor all type specific parameter handling together.
The internal params cbTypeSpecificParams is assigned in SetParameters
after validation, and contains the expected buffer size.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-03 16:56:08 +01:00
Ivo Ivanov 5ce61fc04f dinput: Check cbTypeSpecificParams before lpvTypeSpecificParams.
And return DIERR_MOREDATA the provided buffer is too short.

Fixes the WheelCheck application not showing type specific params
for Constant and Periodic effects.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-03 16:56:08 +01:00
Rémi Bernon 812a975167 dinput: Set internal params lpvTypeSpecificParams in Initialize.
And lpEnvelope in SetParameters.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-03 16:56:08 +01:00
Ivo Ivanov 10d0fbec4b dinput: Fix incorrect use of constant_force instead of ramp_force.
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-12-03 16:56:08 +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 f6fa99bd4e dinput: Look for the PID effect state input report.
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 8feeb883e1 dinput8/tests: Add more effect direction tests.
Making sure we are actually writing the correctly values to PID reports,
regardless of user provided coordinate space.

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
Ivo Ivanov 99ddfc8496 dinput: Send Device Gain Reports only on DISFFC_RESET command.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52062
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-12-01 18:13:54 +01:00
Rémi Bernon 2ca15c8dc8 dinput: Stub HID joystick GetEffectStatus 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:05 +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 13aea4844a dinput: Mark effect parameters as modified when duration is set.
Even if it doesn't actually change.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52061
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Ivo Ivanov 0059dc2567 dinput: Send only the reports that have been modified.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52061
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Rémi Bernon a95f76094e dinput: Send -1 for infinite durations in HID reports.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52061
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Ivo Ivanov 02951f12a4 dinput: Support creating effects using device managed reports.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-19 18:31:39 +01:00
Ivo Ivanov b510558cb6 dinput: Write PID_USAGE_PARAMETER_BLOCK_OFFSET in the set condition report.
Required by the PID spec for devices with device managed blocks.

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-19 18:31:38 +01:00
Ivo Ivanov 21171bec31 dinput: Look for the device managed effect creation reports.
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-19 18:31:38 +01:00
Ivo Ivanov ddd143b0e9 dinput: Fix single-axis effects direction values.
What the tests show is actually that the direction should be set only
if the corresponding axis is in the axis list.

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-19 18:31:38 +01:00
Ivo Ivanov b8931fdce2 dinput: Introduce a new set_parameter_value_angle helper.
To correctly scale angle values and warn about unexpected units.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-19 18:31:38 +01:00
Rémi Bernon ef5fa6c716 dinput: Only scale parameter value if its physical range is defined.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-19 18:31:38 +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
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