Commit Graph

872 Commits

Author SHA1 Message Date
Aric Stewart c5283300e1 dinput: Handle case where IOHIDDeviceGetValue fails.
This prevents crashes if a controller disconnects from OS/X.

Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-04 23:05:26 +02:00
Tim Schumacher 5d51d8a25e dinput/linuxinput: Remap wheel axes to X, Y, and Z.
Signed-off-by: Tim Schumacher <timschumi@gmx.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-03 22:33:30 +02:00
Tim Schumacher 66462cb7dc dinput: Check for wheel axes/buttons when finding joysticks.
Signed-off-by: Tim Schumacher <timschumi@gmx.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-31 21:31:34 +02:00
Alistair Leslie-Hughes 87a8622ffe dinput/tests: Remove unrequired if (Coverity).
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-27 14:39:34 +02:00
Alistair Leslie-Hughes ab5d9e43cb dinput: Support DIDEVICEINSTANCE_DX3 for keyboard GetDeviceInfo.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-21 18:08:37 +02:00
Alistair Leslie-Hughes c4debff5db dinput: Improve returned flags in Mouse GetObjectInfo.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-17 20:42:22 +02:00
Alexandre Julliard 1d399dba61 dinput/tests: Remove duplicate const.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-14 20:37:34 +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 132cf25ed6 dinput: Handle setting DIPROP_CALIBRATIONMODE mode in generic implementation.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47183
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-14 10:29:22 +02:00
Alistair Leslie-Hughes fe4db5309e dinput: Allow enumeration of joysticks with DirectX 3.
Star Wars: Rogue 3D requests a DirectX 3.0 version
0108:trace:dinput:DirectInputCreateEx (0x400000,0300,{9a4cb684-236d-11d3-8e9d-00c04f6844ae},0x7acfa0,(nil))
and then tries to interate over all Joysticks.

When using modern windows, the current tests show that this is the correct behaviour.

However, it's possible to use a shim to allow older games, like the
one above, to interate over joysticks.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-13 13:29:43 +02:00
Alistair Leslie-Hughes 9bcaf9769c dinput: Ensure Cursor is visible on config dialog.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-09 11:39:58 -05: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
Andrew Eikum ae84957916 dinput: Use heuristics to guess if a device is a gamepad or a joystick.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47123
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-07 09:21:21 -05:00
Alistair Leslie-Hughes 1daeef7332 dinput: Use a helper function to get device type.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-06 09:15:34 -05:00
Alistair Leslie-Hughes 381fa00b6a dinput: Support DIDEVICEINSTANCE_DX3 for Mouse GetDeviceInfo.
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 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 b59f8c0c50 dinput: Don't report that we cannot open a device.
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 9e6afc62b3 dinput: Return E_NOINTERFACE from IDirectInputDevice2 QueryInterface.
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
Tim Schumacher 1a6458bad8 dinput: Map wheel, gas, and brake axes as well.
The axes wheel, gas, and brake are just differently named replacements
for X, Y, and Z when using wheel-like joysticks.

Make those accessible by remapping them to X, Y, and Z internally.

Signed-off-by: Tim Schumacher <timschumi@gmx.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-01 11:22:51 +02:00
Alistair Leslie-Hughes b3c5062f36 dinput: Don't report SysMouse/Keyboard devices as supporting Force Feedback.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-26 21:05:08 +02:00
Andrew Eikum 085e58878f dinput: Report controllers as gamepads, not joysticks.
This matches what Windows does with common controllers like xbox 360.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-18 23:37:55 +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
Piotr Caban e7d1107f32 dinput: Don't use strcasecmp.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-08 19:50:40 +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
Alexandre Julliard 6925fb0bb6 dinput: Add error check to silence a compiler warning.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-13 19:45:24 +01: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
Sven Baars 2543295a15 dinput/tests: Fix some memory leaks (Valgrind).
Signed-off-by: Sven Baars <sven.wine@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-01-29 21:38:32 +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
Zebediah Figura a8ce68333c dinput: Move the version resource to a separate file.
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
Alexandre Julliard d62ac319d2 dinput/tests: Try harder to avoid spurious keyboard input.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-10 14:58:57 +01:00
Alex Henrie 2ad7ecc6cd dinput: Turn two variables into static constants.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-04 16:13:10 +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
Brendan McGrath c357f3670f dinput/tests: Test that the GUID is the same 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:33 +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
Akihiro Sagawa 966b3b20de dinput: Correct key name mappings on Japanese 106 keyboard.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:03 +02:00
Akihiro Sagawa 6be7d14fb9 dinput: Fix DIK code mappings on Japanese 106 keyboard.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45475
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:03 +02:00
Akihiro Sagawa d88a2086d1 dinput/tests: Add DIK code tests for symbols and punctuations.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:03 +02:00
Akihiro Sagawa 93b0080ba3 dinput/tests: Skip DIK code tests if the keyboard type doesn't match.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:03 +02:00
Akihiro Sagawa b735a42f1c dinput/tests: Peek messages for the target window only.
This fixes "keyboard.c:365: Tests skipped: failed to queue keyboard event"
message on my Win10 PC (real hardware).
Since some thread messages and window messages, including IME related,
are observed on the thread, they sometimes confuse the message handler.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:03 +02:00
Akihiro Sagawa 8001dda117 dinput: Return DIDEVTYPEKEYBOARD_JAPAN106 subtype when it is used.
For the further improvments, subtype is a member of SysKeyboardImpl structure.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:03 +02:00
Akihiro Sagawa 937dcde349 dinput/tests: Add more tests for keyboard subtypes.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:02 +02:00
Akihiro Sagawa 75a2893fca dinput/tests: Use GET_DIDEVICE_SUBTYPE macro in keyboard type tests.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-17 16:51:02 +02:00
Andrew Eikum 565c2dcf2a dinput: Fix mac build.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-15 20:55:10 +02:00
Józef Kucia 4b90a46e36 dinput/tests: Use GetModuleHandleA() instead of LoadLibraryA() (Coverity).
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-15 20:55:10 +02:00
Andrew Eikum 27ffb662ce dinput: Use vid/pid for first chunk of product guid on OSX, too.
This is already done on the linux backends.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-14 13:55:55 +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
Zebediah Figura 3edbb2a4fd dinput: Notify the desktop window when device input is received.
Avoids letting the display go to sleep while a joystick is being used.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-07-03 20:26:12 +02:00