maximegmd / CyberEngineTweaks

Cyberpunk 2077 tweaks, hacks and scripting framework
MIT License
4.51k stars 287 forks source link

Make bindings work with physical keys instead to be layout independent #606

Open anygoodname opened 3 years ago

anygoodname commented 3 years ago

Hello,

there is an issue with CET overlay hotkey set to ` character/button and English UK language keyboard layout. For whatever reason this key results in a different virtual key id recorded by the CET than other languages mapping this character to the same physical button. This makes the CET overlay inaccessible on switching keyboard languages to/from English UK. I can reproduce the issue every time I try. Please check the tests description bellow for more details.

Kind regards. Anygoodname.

CET keyboard ` hotkey multilanguage tests.

My setup:

All the languages keyboard layouts map ` character to the same physical keyboard key: left to 1 and above TAB keys. Left most in the digits/symbols and the backspace keys row on the HP keyboard.

Test prerequisite: clean install CET (no user settings, no mods)

Test #1:

new bind ` key as CET overlay hot key and verify recorded key id.

With keyboard languages mapping the ` character to the same physical button:

Test #1 results:

1 test English US keyboard language:

"cet.overlay_key": 54043195528445952

2 test English UK keyboard language:

"cet.overlay_key": 62768919806476288

3 test Greek keyboard language:

"cet.overlay_key": 54043195528445952

4 test Polish keyboard language:

"cet.overlay_key": 54043195528445952

Test #2:

switch keyboard language and rebind ` hotkey while the CET is running.

With CET overlay hotkey set to ` in one keyboard language:

Test #1 results:

1 English US > English UK

2 English UK > Greek

3 Greek > Polish

4 Polish > English US

maximegmd commented 3 years ago

This is the intended behaviour, we map virtual keys, not mapped keys.

WSSDude commented 3 years ago

We probably could do it on physical keys though I suppose... I sent him here to create the issue.

WSSDude commented 3 years ago

I think I'll have a look at this at some point if you won't mind... Will keep it as backlog item... Should not be impossible to do and it may be better for cases like these.