[PATCH 3/3] dinput: Fix keyboard behavior for injected events with scancode=0.

Brendan Shanks bshanks at codeweavers.com
Fri Apr 10 00:52:13 CDT 2020


Grand Theft Auto IV injects VK_F8 and scancode=0, and expects
DirectInput not to report that F8 is pressed.

Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
---
 dlls/dinput/keyboard.c      | 3 ---
 dlls/dinput8/tests/device.c | 2 --
 2 files changed, 5 deletions(-)

diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
index 47f28cac52..cecf6c546f 100644
--- a/dlls/dinput/keyboard.c
+++ b/dlls/dinput/keyboard.c
@@ -70,9 +70,6 @@ static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(SysKeyboardIm
 
 static BYTE map_dik_code(DWORD scanCode, DWORD vkCode, DWORD subType)
 {
-    if (!scanCode)
-        scanCode = MapVirtualKeyW(vkCode, MAPVK_VK_TO_VSC);
-
     if (subType == DIDEVTYPEKEYBOARD_JAPAN106)
     {
         switch (scanCode)
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
index cf748c55d9..663630ae0c 100644
--- a/dlls/dinput8/tests/device.c
+++ b/dlls/dinput8/tests/device.c
@@ -819,7 +819,6 @@ static void test_keyboard_events(void)
     data_size = ARRAY_SIZE(obj_data);
     hr = IDirectInputDevice8_GetDeviceData(di_keyboard, sizeof(DIDEVICEOBJECTDATA), obj_data, &data_size, 0);
     ok(SUCCEEDED(hr), "Failed to get data hr=%08x\n", hr);
-    todo_wine
     ok(data_size == 0, "Expected 0 elements, received %d\n", data_size);
 
     hr = IDirectInputDevice8_GetDeviceState(di_keyboard, sizeof(kbdata), kbdata);
@@ -833,7 +832,6 @@ static void test_keyboard_events(void)
     data_size = ARRAY_SIZE(obj_data);
     hr = IDirectInputDevice8_GetDeviceData(di_keyboard, sizeof(DIDEVICEOBJECTDATA), obj_data, &data_size, 0);
     ok(SUCCEEDED(hr), "Failed to get data hr=%08x\n", hr);
-    todo_wine
     ok(data_size == 0, "Expected 0 elements, received %d\n", data_size);
 
     hr = IDirectInputDevice8_Unacquire(di_keyboard);
-- 
2.24.1




More information about the wine-devel mailing list