Commit graph

254 commits

Author SHA1 Message Date
Rémi Bernon
4885bdda95 dinput: Add a description to the dinput worker thread. 2024-01-18 18:08:48 +01:00
Paul Gofman
546f823ed1 dinput: Unregister raw input on foreground loss. 2023-08-31 11:28:49 +02:00
Rémi Bernon
4151acb4e8 dinput: Unacquire only DISCL_FOREGROUND devices on foreground changes.
Fixes broken input in Final Fantasy XIII after main window focus loss.
2023-07-27 13:12:06 +09:00
Alexandre Julliard
aa9aace5f3 dinput: Use nameless unions/structs. 2023-07-10 21:15:55 +02:00
Rémi Bernon
88a34c74b0 dinput: Delay input thread start until the first device acquire.
Some applications create a IDirectInput and IDirectInputDevice instance
from their DllMain procedure, and starting the thread on the first user
creation and waiting for it to start will deadlock on the loader lock.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54916
2023-05-22 11:10:07 +02:00
Rémi Bernon
e5c540c59b dinput: Hook window threads instead of the entire prefix.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54431
2023-02-16 10:36:47 +01:00
Rémi Bernon
aa7a6b8f42 dinput: Use rawinput interface for keyboard device. 2023-02-15 21:48:33 +01:00
Rémi Bernon
a75e0d0622 dinput: Merge all acquired device lists together.
This is no longer needed as an optimization.
2023-02-15 21:48:33 +01:00
Rémi Bernon
6e0dd0d8b1 dinput: Merge mouse and rawmouse acquired lists. 2023-02-15 21:48:33 +01:00
Rémi Bernon
5c16cda656 dinput: Avoid entering the hook CS in input_thread_ll_hook_proc. 2023-02-15 21:48:33 +01:00
Rémi Bernon
b3aea08c31 dinput: Use a WH_CBT hook instead of WH_CALLWNDPROC.
WH_CALLWNDPROC hooks are called on every message, but we only need it
for the activation messages. WH_CBT hooks are called for a few events
only, which is much lighter, as we need to use a global hook to track
windows which belong to any other thread.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54431
2023-02-14 20:57:09 +01:00
Rémi Bernon
20a835a20b dinput: Name input thread message and wparam values.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54431
2023-02-14 20:57:09 +01:00
Rémi Bernon
7f9fb63aec dinput: Split dinput_unacquire_window_devices helper.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54431
2023-02-14 20:57:09 +01:00
Rémi Bernon
e5eeca3843 dinput: Avoid entering hook CS for rawinput messages. 2023-01-30 20:47:34 +01:00
Rémi Bernon
76a138c996 dinput: Use SendMessageW to notify and stop input thread. 2023-01-30 20:47:34 +01:00
Rémi Bernon
f3952a3e21 dinput: Move di_em_win_wndproc function around. 2023-01-30 20:47:34 +01:00
Rémi Bernon
bf8274edd2 dinput: Move rawinput registration to input_thread_update_device_list. 2023-01-30 20:47:34 +01:00
Rémi Bernon
ca2a44bd76 dinput: Move window hook checks to input_thread_update_device_list. 2023-01-30 20:47:33 +01:00
Rémi Bernon
80d1d08787 dinput: Keep track of input thread users using public refcounts.
And start the input thread when first user is created, then stop it when
last user is destroyed.

The thread will not need to enter the hook critical section on stop, as
no public reference are held and devices are already unacquired.
2023-01-27 13:39:07 +01:00
Rémi Bernon
5119753a33 dinput: Unacquire all devices on internal thread error. 2023-01-27 13:39:06 +01:00
Rémi Bernon
7c88cf0f26 dinput: Introduce new dinput_unacquire_window_devices helper. 2023-01-27 13:39:06 +01:00
Rémi Bernon
0a355d8a54 dinput: Cleanup low-level hooks on input thread exit. 2023-01-27 13:39:06 +01:00
Rémi Bernon
721437b436 dinput: Update the device status while holding its CS. 2023-01-27 13:39:06 +01:00
Rémi Bernon
6122dddf4f dinput: Update the input thread device list when notified only. 2023-01-27 13:39:06 +01:00
Rémi Bernon
d58055dd7d dinput: Keep a reference on acquired devices while waiting. 2023-01-26 22:05:13 +01:00
Rémi Bernon
27e89c5c32 dinput: Introduce new input_thread_update_device_list helper. 2023-01-26 22:05:13 +01:00
Rémi Bernon
35e4a577f0 dinput: Introduce a new struct to keep input thread state. 2023-01-26 22:05:13 +01:00
Rémi Bernon
1b7750e448 dinput: Move dinput class implementation to dinput.c. 2023-01-25 18:31:03 +01:00
Rémi Bernon
070e1f5ea8 dinput: Remove unnecessary initialization helpers. 2023-01-25 18:31:03 +01:00
Rémi Bernon
1b3fab9bd4 dinput: Remove outdated and superfluous comments. 2023-01-25 18:31:03 +01:00
Alex Henrie
e72a16b57f uuid: Add devguid.h.
Needed to compile Tera Term.
2022-10-19 21:17:34 +02:00
Zebediah Figura
dd5f3b6fc1 dinput: Rename dinput_device_init() to dinput_device_init_device_format().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-16 22:10:15 +02:00
Zebediah Figura
cc5178fe73 dinput: Factor out the dinput_device_init() call into dinput7_CreateDeviceEx().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-16 22:10:15 +02:00
Rémi Bernon
78ecbc4b2d dinput: Do not delete static critical section.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-06 21:36:38 +02: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
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
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
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
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
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