From 0daf8417127067b1c107cc6bca61c535897e72fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 21 Sep 2021 09:52:45 +0200 Subject: [PATCH] dinput: Fix HID joystick DIPH_BYUSAGE object enumeration. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Alexandre Julliard --- 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 );