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
September 2021
----- 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
1030 discussions
Start a n
N
ew thread
Rémi Bernon : dinput: Return correct errors from HID joystick IDirectInputDevice8_SetProperty.
by Alexandre Julliard
21 Sep '21
21 Sep '21
Module: wine Branch: master Commit: 78f04ca082070b77d2b2252b208bc4f8a93daf43 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=78f04ca082070b77d2b2252b…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Sep 21 09:52:47 2021 +0200 dinput: Return correct errors from HID joystick IDirectInputDevice8_SetProperty. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/joystick_hid.c | 12 ++++++++++++ dlls/dinput8/tests/hid.c | 7 ------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 9cacda6b02b..35a85f0f3d3 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -582,6 +582,18 @@ static HRESULT WINAPI hid_joystick_SetProperty( IDirectInputDevice8W *iface, con if (header->dwSize != sizeof(DIPROPRANGE)) return DIERR_INVALIDPARAM; enum_value_objects( impl, header, DIDFT_AXIS, set_property_prop_range, (void *)header ); return DI_OK; + case (DWORD_PTR)DIPROP_FFLOAD: + case (DWORD_PTR)DIPROP_GRANULARITY: + case (DWORD_PTR)DIPROP_VIDPID: + if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; + return DIERR_READONLY; + case (DWORD_PTR)DIPROP_TYPENAME: + case (DWORD_PTR)DIPROP_USERNAME: + if (header->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM; + return DIERR_READONLY; + case (DWORD_PTR)DIPROP_GUIDANDPATH: + if (header->dwSize != sizeof(DIPROPGUIDANDPATH)) return DIERR_INVALIDPARAM; + return DIERR_READONLY; default: return IDirectInputDevice2WImpl_SetProperty( iface, guid, header ); } diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index a290072f660..cf4762ec86b 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -4337,17 +4337,14 @@ static void test_simple_joystick(void) hr = IDirectInputDevice8_SetProperty( device, DIPROP_VIDPID, NULL ); ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SetProperty returned %#x\n", hr ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_VIDPID, &prop_string.diph ); - todo_wine ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SetProperty returned %#x\n", hr ); prop_dword.diph.dwHow = DIPH_DEVICE; prop_dword.diph.dwObj = 0; prop_dword.dwData = 0xdeadbeef; hr = IDirectInputDevice8_SetProperty( device, DIPROP_VIDPID, &prop_dword.diph ); - todo_wine ok( hr == DIERR_READONLY, "IDirectInputDevice8_SetProperty DIPROP_VIDPID returned %#x\n", hr ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_GUIDANDPATH, &prop_guid_path.diph ); - todo_wine ok( hr == DIERR_READONLY, "IDirectInputDevice8_SetProperty DIPROP_GUIDANDPATH returned %#x\n", hr ); prop_string.diph.dwHow = DIPH_DEVICE; @@ -4367,16 +4364,12 @@ static void test_simple_joystick(void) debugstr_w(prop_string.wsz) ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_TYPENAME, &prop_string.diph ); - todo_wine ok( hr == DIERR_READONLY, "IDirectInputDevice8_SetProperty DIPROP_TYPENAME returned %#x\n", hr ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_USERNAME, &prop_string.diph ); - todo_wine ok( hr == DIERR_READONLY, "IDirectInputDevice8_SetProperty DIPROP_USERNAME returned %#x\n", hr ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFLOAD, &prop_dword.diph ); - todo_wine ok( hr == DIERR_READONLY, "IDirectInputDevice8_SetProperty DIPROP_FFLOAD returned %#x\n", hr ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph ); - todo_wine ok( hr == DIERR_READONLY, "IDirectInputDevice8_SetProperty DIPROP_GRANULARITY returned %#x\n", hr ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_JOYSTICKID, &prop_dword.diph );
1
0
0
0
Rémi Bernon : dinput: Check sizes in HID joystick IDirectInputDevice8_GetProperty.
by Alexandre Julliard
21 Sep '21
21 Sep '21
Module: wine Branch: master Commit: b4dfa8ff7be2394213fc6ebe867debbbe423f709 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b4dfa8ff7be2394213fc6ebe…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Sep 21 09:52:46 2021 +0200 dinput: Check sizes in HID joystick IDirectInputDevice8_GetProperty. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/joystick_hid.c | 9 +++++++++ dlls/dinput8/tests/hid.c | 2 -- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index fb0d769d85f..9cacda6b02b 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -500,28 +500,33 @@ static HRESULT WINAPI hid_joystick_GetProperty( IDirectInputDevice8W *iface, con TRACE( "iface %p, guid %s, header %p\n", iface, debugstr_guid( guid ), header ); if (!header) return DIERR_INVALIDPARAM; + if (header->dwHeaderSize != sizeof(DIPROPHEADER)) return DIERR_INVALIDPARAM; if (!IS_DIPROP( guid )) return DI_OK; switch (LOWORD( guid )) { case (DWORD_PTR)DIPROP_RANGE: + if (header->dwSize != sizeof(DIPROPRANGE)) return DIERR_INVALIDPARAM; enum_value_objects( impl, header, DIDFT_AXIS, get_property_prop_range, header ); return DI_OK; case (DWORD_PTR)DIPROP_PRODUCTNAME: { DIPROPSTRING *value = (DIPROPSTRING *)header; + if (header->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM; lstrcpynW( value->wsz, impl->instance.tszProductName, MAX_PATH ); return DI_OK; } case (DWORD_PTR)DIPROP_INSTANCENAME: { DIPROPSTRING *value = (DIPROPSTRING *)header; + if (header->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM; lstrcpynW( value->wsz, impl->instance.tszInstanceName, MAX_PATH ); return DI_OK; } case (DWORD_PTR)DIPROP_VIDPID: { DIPROPDWORD *value = (DIPROPDWORD *)header; + if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; if (!impl->attrs.VendorID || !impl->attrs.ProductID) return DIERR_UNSUPPORTED; value->dwData = MAKELONG( impl->attrs.VendorID, impl->attrs.ProductID ); return DI_OK; @@ -529,12 +534,14 @@ static HRESULT WINAPI hid_joystick_GetProperty( IDirectInputDevice8W *iface, con case (DWORD_PTR)DIPROP_JOYSTICKID: { DIPROPDWORD *value = (DIPROPDWORD *)header; + if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; value->dwData = impl->instance.guidInstance.Data3; return DI_OK; } case (DWORD_PTR)DIPROP_GUIDANDPATH: { DIPROPGUIDANDPATH *value = (DIPROPGUIDANDPATH *)header; + if (header->dwSize != sizeof(DIPROPGUIDANDPATH)) return DIERR_INVALIDPARAM; lstrcpynW( value->wszPath, impl->device_path, MAX_PATH ); return DI_OK; } @@ -566,11 +573,13 @@ static HRESULT WINAPI hid_joystick_SetProperty( IDirectInputDevice8W *iface, con TRACE( "iface %p, guid %s, header %p\n", iface, debugstr_guid( guid ), header ); if (!header) return DIERR_INVALIDPARAM; + if (header->dwHeaderSize != sizeof(DIPROPHEADER)) return DIERR_INVALIDPARAM; if (!IS_DIPROP( guid )) return DI_OK; switch (LOWORD( guid )) { case (DWORD_PTR)DIPROP_RANGE: + if (header->dwSize != sizeof(DIPROPRANGE)) return DIERR_INVALIDPARAM; enum_value_objects( impl, header, DIDFT_AXIS, set_property_prop_range, (void *)header ); return DI_OK; default: diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 1afb2916d4d..a290072f660 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -3785,11 +3785,9 @@ static void test_simple_joystick(void) hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, NULL ); ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_GetProperty returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, &prop_string.diph ); - todo_wine ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_GetProperty returned %#x\n", hr ); prop_dword.diph.dwHeaderSize = sizeof(DIPROPHEADER) - 1; hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, &prop_dword.diph ); - todo_wine ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_GetProperty returned %#x\n", hr ); prop_dword.diph.dwHeaderSize = sizeof(DIPROPHEADER);
1
0
0
0
Rémi Bernon : dinput: Fix HID joystick DIPH_BYUSAGE object enumeration.
by Alexandre Julliard
21 Sep '21
21 Sep '21
Module: wine Branch: master Commit: 0daf8417127067b1c107cc6bca61c535897e72fa URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0daf8417127067b1c107cc6b…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Sep 21 09:52:45 2021 +0200 dinput: Fix HID joystick DIPH_BYUSAGE object enumeration. This adds some todo_wine because we now get the correct object, but it has incorrect offset and instance number. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/joystick_hid.c | 3 ++- dlls/dinput8/tests/hid.c | 12 +++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index a9ca6fe6cc6..fb0d769d85f 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -209,7 +209,8 @@ static BOOL enum_object( struct hid_joystick *impl, const DIPROPHEADER *filter, if ((filter->dwObj & 0x00ffffff) != (instance->dwType & 0x00ffffff)) return DIENUM_CONTINUE; return callback( impl, caps, instance, data ); case DIPH_BYUSAGE: - if (LOWORD(filter->dwObj) != instance->wUsagePage || HIWORD(filter->dwObj) != instance->wUsage) return DIENUM_CONTINUE; + if (HIWORD( filter->dwObj ) != instance->wUsagePage) return DIENUM_CONTINUE; + if (LOWORD( filter->dwObj ) != instance->wUsage) return DIENUM_CONTINUE; return callback( impl, caps, instance, data ); default: FIXME( "unimplemented filter dwHow %#x dwObj %#x\n", filter->dwHow, filter->dwObj ); diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index e5e1bfde79d..1afb2916d4d 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -3919,9 +3919,7 @@ static void test_simple_joystick(void) prop_range.lMax = 0xdeadbeef; hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); ok( hr == DI_OK, "IDirectInputDevice8_GetProperty DIPROP_RANGE returned %#x\n", hr ); - todo_wine ok( prop_range.lMin == 0, "got %d expected %d\n", prop_range.lMin, 0 ); - todo_wine ok( prop_range.lMax == 65535, "got %d expected %d\n", prop_range.lMax, 65535 ); prop_pointer.diph.dwHow = DIPH_BYUSAGE; @@ -3962,9 +3960,10 @@ static void test_simple_joystick(void) ok( hr == DI_OK, "IDirectInputDevice8_GetObjectInfo returned: %#x\n", hr ); check_member( objinst, expect_objects[1], "%u", dwSize ); - todo_wine check_member_guid( objinst, expect_objects[1], guidType ); + todo_wine check_member( objinst, expect_objects[1], "%#x", dwOfs ); + todo_wine check_member( objinst, expect_objects[1], "%#x", dwType ); check_member( objinst, expect_objects[1], "%#x", dwFlags ); if (!localized) todo_wine check_member_wstr( objinst, expect_objects[1], tszName ); @@ -3974,7 +3973,6 @@ static void test_simple_joystick(void) check_member( objinst, expect_objects[1], "%u", wCollectionNumber ); check_member( objinst, expect_objects[1], "%u", wDesignatorIndex ); check_member( objinst, expect_objects[1], "%#04x", wUsagePage ); - todo_wine check_member( objinst, expect_objects[1], "%#04x", wUsage ); check_member( objinst, expect_objects[1], "%#04x", dwDimension ); check_member( objinst, expect_objects[1], "%#04x", wExponent ); @@ -4310,9 +4308,7 @@ static void test_simple_joystick(void) prop_range.lMax = 0xdeadbeef; hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); ok( hr == DI_OK, "IDirectInputDevice8_GetProperty DIPROP_RANGE returned %#x\n", hr ); - todo_wine ok( prop_range.lMin == -14000, "got %d expected %d\n", prop_range.lMin, -14000 ); - todo_wine ok( prop_range.lMax == -4000, "got %d expected %d\n", prop_range.lMax, -4000 ); prop_range.diph.dwHow = DIPH_BYUSAGE; prop_range.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_Y, HID_USAGE_PAGE_GENERIC ); @@ -4320,9 +4316,7 @@ static void test_simple_joystick(void) prop_range.lMax = 0xdeadbeef; hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); ok( hr == DI_OK, "IDirectInputDevice8_GetProperty DIPROP_RANGE returned %#x\n", hr ); - todo_wine ok( prop_range.lMin == 1000, "got %d expected %d\n", prop_range.lMin, 1000 ); - todo_wine ok( prop_range.lMax == 51000, "got %d expected %d\n", prop_range.lMax, 51000 ); hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state ); @@ -4478,7 +4472,7 @@ static void test_simple_joystick(void) if (broken( state.lX == -10750 )) win_skip( "Ignoring 32-bit rounding\n" ); else { - todo_wine + todo_wine_if( i != 2 ) check_member( state, expect_state_abs[i], "%d", lX ); todo_wine_if( i != 2 ) check_member( state, expect_state_abs[i], "%d", lY );
1
0
0
0
Rémi Bernon : dinput8/tests: Don't check device object data sequence numbers.
by Alexandre Julliard
21 Sep '21
21 Sep '21
Module: wine Branch: master Commit: af58bbb0c4d2878bf5aac5320e08cf10f3dc6592 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=af58bbb0c4d2878bf5aac532…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Sep 21 09:52:44 2021 +0200 dinput8/tests: Don't check device object data sequence numbers. We usually have them wrong but sometimes right. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput8/tests/hid.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index b02cdf1aa30..e5e1bfde79d 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -4214,8 +4214,6 @@ static void test_simple_joystick(void) ok( res == 1, "got %u expected %u\n", res, 1 ); check_member( objdata[0], expect_objdata[0], "%#x", dwOfs ); check_member( objdata[0], expect_objdata[0], "%#x", dwData ); - todo_wine - check_member( objdata[0], expect_objdata[0], "%#x", dwSequence ); ok( objdata[0].uAppData == -1, "got %p, expected %p\n", (void *)objdata[0].uAppData, (void *)-1 ); res = 4; hr = IDirectInputDevice8_GetDeviceData( device, sizeof(DIDEVICEOBJECTDATA), objdata, &res, 0 ); @@ -4226,8 +4224,6 @@ static void test_simple_joystick(void) winetest_push_context( "objdata[%d]", i ); check_member( objdata[i], expect_objdata[1 + i], "%#x", dwOfs ); check_member( objdata[i], expect_objdata[1 + i], "%#x", dwData ); - todo_wine - check_member( objdata[i], expect_objdata[1 + i], "%#x", dwSequence ); ok( objdata[i].uAppData == -1, "got %p, expected %p\n", (void *)objdata[i].uAppData, (void *)-1 ); winetest_pop_context(); }
1
0
0
0
Rémi Bernon : winebus.sys: Simplify SDL controller report descriptor creation.
by Alexandre Julliard
21 Sep '21
21 Sep '21
Module: wine Branch: master Commit: 837575395223f15851d8dc2e2735b9c0553f6f9f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=837575395223f15851d8dc2e…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Sep 21 08:36:44 2021 +0200 winebus.sys: Simplify SDL controller report descriptor creation. Now that we have xinput.sys for translation there's no need to keep this compatible. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus_sdl.c | 99 +++++++++++++++++----------------------------- 1 file changed, 37 insertions(+), 62 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index bfa95387afe..9f6596f5c7d 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -152,10 +152,6 @@ static struct platform_private *find_device_from_id(SDL_JoystickID id) return NULL; } -#define CONTROLLER_NUM_BUTTONS 11 -#define CONTROLLER_NUM_AXES 6 -#define CONTROLLER_NUM_HATSWITCHES 1 - static void set_button_value(struct platform_private *ext, int index, int value) { int byte_index = ext->button_start + index / 8; @@ -173,14 +169,10 @@ static void set_button_value(struct platform_private *ext, int index, int value) } } -static void set_axis_value(struct platform_private *ext, int index, short value, BOOL controller) +static void set_axis_value(struct platform_private *ext, int index, short value) { DWORD *report = (DWORD *)(ext->report_buffer + ext->axis_start); - - if (controller && (index == SDL_CONTROLLER_AXIS_TRIGGERLEFT || index == SDL_CONTROLLER_AXIS_TRIGGERRIGHT)) - report[index] = LE_DWORD(value); - else - report[index] = LE_DWORD(value) + 32768; + report[index] = LE_DWORD(value); } static void set_ball_value(struct platform_private *ext, int index, int value1, int value2) @@ -316,7 +308,7 @@ static NTSTATUS build_joystick_report_descriptor(struct platform_private *ext) /* Initialize axis in the report */ for (i = 0; i < axis_count; i++) - set_axis_value(ext, i, pSDL_JoystickGetAxis(ext->sdl_joystick, i), FALSE); + set_axis_value(ext, i, pSDL_JoystickGetAxis(ext->sdl_joystick, i)); for (i = 0; i < hat_count; i++) set_hat_value(ext, i, pSDL_JoystickGetHat(ext->sdl_joystick, i)); @@ -355,22 +347,18 @@ static SHORT compose_dpad_value(SDL_GameController *joystick) return SDL_HAT_CENTERED; } -static NTSTATUS build_mapped_report_descriptor(struct platform_private *ext) +static NTSTATUS build_controller_report_descriptor(struct platform_private *ext) { static const USAGE left_axis_usages[] = {HID_USAGE_GENERIC_X, HID_USAGE_GENERIC_Y}; static const USAGE right_axis_usages[] = {HID_USAGE_GENERIC_RX, HID_USAGE_GENERIC_RY}; static const USAGE trigger_axis_usages[] = {HID_USAGE_GENERIC_Z, HID_USAGE_GENERIC_RZ}; - INT i; - - static const int BUTTON_BIT_COUNT = CONTROLLER_NUM_BUTTONS; + ULONG i, button_count = SDL_CONTROLLER_BUTTON_MAX - 1; + C_ASSERT(SDL_CONTROLLER_AXIS_MAX == 6); ext->axis_start = 0; - ext->hat_start = CONTROLLER_NUM_AXES * sizeof(DWORD); - ext->button_start = ext->hat_start + CONTROLLER_NUM_HATSWITCHES; - - ext->buffer_length = (BUTTON_BIT_COUNT + 7) / 8 - + CONTROLLER_NUM_HATSWITCHES - + CONTROLLER_NUM_AXES * sizeof(DWORD); + ext->hat_start = SDL_CONTROLLER_AXIS_MAX * sizeof(DWORD); + ext->button_start = ext->hat_start + 1; + ext->buffer_length = ext->button_start + (button_count + 7) / 8; TRACE("Report will be %i bytes\n", ext->buffer_length); @@ -378,21 +366,21 @@ static NTSTATUS build_mapped_report_descriptor(struct platform_private *ext) return STATUS_NO_MEMORY; if (!hid_descriptor_add_axes(&ext->desc, 2, HID_USAGE_PAGE_GENERIC, left_axis_usages, - FALSE, 0, 0xffff)) + FALSE, -32768, 32767)) return STATUS_NO_MEMORY; if (!hid_descriptor_add_axes(&ext->desc, 2, HID_USAGE_PAGE_GENERIC, right_axis_usages, - FALSE, 0, 0xffff)) + FALSE, -32768, 32767)) return STATUS_NO_MEMORY; if (!hid_descriptor_add_axes(&ext->desc, 2, HID_USAGE_PAGE_GENERIC, trigger_axis_usages, - FALSE, 0, 0x7fff)) + FALSE, 0, 32767)) return STATUS_NO_MEMORY; - if (!hid_descriptor_add_hatswitch(&ext->desc, CONTROLLER_NUM_HATSWITCHES)) + if (!hid_descriptor_add_hatswitch(&ext->desc, 1)) return STATUS_NO_MEMORY; - if (!hid_descriptor_add_buttons(&ext->desc, HID_USAGE_PAGE_BUTTON, 1, CONTROLLER_NUM_BUTTONS)) + if (!hid_descriptor_add_buttons(&ext->desc, HID_USAGE_PAGE_BUTTON, 1, button_count)) return STATUS_NO_MEMORY; if (!descriptor_add_haptic(ext)) @@ -405,8 +393,7 @@ static NTSTATUS build_mapped_report_descriptor(struct platform_private *ext) /* Initialize axis in the report */ for (i = SDL_CONTROLLER_AXIS_LEFTX; i < SDL_CONTROLLER_AXIS_MAX; i++) - set_axis_value(ext, i, pSDL_GameControllerGetAxis(ext->sdl_controller, i), TRUE); - + set_axis_value(ext, i, pSDL_GameControllerGetAxis(ext->sdl_controller, i)); set_hat_value(ext, 0, compose_dpad_value(ext->sdl_controller)); return STATUS_SUCCESS; @@ -424,7 +411,7 @@ static void sdl_device_destroy(struct unix_device *iface) static NTSTATUS sdl_device_start(struct unix_device *iface) { struct platform_private *ext = impl_from_unix_device(iface); - if (ext->sdl_controller) return build_mapped_report_descriptor(ext); + if (ext->sdl_controller) return build_controller_report_descriptor(ext); return build_joystick_report_descriptor(ext); } @@ -547,7 +534,7 @@ static BOOL set_report_from_joystick_event(struct platform_private *device, SDL_ if (ie->axis < 6) { - set_axis_value(device, ie->axis, ie->value, FALSE); + set_axis_value(device, ie->axis, ie->value); bus_event_queue_input_report(&event_queue, iface, device->report_buffer, device->buffer_length); } break; @@ -574,7 +561,7 @@ static BOOL set_report_from_joystick_event(struct platform_private *device, SDL_ return FALSE; } -static BOOL set_mapped_report_from_event(struct platform_private *device, SDL_Event *event) +static BOOL set_report_from_controller_event(struct platform_private *device, SDL_Event *event) { struct unix_device *iface = &device->unix_device; @@ -583,47 +570,35 @@ static BOOL set_mapped_report_from_event(struct platform_private *device, SDL_Ev case SDL_CONTROLLERBUTTONDOWN: case SDL_CONTROLLERBUTTONUP: { - int usage = -1; SDL_ControllerButtonEvent *ie = &event->cbutton; + int button; - switch (ie->button) + switch ((button = ie->button)) { - case SDL_CONTROLLER_BUTTON_A: usage = 0; break; - case SDL_CONTROLLER_BUTTON_B: usage = 1; break; - case SDL_CONTROLLER_BUTTON_X: usage = 2; break; - case SDL_CONTROLLER_BUTTON_Y: usage = 3; break; - case SDL_CONTROLLER_BUTTON_LEFTSHOULDER: usage = 4; break; - case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER: usage = 5; break; - case SDL_CONTROLLER_BUTTON_BACK: usage = 6; break; - case SDL_CONTROLLER_BUTTON_START: usage = 7; break; - case SDL_CONTROLLER_BUTTON_LEFTSTICK: usage = 8; break; - case SDL_CONTROLLER_BUTTON_RIGHTSTICK: usage = 9; break; - case SDL_CONTROLLER_BUTTON_GUIDE: usage = 10; break; - - case SDL_CONTROLLER_BUTTON_DPAD_UP: - case SDL_CONTROLLER_BUTTON_DPAD_DOWN: - case SDL_CONTROLLER_BUTTON_DPAD_LEFT: - case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: - set_hat_value(device, 0, compose_dpad_value(device->sdl_controller)); - bus_event_queue_input_report(&event_queue, iface, device->report_buffer, device->buffer_length); - break; - - default: - ERR("Unknown Button %i\n",ie->button); + case SDL_CONTROLLER_BUTTON_DPAD_UP: + case SDL_CONTROLLER_BUTTON_DPAD_DOWN: + case SDL_CONTROLLER_BUTTON_DPAD_LEFT: + case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: + set_hat_value(device, 0, compose_dpad_value(device->sdl_controller)); + break; + case SDL_CONTROLLER_BUTTON_LEFTSHOULDER: button = 4; break; + case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER: button = 5; break; + case SDL_CONTROLLER_BUTTON_BACK: button = 6; break; + case SDL_CONTROLLER_BUTTON_START: button = 7; break; + case SDL_CONTROLLER_BUTTON_LEFTSTICK: button = 8; break; + case SDL_CONTROLLER_BUTTON_RIGHTSTICK: button = 9; break; + case SDL_CONTROLLER_BUTTON_GUIDE: button = 10; break; } - if (usage >= 0) - { - set_button_value(device, usage, ie->state); - bus_event_queue_input_report(&event_queue, iface, device->report_buffer, device->buffer_length); - } + set_button_value(device, button, ie->state); + bus_event_queue_input_report(&event_queue, iface, device->report_buffer, device->buffer_length); break; } case SDL_CONTROLLERAXISMOTION: { SDL_ControllerAxisEvent *ie = &event->caxis; - set_axis_value(device, ie->axis, ie->value, TRUE); + set_axis_value(device, ie->axis, ie->value); bus_event_queue_input_report(&event_queue, iface, device->report_buffer, device->buffer_length); break; } @@ -727,7 +702,7 @@ static void process_device_event(SDL_Event *event) { id = ((SDL_ControllerButtonEvent *)event)->which; device = find_device_from_id(id); - if (device) set_mapped_report_from_event(device, event); + if (device) set_report_from_controller_event(device, event); else WARN("failed to find device with id %d\n", id); }
1
0
0
0
Rémi Bernon : winebus.sys: Simplify SDL joystick report descriptor creation.
by Alexandre Julliard
21 Sep '21
21 Sep '21
Module: wine Branch: master Commit: 4a15cc9eb9665a44c8948f51d2035f2aa3ac2791 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4a15cc9eb9665a44c8948f51…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Sep 21 08:36:43 2021 +0200 winebus.sys: Simplify SDL joystick report descriptor creation. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus_sdl.c | 73 +++++++++++++--------------------------------- 1 file changed, 21 insertions(+), 52 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index bebe2eeb0f2..bfa95387afe 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -241,13 +241,10 @@ static BOOL descriptor_add_haptic(struct platform_private *ext) return TRUE; } -static NTSTATUS build_report_descriptor(struct platform_private *ext) +static NTSTATUS build_joystick_report_descriptor(struct platform_private *ext) { - INT i; - INT report_size; - INT button_count, axis_count, ball_count, hat_count; - static const USAGE device_usage[2] = {HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_GAMEPAD}; - static const USAGE controller_usages[] = { + static const USAGE joystick_usages[] = + { HID_USAGE_GENERIC_X, HID_USAGE_GENERIC_Y, HID_USAGE_GENERIC_Z, @@ -256,19 +253,11 @@ static NTSTATUS build_report_descriptor(struct platform_private *ext) HID_USAGE_GENERIC_RZ, HID_USAGE_GENERIC_SLIDER, HID_USAGE_GENERIC_DIAL, - HID_USAGE_GENERIC_WHEEL}; - static const USAGE joystick_usages[] = { - HID_USAGE_GENERIC_X, - HID_USAGE_GENERIC_Y, - HID_USAGE_GENERIC_Z, - HID_USAGE_GENERIC_RZ, - HID_USAGE_GENERIC_RX, - HID_USAGE_GENERIC_RY, - HID_USAGE_GENERIC_SLIDER, - HID_USAGE_GENERIC_DIAL, - HID_USAGE_GENERIC_WHEEL}; + HID_USAGE_GENERIC_WHEEL + }; - report_size = 0; + int i, report_size = 1; + int button_count, axis_count, ball_count, hat_count; axis_count = pSDL_JoystickNumAxes(ext->sdl_joystick); if (axis_count > 6) @@ -276,24 +265,17 @@ static NTSTATUS build_report_descriptor(struct platform_private *ext) FIXME("Clamping joystick to 6 axis\n"); axis_count = 6; } - ext->axis_start = report_size; - if (axis_count) - { - report_size += (sizeof(DWORD) * axis_count); - } + report_size += (sizeof(DWORD) * axis_count); ball_count = pSDL_JoystickNumBalls(ext->sdl_joystick); - ext->ball_start = report_size; - if (ball_count) + if (axis_count + ball_count * 2 > ARRAY_SIZE(joystick_usages)) { - if ((ball_count*2) + axis_count > 9) - { - FIXME("Capping ball + axis at 9\n"); - ball_count = (9-axis_count)/2; - } - report_size += (sizeof(DWORD) * 2 * ball_count); + FIXME("Capping ball + axis at 9\n"); + ball_count = (ARRAY_SIZE(joystick_usages) - axis_count) / 2; } + ext->ball_start = report_size; + report_size += (sizeof(DWORD) * 2 * ball_count); hat_count = pSDL_JoystickNumHats(ext->sdl_joystick); ext->hat_start = report_size; @@ -306,21 +288,12 @@ static NTSTATUS build_report_descriptor(struct platform_private *ext) TRACE("Report will be %i bytes\n", report_size); - if (!hid_descriptor_begin(&ext->desc, device_usage[0], device_usage[1])) + if (!hid_descriptor_begin(&ext->desc, HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_JOYSTICK)) return STATUS_NO_MEMORY; - if (axis_count == 6 && button_count >= 14) - { - if (!hid_descriptor_add_axes(&ext->desc, axis_count, HID_USAGE_PAGE_GENERIC, - controller_usages, FALSE, 0, 0xffff)) - return STATUS_NO_MEMORY; - } - else if (axis_count) - { - if (!hid_descriptor_add_axes(&ext->desc, axis_count, HID_USAGE_PAGE_GENERIC, - joystick_usages, FALSE, 0, 0xffff)) - return STATUS_NO_MEMORY; - } + if (axis_count && !hid_descriptor_add_axes(&ext->desc, axis_count, HID_USAGE_PAGE_GENERIC, + joystick_usages, FALSE, -32768, 32767)) + return STATUS_NO_MEMORY; if (ball_count && !hid_descriptor_add_axes(&ext->desc, ball_count * 2, HID_USAGE_PAGE_GENERIC, &joystick_usages[axis_count], TRUE, INT32_MIN, INT32_MAX)) @@ -452,7 +425,7 @@ static NTSTATUS sdl_device_start(struct unix_device *iface) { struct platform_private *ext = impl_from_unix_device(iface); if (ext->sdl_controller) return build_mapped_report_descriptor(ext); - return build_report_descriptor(ext); + return build_joystick_report_descriptor(ext); } static void sdl_device_stop(struct unix_device *iface) @@ -550,15 +523,11 @@ static const struct unix_device_vtbl sdl_device_vtbl = sdl_device_set_feature_report, }; -static BOOL set_report_from_event(struct platform_private *device, SDL_Event *event) +static BOOL set_report_from_joystick_event(struct platform_private *device, SDL_Event *event) { struct unix_device *iface = &device->unix_device; - if (device->sdl_controller) - { - /* We want mapped events */ - return TRUE; - } + if (device->sdl_controller) return TRUE; /* use controller events instead */ switch(event->type) { @@ -751,7 +720,7 @@ static void process_device_event(SDL_Event *event) { id = ((SDL_JoyButtonEvent *)event)->which; device = find_device_from_id(id); - if (device) set_report_from_event(device, event); + if (device) set_report_from_joystick_event(device, event); else WARN("failed to find device with id %d\n", id); } else if (event->type >= SDL_CONTROLLERAXISMOTION && event->type <= SDL_CONTROLLERBUTTONUP)
1
0
0
0
Rémi Bernon : winebus.sys: Always add padding after button blocks.
by Alexandre Julliard
21 Sep '21
21 Sep '21
Module: wine Branch: master Commit: 8221229498a119ec0af1d48e42d2eb83580956b5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8221229498a119ec0af1d48e…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Sep 21 08:36:42 2021 +0200 winebus.sys: Always add padding after button blocks. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus_sdl.c | 7 ------- dlls/winebus.sys/bus_udev.c | 7 ------- dlls/winebus.sys/hid.c | 21 +++++++++++---------- dlls/winebus.sys/unix_private.h | 1 - 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index c83276aa873..bebe2eeb0f2 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -422,13 +422,6 @@ static NTSTATUS build_mapped_report_descriptor(struct platform_private *ext) if (!hid_descriptor_add_buttons(&ext->desc, HID_USAGE_PAGE_BUTTON, 1, CONTROLLER_NUM_BUTTONS)) return STATUS_NO_MEMORY; - if (BUTTON_BIT_COUNT % 8 != 0) - { - /* unused bits between hatswitch and following constant */ - if (!hid_descriptor_add_padding(&ext->desc, 8 - (BUTTON_BIT_COUNT % 8))) - return STATUS_NO_MEMORY; - } - if (!descriptor_add_haptic(ext)) return STATUS_NO_MEMORY; diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 00c64829172..b9e5c968d0c 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -521,13 +521,6 @@ static NTSTATUS build_report_descriptor(struct wine_input_private *ext, struct u if (!hid_descriptor_add_buttons(&ext->desc, HID_USAGE_PAGE_BUTTON, 1, button_count)) return STATUS_NO_MEMORY; - if (button_count % 8) - { - BYTE padding = 8 - (button_count % 8); - if (!hid_descriptor_add_padding(&ext->desc, padding)) - return STATUS_NO_MEMORY; - } - report_size += (button_count + 7) / 8; } diff --git a/dlls/winebus.sys/hid.c b/dlls/winebus.sys/hid.c index ba9fa4ba12d..d2dff7e5a24 100644 --- a/dlls/winebus.sys/hid.c +++ b/dlls/winebus.sys/hid.c @@ -99,6 +99,7 @@ void hid_descriptor_free(struct hid_descriptor *desc) BOOL hid_descriptor_add_buttons(struct hid_descriptor *desc, USAGE usage_page, USAGE usage_min, USAGE usage_max) { + const USHORT count = usage_max - usage_min + 1; const BYTE template[] = { USAGE_PAGE(2, usage_page), @@ -108,24 +109,24 @@ BOOL hid_descriptor_add_buttons(struct hid_descriptor *desc, USAGE usage_page, LOGICAL_MAXIMUM(1, 1), PHYSICAL_MINIMUM(1, 0), PHYSICAL_MAXIMUM(1, 1), - REPORT_COUNT(2, usage_max - usage_min + 1), + REPORT_COUNT(2, count), REPORT_SIZE(1, 1), INPUT(1, Data|Var|Abs), }; - - return hid_descriptor_append(desc, template, sizeof(template)); -} - -BOOL hid_descriptor_add_padding(struct hid_descriptor *desc, BYTE bitcount) -{ - const BYTE template[] = + const BYTE template_pad[] = { - REPORT_COUNT(1, bitcount), + REPORT_COUNT(1, 8 - (count % 8)), REPORT_SIZE(1, 1), INPUT(1, Cnst|Var|Abs), }; - return hid_descriptor_append(desc, template, sizeof(template)); + if (!hid_descriptor_append(desc, template, sizeof(template))) + return FALSE; + + if ((count % 8) && !hid_descriptor_append(desc, template_pad, sizeof(template_pad))) + return FALSE; + + return TRUE; } BOOL hid_descriptor_add_hatswitch(struct hid_descriptor *desc, INT count) diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 069b6a0964a..cfb56d2d83e 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -82,7 +82,6 @@ extern void hid_descriptor_free(struct hid_descriptor *desc) DECLSPEC_HIDDEN; extern BOOL hid_descriptor_add_buttons(struct hid_descriptor *desc, USAGE usage_page, USAGE usage_min, USAGE usage_max) DECLSPEC_HIDDEN; -extern BOOL hid_descriptor_add_padding(struct hid_descriptor *desc, BYTE bitcount) DECLSPEC_HIDDEN; extern BOOL hid_descriptor_add_hatswitch(struct hid_descriptor *desc, INT count) DECLSPEC_HIDDEN; extern BOOL hid_descriptor_add_axes(struct hid_descriptor *desc, BYTE count, USAGE usage_page, const USAGE *usages, BOOL rel, LONG min, LONG max) DECLSPEC_HIDDEN;
1
0
0
0
Rémi Bernon : winebus.sys: Move hats before buttons and use one byte each.
by Alexandre Julliard
21 Sep '21
21 Sep '21
Module: wine Branch: master Commit: 593c4d51493c95b6ffa87c0572f893b42233d803 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=593c4d51493c95b6ffa87c05…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Sep 21 08:36:41 2021 +0200 winebus.sys: Move hats before buttons and use one byte each. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus_sdl.c | 57 ++++++++++++++------------------------------- dlls/winebus.sys/bus_udev.c | 34 +++++++++++++-------------- dlls/winebus.sys/hid.c | 2 +- 3 files changed, 35 insertions(+), 58 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index a589814ee26..c83276aa873 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -126,7 +126,7 @@ struct platform_private int button_start; int axis_start; int ball_start; - int hat_bit_offs; /* hatswitches are reported in the same bytes as buttons */ + int hat_start; struct hid_descriptor desc; @@ -193,26 +193,8 @@ static void set_ball_value(struct platform_private *ext, int index, int value1, static void set_hat_value(struct platform_private *ext, int index, int value) { - int byte = ext->button_start + (ext->hat_bit_offs + 4 * index) / 8; - int bit_offs = (ext->hat_bit_offs + 4 * index) % 8; - int num_low_bits, num_high_bits; - unsigned char val, low_mask, high_mask; - - /* 4-bit hatswitch value is packed into button bytes */ - if (bit_offs <= 4) - { - num_low_bits = 4; - num_high_bits = 0; - low_mask = 0xf; - high_mask = 0; - } - else - { - num_low_bits = 8 - bit_offs; - num_high_bits = 4 - num_low_bits; - low_mask = (1 << num_low_bits) - 1; - high_mask = (1 << num_high_bits) - 1; - } + int byte = ext->hat_start + index; + unsigned char val; switch (value) { @@ -231,13 +213,7 @@ static void set_hat_value(struct platform_private *ext, int index, int value) default: return; } - ext->report_buffer[byte] &= ~(low_mask << bit_offs); - ext->report_buffer[byte] |= (val & low_mask) << bit_offs; - if (high_mask) - { - ext->report_buffer[byte + 1] &= ~high_mask; - ext->report_buffer[byte + 1] |= val & high_mask; - } + ext->report_buffer[byte] = val; } static BOOL descriptor_add_haptic(struct platform_private *ext) @@ -319,14 +295,14 @@ static NTSTATUS build_report_descriptor(struct platform_private *ext) report_size += (sizeof(DWORD) * 2 * ball_count); } + hat_count = pSDL_JoystickNumHats(ext->sdl_joystick); + ext->hat_start = report_size; + report_size += hat_count; + /* For now lump all buttons just into incremental usages, Ignore Keys */ button_count = pSDL_JoystickNumButtons(ext->sdl_joystick); ext->button_start = report_size; - - hat_count = pSDL_JoystickNumHats(ext->sdl_joystick); - ext->hat_bit_offs = button_count; - - report_size += (button_count + hat_count * 4 + 7) / 8; + report_size += (button_count + 7) / 8; TRACE("Report will be %i bytes\n", report_size); @@ -350,10 +326,10 @@ static NTSTATUS build_report_descriptor(struct platform_private *ext) &joystick_usages[axis_count], TRUE, INT32_MIN, INT32_MAX)) return STATUS_NO_MEMORY; - if (button_count && !hid_descriptor_add_buttons(&ext->desc, HID_USAGE_PAGE_BUTTON, 1, button_count)) + if (hat_count && !hid_descriptor_add_hatswitch(&ext->desc, hat_count)) return STATUS_NO_MEMORY; - if (hat_count && !hid_descriptor_add_hatswitch(&ext->desc, hat_count)) + if (button_count && !hid_descriptor_add_buttons(&ext->desc, HID_USAGE_PAGE_BUTTON, 1, button_count)) return STATUS_NO_MEMORY; if (!descriptor_add_haptic(ext)) @@ -413,13 +389,14 @@ static NTSTATUS build_mapped_report_descriptor(struct platform_private *ext) static const USAGE trigger_axis_usages[] = {HID_USAGE_GENERIC_Z, HID_USAGE_GENERIC_RZ}; INT i; - static const int BUTTON_BIT_COUNT = CONTROLLER_NUM_BUTTONS + CONTROLLER_NUM_HATSWITCHES * 4; + static const int BUTTON_BIT_COUNT = CONTROLLER_NUM_BUTTONS; ext->axis_start = 0; - ext->button_start = CONTROLLER_NUM_AXES * sizeof(DWORD); - ext->hat_bit_offs = CONTROLLER_NUM_BUTTONS; + ext->hat_start = CONTROLLER_NUM_AXES * sizeof(DWORD); + ext->button_start = ext->hat_start + CONTROLLER_NUM_HATSWITCHES; ext->buffer_length = (BUTTON_BIT_COUNT + 7) / 8 + + CONTROLLER_NUM_HATSWITCHES + CONTROLLER_NUM_AXES * sizeof(DWORD); TRACE("Report will be %i bytes\n", ext->buffer_length); @@ -439,10 +416,10 @@ static NTSTATUS build_mapped_report_descriptor(struct platform_private *ext) FALSE, 0, 0x7fff)) return STATUS_NO_MEMORY; - if (!hid_descriptor_add_buttons(&ext->desc, HID_USAGE_PAGE_BUTTON, 1, CONTROLLER_NUM_BUTTONS)) + if (!hid_descriptor_add_hatswitch(&ext->desc, CONTROLLER_NUM_HATSWITCHES)) return STATUS_NO_MEMORY; - if (!hid_descriptor_add_hatswitch(&ext->desc, 1)) + if (!hid_descriptor_add_buttons(&ext->desc, HID_USAGE_PAGE_BUTTON, 1, CONTROLLER_NUM_BUTTONS)) return STATUS_NO_MEMORY; if (BUTTON_BIT_COUNT % 8 != 0) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index e62c8c2eda1..00c64829172 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -496,6 +496,23 @@ static NTSTATUS build_report_descriptor(struct wine_input_private *ext, struct u rel_count++; } + hat_count = 0; + for (i = ABS_HAT0X; i <=ABS_HAT3X; i+=2) + { + if (!test_bit(absbits, i)) continue; + ext->hat_map[i - ABS_HAT0X] = report_size; + ext->hat_values[i - ABS_HAT0X] = 0; + ext->hat_values[i - ABS_HAT0X + 1] = 0; + report_size++; + hat_count++; + } + + if (hat_count) + { + if (!hid_descriptor_add_hatswitch(&ext->desc, hat_count)) + return STATUS_NO_MEMORY; + } + /* For now lump all buttons just into incremental usages, Ignore Keys */ ext->button_start = report_size; button_count = count_buttons(ext->base.device_fd, ext->button_map); @@ -514,23 +531,6 @@ static NTSTATUS build_report_descriptor(struct wine_input_private *ext, struct u report_size += (button_count + 7) / 8; } - hat_count = 0; - for (i = ABS_HAT0X; i <=ABS_HAT3X; i+=2) - { - if (!test_bit(absbits, i)) continue; - ext->hat_map[i - ABS_HAT0X] = report_size; - ext->hat_values[i - ABS_HAT0X] = 0; - ext->hat_values[i - ABS_HAT0X + 1] = 0; - report_size++; - hat_count++; - } - - if (hat_count) - { - if (!hid_descriptor_add_hatswitch(&ext->desc, hat_count)) - return STATUS_NO_MEMORY; - } - if (!hid_descriptor_end(&ext->desc)) return STATUS_NO_MEMORY; diff --git a/dlls/winebus.sys/hid.c b/dlls/winebus.sys/hid.c index feff8aec013..ba9fa4ba12d 100644 --- a/dlls/winebus.sys/hid.c +++ b/dlls/winebus.sys/hid.c @@ -138,7 +138,7 @@ BOOL hid_descriptor_add_hatswitch(struct hid_descriptor *desc, INT count) LOGICAL_MAXIMUM(1, 8), PHYSICAL_MINIMUM(1, 0), PHYSICAL_MAXIMUM(2, 8), - REPORT_SIZE(1, 4), + REPORT_SIZE(1, 8), REPORT_COUNT(4, count), UNIT(1, 0x0e /* none */), INPUT(1, Data|Var|Abs|Null),
1
0
0
0
Rémi Bernon : winebus.sys: Enforce all axis values to be 32bit.
by Alexandre Julliard
21 Sep '21
21 Sep '21
Module: wine Branch: master Commit: d7c4867257e0388096839c3208fb6e8a7d19625e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d7c4867257e0388096839c32…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Sep 21 08:36:40 2021 +0200 winebus.sys: Enforce all axis values to be 32bit. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus_sdl.c | 40 +++++++++++++++++--------------------- dlls/winebus.sys/bus_udev.c | 15 ++++++-------- dlls/winebus.sys/hid.c | 43 +++++------------------------------------ dlls/winebus.sys/unix_private.h | 2 +- 4 files changed, 30 insertions(+), 70 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=d7c4867257e038809683…
1
0
0
0
Rémi Bernon : winebus.sys: Remove the bogus SDL "unknown" HID report constant.
by Alexandre Julliard
21 Sep '21
21 Sep '21
Module: wine Branch: master Commit: 059764e87ea32b0c0bb32c84d5f4749558c874f2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=059764e87ea32b0c0bb32c84…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Sep 21 08:36:39 2021 +0200 winebus.sys: Remove the bogus SDL "unknown" HID report constant. It was used for XInput compatibility and is not needed anymore. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus_sdl.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index b7734b4016e..bf36830b817 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -424,8 +424,7 @@ static NTSTATUS build_mapped_report_descriptor(struct platform_private *ext) ext->hat_bit_offs = CONTROLLER_NUM_BUTTONS; ext->buffer_length = (BUTTON_BIT_COUNT + 7) / 8 - + CONTROLLER_NUM_AXES * sizeof(WORD) - + 2/* unknown constant*/; + + CONTROLLER_NUM_AXES * sizeof(WORD); TRACE("Report will be %i bytes\n", ext->buffer_length); @@ -457,10 +456,6 @@ static NTSTATUS build_mapped_report_descriptor(struct platform_private *ext) return STATUS_NO_MEMORY; } - /* unknown constant */ - if (!hid_descriptor_add_padding(&ext->desc, 16)) - return STATUS_NO_MEMORY; - if (!descriptor_add_haptic(ext)) return STATUS_NO_MEMORY; @@ -475,10 +470,6 @@ static NTSTATUS build_mapped_report_descriptor(struct platform_private *ext) set_hat_value(ext, 0, compose_dpad_value(ext->sdl_controller)); - /* unknown constant */ - ext->report_buffer[14] = 0x89; - ext->report_buffer[15] = 0xc5; - return STATUS_SUCCESS; failed:
1
0
0
0
← Newer
1
...
35
36
37
38
39
40
41
...
103
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Results per page:
10
25
50
100
200