Commit Graph

176 Commits

Author SHA1 Message Date
Rémi Bernon 531247b84e 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>
(cherry picked from commit 52aacd2377)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
2021-10-03 20:53:32 +02:00
Rémi Bernon 4dc5606c35 dinput: Wait for the hook thread to exit when stopping it.
FlatOut2 demo calls FreeLibrary on the dinput8 module more times than
it has loaded it, and the module reference that the internal thread has
is getting decremented before its exit.

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

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

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50673
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit b71cea76ed)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
2021-06-30 22:19:32 +02:00
Rémi Bernon 447bce4117 dinput8: Stop using LL hooks for mouse devices.
LL hooks are heavy and using them cause performance hit with high
polling rate mice. We don't need them anymore since we now use rawinput
API for mouse device.

This also uses a separate list for rawinput mouse devices.

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

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

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

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

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Brendan Shanks d5fd3c8a38 dinput: Block Acquire() until hooks are installed to prevent input being lost.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-21 22:54:26 +02:00
Alexey Prokhin 16a11d0c90 dinput: Return fake DIPROP_GUIDANDPATH property for linux joysticks.
Some Ubisoft titles use the property to check if a dinput gamepad is
also an xinput device.

Signed-off-by: Alexey Prokhin <alexey@prokhin.ru>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-10 20:25:29 +02:00
Alistair Leslie-Hughes dba4428b6d dinput: Trace reference count in a consistent way.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-10 12:25:25 +02:00
Alexandre Julliard d5a372abbb include: Move inline assembly definitions to a new wine/asm.h header.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-14 13:45:07 +02:00
Alistair Leslie-Hughes 52deca4900 dinput: Trace This pointer in a consistent way.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-09 11:39:52 -05:00
Alistair Leslie-Hughes f3259ba66c dinput: Improve EnumDevice tracing.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-06 07:13:53 -05:00
Alistair Leslie-Hughes a2c10f4dca dinput: Don't return unsupported interfaces.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-03 21:51:08 +02:00
Zhiyi Zhang 886d28de97 dinput: Fix a possible deadlock at exit.
This fix another deadlock issue with dinput.

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

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-11 19:29:41 +02:00
Sebastian Lackner 02f0342833 dinput: Avoid deadlock when CS are acquired in different order.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43356
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-08 09:55:23 +02:00
Sebastian Lackner 890d1b812a dinput: Do not wait for hook thread startup in IDirectInput8::Initialize.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=21403
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-03 09:40:57 +02:00
Sven Baars cf1b9fe2c7 dinput: Free the device after a callback (Valgrind).
Signed-off-by: Sven Baars <sven.wine@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-01-29 21:39:20 +01:00
Zebediah Figura d507549038 dinput: Use the global module instance handle to load resources.
This fixes a regression introduced by 56345c8757.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46323
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-20 15:34:01 +01:00
Brendan McGrath 3a2834b3a4 dinput: Use the same GUID for Instance and Product.
Signed-off-by: Brendan McGrath <brendan@redmandi.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-31 17:22:36 +01:00
Michael Stefaniuc 6710a0485d dinput: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-15 13:56:16 +02:00
Alistair Leslie-Hughes 56345c8757 dinput8: Share source with dinput.
Based on a patch by Andrew Wesie.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45568
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-21 23:21:52 +02:00
Michael Stefaniuc 870a876773 dinput: Avoid ARRAY_SIZE-like macros.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-07-06 19:44:26 +02:00
Jetro Jormalainen 41b126b5fc dinput: Handle username in EnumDevicesBySemantics.
EnumDevicesBySemantics enums only devices with given username when
DIEDBSFL_THISUSER is set and only unowned devices when
DIEDBSFL_AVAILABLEDEVICES is set.

Signed-off-by: Jetro Jormalainen <jje-wine@jv.jetro.fi>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-03 20:43:39 +01:00
Jetro Jormalainen 967399eba0 dinput: Keep username same between device objects.
Signed-off-by: Jetro Jormalainen <jje-wine@jv.jetro.fi>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-03 20:43:39 +01:00
Sebastian Lackner f9b4be5556 dinput: Allocate correct amount of memory in IDirectInput8AImpl_EnumDevicesBySemantics.
Fixes 04bddb6c93.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-13 18:50:13 +01:00
Jetro Jormalainen 04bddb6c93 dinput: Give correct count of devices still to be enumerated.
EnumDevicesBySemantics should give count of all devices instead of
just keyboard and mouse still to be enumerated when calling callback.

Signed-off-by: Jetro Jormalainen <jje-wine@jv.jetro.fi>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Bruno Jesus <00cpxxx@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-09 19:38:07 +01:00
Sebastian Lackner 2a5f05e316 dinput: Use variable of correct type to store HRESULT value.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-09-13 22:41:03 +09:00
Bruno Jesus 80fca2d86d dinput: Remove trailing space from debug string.
Spotted by Elias Vanderstuyft.

Signed-off-by: Bruno Jesus <00cpxxx@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-09-13 12:47:57 +09:00
Bruno Jesus e3b783174d dinput: Add DirectInput8 device type names to debug.
Signed-off-by: Bruno Jesus <00cpxxx@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-15 12:56:09 +09:00
Thomas Faber 805473dec7 dinput: Implement MSVC version of enum_callback_wrapper.
Signed-off-by: Thomas Faber <thomas.faber@reactos.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-23 23:35:10 +09:00
Andrew Nguyen 6566cd76ce dinput: Allow EnumDevices callback functions with broken calling conventions.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-16 17:21:26 +09:00
Sebastian Lackner bfb845f9fc dinput: Ensure X11 input events are forwarded to wineserver even without message loop.
This commit basically reverts b22ff8018a.

Windows does not do that, but our current implementation of winex11
requires periodic event polling to forward events to the wineserver.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Michael Müller <michael@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-06 01:13:58 +09:00
André Hentschel c440168e53 dinput: Remove unused functions (Clang). 2014-11-25 19:49:40 +01:00
Andrew Eikum 0ba314ebfa dinput: Enumerate devices past the first non-matching device. 2013-05-21 12:08:01 +02:00
Alexandre Julliard d15aee92f2 dinput: Don't bother to delete critical sections at process exit. 2013-05-16 12:53:07 +02:00
Eric Pouech d1ccbceb4d Various background processes must be launched detached from current console (if any). 2013-01-16 14:02:55 +01:00
Christian Costa 6d62cc1212 dinput: Replace FIXMEs by TRACEs in dump function. 2012-10-15 15:25:23 +02:00
Lucas Zawacki e8f808a607 dinput: Semi-stub for IDirectInputJoyConfig8_GetConfig. 2012-08-14 12:01:10 +02:00
Lucas Zawacki 146176cc38 dinput: Correct wrong loop delimiter in diactionformat_priority. 2012-03-26 18:15:04 +02:00
Vitaliy Margolen 7260132c5d dinput: Fix device enumeration by DX8 device type. 2011-12-02 12:15:35 +01:00
Vitaliy Margolen 699da40d1b dinput: Add more error checking to IDirectInput_GetDeviceStatus. 2011-11-29 14:04:25 +01:00
Vitaliy Margolen 310859db67 dinput: Add more parameter checking to enum devices. 2011-11-29 14:04:20 +01:00
Vitaliy Margolen a84d2fe20e dinput: Stub IDirectInputJoyConfig8 interface. 2011-11-29 14:04:01 +01:00
Francois Gouget 4ed24cd5f5 dinput: Delete the static critical section when unloading the dll. 2011-11-16 17:02:39 +01:00
Francois Gouget ca8c1103af dinput: Fix printing NULL strings. 2011-09-19 17:56:05 +02:00
Lucas Fialho Zawacki 0ae4710926 dinput: Added ConfigureDevices dialog. 2011-09-06 12:22:09 +02:00
Lucas Fialho Zawacki 89367ebec0 dinput: Added ConfigureDevices A to W crosscall. 2011-08-26 13:13:36 +02:00
Francois Gouget 19edb43627 dinput: Make _dump_diactionformatA() static. 2011-08-03 14:15:48 +02:00
Alexandre Julliard b56dc9a6f7 winecrt0: Remove the clsid parameter in __wine_(un)register_resources. 2011-08-02 20:47:49 +02:00