winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
June 2022
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
791 discussions
Start a n
N
ew thread
Timo Zuccarello : winebus: Optionally split joysticks with more than 6 axes.
by Alexandre Julliard
10 Jun '22
10 Jun '22
Module: wine Branch: master Commit: de280569a1d05905d9bd1abd89526aecf4dd3e81 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=de280569a1d05905d9bd1abd…
Author: Timo Zuccarello <timo(a)zuccarello.eu> Date: Thu Jun 2 23:00:40 2022 +0200 winebus: Optionally split joysticks with more than 6 axes. Add registry option "Split Controllers" and optionally split joysticks with more than 6 axes to improve compatibility with applications that do not support more than 6 axes where on Windows a driver would be installed that splits the device. Signed-off-by: Timo Zuccarello <timo(a)zuccarello.eu> Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/winebus.sys/bus_sdl.c | 89 +++++++++++++++++++++++++++++++++++----------- dlls/winebus.sys/main.c | 2 ++ dlls/winebus.sys/unixlib.h | 1 + 3 files changed, 71 insertions(+), 21 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index a5621972493..7dc47cdd518 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -28,6 +28,7 @@ #include <fcntl.h> #include <stdarg.h> #include <stdlib.h> +#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <dlfcn.h> @@ -143,6 +144,7 @@ struct sdl_device int effect_ids[256]; int effect_state[256]; LONG effect_flags; + int axis_offset; }; static inline struct sdl_device *impl_from_unix_device(struct unix_device *iface) @@ -155,7 +157,21 @@ static struct sdl_device *find_device_from_id(SDL_JoystickID id) struct sdl_device *impl; LIST_FOR_EACH_ENTRY(impl, &device_list, struct sdl_device, unix_device.entry) - if (impl->id == id) return impl; + if (impl->id == id && impl->axis_offset == 0) return impl; + + return NULL; +} + +static struct sdl_device *find_device_from_id_and_axis(SDL_JoystickID id, int axis) +{ + struct sdl_device *impl; + + LIST_FOR_EACH_ENTRY(impl, &device_list, struct sdl_device, unix_device.entry) + { + USHORT count = impl->unix_device.hid_device_state.abs_axis_count; + if (impl->id == id && impl->axis_offset <= axis && impl->axis_offset + count > axis) + return impl; + } return NULL; } @@ -184,7 +200,7 @@ static BOOL descriptor_add_haptic(struct sdl_device *impl) USHORT i, count = 0; USAGE usages[16]; - if (!pSDL_JoystickIsHaptic(impl->sdl_joystick) || + if (impl->axis_offset > 0 || !pSDL_JoystickIsHaptic(impl->sdl_joystick) || !(impl->sdl_haptic = pSDL_HapticOpenFromJoystick(impl->sdl_joystick))) impl->effect_support = 0; else @@ -196,7 +212,7 @@ static BOOL descriptor_add_haptic(struct sdl_device *impl) impl->effect_support |= WINE_SDL_HAPTIC_RUMBLE; } - if (pSDL_JoystickRumble && !pSDL_JoystickRumble(impl->sdl_joystick, 0, 0, 0)) + if (impl->axis_offset == 0 && pSDL_JoystickRumble && !pSDL_JoystickRumble(impl->sdl_joystick, 0, 0, 0)) impl->effect_support |= WINE_SDL_JOYSTICK_RUMBLE; if (impl->effect_support & EFFECT_SUPPORT_HAPTICS) @@ -262,6 +278,7 @@ static NTSTATUS build_joystick_report_descriptor(struct unix_device *iface) USAGE_AND_PAGE physical_usage; axis_count = pSDL_JoystickNumAxes(impl->sdl_joystick); + if (options.split_controllers) axis_count = min(6, axis_count - impl->axis_offset); if (axis_count > ARRAY_SIZE(absolute_usages)) { FIXME("More than %zu absolute axes found, ignoring.\n", ARRAY_SIZE(absolute_usages)); @@ -275,8 +292,16 @@ static NTSTATUS build_joystick_report_descriptor(struct unix_device *iface) ball_count = ARRAY_SIZE(relative_usages) / 2; } - hat_count = pSDL_JoystickNumHats(impl->sdl_joystick); - button_count = pSDL_JoystickNumButtons(impl->sdl_joystick); + if (impl->axis_offset == 0) + { + hat_count = pSDL_JoystickNumHats(impl->sdl_joystick); + button_count = pSDL_JoystickNumButtons(impl->sdl_joystick); + } + else + { + hat_count = 0; + button_count = 0; + } if (!pSDL_JoystickGetType) physical_usage = device_usage; else switch (pSDL_JoystickGetType(impl->sdl_joystick)) @@ -902,8 +927,9 @@ static void sdl_add_device(unsigned int index) SDL_JoystickID id; SDL_JoystickGUID guid; SDL_GameController *controller = NULL; - const char *str; - char guid_str[33]; + const char *product; + char guid_str[33], buffer[ARRAY_SIZE(desc.product)]; + int axis_count, axis_offset; if ((joystick = pSDL_JoystickOpen(index)) == NULL) { @@ -914,9 +940,9 @@ static void sdl_add_device(unsigned int index) if (options.map_controllers && pSDL_IsGameController(index)) controller = pSDL_GameControllerOpen(index); - if (controller) str = pSDL_GameControllerName(controller); - else str = pSDL_JoystickName(joystick); - if (str) ntdll_umbstowcs(str, strlen(str) + 1, desc.product, ARRAY_SIZE(desc.product)); + if (controller) product = pSDL_GameControllerName(controller); + else product = pSDL_JoystickName(joystick); + if (!product) product = "Joystick"; id = pSDL_JoystickInstanceID(joystick); @@ -936,25 +962,35 @@ static void sdl_add_device(unsigned int index) pSDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str)); ntdll_umbstowcs(guid_str, strlen(guid_str) + 1, desc.serialnumber, ARRAY_SIZE(desc.serialnumber)); - if (controller) desc.is_gamepad = TRUE; + if (controller) + { + desc.is_gamepad = TRUE; + axis_count = 6; + } else { - int button_count, axis_count; - + int button_count = pSDL_JoystickNumButtons(joystick); axis_count = pSDL_JoystickNumAxes(joystick); - button_count = pSDL_JoystickNumButtons(joystick); desc.is_gamepad = (axis_count == 6 && button_count >= 14); } - TRACE("%s id %d, desc %s.\n", controller ? "controller" : "joystick", id, debugstr_device_desc(&desc)); + for (axis_offset = 0; axis_offset < axis_count; axis_offset += (options.split_controllers ? 6 : axis_count)) + { + if (!axis_offset) strcpy(buffer, product); + else snprintf(buffer, ARRAY_SIZE(buffer), "%s %d", product, axis_offset / 6); + ntdll_umbstowcs(buffer, strlen(buffer) + 1, desc.product, ARRAY_SIZE(desc.product)); + + TRACE("%s id %d, axis_offset %u, desc %s.\n", controller ? "controller" : "joystick", id, axis_offset, debugstr_device_desc(&desc)); - if (!(impl = hid_device_create(&sdl_device_vtbl, sizeof(struct sdl_device)))) return; - list_add_tail(&device_list, &impl->unix_device.entry); - impl->sdl_joystick = joystick; - impl->sdl_controller = controller; - impl->id = id; + if (!(impl = hid_device_create(&sdl_device_vtbl, sizeof(struct sdl_device)))) return; + list_add_tail(&device_list, &impl->unix_device.entry); + impl->sdl_joystick = joystick; + impl->sdl_controller = controller; + impl->id = id; + impl->axis_offset = axis_offset; - bus_event_queue_device_created(&event_queue, &impl->unix_device, &desc); + bus_event_queue_device_created(&event_queue, &impl->unix_device, &desc); + } } static void process_device_event(SDL_Event *event) @@ -975,6 +1011,17 @@ static void process_device_event(SDL_Event *event) if (impl) bus_event_queue_device_removed(&event_queue, &impl->unix_device); else WARN("failed to find device with id %d\n", id); } + else if (event->type == SDL_JOYAXISMOTION && options.split_controllers) + { + id = event->jaxis.which; + impl = find_device_from_id_and_axis(id, event->jaxis.axis); + if (!impl) WARN("failed to find device with id %d for axis %d\n", id, event->jaxis.axis); + else + { + event->jaxis.axis -= impl->axis_offset; + set_report_from_joystick_event(impl, event); + } + } else if (event->type >= SDL_JOYAXISMOTION && event->type <= SDL_JOYBUTTONUP) { id = ((SDL_JoyButtonEvent *)event)->which; diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 4588fee1b02..35db8a5fb9a 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -720,6 +720,8 @@ static NTSTATUS sdl_driver_init(void) }; NTSTATUS status; + bus_options.split_controllers = check_bus_option(L"Split Controllers", 0); + if (bus_options.split_controllers) TRACE("SDL controller splitting enabled\n"); bus_options.map_controllers = check_bus_option(L"Map Controllers", 1); if (!bus_options.map_controllers) TRACE("SDL controller to XInput HID gamepad mapping disabled\n"); sdl_bus_load_mappings(&bus_options); diff --git a/dlls/winebus.sys/unixlib.h b/dlls/winebus.sys/unixlib.h index a84a3331a25..f43cd03c89a 100644 --- a/dlls/winebus.sys/unixlib.h +++ b/dlls/winebus.sys/unixlib.h @@ -46,6 +46,7 @@ struct device_desc struct sdl_bus_options { + BOOL split_controllers; BOOL map_controllers; /* freed after bus_init */ UINT mappings_count;
1
0
0
0
Rémi Bernon : dinput/tests: Merge keyboard.c tests into device8.c.
by Alexandre Julliard
10 Jun '22
10 Jun '22
Module: wine Branch: master Commit: e1083de9a7153bbdeb2691180074dd2b5c6a828e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e1083de9a7153bbdeb269118…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Jun 8 15:45:00 2022 +0200 dinput/tests: Merge keyboard.c tests into device8.c. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/dinput/tests/Makefile.in | 3 +- dlls/dinput/tests/device8.c | 298 +++++++++++++++++++++++++++ dlls/dinput/tests/keyboard.c | 458 ------------------------------------------ 3 files changed, 299 insertions(+), 460 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=e1083de9a7153bbdeb26…
1
0
0
0
Rémi Bernon : dinput/tests: Run keyboard info tests for every dinput version.
by Alexandre Julliard
10 Jun '22
10 Jun '22
Module: wine Branch: master Commit: cda4596cadac856933a7f23fac366a20447888d7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cda4596cadac856933a7f23f…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Jun 2 13:39:46 2022 +0200 dinput/tests: Run keyboard info tests for every dinput version. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/dinput/tests/device8.c | 51 ++++++++++++++-------- dlls/dinput/tests/keyboard.c | 101 ------------------------------------------- 2 files changed, 34 insertions(+), 118 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=cda4596cadac856933a7…
1
0
0
0
Rémi Bernon : dinput/tests: Merge mouse.c tests into device8.c.
by Alexandre Julliard
10 Jun '22
10 Jun '22
Module: wine Branch: master Commit: 74b9bd676725a167454d610823f64595b52d00ff URL:
https://source.winehq.org/git/wine.git/?a=commit;h=74b9bd676725a167454d6108…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Jun 2 10:37:31 2022 +0200 dinput/tests: Merge mouse.c tests into device8.c. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/dinput/tests/Makefile.in | 3 +- dlls/dinput/tests/device8.c | 182 +++++++++++++++++++++++++++++++ dlls/dinput/tests/mouse.c | 242 ------------------------------------------ 3 files changed, 183 insertions(+), 244 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=74b9bd676725a167454d…
1
0
0
0
Rémi Bernon : dinput/tests: Run mouse info tests for every dinput version.
by Alexandre Julliard
10 Jun '22
10 Jun '22
Module: wine Branch: master Commit: fd46b4bb48a603ad13fd8a82d198d575141d2c71 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=fd46b4bb48a603ad13fd8a82…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Jun 2 10:37:31 2022 +0200 dinput/tests: Run mouse info tests for every dinput version. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/dinput/tests/device8.c | 82 ++++++++++++++++++++++++++++++++--------- dlls/dinput/tests/mouse.c | 90 --------------------------------------------- 2 files changed, 65 insertions(+), 107 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=fd46b4bb48a603ad13fd…
1
0
0
0
Rémi Bernon : dinput: Fix DIPROP_FFGAIN mouse and keyboard tests.
by Alexandre Julliard
10 Jun '22
10 Jun '22
Module: wine Branch: master Commit: d4ea5f98c3e93eef756ddd035baf707c5e877e2a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d4ea5f98c3e93eef756ddd03…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Jun 2 15:44:04 2022 +0200 dinput: Fix DIPROP_FFGAIN mouse and keyboard tests. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/dinput/device.c | 2 +- dlls/dinput/tests/device8.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 9e7cb20453c..f4bdce51633 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1394,9 +1394,9 @@ static HRESULT WINAPI dinput_device_set_property( IDirectInputDevice8W *iface, c case (DWORD_PTR)DIPROP_FFGAIN: { const DIPROPDWORD *value = (const DIPROPDWORD *)header; - if (!impl->vtbl->send_device_gain) return DIERR_UNSUPPORTED; impl->device_gain = value->dwData; if (!is_exclusively_acquired( impl )) return DI_OK; + if (!impl->vtbl->send_device_gain) return DI_OK; return impl->vtbl->send_device_gain( iface, impl->device_gain ); } case (DWORD_PTR)DIPROP_AXISMODE: diff --git a/dlls/dinput/tests/device8.c b/dlls/dinput/tests/device8.c index 7bd3600df61..a5c647713f2 100644 --- a/dlls/dinput/tests/device8.c +++ b/dlls/dinput/tests/device8.c @@ -1745,14 +1745,14 @@ static void test_mouse_info(void) hr = IDirectInputDevice8_GetProperty( device, DIPROP_KEYNAME, &prop_string.diph ); ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_KEYNAME returned %#lx\n", hr ); - prop_range.diph.dwHow = DIPH_DEVICE; - prop_range.diph.dwObj = 0; + prop_dword.diph.dwHow = DIPH_DEVICE; + prop_dword.diph.dwObj = 0; prop_dword.dwData = 0xdeadbeef; hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); - ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr ); + ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr ); prop_dword.dwData = 1000; hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); - ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr ); + ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr ); res = 0; hr = IDirectInputDevice8_EnumObjects( device, check_object_count, &res, DIDFT_AXIS | DIDFT_PSHBUTTON ); @@ -2080,14 +2080,14 @@ static void test_keyboard_info(void) hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_RANGE returned %#lx\n", hr ); - prop_range.diph.dwHow = DIPH_DEVICE; - prop_range.diph.dwObj = 0; + prop_dword.diph.dwHow = DIPH_DEVICE; + prop_dword.diph.dwObj = 0; prop_dword.dwData = 0xdeadbeef; hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); - ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr ); + ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr ); prop_dword.dwData = 1000; hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); - ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr ); + ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr ); res = 0; hr = IDirectInputDevice8_EnumObjects( device, check_object_count, &res, DIDFT_AXIS | DIDFT_PSHBUTTON );
1
0
0
0
Rémi Bernon : dinput/tests: Add some broken joystick axis results.
by Alexandre Julliard
10 Jun '22
10 Jun '22
Module: wine Branch: master Commit: 6a95003b8b3acc0394f273bd4d5cbdc6fd6e4271 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6a95003b8b3acc0394f273bd…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Jun 8 18:15:04 2022 +0200 dinput/tests: Add some broken joystick axis results. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/dinput/tests/joystick8.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index c706276f146..e73330815a0 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -1682,8 +1682,8 @@ static void test_simple_joystick( DWORD version ) hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state ); ok( hr == DI_OK, "GetDeviceState returned: %#lx\n", hr ); - check_member( state, expect_state_abs[1], "%ld", lX ); - check_member( state, expect_state_abs[1], "%ld", lY ); + ok( state.lX == expect_state_abs[1].lX || broken( state.lX == 16853 ) /* w8 */, "got lX %ld", state.lX ); + ok( state.lY == expect_state_abs[1].lY || broken( state.lY == 16853 ) /* w8 */, "got lY %ld", state.lY ); check_member( state, expect_state_abs[1], "%ld", lZ ); check_member( state, expect_state_abs[1], "%ld", lRx ); check_member( state, expect_state_abs[1], "%ld", rgdwPOV[0] );
1
0
0
0
Zebediah Figura : user32: Use registry APIs to enumerate raw input devices.
by Alexandre Julliard
10 Jun '22
10 Jun '22
Module: wine Branch: master Commit: b0731f6e7e281620fe6e6b809ea84be72ea77b9e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b0731f6e7e281620fe6e6b80…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Sun May 15 12:31:09 2022 -0500 user32: Use registry APIs to enumerate raw input devices. --- dlls/user32/rawinput.c | 119 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 84 insertions(+), 35 deletions(-) diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c index 3750332c0cf..ab542956f11 100644 --- a/dlls/user32/rawinput.c +++ b/dlls/user32/rawinput.c @@ -30,18 +30,13 @@ #include "winnls.h" #include "winreg.h" #include "winuser.h" -#include "setupapi.h" +#include "ddk/hidclass.h" #include "wine/debug.h" #include "wine/server.h" #include "wine/hid.h" #include "user_private.h" -#include "initguid.h" -#include "ddk/hidclass.h" -#include "ntddmou.h" -#include "ntddkbd.h" - WINE_DEFAULT_DEBUG_CHANNEL(rawinput); struct device @@ -92,40 +87,47 @@ static BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int return TRUE; } -static struct device *add_device( HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface, DWORD type ) +static ULONG query_reg_value( HKEY hkey, const WCHAR *name, + KEY_VALUE_PARTIAL_INFORMATION *info, ULONG size ) { + unsigned int name_size = name ? lstrlenW( name ) * sizeof(WCHAR) : 0; + UNICODE_STRING nameW = { name_size, name_size, (WCHAR *)name }; + + if (NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, + info, size, &size )) + return 0; + + return size - FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data); +} + +static struct device *add_device( HKEY key, DWORD type ) +{ + static const WCHAR symbolic_linkW[] = {'S','y','m','b','o','l','i','c','L','i','n','k',0}; + char value_buffer[4096]; + KEY_VALUE_PARTIAL_INFORMATION *value = (KEY_VALUE_PARTIAL_INFORMATION *)value_buffer; static const RID_DEVICE_INFO_KEYBOARD keyboard_info = {0, 0, 1, 12, 3, 101}; static const RID_DEVICE_INFO_MOUSE mouse_info = {1, 5, 0, FALSE}; - SP_DEVINFO_DATA device_data = {sizeof(device_data)}; struct hid_preparsed_data *preparsed = NULL; - SP_DEVICE_INTERFACE_DETAIL_DATA_W *detail; HID_COLLECTION_INFORMATION hid_info; struct device *device = NULL; RID_DEVICE_INFO info; IO_STATUS_BLOCK io; WCHAR *path, *pos; NTSTATUS status; + unsigned int i; UINT32 handle; - DWORD i, size; HANDLE file; - SetupDiGetDeviceInterfaceDetailW(set, iface, NULL, 0, &size, &device_data); - if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) + if (!query_reg_value( key, symbolic_linkW, value, sizeof(value_buffer) )) { - ERR("Failed to get device path, error %#lx.\n", GetLastError()); - return FALSE; + ERR( "failed to get symbolic link value\n" ); + return NULL; } - if (!(detail = malloc(size))) - { - ERR("Failed to allocate memory.\n"); - return FALSE; - } - detail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W); - SetupDiGetDeviceInterfaceDetailW(set, iface, detail, size, NULL, NULL); - path = wcsdup( detail->DevicePath ); - free( detail ); - if (!path) return NULL; + if (!(path = malloc( value->DataLength + sizeof(WCHAR) ))) + return NULL; + memcpy( path, value->Data, value->DataLength ); + path[value->DataLength / sizeof(WCHAR)] = 0; /* upper case everything but the GUID */ for (pos = path; *pos && *pos != '{'; pos++) *pos = towupper(*pos); @@ -234,18 +236,65 @@ fail: return NULL; } -static void enumerate_devices( DWORD type, const GUID *guid ) +static HKEY reg_open_key( HKEY root, const WCHAR *name, ULONG name_len ) { - SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)}; - HDEVINFO set; - DWORD idx; + UNICODE_STRING nameW = { name_len, name_len, (WCHAR *)name }; + OBJECT_ATTRIBUTES attr; + HANDLE ret; + + attr.Length = sizeof(attr); + attr.RootDirectory = root; + attr.ObjectName = &nameW; + attr.Attributes = 0; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + + if (NtOpenKeyEx( &ret, MAXIMUM_ALLOWED, &attr, 0 )) return 0; + return ret; +} - set = SetupDiGetClassDevsW( guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT ); +static const WCHAR device_classesW[] = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\DeviceClasses\\"; +static const WCHAR guid_devinterface_hidW[] = L"{4d1e55b2-f16f-11cf-88cb-001111000030}"; +static const WCHAR guid_devinterface_keyboardW[] = L"{884b96c3-56ef-11d1-bc8c-00a0c91405dd}"; +static const WCHAR guid_devinterface_mouseW[] = L"{378de44c-56ef-11d1-bc8c-00a0c91405dd}"; - for (idx = 0; SetupDiEnumDeviceInterfaces( set, NULL, &GUID_DEVINTERFACE_HID, idx, &iface); ++idx ) - add_device( set, &iface, type ); +static void enumerate_devices( DWORD type, const WCHAR *class ) +{ + WCHAR buffer[1024]; + KEY_NODE_INFORMATION *subkey_info = (void *)buffer; + HKEY class_key, device_key, iface_key; + unsigned int i, j; + DWORD size; + + wcscpy( buffer, device_classesW ); + wcscat( buffer, class ); + if (!(class_key = reg_open_key( NULL, buffer, wcslen( buffer ) * sizeof(WCHAR) ))) + return; + + for (i = 0; !NtEnumerateKey( class_key, i, KeyNodeInformation, buffer, sizeof(buffer), &size ); ++i) + { + if (!(device_key = reg_open_key( class_key, subkey_info->Name, subkey_info->NameLength ))) + { + ERR( "failed to open %s\n", debugstr_wn(subkey_info->Name, subkey_info->NameLength / sizeof(WCHAR)) ); + continue; + } + + for (j = 0; !NtEnumerateKey( device_key, j, KeyNodeInformation, buffer, sizeof(buffer), &size ); ++j) + { + if (!(iface_key = reg_open_key( device_key, subkey_info->Name, subkey_info->NameLength ))) + { + ERR( "failed to open %s\n", debugstr_wn(subkey_info->Name, subkey_info->NameLength / sizeof(WCHAR)) ); + continue; + } + + add_device( iface_key, type ); + NtClose( iface_key ); + } + + NtClose( device_key ); + } - SetupDiDestroyDeviceInfoList( set ); + NtClose( class_key ); } void rawinput_update_device_list(void) @@ -265,9 +314,9 @@ void rawinput_update_device_list(void) } rawinput_devices_count = 0; - enumerate_devices( RIM_TYPEHID, &GUID_DEVINTERFACE_HID ); - enumerate_devices( RIM_TYPEMOUSE, &GUID_DEVINTERFACE_MOUSE ); - enumerate_devices( RIM_TYPEKEYBOARD, &GUID_DEVINTERFACE_KEYBOARD ); + enumerate_devices( RIM_TYPEHID, guid_devinterface_hidW ); + enumerate_devices( RIM_TYPEMOUSE, guid_devinterface_mouseW ); + enumerate_devices( RIM_TYPEKEYBOARD, guid_devinterface_keyboardW ); LeaveCriticalSection(&rawinput_devices_cs); }
1
0
0
0
Zebediah Figura : user32: Store the device path as a simple string pointer.
by Alexandre Julliard
10 Jun '22
10 Jun '22
Module: wine Branch: master Commit: 5d63f809c98dc2733a25d5d55f9a5d942aad5158 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5d63f809c98dc2733a25d5d5…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Sun May 15 12:23:27 2022 -0500 user32: Store the device path as a simple string pointer. --- dlls/user32/rawinput.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c index e7ff854e3b5..3750332c0cf 100644 --- a/dlls/user32/rawinput.c +++ b/dlls/user32/rawinput.c @@ -46,7 +46,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(rawinput); struct device { - SP_DEVICE_INTERFACE_DETAIL_DATA_W *detail; + WCHAR *path; HANDLE file; HANDLE handle; RID_DEVICE_INFO info; @@ -103,11 +103,11 @@ static struct device *add_device( HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface, struct device *device = NULL; RID_DEVICE_INFO info; IO_STATUS_BLOCK io; + WCHAR *path, *pos; NTSTATUS status; UINT32 handle; DWORD i, size; HANDLE file; - WCHAR *pos; SetupDiGetDeviceInterfaceDetailW(set, iface, NULL, 0, &size, &device_data); if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) @@ -123,16 +123,19 @@ static struct device *add_device( HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface, } detail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W); SetupDiGetDeviceInterfaceDetailW(set, iface, detail, size, NULL, NULL); + path = wcsdup( detail->DevicePath ); + free( detail ); + if (!path) return NULL; /* upper case everything but the GUID */ - for (pos = detail->DevicePath; *pos && *pos != '{'; pos++) *pos = towupper(*pos); + for (pos = path; *pos && *pos != '{'; pos++) *pos = towupper(*pos); - file = CreateFileW(detail->DevicePath, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); + file = CreateFileW( path, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 ); if (file == INVALID_HANDLE_VALUE) { - ERR("Failed to open device file %s, error %lu.\n", debugstr_w(detail->DevicePath), GetLastError()); - free(detail); + ERR( "Failed to open device file %s, error %lu.\n", debugstr_w(path), GetLastError() ); + free( path ); return NULL; } @@ -199,16 +202,16 @@ static struct device *add_device( HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface, if (device) { - TRACE("Updating device %x / %s.\n", handle, debugstr_w(detail->DevicePath)); + TRACE( "Updating device %#x / %s.\n", handle, debugstr_w(path) ); free(device->data); CloseHandle(device->file); - free(device->detail); + free( device->path ); } else if (array_reserve((void **)&rawinput_devices, &rawinput_devices_max, rawinput_devices_count + 1, sizeof(*rawinput_devices))) { device = &rawinput_devices[rawinput_devices_count++]; - TRACE("Adding device %x / %s.\n", handle, debugstr_w(detail->DevicePath)); + TRACE( "Adding device %#x / %s.\n", handle, debugstr_w(path) ); } else { @@ -216,7 +219,7 @@ static struct device *add_device( HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface, goto fail; } - device->detail = detail; + device->path = path; device->file = file; device->handle = ULongToHandle(handle); device->info = info; @@ -227,7 +230,7 @@ static struct device *add_device( HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface, fail: free( preparsed ); CloseHandle( file ); - free( detail ); + free( path ); return NULL; } @@ -258,7 +261,7 @@ void rawinput_update_device_list(void) { free(rawinput_devices[idx].data); CloseHandle(rawinput_devices[idx].file); - free(rawinput_devices[idx].detail); + free( rawinput_devices[idx].path ); } rawinput_devices_count = 0; @@ -762,8 +765,8 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT switch (command) { case RIDI_DEVICENAME: - if ((len = wcslen(device->detail->DevicePath) + 1) <= data_len && data) - memcpy(data, device->detail->DevicePath, len * sizeof(WCHAR)); + if ((len = wcslen( device->path ) + 1) <= data_len && data) + memcpy( data, device->path, len * sizeof(WCHAR) ); *data_size = len; break;
1
0
0
0
Jinoh Kang : comctl32: Fix integer overflow in DPA_Search.
by Alexandre Julliard
10 Jun '22
10 Jun '22
Module: wine Branch: master Commit: 58571710ba7421bc2fee5c912157d16a90a1c7b5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=58571710ba7421bc2fee5c91…
Author: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Date: Sat Mar 12 20:54:29 2022 +0900 comctl32: Fix integer overflow in DPA_Search. Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/comctl32/dpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/comctl32/dpa.c b/dlls/comctl32/dpa.c index b8d23f6cafa..aa9a045e516 100644 --- a/dlls/comctl32/dpa.c +++ b/dlls/comctl32/dpa.c @@ -859,7 +859,7 @@ INT WINAPI DPA_Search (HDPA hdpa, LPVOID pFind, INT nStart, r = hdpa->nItemCount - 1; lpPtr = hdpa->ptrs; while (r >= l) { - x = (l + r) / 2; + x = l + (r - l) / 2; n = (pfnCompare)(pFind, lpPtr[x], lParam); if (n == 0) return x;
1
0
0
0
← Newer
1
...
47
48
49
50
51
52
53
...
80
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Results per page:
10
25
50
100
200