scp-fs2open / fs2open.github.com

Origin Repository for SCP FreeSpace 2 Open
https://www.hard-light.net/
Other
401 stars 161 forks source link

International Keyboard Layouts #2225

Closed dseddah closed 2 years ago

dseddah commented 4 years ago

Hi all, fso doesn't take international keyboard layout into account, it keeps using qwerty layout even though I'm in azerty (mac).

Steps to reproduce: 1° from the system pick any other keyboard layout than the qwerty pc one 2° go to create a player, type anything, it will still be qwerty

configuration fso version : 3.8.1 (compiled from github), 3.8.0 (from knossow), 3.8.0 debug (from knossois) os: 10.14.6 language and keyboard set to French

Djamé

asarium commented 4 years ago

Thank you for the report but this is a known issue and will require some rather heavy reworking of how FSO handles text input so don't hold your breath for this to be fixed soon. Sorry.

dseddah commented 4 years ago

Argh, too bad. It's impossible to play without rebinding most of the commands. By any chance do you know if someone contributed some ini with new key mapping somewhere I could use for that ? Is it also the case in the retail version ? Also, I've seen a mention of the -keyboard_layout option. Does it work? I tried -keyboard_layout azerty but no luck.

asarium commented 4 years ago

The way the controls work is by position so you don't need to rebind the controls. If the game says "W" in the controls screen then it refers to your "Z" key and so on. You might need a QWERTY keyboard image at the start to get used to what key maps to what. Retail had the same issue.

-keyboard_layout has no effect at the moment and in fact isn't needed anyway so I think I'll just remove that... I had a test build where the mapping was done for you automatically but it had issues at that point. I should look into that again...

dseddah commented 4 years ago

hi, thx for your answer. Problem is that my keyboard is a mac one so the positions of the keys are not the same than for a regular pc keyboard. For example the \ is shift+option+: in my kbd. there's no insert/del keys, etc..

So, if you have a mean to generate a mapping that would be great :)

Djamé ps: is there some kind of architecture diagram of the code base ?

asarium commented 4 years ago

Oh, a mac. Sorry I have no idea about the specifics of that platform. To get a mapping on which keyboard button produces which input for the engine you can try rebinding controls and see what the output for that button is.

There is no real diagram. The game begins in freespace.cpp and branches out from there. The folders under code are loosely named after the system they contain code for so you can use that as an initial guideline.

chief1983 commented 4 years ago

The 'Ins' key should be the 'Fn' key on a full Mac keyboard, but if you have the cut down bluetooth one (A1314), or a laptop keyboard, sorry, it just is going to be missing a large number of default key binds, considering it also uses the numpad by default. If you have the standalone numpad you are still missing the fn (Ins)/del/home/end/pgup/pgdn keys, and f13-f15, which are pause/scroll lock/print on a standard PC keyboard. It's nothing to do with your platform specifically, or the labeling of your keys, but the fact that the default keys just aren't there, if that's the keyboard you have. If you have a full size Apple keyboard though, you should have all the keys, even if the labels don't match up. I'm one of the few users in my office (of all Macs) who has a full Mac keyboard (A1243) however. They can pry it from my cold dead hands.

dseddah commented 4 years ago

Hi, thanks you both for your answers. I'm going to try to map the keys myself but it's going to be a bit tedious. Someone said in the forum that in reality there's only a bunch of keys that absolutely need to be used (acceleration, afterburner, circle weapons and the target keys), do you agree?

X3N0-Life-Form commented 4 years ago

I would agree, the only keys you really need to be comfortable are:

So about 12-ish keys in total, and even then you might be able to stick a few of those on your mouse. Some others that can be nice to have :

z64555 commented 3 years ago

Discussed this with @SelfGamer over discord. SDL doesn't provide a method to arbitrarily translate a keycode into scancode from external files, which means any files that save the bindings must be done in scancodes (This includes the controlconfigdefaults.tbl and the new preset files)

Plan is to forego the feature of having those files user-editable by international users, and instead provide tools in FSO to set them. Preset files already have the ability to set and saved, and there is plans to make a converter tool for modders that'll take in a preset and convert it into an #Override or a #Preset configuration within the .tbl.

We still have the issue with in-game display of non-ascii characters, which will require some more deliberation.

z64555 commented 3 years ago

Setting milestone to 21.6. However, this issue is addressed in Controls6 which is still waiting on the Controls4/5 PR, and may not be completed in time for 21.6.

z64555 commented 2 years ago

Should be addressed by #4133