but I don't know if those are dependant on the keyboard layout. Do you?
I think they are.
You are right. Whit a different codepage DIK_BACKSLASH is not a backslash at all.
What do you think of this?
--- wine/dlls/dinput/keyboard/main.c Thu Oct 18 23:30:06 2001 +++ main.c Sat Feb 23 23:07:52 2002 @@ -132,6 +132,51 @@ return 0; }
+/* use MapVirtualKey for dik < 0x80 + for dik >= 0x80 use this table. + MapVirtualKey returns the wrong values for the numpad, + so those are here also. +*/ +struct { + BYTE dik; + BYTE vk; +} dik_to_vk[] = { + {DIK_NUMPAD7, VK_NUMPAD7}, + {DIK_NUMPAD8, VK_NUMPAD8}, + {DIK_NUMPAD9, VK_NUMPAD9}, + {DIK_SUBTRACT, VK_SUBTRACT}, + {DIK_NUMPAD4, VK_NUMPAD4}, + {DIK_NUMPAD5, VK_NUMPAD5}, /* Check both */ + {DIK_NUMPAD5, VK_CLEAR}, /* Num Lock off */ + {DIK_NUMPAD6, VK_NUMPAD6}, + {DIK_ADD, VK_ADD}, + {DIK_NUMPAD1, VK_NUMPAD1}, + {DIK_NUMPAD2, VK_NUMPAD2}, + {DIK_NUMPAD3, VK_NUMPAD3}, + {DIK_NUMPAD0, VK_NUMPAD0}, + {DIK_DECIMAL, VK_DECIMAL}, + {0x56, VK_OEM_102}, + {DIK_F11, VK_F11}, + {DIK_F12, VK_F12}, + {0x5E, 0x5E}, + {0x5F, 0x5F}, + {DIK_NUMPADENTER, VK_RETURN}, + {DIK_DIVIDE, VK_DIVIDE}, + {DIK_HOME, VK_HOME}, + {DIK_UP, VK_UP}, + {DIK_PRIOR, VK_PRIOR}, + {DIK_LEFT, VK_LEFT}, + {DIK_RIGHT, VK_RIGHT}, + {DIK_END, VK_END}, + {DIK_DOWN, VK_DOWN}, + {DIK_NEXT, VK_NEXT}, + {DIK_INSERT, VK_INSERT}, + {DIK_DELETE, VK_DELETE}, + {DIK_LWIN, VK_LWIN}, + {DIK_RWIN, VK_RWIN}, + {DIK_APPS, VK_APPS} +}; + static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState( LPDIRECTINPUTDEVICE2A iface,DWORD len,LPVOID ptr ) @@ -144,13 +189,19 @@ WARN("whoops, got len %ld?\n", len); return DI_OK; } - for (i = 0; i < 0x80; i++) + for (i = 0; i < DIK_NUMPAD7; i++) { WORD vkey = MapVirtualKeyA( i, 1 ); if (vkey && (GetAsyncKeyState( vkey ) & 0x8000)) { ((LPBYTE)ptr)[i] = 0x80; - ((LPBYTE)ptr)[i | 0x80] = 0x80; + } + } + for (i = 0; i < (sizeof(dik_to_vk) / sizeof(dik_to_vk[0])); i++) + { + if (GetAsyncKeyState( dik_to_vk[i].vk ) & 0x8000) + { + ((LPBYTE)ptr)[dik_to_vk[i].dik] = 0x80; } } return DI_OK;