WIP: Locale input
keyboardlocale: Enables receiving text input from
SDL_TEXTINPUT events. Text input fields (console, chat, some menu fields) will accurately follow the keyboard's layout.
usekeycodes: Uses keycodes (the key arrangement on a keyboard) instead of scancodes (the data transmitted by keyboard). Not entirely accurate.
forceqwerty: Forces a QWERTY layout (instead of QWERTZ or AZERTY - did not test with Dvorak.) Does not work with
changed the descriptionToggle commit list
With a Danish QWERTY keyboard, this merge request prevents me from opening the console.
Previously, it was the key to the left of 1, above Tab, below Escape. (This key is ½, or § when Shift is held, for me.)
For me, Tilde (~) is two spaces to the right of P (being the ¨ key) and requires Alt Gr to be held, but pressing Alt Gr+¨ doesn't do anything in-game for me.
Additionally, I can no longer bind any controls to ´ (the key two spaces to the right of 0), Å (one to the right of P), ¨ (to the right of Å), Æ (to the right of L), or Ø (to the right of Æ).
Previously, they could all be bound (but of course showing the US English keyboard equivalents in the control binding menu and text input fields).
If I open config.cfg and disable the
textinput) convar in there, everything returns to the way it was before this merge request. ½ opens the console, Å is useable as [ in bindings and text inputs, et cetera.
keyboardlocaleaffects message boxes, because
IT_MSGHANDLERshares a bit with
IT_KEYHANDLERfor "this is a text box" is bad, I'll need to change that.)
As for the console key, it didn't work for me either until I mapped it to the application key, and then later to the ' key in my keyboard, where the tilde key is on an US keyboard. I just couldn't type any apostrophes or quotes.
The tilde key in an US keyboard is shared with the grave key - opening the console with that key doesn't work in my keyboard, because it's on a dead key instead, which SRB2 doesn't handle at all.
If it's a key that corresponds to an Unicode character, SRB2 won't recognize it either.
The console key could be, by default, mapped to both the US tilde key, and a key that isn't mapped to anything in vanilla (the application key, as an example, or an unused function key)
The original implementation of this caused the Knuckles can't jump glitch. I assume you've tested that, but I'd be an undercautious fool if I didn't at least mention it
That happened because of
setlocaleaffecting affecting string to number conversions. I don't see any changes to the locale here. I am curious though, does SDL use the system locale for this? I think we should force locale to C eventually, since there are some issues on Windows with
printfspitting out garbage and sometimes crashing with some non latin layouts I'm guessing (#180).
marked as a Work In ProgressToggle commit list