https://bugs.winehq.org/show_bug.cgi?id=45605
Bug ID: 45605 Summary: Letter keys doesn't work in DirectX aplications Product: Wine Version: 3.13 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: directx-dinput Assignee: wine-bugs@winehq.org Reporter: ilya77105@gmail.com Distribution: ---
Created attachment 62035 --> https://bugs.winehq.org/attachment.cgi?id=62035 Screenshot without keys
I will use Far Cry 3 for demonstration, but all applications, that i tested shows the same behavior. When English layout is not selected as default in keyboard settings (in OS settings, not Wine) games doesn't recognize keys at all (screenshot). When i select English layout as default, all is ok. Console output have no information about it.
https://bugs.winehq.org/show_bug.cgi?id=45605
--- Comment #1 from Austin English austinenglish@gmail.com --- What keyboard layout/locale?
https://bugs.winehq.org/show_bug.cgi?id=45605
--- Comment #2 from Ilya ilya77105@gmail.com --- (In reply to Austin English from comment #1)
What keyboard layout/locale?
In my case Russian. But it works with any non-Latin layout.
https://bugs.winehq.org/show_bug.cgi?id=45605
supercoolemail@seznam.cz changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |supercoolemail@seznam.cz
https://bugs.winehq.org/show_bug.cgi?id=45605
--- Comment #3 from supercoolemail@seznam.cz --- Created attachment 62867 --> https://bugs.winehq.org/attachment.cgi?id=62867 dinput log
Log caputired with WINEDEBUG=+dinput on Gothic 2. During this, I pressed keys 1-0 on keypad and then alt tabbed and ctrl+c to quit the game. Key 1 works correctly. Key 2 is not mapped to anything in game so it might work, but I don't know. Keys 3-0 don't work.
https://bugs.winehq.org/show_bug.cgi?id=45605
--- Comment #4 from supercoolemail@seznam.cz --- Active layout does not change anything, only first layout matters.
local layout first: 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000100, lp 1906fba4, vk 31, scan 02 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000101, lp 1906fba4, vk 31, scan 02 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000100, lp 1906fba4, vk 32, scan 60 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000101, lp 1906fba4, vk 32, scan 60 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000100, lp 1906fba4, vk 33, scan 61 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000101, lp 1906fba4, vk 33, scan 61 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000100, lp 1906fba4, vk 34, scan 62 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000101, lp 1906fba4, vk 34, scan 62 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000100, lp 1906fba4, vk 35, scan 63 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000101, lp 1906fba4, vk 35, scan 63 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000100, lp 1906fba4, vk 36, scan 64 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000101, lp 1906fba4, vk 36, scan 64 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000100, lp 1906fba4, vk 37, scan 65 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000101, lp 1906fba4, vk 37, scan 65 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000100, lp 1906fba4, vk 38, scan 66 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000101, lp 1906fba4, vk 38, scan 66 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000100, lp 1906fba4, vk 39, scan 67 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000101, lp 1906fba4, vk 39, scan 67 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000100, lp 1906fba4, vk 30, scan 68 0041:trace:dinput:KeyboardCallback (0x18250c68) wp 00000101, lp 1906fba4, vk 30, scan 68
US layout first: 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000100, lp 1804fbb4, vk 31, scan 02 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000101, lp 1804fbb4, vk 31, scan 02 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000100, lp 1804fbb4, vk 32, scan 03 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000101, lp 1804fbb4, vk 32, scan 03 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000100, lp 1804fbb4, vk 33, scan 04 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000101, lp 1804fbb4, vk 33, scan 04 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000100, lp 1804fbb4, vk 34, scan 05 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000101, lp 1804fbb4, vk 34, scan 05 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000100, lp 1804fbb4, vk 35, scan 06 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000101, lp 1804fbb4, vk 35, scan 06 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000100, lp 1804fbb4, vk 36, scan 07 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000101, lp 1804fbb4, vk 36, scan 07 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000100, lp 1804fbb4, vk 37, scan 08 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000101, lp 1804fbb4, vk 37, scan 08 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000100, lp 1804fbb4, vk 38, scan 09 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000101, lp 1804fbb4, vk 38, scan 09 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000100, lp 1804fbb4, vk 39, scan 0a 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000101, lp 1804fbb4, vk 39, scan 0a 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000100, lp 1804fbb4, vk 30, scan 0b 0039:trace:dinput:KeyboardCallback (0x1724fcb8) wp 00000101, lp 1804fbb4, vk 30, scan 0b
https://bugs.winehq.org/show_bug.cgi?id=45605
--- Comment #5 from supercoolemail@seznam.cz --- Created attachment 62868 --> https://bugs.winehq.org/attachment.cgi?id=62868 Key log
log with WINEDEBUG=+key
This is possibly caused by something deeper than dinput. I've trace it here https://github.com/wine-mirror/wine/blob/master/dlls/user32/message.c#L2881
From there I went to +key and it floods logs with
0027:trace:key:X11DRV_KEYBOARD_DetectLayout mismatch for keycode 10, got L"+1!~" 0027:trace:key:X11DRV_KEYBOARD_DetectLayout mismatch for keycode 11, got L"\011b2@\02c7" 0027:trace:key:X11DRV_KEYBOARD_DetectLayout mismatch for keycode 12, got L"\01613#^" 0027:trace:key:X11DRV_KEYBOARD_DetectLayout mismatch for keycode 13, got L"\010d4$\02d8" 0027:trace:key:X11DRV_KEYBOARD_DetectLayout mismatch for keycode 14, got L"\01595%\00b0" 0027:trace:key:X11DRV_KEYBOARD_DetectLayout mismatch for keycode 15, got L"\017e6^\02db" 0027:trace:key:X11DRV_KEYBOARD_DetectLayout mismatch for keycode 16, got L"\00fd7&`" 0027:trace:key:X11DRV_KEYBOARD_DetectLayout mismatch for keycode 17, got L"\00e18*\02d9" ...and many more ofthese just with different codes
Later it logs 0009:trace:key:X11DRV_KeyEvent KeyPress : keysym=2b (plus), # of chars=1 / "+" 0009:trace:key:EVENT_event_to_vkey e->keycode = 10 0009:trace:key:X11DRV_KeyEvent keycode 10 converted to vkey 0x31 scan 02 0009:trace:key:X11DRV_send_keyboard_input hwnd 0x10058 vkey=0090 scan=0045 flags=0001 0009:trace:key:X11DRV_send_keyboard_input hwnd 0x10058 vkey=0090 scan=0045 flags=0003 0009:trace:key:X11DRV_send_keyboard_input hwnd 0x10058 vkey=0031 scan=0002 flags=0000 0009:trace:key:X11DRV_KeyEvent type 3, window 8000001, state 0x0010, keycode 10 0009:trace:key:X11DRV_KeyEvent nbyte = 1, status 0 0009:trace:key:X11DRV_KeyEvent KeyRelease : keysym=2b (plus), # of chars=1 / "+" 0009:trace:key:EVENT_event_to_vkey e->keycode = 10 0009:trace:key:X11DRV_KeyEvent keycode 10 converted to vkey 0x31 scan 02 0009:trace:key:X11DRV_send_keyboard_input hwnd 0x10058 vkey=0031 scan=0002 flags=0002 0009:trace:key:X11DRV_KeyEvent type 2, window 8000001, state 0x0010, keycode 11 0009:trace:key:X11DRV_KeyEvent XmbLookupString needs 2 byte(s) 0009:trace:key:X11DRV_KeyEvent nbyte = 2, status 4 0009:trace:key:X11DRV_KeyEvent KeyPress : keysym=1ec (ecaron), # of chars=2 / "\xc4\x9b" 0009:trace:key:EVENT_event_to_vkey e->keycode = 11 0009:trace:key:X11DRV_KeyEvent keycode 11 converted to vkey 0x32 scan 03 0009:trace:key:X11DRV_send_keyboard_input hwnd 0x10058 vkey=0032 scan=0003 flags=0000 0009:trace:key:X11DRV_KeyEvent type 3, window 8000001, state 0x0010, keycode 11 0009:trace:key:X11DRV_KeyEvent nbyte = 2, status 0 0009:trace:key:X11DRV_KeyEvent KeyRelease : keysym=1ec (ecaron), # of chars=2 / "\xc4\x9b" 0009:trace:key:EVENT_event_to_vkey e->keycode = 11 0009:trace:key:X11DRV_KeyEvent keycode 11 converted to vkey 0x32 scan 03
So 1 is translated to +, but later keys (2 to 0) are translated to locale dependent codes.
https://bugs.winehq.org/show_bug.cgi?id=45605
--- Comment #6 from supercoolemail@seznam.cz --- Turns out the reason for + being correct is quite simple: it is what the key is with local layout.
https://bugs.winehq.org/show_bug.cgi?id=45605
--- Comment #7 from supercoolemail@seznam.cz --- Problem is here https://github.com/wine-mirror/wine/blob/3a2834b3a42e869b7d450074c29cd7089bf... It translates something, but returns scancode for rest (if does not have any effect, since scancode is provided).
https://bugs.winehq.org/show_bug.cgi?id=45605
--- Comment #8 from supercoolemail@seznam.cz --- Created attachment 62870 --> https://bugs.winehq.org/attachment.cgi?id=62870 Hack
This maps VK key codes for keypad numbers and tilde to dinput key codes and tilde to grave. It should fix greatest annoyances.
https://bugs.winehq.org/show_bug.cgi?id=45605
supercoolemail@seznam.cz changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #62870|0 |1 is obsolete| |
--- Comment #9 from supercoolemail@seznam.cz --- Created attachment 62872 --> https://bugs.winehq.org/attachment.cgi?id=62872 Hack 2
With this path everything looks correct, but nothing gets queued in queue_event, because "ofs" is negative (nothing gets traced, queue length is 16 and no mentions of overflow anywhere, ofs is only remaining condition). I have absolutely no idea what is going on. But it at least fixes keypad numbers (now they work with both Czech and Russian layout).
US layout first: 003a:trace:dinput:LL_hook_proc calling 0x1724e608->0x7e4057eb (100 1804fbb4) 003a:trace:dinput:KeyboardCallback (0x1724e608) wp 00000100, lp 1804fbb4, vk 58, scan 2d 003a:trace:dinput:KeyboardCallback setting 2D to 80 003a:trace:dinput:queue_event queueing 128 at offset 45 (queue head 4 / size 16) 003a:trace:dinput:LL_hook_proc calling 0x17250880->0x7e4070cc (100 1804fbb4)
Russian layout first: 003a:trace:dinput:LL_hook_proc calling 0x1724e428->0x7e4057eb (100 1804fbb4) 003a:trace:dinput:KeyboardCallback (0x1724e428) wp 00000100, lp 1804fbb4, vk 58, scan 79 003a:trace:dinput:KeyboardCallback setting 2D to 80 003a:trace:dinput:LL_hook_proc calling 0x1724e700->0x7e4070cc (100 1804fbb4)
https://bugs.winehq.org/show_bug.cgi?id=45605
--- Comment #10 from supercoolemail@seznam.cz --- When this code https://github.com/wine-mirror/wine/blob/cbc657a244d16d52414ab7c8319afa885c6... is triggered for some key, such key will not work in apps that use dinput. For Czech layout, it assigns random codes for some Czech characters (the special ones, like š and ž mapped to numbers on keypad) and ALL characters on Russian layout. This happens in winex11 and is thus triggered for every app, but for some reason, special characters (or all characters in case of Russian layout) work fine in e.g. wine notepad, but break in dinput.
https://bugs.winehq.org/show_bug.cgi?id=45605
--- Comment #11 from supercoolemail@seznam.cz --- Problems with Czech layout are fixed by patches 41141 and 62629 from https://bugs.winehq.org/show_bug.cgi?id=30984 and small additional patch to Czech mapping. But these patches do not help with Russian layout. Also, Russian layout is detected as Ukrainian standard layout as it is closest match. Reordering fixes it, but there are stil a lot of mapping mismatches. Either patches do not help with Russian for some reason (I doubt) or Russian layout mapping in Wine is wrong (some handchecked keys map correctly to KOI8-R, but I don't know if it is what it's supposed to be).
https://bugs.winehq.org/show_bug.cgi?id=45605
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |STAGED CC| |leslie_alistair@hotmail.com Staged patchset| |https://github.com/wine-sta | |ging/wine-staging/tree/mast | |er/patches/dinput-map_dik_c | |odes
https://bugs.winehq.org/show_bug.cgi?id=45605
supercoolemail@seznam.cz changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #62872|0 |1 is obsolete| |
--- Comment #12 from supercoolemail@seznam.cz --- Created attachment 62990 --> https://bugs.winehq.org/attachment.cgi?id=62990 Russian keyboard mapping fix
Could you test this patch on top of patches 41141 and 62629 from https://bugs.winehq.org/show_bug.cgi?id=30984 ? It should fix mapping issues with default Russian layout (that's what it's called in X). If you need other layout, let me know and provide layout name from X.
https://bugs.winehq.org/show_bug.cgi?id=45605
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Staged patchset|https://github.com/wine-sta |https://github.com/wine-sta |ging/wine-staging/tree/mast |ging/wine-staging/tree/mast |er/patches/dinput-map_dik_c |er/patches/winex11-key_tran |odes |slation
https://bugs.winehq.org/show_bug.cgi?id=45605
Maxime berillions@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |berillions@gmail.com
--- Comment #13 from Maxime berillions@gmail.com --- I up this bug report because this issue still exist with wine-7.8 and the STAGED patchset is broken since winex11 has been converted to PE.
So for now, some keys do not work in directx games like "é", "à", "ç" with AZERTY keyboard.
It would be great if a solution exist to implement a fix upstream.
Thanks,