Added dinput-wheel-support patchset

This commit is contained in:
Alistair Leslie-Hughes 2019-04-11 11:43:11 +10:00
parent 72a13348de
commit d0190e3ade
4 changed files with 110 additions and 0 deletions

View File

@ -0,0 +1,51 @@
From a82c1a7a7342200b8112dc4176ad5adf557787c0 Mon Sep 17 00:00:00 2001
From: Tim Schumacher <timschumi@gmx.de>
Date: Sun, 31 Mar 2019 13:02:27 +0200
Subject: [PATCH 1/2] winejoystick: Add support for wheel axes
Wheel, gas, and brake are replacements for X, Y and Z in wheel-like
joysticks. Remap them internally to send inputs as X, Y, and Z.
Signed-off-by: Tim Schumacher <timschumi@gmx.de>
---
dlls/winejoystick.drv/joystick_linux.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/winejoystick.drv/joystick_linux.c b/dlls/winejoystick.drv/joystick_linux.c
index 287f4be..7c24040 100644
--- a/dlls/winejoystick.drv/joystick_linux.c
+++ b/dlls/winejoystick.drv/joystick_linux.c
@@ -280,10 +280,13 @@ static const WCHAR ini[] = {'W','i','n','e',' ','J','o','y','s','t','i','c','k',
switch (jstck->axesMap[i]) {
case 0: /* X */
case 1: /* Y */
+ case 8: /* Wheel */
+ case 9: /* Gas */
lpCaps->wNumAxes++;
break;
case 2: /* Z */
case 6: /* Throttle */
+ case 10: /* Brake */
lpCaps->wNumAxes++;
lpCaps->wCaps |= JOYCAPS_HASZ;
break;
@@ -365,13 +368,16 @@ LRESULT driver_joyGetPosEx(DWORD_PTR dwDevID, LPJOYINFOEX lpInfo)
if (ev.type == (JS_EVENT_AXIS)) {
switch (jstck->axesMap[ev.number]) {
case 0: /* X */
+ case 8: /* Wheel */
jstck->x = ev.value;
break;
case 1: /* Y */
+ case 9: /* Gas */
jstck->y = ev.value;
break;
case 2: /* Z */
case 6: /* Throttle */
+ case 10: /* Brake */
jstck->z = ev.value;
break;
case 5: /* Rz */
--
1.9.1

View File

@ -0,0 +1,37 @@
From dddcfcb92fb61c70738378b29db0ede050bcf162 Mon Sep 17 00:00:00 2001
From: Tim Schumacher <timschumi@gmx.de>
Date: Sun, 31 Mar 2019 13:09:43 +0200
Subject: [PATCH 2/2] 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>
---
dlls/dinput/joystick_linux.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c
index 963e62f..c4efc93 100644
--- a/dlls/dinput/joystick_linux.c
+++ b/dlls/dinput/joystick_linux.c
@@ -239,6 +239,14 @@ static INT find_joystick_devices(void)
joydev.dev_axes_map[j] = j;
found_axes++;
}
+ else if (axes_map[j] <= 10)
+ {
+ /* Axes 8 through 10 are Wheel, Gas and Brake,
+ * remap to 0, 1 and 2
+ */
+ joydev.dev_axes_map[j] = axes_map[j] - 8;
+ found_axes++;
+ }
else if (axes_map[j] == 16 ||
axes_map[j] == 17)
{
--
1.9.1

View File

@ -0,0 +1 @@
Fixes: [46989] dinput: Wheel (Wheel, Gas, Brake) axes inputs aren't recognized

View File

@ -133,6 +133,7 @@ patch_enable_all ()
enable_dinput_axis_recalc="$1"
enable_dinput_reconnect_joystick="$1"
enable_dinput_remap_joystick="$1"
enable_dinput_wheel_support="$1"
enable_dsound_EAX="$1"
enable_dsound_Fast_Mixer="$1"
enable_dwmapi_DwmGetTransportAttributes="$1"
@ -539,6 +540,9 @@ patch_enable ()
dinput-remap-joystick)
enable_dinput_remap_joystick="$2"
;;
dinput-wheel-support)
enable_dinput_wheel_support="$2"
;;
dsound-EAX)
enable_dsound_EAX="$2"
;;
@ -3224,6 +3228,23 @@ if test "$enable_dinput_remap_joystick" -eq 1; then
) >> "$patchlist"
fi
# Patchset dinput-wheel-support
# |
# | This patchset fixes the following Wine bugs:
# | * [#46989] dinput: Wheel (Wheel, Gas, Brake) axes inputs aren't recognized
# |
# | Modified files:
# | * dlls/dinput/joystick_linux.c, dlls/winejoystick.drv/joystick_linux.c
# |
if test "$enable_dinput_wheel_support" -eq 1; then
patch_apply dinput-wheel-support/0001-winejoystick-Add-support-for-wheel-axes.patch
patch_apply dinput-wheel-support/0002-dinput-Map-wheel-gas-and-brake-axes-as-well.patch
(
printf '%s\n' '+ { "Tim Schumacher", "winejoystick: Add support for wheel axes.", 1 },';
printf '%s\n' '+ { "Tim Schumacher", "dinput: Map wheel, gas, and brake axes as well.", 1 },';
) >> "$patchlist"
fi
# Patchset dsound-Fast_Mixer
# |
# | This patchset fixes the following Wine bugs: