[DINPUT] Sync with Wine Staging 3.9. CORE-14656
authorAmine Khaldi <amine.khaldi@reactos.org>
Sun, 27 May 2018 02:57:38 +0000 (03:57 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 27 May 2018 02:57:38 +0000 (03:57 +0100)
dll/directx/wine/dinput/keyboard.c
dll/directx/wine/dinput/mouse.c
media/doc/README.WINE

index 4c3c38e..8a59ce0 100644 (file)
@@ -69,26 +69,10 @@ static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(SysKeyboardIm
 
 static BYTE map_dik_code(DWORD scanCode, DWORD vkCode)
 {
 
 static BYTE map_dik_code(DWORD scanCode, DWORD vkCode)
 {
-    static const BYTE asciiCodes[] =
-     {/*32*/  DIK_SPACE,0,0,0,0,0,0,DIK_APOSTROPHE,
-      /*40*/  0,0,0,0,DIK_COMMA,DIK_MINUS,DIK_PERIOD,DIK_SLASH,
-      /*48*/  DIK_0,DIK_1,DIK_2,DIK_3,DIK_4,DIK_5,DIK_6,DIK_7,
-      /*56*/  DIK_8,DIK_9,DIK_COLON,DIK_SEMICOLON,0,DIK_EQUALS,0,0,
-      /*64*/  DIK_AT,DIK_A,DIK_B,DIK_C,DIK_D,DIK_E,DIK_F,DIK_G,
-      /*72*/  DIK_H,DIK_I,DIK_J,DIK_K,DIK_L,DIK_M,DIK_N,DIK_O,
-      /*80*/  DIK_P,DIK_Q,DIK_R,DIK_S,DIK_T,DIK_U,DIK_V,DIK_W,
-      /*88*/  DIK_X,DIK_Y,DIK_Z,DIK_LBRACKET,0,DIK_RBRACKET,DIK_CIRCUMFLEX,DIK_UNDERLINE}      /*95*/ ;
-
-    BYTE out_code = 0;
-    WCHAR c = MapVirtualKeyW(vkCode,MAPVK_VK_TO_CHAR);
-
-    if (c > 31 && c < 96)
-        out_code = asciiCodes[c - 32];
-
-    if (out_code == 0)
-        out_code = scanCode;
-
-    return out_code;
+    if (!scanCode)
+        scanCode = MapVirtualKeyW(vkCode, MAPVK_VK_TO_VSC);
+
+    return scanCode;
 }
 
 static int KeyboardCallback( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam )
 }
 
 static int KeyboardCallback( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam )
@@ -102,7 +86,8 @@ static int KeyboardCallback( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
         wparam != WM_SYSKEYDOWN && wparam != WM_SYSKEYUP)
         return 0;
 
         wparam != WM_SYSKEYDOWN && wparam != WM_SYSKEYUP)
         return 0;
 
-    TRACE("(%p) %ld,%ld\n", iface, wparam, lparam);
+    TRACE("(%p) wp %08lx, lp %08lx, vk %02x, scan %02x\n",
+          iface, wparam, lparam, hook->vkCode, hook->scanCode);
 
     switch (hook->vkCode)
     {
 
     switch (hook->vkCode)
     {
index eaec6b1..6d3eff5 100644 (file)
@@ -616,8 +616,21 @@ static HRESULT WINAPI SysMouseWImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REF
            case (DWORD_PTR) DIPROP_GRANULARITY: {
                LPDIPROPDWORD pr = (LPDIPROPDWORD) pdiph;
                
            case (DWORD_PTR) DIPROP_GRANULARITY: {
                LPDIPROPDWORD pr = (LPDIPROPDWORD) pdiph;
                
-               /* We'll just assume that the app asks about the Z axis */
-               pr->dwData = WHEEL_DELTA;
+               if (
+                   ((pdiph->dwHow == DIPH_BYOFFSET) &&
+                    ((pdiph->dwObj == DIMOFS_X) ||
+                     (pdiph->dwObj == DIMOFS_Y)))
+                   ||
+                   ((pdiph->dwHow == DIPH_BYID) &&
+                    ((pdiph->dwObj == (DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS)) ||
+                     (pdiph->dwObj == (DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS))))
+               ){
+                   /* Set granularity of X/Y Axis to 1. See MSDN on DIPROP_GRANULARITY */
+                   pr->dwData = 1;
+               } else {
+                   /* We'll just assume that the app asks about the Z axis */
+                   pr->dwData = WHEEL_DELTA;
+               }
                
                break;
            }
                
                break;
            }
index a5b6b18..ad529a3 100644 (file)
@@ -30,7 +30,7 @@ reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-3.9
 reactos/dll/directx/wine/d3dxof         # Synced to WineStaging-3.3
 reactos/dll/directx/wine/ddraw          # Synced to WineStaging-3.9
 reactos/dll/directx/wine/devenum        # Synced to WineStaging-3.9
 reactos/dll/directx/wine/d3dxof         # Synced to WineStaging-3.3
 reactos/dll/directx/wine/ddraw          # Synced to WineStaging-3.9
 reactos/dll/directx/wine/devenum        # Synced to WineStaging-3.9
-reactos/dll/directx/wine/dinput         # Synced to WineStaging-3.3
+reactos/dll/directx/wine/dinput         # Synced to WineStaging-3.9
 reactos/dll/directx/wine/dinput8        # Synced to WineStaging-3.3
 reactos/dll/directx/wine/dmusic         # Synced to WineStaging-3.3
 reactos/dll/directx/wine/dplay          # Synced to WineStaging-3.3
 reactos/dll/directx/wine/dinput8        # Synced to WineStaging-3.3
 reactos/dll/directx/wine/dmusic         # Synced to WineStaging-3.3
 reactos/dll/directx/wine/dplay          # Synced to WineStaging-3.3