etfdevs / ETe

Improved Wolfenstein: Enemy Territory Engine
GNU General Public License v3.0
57 stars 17 forks source link

Some media keys are mapped wrong #72

Open rorgoroth opened 2 years ago

rorgoroth commented 2 years ago

Hi,

On my keyboard I have volume up and down, on F5 F6, you press FN to use the keys as F5 F6.

In game, pressing volume_down key crouches, so I test in the controls and here is the results:

volume_down(E0_2E) registers as "c" volume_up(E0_30) registers as "b" volume_mute(E0_20) registers as "d"

All normal keys work, but the F*/Funtion keys are all messed up.

ensiform commented 2 years ago

Which platform, if Windows does the same issue appear in original ET.exe.

If Linux/SDL does it happen on ETL? And if linux are you using a self compile with or without SDL active.

Keyboard language/layout? In-game cl_language?

rorgoroth commented 2 years ago

This is on Windows, my keyboard is en_GB and in game is English (0)

It happens in original et.exe but is fixed in etl.exe

ensiform commented 2 years ago

Then ETL only fixed it by using SDL on Windows and will be more complicated to track the windows fix down.

ensiform commented 2 years ago

Are you knowledgeable to make a build for yourself? I have a way that helps diagnose the keys but I do not wish to turn it on globally for all users in pre-built bins if possible to avoid.

https://github.com/etfdevs/ETe/blob/master/src/win32/win_wndproc.c#L1035

Uncommenting this line should give some data to help look further for when pressing those keys. As I am on Linux and not windows I cannot reproduce the issue locally.

rorgoroth commented 2 years ago

Well, maybe it's not worth chasing - it's really a minor annoyance more than anything.

I did try as you suggest:

k+ wParam:000000ae lParam:012e0001
k+ wParam:000000af lParam:01300001

First is vol_down(f5) and second vol_up(f6)

ec- commented 2 years ago

Add at following line https://github.com/etfdevs/ETe/blob/master/src/win32/win_wndproc.c#L336

Com_Printf( "key: 0x%08x mod:%i ext:%i res:%i(%02x) vkey=%i scan=%i\n", key, modified, is_extended, result, result, nVirtKey, MapVirtualKey( nVirtKey, MAPVK_VK_TO_VSC ) );
rorgoroth commented 2 years ago

Add at following line https://github.com/etfdevs/ETe/blob/master/src/win32/win_wndproc.c#L336

Com_Printf( "key: 0x%08x mod:%i ext:%i res:%i(%02x) vkey=%i scan=%i\n", key, modified, is_extended, result, result, nVirtKey, MapVirtualKey( nVirtKey, MAPVK_VK_TO_VSC ) );

No change unfortunately, same output. It's strange because just trying now, the brightness keys don't register at all.

The same happens in q3e though, but with the difference that volume control comes up on the screen as expected even though it still makes you crouch.

ec- commented 2 years ago

No change unfortunately, same output

Did you recompiled it? Output should provide more info than before

rorgoroth commented 2 years ago

Yes, just that I'm an idiot and put them in my normal game dir rather than the test one. Here is output I press keys in this order: vol_down, vol_up, c, b

k+ wParam:000000ae lParam:012e0001
key: 0x012e0001 mod:46 ext:1 res:99(63) vkey=174 scan=46
key: 0xc12e0001 mod:46 ext:1 res:99(63) vkey=174 scan=46

k+ wParam:000000af lParam:01300001
key: 0x01300001 mod:48 ext:1 res:98(62) vkey=175 scan=48
key: 0xc1300001 mod:48 ext:1 res:98(62) vkey=175 scan=48

k+ wParam:00000043 lParam:002e0001
key: 0x002e0001 mod:46 ext:0 res:99(63) vkey=67 scan=46
key: 0xc02e0001 mod:46 ext:0 res:99(63) vkey=67 scan=46

k+ wParam:00000042 lParam:00300001
key: 0x00300001 mod:48 ext:0 res:98(62) vkey=66 scan=48
key: 0xc0300001 mod:48 ext:0 res:98(62) vkey=66 scan=48
ensiform commented 2 years ago

Well just from that it appears scancodes for volume match the character scan codes.