Key bindings should be done against key position codes, not key chars. This means binding on VK code(virtual key code) in WIN or key code like "AE01" in Linux X server
I see a lot of problems about key binding on keyboard layouts other than en_US. I think there are 3 things here:
- CS/HL engine should bind keys depending on the position on the keyboard. In Windows, this is done by binding on Virtual Key code(VK code). For example, the key on the right side of normal
~key, has VK code "VK_1". This normally does not change in different keyboard layouts. - When I press the key, CS/HL should check the VK code against the bindings, and does the action correspondent. For example, now, I have to press
Shift+VK_1to select menu item 1; apparently this means the bindings are done against key chars; this is incorrect in many senses. Fixing this depends on 1. - (Optional)The option menu GUI should show the key char of each key. For example, now on my keyboard layout, the VK_1 key will output
{symbol when not pressing SHIFT; and when pressing SHIFT, it will output1.{and1are key chars, and will change depending on the SHIFT state, the capslock state, AltGr state, etc. Now, for menuitem 1, the bindkey is shown as "1"; this is not correct, it should show non-Shift state key char, which is{; but that's OK anyway, as CS/HL has no way to know which key char should show on each key depending on the keyboard layout; it can only show the key char in en_US. This needs HL to peek into the current keyboard dll to check the char; this should not be done.
About Virtual Key codes, read this:https://learn.microsoft.com/en-us/previous-versions/windows/embedded/ms927178(v=msdn.10)?redirectedfrom=MSDN. In Linux, this is done similarly. Please read this file to learn more. https://github.com/WesternGun/Symmetri-Keyboard-layout/blob/master/linux/symmetri. Here for example, the position of VK_1 in Windows has name <AE01> in Linux X server. You should bind on these codes, not key chars.
As I see it, it can be fixed; and since I am still playing CS 1.6, and I believe many do, this will benefit a lot. I see this is perfectly done in CSGO.
CS version: latest version bought on Steam.
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
Exe build: 19:53:27 Aug 3 2020 (8684)
I see you are using SDL; let me check the usage and do some experiments..