Skip to content

Instantly share code, notes, and snippets.

@ananace
Last active September 25, 2021 07:39
Show Gist options
  • Save ananace/6e99ff214b27686939f35dcb40d1d75b to your computer and use it in GitHub Desktop.
Save ananace/6e99ff214b27686939f35dcb40d1d75b to your computer and use it in GitHub Desktop.
Quick hack to get the expanded joyaxises patch to apply on Wine 6.18
diff --git a/dlls/joy.cpl/joy.h b/dlls/joy.cpl/joy.h
index 64df21963b9..c05880d88ba 100644
--- a/dlls/joy.cpl/joy.h
+++ b/dlls/joy.cpl/joy.h
@@ -49,8 +49,8 @@ struct Joystick {
struct Effect *effects;
};
-#define TEST_MAX_BUTTONS 32
-#define TEST_MAX_AXES 4
+#define TEST_MAX_BUTTONS 64
+#define TEST_MAX_AXES 8
struct Graphics {
HWND hwnd;
diff --git a/dlls/joy.cpl/main.c b/dlls/joy.cpl/main.c
index 57c188a5df1..a304643c9f8 100644
--- a/dlls/joy.cpl/main.c
+++ b/dlls/joy.cpl/main.c
@@ -487,6 +487,16 @@ static DWORD WINAPI input_thread(void *param)
axes_pos[1][1] = state.lRy;
axes_pos[2][0] = state.lZ;
axes_pos[2][1] = state.lRz;
+ axes_pos[3][0] = 0;
+ axes_pos[3][1] = 0;
+ axes_pos[4][0] = 0;
+ axes_pos[4][1] = 0;
+ axes_pos[5][0] = 0;
+ axes_pos[5][1] = 0;
+ axes_pos[6][0] = 0;
+ axes_pos[6][1] = 0;
+ axes_pos[7][0] = 0;
+ axes_pos[7][1] = 0;
/* Set pov values */
for (j = 0; j < ARRAY_SIZE(pov_val); j++)
diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c
index 17032e1dba9..ca82d07e026 100644
--- a/dlls/winebus.sys/bus_sdl.c
+++ b/dlls/winebus.sys/bus_sdl.c
@@ -204,23 +204,31 @@ static NTSTATUS build_joystick_report_descriptor(struct unix_device *iface)
HID_USAGE_GENERIC_RY,
HID_USAGE_GENERIC_RZ,
HID_USAGE_GENERIC_SLIDER,
+ HID_USAGE_GENERIC_SLIDER,
+ HID_USAGE_GENERIC_DIAL,
+ HID_USAGE_GENERIC_DIAL,
+ HID_USAGE_GENERIC_DIAL,
+ HID_USAGE_GENERIC_DIAL,
+ HID_USAGE_GENERIC_DIAL,
+ HID_USAGE_GENERIC_DIAL,
HID_USAGE_GENERIC_DIAL,
- HID_USAGE_GENERIC_WHEEL
+ HID_USAGE_GENERIC_WHEEL,
+ HID_USAGE_GENERIC_SLIDER
};
struct sdl_device *impl = impl_from_unix_device(iface);
int i, button_count, axis_count, ball_count, hat_count;
axis_count = pSDL_JoystickNumAxes(impl->sdl_joystick);
- if (axis_count > 6)
+ if (axis_count > 16)
{
- FIXME("Clamping joystick to 6 axis\n");
- axis_count = 6;
+ FIXME("Clamping joystick to 16 axis\n");
+ axis_count = 16;
}
ball_count = pSDL_JoystickNumBalls(impl->sdl_joystick);
if (axis_count + ball_count * 2 > ARRAY_SIZE(joystick_usages))
{
- FIXME("Capping ball + axis at 9\n");
+ FIXME("Capping ball + axis at 19\n");
ball_count = (ARRAY_SIZE(joystick_usages) - axis_count) / 2;
}
diff --git a/dlls/winejoystick.drv/joystick_linux.c b/dlls/winejoystick.drv/joystick_linux.c
index 8d1a7b1a25a..e579d99aa73 100644
--- a/dlls/winejoystick.drv/joystick_linux.c
+++ b/dlls/winejoystick.drv/joystick_linux.c
@@ -260,9 +260,9 @@ LRESULT driver_joyGetDevCaps(DWORD_PTR dwDevID, LPJOYCAPSW lpCaps, DWORD dwSize)
lpCaps->wUmax = 0xFFFF;
lpCaps->wVmin = 0;
lpCaps->wVmax = 0xFFFF;
- lpCaps->wMaxAxes = 6; /* same as MS Joystick Driver */
+ lpCaps->wMaxAxes = 16; /* same as MS Joystick Driver */
lpCaps->wNumAxes = 0; /* nr of axes in use */
- lpCaps->wMaxButtons = 32; /* same as MS Joystick Driver */
+ lpCaps->wMaxButtons = 64; /* same as MS Joystick Driver */
lpCaps->szRegKey[0] = 0;
lpCaps->szOEMVxD[0] = 0;
lpCaps->wCaps = 0;
@@ -326,6 +326,7 @@ LRESULT driver_joyGetPosEx(DWORD_PTR dwDevID, LPJOYINFOEX lpInfo)
switch (jstck->axesMap[ev.number]) {
case 0: /* X */
case 8: /* Wheel */
+ case 40: /* Mouse-like */
jstck->x = ev.value;
break;
case 1: /* Y */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment