ValveSoftware / Dota2-Gameplay

Public Bug Tracker for Dota2
1.48k stars 87 forks source link

Keyboard layout issue #17389

Open EnderHDMC opened 5 months ago

EnderHDMC commented 5 months ago

Description

Not directly related to gameplay, but I don't know where else to report this bug.

The issue is that launching Dota 2 adds an additional US layout keyboard, even without US langauge installed. From information I can find in forums, this is a longstanding issue and affects anyone who has multiple keyboard layouts, where one of them is not US langauge pack and US layout combination. Attached screenshots show before and after of the keyboard layouts.

I've ruled out Windows related bugs and fixes. From what I can find, this could be a Source engine issue. Here is the best info I found, from a Steam user in a forum discussion: https://steamcommunity.com/groups/SteamClientBeta/discussions/1/864976115478357063/?ctp=10

" Time to explain the true cause of this issue then, as I actually managed to figure out what was going on with Source games adding the en-US layout a while back, and was able to disable that behaviour entirely on some of my modification projects.

The TL:DR here is that, in the InputSystem DLL used by all Source games to register and handle keyboard, mouse, joystick, gamepad, etc inputs, when a function named ButtonCode_UpdateScanCodeLayout is called, it will always execute this following line of code on Windows PCs only (not consoles or POSIX platforms, so not Linux, BSD, etc, only Windows): HKL englishKb = ::LoadKeyboardLayout("00000409", 0);

I think you can deduce from here as to why that's bad given prior discussion: this code force-loads in the EN-US QWERTY layout irrespective of user configuration, mainly to afaik try and remap certain special keys between layouts or some b**llshit of that sort. Nuking that offending line of code (and subsequent code reliant on it) fixes the issue permanently, but that requires binary modification, which for VAC enabled games will be a big no-no.

Here's a link to the offending source code file from the CSGO leak if anyone wants to check for themselves: https://github.com/perilouswithadollarsign/cstrike15_src/blob/master/inputsystem/key_translation.cpp "

Even though this issue might not be directly related to Dota, it is with Dota where I encounter it. And since it negatively affects user experience, I would like to bring attention to it somehow. Thanks for reading.

Example Match ID (and possibly Timestamp)

No response

Screenshots

Before Dota After Dota

Memoframe commented 5 months ago

Sry for off top but can you comment your thoughts on this if you have any? https://github.com/ValveSoftware/Dota-2/issues/2692

robotboy655 commented 3 months ago

Simply adding UnloadKeyboardLayout( englishKb ); after the for loop seems to fix the bug. I will be trialing it over in Garry's Mod.