diff --git a/patches/dinput-reconnect-joystick/0001-dinput-Allow-reconnecting-to-disconnected-joysticks.patch b/patches/dinput-reconnect-joystick/0001-dinput-Allow-reconnecting-to-disconnected-joysticks.patch index db39e861..3f343dfc 100644 --- a/patches/dinput-reconnect-joystick/0001-dinput-Allow-reconnecting-to-disconnected-joysticks.patch +++ b/patches/dinput-reconnect-joystick/0001-dinput-Allow-reconnecting-to-disconnected-joysticks.patch @@ -1,15 +1,15 @@ -From 80eb290cf245dcca259049a5bd948a5632d54608 Mon Sep 17 00:00:00 2001 +From 5a3007325917b8818493fc2193019e829916b733 Mon Sep 17 00:00:00 2001 From: Andrew Church Date: Mon, 25 Feb 2019 11:23:12 +1100 Subject: [PATCH] dinput: Allow reconnecting to disconnected joysticks Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=34297 --- - dlls/dinput/joystick_linuxinput.c | 148 +++++++++++++++++++++++------- - 1 file changed, 113 insertions(+), 35 deletions(-) + dlls/dinput/joystick_linuxinput.c | 152 ++++++++++++++++++++++-------- + 1 file changed, 115 insertions(+), 37 deletions(-) diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c -index 3bc6114322f..3b5ad7c532a 100644 +index 2b970271ec3..8e292904f78 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -84,6 +84,13 @@ struct wine_input_absinfo { @@ -34,7 +34,7 @@ index 3bc6114322f..3b5ad7c532a 100644 int dev_axes_to_di[ABS_MAX]; POINTL povs[4]; -@@ -459,6 +467,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm +@@ -411,6 +419,7 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, JoystickIm newDevice->generic.joy_polldev = joy_polldev; newDevice->joyfd = -1; @@ -42,106 +42,98 @@ index 3bc6114322f..3b5ad7c532a 100644 newDevice->joydev = &joydevs[index]; newDevice->generic.name = newDevice->joydev->name; list_init(&newDevice->ff_effects); -@@ -663,38 +672,15 @@ static HRESULT joydev_create_device(IDirectInputImpl *dinput, REFGUID rguid, REF +@@ -589,6 +598,44 @@ static HRESULT joydev_create_device( IDirectInputImpl *dinput, REFGUID rguid, ID return DIERR_DEVICENOTREG; } -- --const struct dinput_device joystick_linuxinput_device = { -- "Wine Linux-input joystick driver", -- joydev_enum_deviceA, -- joydev_enum_deviceW, -- joydev_create_device --}; -- --/****************************************************************************** -- * Acquire : gets exclusive control of the joystick -- */ --static HRESULT WINAPI JoystickWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface) +static int joydev_open_evdev(JoystickImpl *This) - { -- JoystickImpl *This = impl_from_IDirectInputDevice8W(iface); -- HRESULT res; -- -- TRACE("(this=%p)\n",This); ++{ + int fd; - -- if ((res = IDirectInputDevice2WImpl_Acquire(iface)) != DI_OK) ++ + if ((fd = open(This->joydev->device, O_RDWR)) == -1) - { -- WARN("Failed to acquire: %x\n", res); -- return res; -- } -- -- if ((This->joyfd = open(This->joydev->device, O_RDWR)) == -1) -- { -- if ((This->joyfd = open(This->joydev->device, O_RDONLY)) == -1) ++ { + if ((fd = open(This->joydev->device, O_RDONLY)) == -1) - { - /* Couldn't open the device at all */ -- ERR("Failed to open device %s: %d %s\n", This->joydev->device, errno, strerror(errno)); -- IDirectInputDevice2WImpl_Unacquire(iface); -- return DIERR_NOTFOUND; - } - else - { -@@ -709,18 +695,53 @@ static HRESULT WINAPI JoystickWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface) - event.type = EV_FF; - event.code = FF_GAIN; - event.value = This->ff_gain; -- if (write(This->joyfd, &event, sizeof(event)) == -1) ++ { ++ /* Couldn't open the device at all */ ++ } ++ else ++ { ++ /* Couldn't open in r/w but opened in read-only. */ ++ WARN("Could not open %s in read-write mode. Force feedback will be disabled.\n", This->joydev->device); ++ } ++ } ++ else ++ { ++ struct input_event event; ++ ++ event.type = EV_FF; ++ event.code = FF_GAIN; ++ event.value = This->ff_gain; + if (write(fd, &event, sizeof(event)) == -1) - ERR("Failed to set gain (%i): %d %s\n", This->ff_gain, errno, strerror(errno)); - if (!This->ff_autocenter) - { - /* Disable autocenter. */ - event.code = FF_AUTOCENTER; - event.value = 0; -- if (write(This->joyfd, &event, sizeof(event)) == -1) ++ ERR("Failed to set gain (%i): %d %s\n", This->ff_gain, errno, strerror(errno)); ++ if (!This->ff_autocenter) ++ { ++ /* Disable autocenter. */ ++ event.code = FF_AUTOCENTER; ++ event.value = 0; + if (write(fd, &event, sizeof(event)) == -1) - ERR("Failed disabling autocenter: %d %s\n", errno, strerror(errno)); - } - } - ++ ERR("Failed disabling autocenter: %d %s\n", errno, strerror(errno)); ++ } ++ } ++ + return fd; +} + -+ -+const struct dinput_device joystick_linuxinput_device = { -+ "Wine Linux-input joystick driver", -+ joydev_enum_deviceA, -+ joydev_enum_deviceW, -+ joydev_create_device -+}; -+ -+/****************************************************************************** -+ * Acquire : gets exclusive control of the joystick -+ */ -+static HRESULT WINAPI JoystickWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface) -+{ -+ JoystickImpl *This = impl_from_IDirectInputDevice8W(iface); -+ HRESULT res; -+ -+ TRACE("(this=%p)\n",This); -+ -+ if ((res = IDirectInputDevice2WImpl_Acquire(iface)) != DI_OK) -+ { -+ WARN("Failed to acquire: %x\n", res); -+ return res; -+ } -+ + + const struct dinput_device joystick_linuxinput_device = { + "Wine Linux-input joystick driver", +@@ -612,40 +659,14 @@ static HRESULT WINAPI JoystickWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface) + return res; + } + +- if ((This->joyfd = open(This->joydev->device, O_RDWR)) == -1) + if ((This->joyfd = joydev_open_evdev(This)) == -1) -+ { + { +- if ((This->joyfd = open(This->joydev->device, O_RDONLY)) == -1) +- { +- /* Couldn't open the device at all */ +- ERR("Failed to open device %s: %d %s\n", This->joydev->device, errno, strerror(errno)); +- IDirectInputDevice2WImpl_Unacquire(iface); +- return DIERR_NOTFOUND; +- } +- else +- { +- /* Couldn't open in r/w but opened in read-only. */ +- WARN("Could not open %s in read-write mode. Force feedback will be disabled.\n", This->joydev->device); +- } +- } +- else +- { +- struct input_event event; +- +- event.type = EV_FF; +- event.code = FF_GAIN; +- event.value = This->ff_gain; +- if (write(This->joyfd, &event, sizeof(event)) == -1) +- ERR("Failed to set gain (%i): %d %s\n", This->ff_gain, errno, strerror(errno)); +- if (!This->ff_autocenter) +- { +- /* Disable autocenter. */ +- event.code = FF_AUTOCENTER; +- event.value = 0; +- if (write(This->joyfd, &event, sizeof(event)) == -1) +- ERR("Failed disabling autocenter: %d %s\n", errno, strerror(errno)); +- } + ERR("Failed to open device %s: %d %s\n", This->joydev->device, errno, strerror(errno)); + IDirectInputDevice2WImpl_Unacquire(iface); + return DIERR_NOTFOUND; -+ } -+ + } + + This->joyfd_state = WINE_FD_STATE_OK; return DI_OK; } -@@ -752,6 +773,7 @@ static HRESULT WINAPI JoystickWImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface) +@@ -677,6 +698,7 @@ static HRESULT WINAPI JoystickWImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface) close(This->joyfd); This->joyfd = -1; @@ -149,7 +141,7 @@ index 3bc6114322f..3b5ad7c532a 100644 } return res; } -@@ -790,23 +812,79 @@ static void joy_polldev( IDirectInputDevice8W *iface ) +@@ -715,23 +737,79 @@ static void joy_polldev( IDirectInputDevice8W *iface ) struct input_event ie; JoystickImpl *This = impl_from_IDirectInputDevice8W( iface ); diff --git a/patches/msvcrt-Math_Precision/definition b/patches/msvcrt-Math_Precision/definition index a2f38cf6..c2f2f0c4 100644 --- a/patches/msvcrt-Math_Precision/definition +++ b/patches/msvcrt-Math_Precision/definition @@ -1 +1,3 @@ Fixes: [37149] Calculate msvcrt exponential math operations with higher precision +# Needs retesting when exp() and pow() are moved as well. +Disabled: true diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index d75fbc89..004aac61 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "35180d368a94156cb77b09560b24d3af428b988b" + echo "96030ce738aa20f85a5138ec7c231c19a086f019" } # Show version information @@ -142,7 +142,6 @@ patch_enable_all () enable_mshtml_HTMLLocation_put_hash="$1" enable_mshtml_TranslateAccelerator="$1" enable_msi_msi_vcl_get_cost="$1" - enable_msvcrt_Math_Precision="$1" enable_msxml3_FreeThreadedXMLHTTP60="$1" enable_ntdll_APC_Performance="$1" enable_ntdll_ApiSetMap="$1" @@ -232,7 +231,6 @@ patch_enable_all () enable_user32_ScrollWindowEx="$1" enable_user32_message_order="$1" enable_user32_msgbox_Support_WM_COPY_mesg="$1" - enable_user32_rawinput_hid="$1" enable_user32_rawinput_mouse="$1" enable_user32_rawinput_mouse_experimental="$1" enable_user32_recursive_activation="$1" @@ -475,9 +473,6 @@ patch_enable () msi-msi_vcl_get_cost) enable_msi_msi_vcl_get_cost="$2" ;; - msvcrt-Math_Precision) - enable_msvcrt_Math_Precision="$2" - ;; msxml3-FreeThreadedXMLHTTP60) enable_msxml3_FreeThreadedXMLHTTP60="$2" ;; @@ -745,9 +740,6 @@ patch_enable () user32-msgbox-Support-WM_COPY-mesg) enable_user32_msgbox_Support_WM_COPY_mesg="$2" ;; - user32-rawinput-hid) - enable_user32_rawinput_hid="$2" - ;; user32-rawinput-mouse) enable_user32_rawinput_mouse="$2" ;; @@ -1298,20 +1290,6 @@ if test "$enable_user32_rawinput_mouse_experimental" -eq 1; then enable_user32_rawinput_mouse=1 fi -if test "$enable_user32_rawinput_mouse" -eq 1; then - if test "$enable_user32_rawinput_hid" -gt 1; then - abort "Patchset user32-rawinput-hid disabled, but user32-rawinput-mouse depends on that." - fi - enable_user32_rawinput_hid=1 -fi - -if test "$enable_user32_rawinput_hid" -eq 1; then - if test "$enable_loader_KeyboardLayouts" -gt 1; then - abort "Patchset loader-KeyboardLayouts disabled, but user32-rawinput-hid depends on that." - fi - enable_loader_KeyboardLayouts=1 -fi - if test "$enable_stdole32_tlb_SLTG_Typelib" -eq 1; then if test "$enable_widl_SLTG_Typelib_Support" -gt 1; then abort "Patchset widl-SLTG_Typelib_Support disabled, but stdole32.tlb-SLTG_Typelib depends on that." @@ -2511,18 +2489,6 @@ if test "$enable_msi_msi_vcl_get_cost" -eq 1; then patch_apply msi-msi_vcl_get_cost/0001-msi-Do-not-sign-extend-after-multiplying.patch fi -# Patchset msvcrt-Math_Precision -# | -# | This patchset fixes the following Wine bugs: -# | * [#37149] Calculate msvcrt exponential math operations with higher precision -# | -# | Modified files: -# | * dlls/msvcrt/unixlib.c -# | -if test "$enable_msvcrt_Math_Precision" -eq 1; then - patch_apply msvcrt-Math_Precision/0001-msvcrt-Calculate-sinh-cosh-exp-pow-with-higher-preci.patch -fi - # Patchset msxml3-FreeThreadedXMLHTTP60 # | # | This patchset fixes the following Wine bugs: @@ -3630,30 +3596,8 @@ if test "$enable_user32_msgbox_Support_WM_COPY_mesg" -eq 1; then patch_apply user32-msgbox-Support-WM_COPY-mesg/0002-user32-msgbox-Use-a-windows-hook-to-trap-Ctrl-C.patch fi -# Patchset user32-rawinput-hid -# | -# | This patchset has the following (direct or indirect) dependencies: -# | * loader-KeyboardLayouts -# | -# | This patchset fixes the following Wine bugs: -# | * [#50506] WM_INPUT messages are not received for HID devices registered with RegisterRawInputDevices -# | -# | Modified files: -# | * dlls/user32/message.c, dlls/user32/rawinput.c, dlls/user32/user_private.h, server/protocol.def, server/queue.c, -# | server/trace.c, tools/make_requests -# | -if test "$enable_user32_rawinput_hid" -eq 1; then - patch_apply user32-rawinput-hid/0001-server-Add-extra-data-bytes-to-be-added-after-hardwa.patch - patch_apply user32-rawinput-hid/0002-server-Add-HID-reports-count-length-to-rawinput-unio.patch - patch_apply user32-rawinput-hid/0003-server-Add-HID-reports-support-in-GetRawInputBuffer.patch - patch_apply user32-rawinput-hid/0004-server-Implement-WM_INPUT-RIM_TYPEHID-message-dispat.patch -fi - # Patchset user32-rawinput-mouse # | -# | This patchset has the following (direct or indirect) dependencies: -# | * loader-KeyboardLayouts, user32-rawinput-hid -# | # | This patchset fixes the following Wine bugs: # | * [#42631] Mouse drift, jump or don't react to small slow movements in Unity-engine games and Fallout 4 (partly fixed in # | Unity games, have walkaround in Fallout4 ) @@ -3679,7 +3623,7 @@ fi # Patchset user32-rawinput-mouse-experimental # | # | This patchset has the following (direct or indirect) dependencies: -# | * loader-KeyboardLayouts, user32-rawinput-hid, user32-rawinput-mouse +# | * user32-rawinput-mouse # | # | This patchset fixes the following Wine bugs: # | * [#45882] - Raw Input should use untransformed mouse values (affects Overwatch, several Source games). diff --git a/patches/user32-rawinput-hid/0001-server-Add-extra-data-bytes-to-be-added-after-hardwa.patch b/patches/user32-rawinput-hid/0001-server-Add-extra-data-bytes-to-be-added-after-hardwa.patch deleted file mode 100644 index ad73592a..00000000 --- a/patches/user32-rawinput-hid/0001-server-Add-extra-data-bytes-to-be-added-after-hardwa.patch +++ /dev/null @@ -1,138 +0,0 @@ -From c9e0eb6e9625d7d8dc31a208c5bbff25e5eff4d5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Tue, 23 Mar 2021 10:11:07 +0100 -Subject: [PATCH] server: Add extra data bytes to be added after - hardware_msg_data. - -The RIM_TYPEHID messages will have to carry the variable length HID -report. - -Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506 ---- - server/queue.c | 27 ++++++++++++++++++--------- - 1 file changed, 18 insertions(+), 9 deletions(-) - -diff --git a/server/queue.c b/server/queue.c -index 5d65e030112..c43386ee317 100644 ---- a/server/queue.c -+++ b/server/queue.c -@@ -348,13 +348,13 @@ static int assign_thread_input( struct thread *thread, struct thread_input *new_ - - /* allocate a hardware message and its data */ - static struct message *alloc_hardware_message( lparam_t info, struct hw_msg_source source, -- unsigned int time ) -+ unsigned int time, data_size_t extra_len ) - { - struct hardware_msg_data *msg_data; - struct message *msg; - - if (!(msg = mem_alloc( sizeof(*msg) ))) return NULL; -- if (!(msg_data = mem_alloc( sizeof(*msg_data) ))) -+ if (!(msg_data = mem_alloc( sizeof(*msg_data) + extra_len ))) - { - free( msg ); - return NULL; -@@ -363,9 +363,9 @@ static struct message *alloc_hardware_message( lparam_t info, struct hw_msg_sour - msg->type = MSG_HARDWARE; - msg->time = time; - msg->data = msg_data; -- msg->data_size = sizeof(*msg_data); -+ msg->data_size = sizeof(*msg_data) + extra_len; - -- memset( msg_data, 0, sizeof(*msg_data) ); -+ memset( msg_data, 0, sizeof(*msg_data) + extra_len ); - msg_data->info = info; - msg_data->source = source; - return msg; -@@ -398,7 +398,7 @@ static void set_cursor_pos( struct desktop *desktop, int x, int y ) - return; - } - -- if (!(msg = alloc_hardware_message( 0, source, get_tick_count() ))) return; -+ if (!(msg = alloc_hardware_message( 0, source, get_tick_count(), 0 ))) return; - - msg->msg = WM_MOUSEMOVE; - msg->x = x; -@@ -1664,6 +1664,8 @@ struct rawinput_message - unsigned int time; - unsigned int message; - struct hardware_msg_data data; -+ const void *extra; -+ data_size_t extra_len; - }; - - /* check if process is supposed to receive a WM_INPUT message and eventually queue it */ -@@ -1702,7 +1704,7 @@ static int queue_rawinput_message( struct process* process, void *arg ) - wparam = RIM_INPUTSINK; - } - -- if (!(msg = alloc_hardware_message( raw_msg->data.info, raw_msg->source, raw_msg->time ))) -+ if (!(msg = alloc_hardware_message( raw_msg->data.info, raw_msg->source, raw_msg->time, raw_msg->extra_len ))) - goto done; - - msg->win = device->target; -@@ -1710,6 +1712,7 @@ static int queue_rawinput_message( struct process* process, void *arg ) - msg->wparam = wparam; - msg->lparam = 0; - memcpy( msg->data, &raw_msg->data, sizeof(raw_msg->data) ); -+ if (raw_msg->extra) memcpy( (struct hardware_msg_data *)msg->data + 1, raw_msg->extra, raw_msg->extra_len ); - - if (raw_msg->message == WM_INPUT_DEVICE_CHANGE && raw_msg->data.rawinput.type == RIM_TYPEHID) - { -@@ -1791,6 +1794,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons - raw_msg.source = source; - raw_msg.time = time; - raw_msg.message = WM_INPUT; -+ raw_msg.extra = NULL; -+ raw_msg.extra_len = 0; - - msg_data = &raw_msg.data; - msg_data->info = input->mouse.info; -@@ -1816,7 +1821,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons - if (!(flags & (1 << i))) continue; - flags &= ~(1 << i); - -- if (!(msg = alloc_hardware_message( input->mouse.info, source, time ))) return 0; -+ if (!(msg = alloc_hardware_message( input->mouse.info, source, time, 0 ))) return 0; - msg_data = msg->data; - - msg->win = get_user_full_handle( win ); -@@ -1926,6 +1931,8 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c - raw_msg.source = source; - raw_msg.time = time; - raw_msg.message = WM_INPUT; -+ raw_msg.extra = NULL; -+ raw_msg.extra_len = 0; - - msg_data = &raw_msg.data; - msg_data->info = input->kbd.info; -@@ -1945,7 +1952,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c - return 0; - } - -- if (!(msg = alloc_hardware_message( input->kbd.info, source, time ))) return 0; -+ if (!(msg = alloc_hardware_message( input->kbd.info, source, time, 0 ))) return 0; - msg_data = msg->data; - - msg->win = get_user_full_handle( win ); -@@ -1993,6 +2000,8 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ - raw_msg.source = source; - raw_msg.time = get_tick_count(); - raw_msg.message = input->hw.msg; -+ raw_msg.extra = NULL; -+ raw_msg.extra_len = 0; - - msg_data = &raw_msg.data; - msg_data->info = 0; -@@ -2005,7 +2014,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ - return; - } - -- if (!(msg = alloc_hardware_message( 0, source, get_tick_count() ))) return; -+ if (!(msg = alloc_hardware_message( 0, source, get_tick_count(), 0 ))) return; - - msg->win = get_user_full_handle( win ); - msg->msg = input->hw.msg; --- -2.30.2 - diff --git a/patches/user32-rawinput-hid/0002-server-Add-HID-reports-count-length-to-rawinput-unio.patch b/patches/user32-rawinput-hid/0002-server-Add-HID-reports-count-length-to-rawinput-unio.patch deleted file mode 100644 index 6c7a8dc4..00000000 --- a/patches/user32-rawinput-hid/0002-server-Add-HID-reports-count-length-to-rawinput-unio.patch +++ /dev/null @@ -1,111 +0,0 @@ -From c88f4c3f0b2ae90b8357419fe8f90a59c8982a3b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Fri, 14 May 2021 22:05:06 +0200 -Subject: [PATCH] server: Add HID reports count / length to rawinput union. - -And send HID reports data in send_hardware_message request, then append -the reports after hardware_msg_data. - -Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506 ---- - dlls/user32/message.c | 4 +++- - server/protocol.def | 3 +++ - server/queue.c | 11 +++++++++-- - server/trace.c | 4 ++-- - tools/make_requests | 2 +- - 5 files changed, 18 insertions(+), 6 deletions(-) - -diff --git a/dlls/user32/message.c b/dlls/user32/message.c -index 9af33c3291e..71d0be8913e 100644 ---- a/dlls/user32/message.c -+++ b/dlls/user32/message.c -@@ -3288,11 +3288,13 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r - switch (rawinput->header.dwType) - { - case RIM_TYPEHID: -- assert( rawinput->data.hid.dwCount <= 1 ); - req->input.hw.rawinput.hid.device = HandleToUlong( rawinput->header.hDevice ); - req->input.hw.rawinput.hid.param = rawinput->header.wParam; - req->input.hw.rawinput.hid.usage_page = hid_usage_page; - req->input.hw.rawinput.hid.usage = hid_usage; -+ req->input.hw.rawinput.hid.count = rawinput->data.hid.dwCount; -+ req->input.hw.rawinput.hid.length = rawinput->data.hid.dwSizeHid; -+ wine_server_add_data( req, rawinput->data.hid.bRawData, rawinput->data.hid.dwCount * rawinput->data.hid.dwSizeHid ); - break; - default: - assert( 0 ); -diff --git a/server/protocol.def b/server/protocol.def -index 4239be834d1..eb15cef6fdb 100644 ---- a/server/protocol.def -+++ b/server/protocol.def -@@ -302,6 +302,8 @@ union rawinput - unsigned int param; /* rawinput message param */ - unsigned short usage_page;/* HID usage page */ - unsigned short usage; /* HID usage */ -+ unsigned int count; /* HID report count */ -+ unsigned int length; /* HID report length */ - } hid; - }; - -@@ -2032,6 +2034,7 @@ enum message_type - user_handle_t win; /* window handle */ - hw_input_t input; /* input data */ - unsigned int flags; /* flags (see below) */ -+ VARARG(report,bytes); /* HID report data */ - @REPLY - int wait; /* do we need to wait for a reply? */ - int prev_x; /* previous cursor position */ -diff --git a/server/queue.c b/server/queue.c -index c43386ee317..4f1695c92cc 100644 ---- a/server/queue.c -+++ b/server/queue.c -@@ -2000,8 +2000,15 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ - raw_msg.source = source; - raw_msg.time = get_tick_count(); - raw_msg.message = input->hw.msg; -- raw_msg.extra = NULL; -- raw_msg.extra_len = 0; -+ raw_msg.extra = get_req_data(); -+ raw_msg.extra_len = get_req_data_size(); -+ -+ if (input->hw.rawinput.type == RIM_TYPEHID && -+ raw_msg.extra_len != input->hw.rawinput.hid.length * input->hw.rawinput.hid.count) -+ { -+ set_error( STATUS_INVALID_PARAMETER ); -+ return; -+ } - - msg_data = &raw_msg.data; - msg_data->info = 0; -diff --git a/server/trace.c b/server/trace.c -index 6b5946c2bcf..3b6c8387149 100644 ---- a/server/trace.c -+++ b/server/trace.c -@@ -408,9 +408,9 @@ static void dump_rawinput( const char *prefix, const union rawinput *rawinput ) - rawinput->kbd.message, rawinput->kbd.vkey, rawinput->kbd.scan ); - break; - case RIM_TYPEHID: -- fprintf( stderr, "%s{type=HID,device=%04x,param=%04x,page=%04hx,usage=%04hx}", -+ fprintf( stderr, "%s{type=HID,device=%04x,param=%04x,page=%04hx,usage=%04hx,count=%u,length=%u}", - prefix, rawinput->hid.device, rawinput->hid.param, rawinput->hid.usage_page, -- rawinput->hid.usage ); -+ rawinput->hid.usage, rawinput->hid.count, rawinput->hid.length ); - break; - default: - fprintf( stderr, "%s{type=%04x}", prefix, rawinput->type ); -diff --git a/tools/make_requests b/tools/make_requests -index a70b29df3d2..1c4e5977c8b 100755 ---- a/tools/make_requests -+++ b/tools/make_requests -@@ -52,7 +52,7 @@ my %formats = - "luid_t" => [ 8, 4, "&dump_luid" ], - "generic_map_t" => [ 16, 4, "&dump_generic_map" ], - "ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ], -- "hw_input_t" => [ 32, 8, "&dump_hw_input" ], -+ "hw_input_t" => [ 40, 8, "&dump_hw_input" ], - ); - - my @requests = (); --- -2.30.2 - diff --git a/patches/user32-rawinput-hid/0003-server-Add-HID-reports-support-in-GetRawInputBuffer.patch b/patches/user32-rawinput-hid/0003-server-Add-HID-reports-support-in-GetRawInputBuffer.patch deleted file mode 100644 index fc9030e5..00000000 --- a/patches/user32-rawinput-hid/0003-server-Add-HID-reports-support-in-GetRawInputBuffer.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 508f296e7ae9804a34438fd0d03eafcdb1c888f4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Fri, 14 May 2021 22:05:06 +0200 -Subject: [PATCH] server: Add HID reports support in GetRawInputBuffer. - -Returned by get_rawinput_buffer request after each hardware_msg_data. - -Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506 ---- - dlls/user32/rawinput.c | 28 +++++++++++++++++++++++++--- - server/queue.c | 11 ++++++----- - 2 files changed, 31 insertions(+), 8 deletions(-) - -diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c -index e4e7bad508f..716047b4599 100644 ---- a/dlls/user32/rawinput.c -+++ b/dlls/user32/rawinput.c -@@ -280,6 +280,8 @@ struct rawinput_thread_data *rawinput_thread_data(void) - - BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_msg_data *msg_data) - { -+ SIZE_T size; -+ - rawinput->header.dwType = msg_data->rawinput.type; - if (msg_data->rawinput.type == RIM_TYPEMOUSE) - { -@@ -371,6 +373,23 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms - rawinput->data.keyboard.Message = msg_data->rawinput.kbd.message; - rawinput->data.keyboard.ExtraInformation = msg_data->info; - } -+ else if (msg_data->rawinput.type == RIM_TYPEHID) -+ { -+ size = msg_data->rawinput.hid.count * msg_data->rawinput.hid.length; -+ if (size > RAWINPUT_BUFFER_SIZE - sizeof(*rawinput)) -+ { -+ ERR( "Dropping unexpectedly large HID hardware message.\n" ); -+ return FALSE; -+ } -+ -+ rawinput->header.dwSize = FIELD_OFFSET( RAWINPUT, data.hid.bRawData ) + size; -+ rawinput->header.hDevice = ULongToHandle( msg_data->rawinput.hid.device ); -+ rawinput->header.wParam = 0; -+ -+ rawinput->data.hid.dwCount = msg_data->rawinput.hid.count; -+ rawinput->data.hid.dwSizeHid = msg_data->rawinput.hid.length; -+ memcpy( rawinput->data.hid.bRawData, msg_data + 1, size ); -+ } - else - { - FIXME("Unhandled rawinput type %#x.\n", msg_data->rawinput.type); -@@ -564,7 +583,7 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size, - struct hardware_msg_data *msg_data; - struct rawinput_thread_data *thread_data; - RAWINPUT *rawinput; -- UINT count = 0, rawinput_size, next_size, overhead; -+ UINT count = 0, rawinput_size, msg_size, next_size, overhead; - BOOL is_wow64; - int i; - -@@ -619,12 +638,15 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size, - - for (i = 0; i < count; ++i) - { -- rawinput_from_hardware_message(data, msg_data); -+ if (!rawinput_from_hardware_message(data, msg_data)) break; - if (overhead) memmove((char *)&data->data + overhead, &data->data, - data->header.dwSize - sizeof(RAWINPUTHEADER)); - data->header.dwSize += overhead; - data = NEXTRAWINPUTBLOCK(data); -- msg_data++; -+ msg_size = sizeof(*msg_data); -+ if (msg_data->rawinput.type == RIM_TYPEHID) -+ msg_size += msg_data->rawinput.hid.count * msg_data->rawinput.hid.length; -+ msg_data = (struct hardware_msg_data *)((char *)msg_data + msg_size); - } - - if (count == 0 && next_size == 0) *data_size = 0; -diff --git a/server/queue.c b/server/queue.c -index 4f1695c92cc..ebbe4049ae8 100644 ---- a/server/queue.c -+++ b/server/queue.c -@@ -3311,16 +3311,17 @@ DECL_HANDLER(get_rawinput_buffer) - { - struct message *msg = LIST_ENTRY( ptr, struct message, entry ); - struct hardware_msg_data *data = msg->data; -+ data_size_t hid_size = data->rawinput.type != RIM_TYPEHID ? 0 : msg->data_size - sizeof(*data); - - ptr = list_next( &input->msg_list, ptr ); - if (msg->msg != WM_INPUT) continue; - -- next_size = req->rawinput_size; -+ next_size = req->rawinput_size + hid_size; - if (size + next_size > req->buffer_size) break; -- if (cur + sizeof(*data) > buf + get_reply_max_size()) break; -- if (cur + sizeof(*data) > buf + buf_size) -+ if (cur + msg->data_size > buf + get_reply_max_size()) break; -+ if (cur + msg->data_size > buf + buf_size) - { -- buf_size += buf_size / 2; -+ buf_size += buf_size / 2 + hid_size; - if (!(tmp = realloc( buf, buf_size ))) - { - set_error( STATUS_NO_MEMORY ); -@@ -3330,7 +3331,7 @@ DECL_HANDLER(get_rawinput_buffer) - buf = tmp; - } - -- memcpy(cur, data, sizeof(*data)); -+ memcpy( cur, data, msg->data_size ); - list_remove( &msg->entry ); - free_message( msg ); - --- -2.30.2 - diff --git a/patches/user32-rawinput-hid/0004-server-Implement-WM_INPUT-RIM_TYPEHID-message-dispat.patch b/patches/user32-rawinput-hid/0004-server-Implement-WM_INPUT-RIM_TYPEHID-message-dispat.patch deleted file mode 100644 index f32bb883..00000000 --- a/patches/user32-rawinput-hid/0004-server-Implement-WM_INPUT-RIM_TYPEHID-message-dispat.patch +++ /dev/null @@ -1,117 +0,0 @@ -From efdc9faae44a7b2a60ab3d383f83c573a65b1c2e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Bernon?= -Date: Fri, 16 Apr 2021 12:54:16 +0200 -Subject: [PATCH] server: Implement WM_INPUT / RIM_TYPEHID message dispatch. - -The messages are of variable size and carry the corresponding HID report -data after each RAWINPUT struct. - -Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506 ---- - dlls/user32/message.c | 9 +++++++++ - dlls/user32/rawinput.c | 15 +++++++++++++++ - dlls/user32/user_private.h | 2 ++ - server/queue.c | 1 + - server/trace.c | 1 + - 5 files changed, 28 insertions(+) - -diff --git a/dlls/user32/message.c b/dlls/user32/message.c -index 71d0be8913e..a80fb8c57ea 100644 ---- a/dlls/user32/message.c -+++ b/dlls/user32/message.c -@@ -3254,6 +3254,14 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r - hid_usage_page = ((USAGE *)rawinput->data.hid.bRawData)[0]; - hid_usage = ((USAGE *)rawinput->data.hid.bRawData)[1]; - } -+ if (input->u.hi.uMsg == WM_INPUT) -+ { -+ if (!rawinput_device_get_usages( rawinput->header.hDevice, &hid_usage_page, &hid_usage )) -+ { -+ WARN( "unable to get HID usages for device %p\n", rawinput->header.hDevice ); -+ return STATUS_INVALID_HANDLE; -+ } -+ } - } - - SERVER_START_REQ( send_hardware_message ) -@@ -3283,6 +3291,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r - req->input.hw.lparam = MAKELONG( input->u.hi.wParamL, input->u.hi.wParamH ); - switch (input->u.hi.uMsg) - { -+ case WM_INPUT: - case WM_INPUT_DEVICE_CHANGE: - req->input.hw.rawinput.type = rawinput->header.dwType; - switch (rawinput->header.dwType) -diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c -index 716047b4599..103f2bb8a55 100644 ---- a/dlls/user32/rawinput.c -+++ b/dlls/user32/rawinput.c -@@ -267,6 +267,21 @@ static struct device *find_device_from_handle(HANDLE handle) - } - - -+BOOL rawinput_device_get_usages(HANDLE handle, USAGE *usage_page, USAGE *usage) -+{ -+ struct device *device; -+ -+ *usage_page = *usage = 0; -+ -+ if (!(device = find_device_from_handle(handle))) return FALSE; -+ if (device->info.dwType != RIM_TYPEHID) return FALSE; -+ -+ *usage_page = device->info.u.hid.usUsagePage; -+ *usage = device->info.u.hid.usUsage; -+ return TRUE; -+} -+ -+ - struct rawinput_thread_data *rawinput_thread_data(void) - { - struct user_thread_info *thread_info = get_user_thread_info(); -diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h -index cb780f0c963..0838ba28b32 100644 ---- a/dlls/user32/user_private.h -+++ b/dlls/user32/user_private.h -@@ -28,6 +28,7 @@ - #include "winuser.h" - #include "winreg.h" - #include "winternl.h" -+#include "hidusage.h" - #include "wine/heap.h" - - #define GET_WORD(ptr) (*(const WORD *)(ptr)) -@@ -239,6 +240,7 @@ struct tagWND; - - struct hardware_msg_data; - extern BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_msg_data *msg_data); -+extern BOOL rawinput_device_get_usages(HANDLE handle, USAGE *usage_page, USAGE *usage); - extern struct rawinput_thread_data *rawinput_thread_data(void); - - extern void keyboard_init(void) DECLSPEC_HIDDEN; -diff --git a/server/queue.c b/server/queue.c -index ebbe4049ae8..3e6050686ae 100644 ---- a/server/queue.c -+++ b/server/queue.c -@@ -1994,6 +1994,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ - - switch (input->hw.msg) - { -+ case WM_INPUT: - case WM_INPUT_DEVICE_CHANGE: - raw_msg.foreground = NULL; - raw_msg.desktop = NULL; -diff --git a/server/trace.c b/server/trace.c -index 3b6c8387149..d84f4c9543a 100644 ---- a/server/trace.c -+++ b/server/trace.c -@@ -440,6 +440,7 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input ) - dump_uint64( ",lparam=", &input->hw.lparam ); - switch (input->hw.msg) - { -+ case WM_INPUT: - case WM_INPUT_DEVICE_CHANGE: - dump_rawinput( ",rawinput=", &input->hw.rawinput ); - } --- -2.30.2 - diff --git a/patches/user32-rawinput-hid/definition b/patches/user32-rawinput-hid/definition deleted file mode 100644 index d39ee187..00000000 --- a/patches/user32-rawinput-hid/definition +++ /dev/null @@ -1,2 +0,0 @@ -Fixes: [50506] WM_INPUT messages are not received for HID devices registered with RegisterRawInputDevices -Depends: loader-KeyboardLayouts diff --git a/patches/user32-rawinput-keyboard/definition b/patches/user32-rawinput-keyboard/definition index 8c4d2401..36d2db9f 100644 --- a/patches/user32-rawinput-keyboard/definition +++ b/patches/user32-rawinput-keyboard/definition @@ -1,3 +1,2 @@ Fixes: [35128] Air Conflicts (Pacific Carriers/Secret Wars) hangs at the loading screen (needs support for raw input in DInput8 keyboard) -Depends: user32-rawinput-hid Disabled: true diff --git a/patches/user32-rawinput-mouse-experimental/0001-winex11.drv-Add-support-for-absolute-RawMotion-event.patch b/patches/user32-rawinput-mouse-experimental/0001-winex11.drv-Add-support-for-absolute-RawMotion-event.patch index dbc0ec13..4ae0dd03 100644 --- a/patches/user32-rawinput-mouse-experimental/0001-winex11.drv-Add-support-for-absolute-RawMotion-event.patch +++ b/patches/user32-rawinput-mouse-experimental/0001-winex11.drv-Add-support-for-absolute-RawMotion-event.patch @@ -1,4 +1,4 @@ -From dc65316fb38101e2b0c0d3047553c06b3e951d7f Mon Sep 17 00:00:00 2001 +From f687aaf5963a1f2b10a4fa4212c93e5361afe927 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 25 Jun 2019 22:37:34 -0400 Subject: [PATCH] winex11.drv: Add support for absolute RawMotion events. @@ -27,10 +27,10 @@ and absolute position events. 6 files changed, 80 insertions(+), 48 deletions(-) diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c -index af9d6acb70e..f51f3666778 100644 +index 41d627c62c2..22220b92462 100644 --- a/dlls/user32/rawinput.c +++ b/dlls/user32/rawinput.c -@@ -301,7 +301,12 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms +@@ -316,7 +316,12 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms rawinput->header.hDevice = WINE_MOUSE_HANDLE; rawinput->header.wParam = 0; @@ -45,7 +45,7 @@ index af9d6acb70e..f51f3666778 100644 rawinput->data.mouse.u.s.usButtonData = 0; for (i = 1; i < ARRAY_SIZE(button_flags); ++i) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index 0558467a805..dcc9fe82fd1 100644 +index 7ff360d5127..76d2ba510da 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -331,32 +331,40 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator @@ -192,7 +192,7 @@ index 0558467a805..dcc9fe82fd1 100644 } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c -index b2c5f4016fe..3ef6eb6ecd0 100644 +index 92b296224eb..cd01b330881 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -37,6 +37,8 @@ @@ -213,7 +213,7 @@ index b2c5f4016fe..3ef6eb6ecd0 100644 #include "wine/server.h" #include "mwm.h" diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index 5f096b5d086..c1ed6eea1de 100644 +index 2fd8519971d..bce49b809e2 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -32,6 +32,9 @@ @@ -226,7 +226,7 @@ index 5f096b5d086..c1ed6eea1de 100644 #define BOOL X_BOOL #define BYTE X_BYTE -@@ -320,13 +323,6 @@ struct x11drv_escape_flush_gl_drawable +@@ -319,13 +322,6 @@ struct x11drv_escape_flush_gl_drawable * X11 USER driver */ @@ -240,7 +240,7 @@ index 5f096b5d086..c1ed6eea1de 100644 enum xi2_state { xi_unavailable = -1, -@@ -350,11 +346,13 @@ struct x11drv_thread_data +@@ -348,11 +344,13 @@ struct x11drv_thread_data Window clip_window; /* window used for cursor clipping */ HWND clip_hwnd; /* message window stored in desktop while clipping is active */ DWORD clip_reset; /* time when clipping was last reset */ @@ -256,7 +256,7 @@ index 5f096b5d086..c1ed6eea1de 100644 }; extern struct x11drv_thread_data *x11drv_init_thread_data(void) DECLSPEC_HIDDEN; -@@ -439,6 +437,8 @@ enum x11drv_atoms +@@ -437,6 +435,8 @@ enum x11drv_atoms XATOM_RAW_CAP_HEIGHT, XATOM_Rel_X, XATOM_Rel_Y, @@ -266,7 +266,7 @@ index 5f096b5d086..c1ed6eea1de 100644 XATOM_WM_DELETE_WINDOW, XATOM_WM_STATE, diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c -index 369515bba71..6f1e8c6cfb6 100644 +index c16825751c8..4ad6a5714ea 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -142,6 +142,8 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = @@ -279,11 +279,11 @@ index 369515bba71..6f1e8c6cfb6 100644 "WM_DELETE_WINDOW", "WM_STATE", diff --git a/server/queue.c b/server/queue.c -index 9da4cb48d0e..b305bec2d2d 100644 +index 552b5a1fe20..d783b5ace7a 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -1932,8 +1932,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons - msg_data->info = input->mouse.info; +@@ -1805,8 +1805,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons + msg_data->size = sizeof(*msg_data); msg_data->flags = flags; msg_data->rawinput.type = RIM_TYPEMOUSE; - msg_data->rawinput.mouse.x = x - desktop->cursor.x; diff --git a/patches/user32-rawinput-mouse/definition b/patches/user32-rawinput-mouse/definition index 79417ded..dc3fe9f3 100644 --- a/patches/user32-rawinput-mouse/definition +++ b/patches/user32-rawinput-mouse/definition @@ -1,3 +1,2 @@ Fixes: [42631] Mouse drift, jump or don't react to small slow movements in Unity-engine games and Fallout 4 (partly fixed in Unity games, have walkaround in Fallout4 ) Fixes: [42675] Overwatch: Phantom mouse input / view pulled up to ceiling -Depends: user32-rawinput-hid diff --git a/staging/upstream-commit b/staging/upstream-commit index 87109eb7..445c7ef2 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -35180d368a94156cb77b09560b24d3af428b988b +211da181c9140541ab7f7fcfa479367b3f7783eb