Re: [hatari-devel] Recent symbolic keyboard mapping change

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hello. I was not finished with this, but yes I realize I have not been able to work on that branch for several months. Life has been a bit tough and I have not prioritized working on this, sorry.

The layouts I had completed I considered complete: US, DE, FR, UK, ES, IT, SE, CHFR, and CHDE

Layouts I have not yet researched: FI, NO, DK, SA, NL, CS, HU

Other known layouts I had mapped to US for lack of information: TR, RU, RO, GR.

I wish you had contacted me with a request to make the restructuring you wanted instead of just taking it and integrating it without warning, with so many modifications. It would have been easier for me to understand what changed if you had requested me to do it myself. Because I had not finished the other languages, I had deliberately not made any kind of pull request about this yet. I do think it is nice to have the working half integrated at least, maybe we don't need to wait for the rest, but I would have appreciated at least notice before taking my code for this. In doing so you seem to have discarded a substantial portion of my research with no comment.

I've tried to do a careful review of the changes, and I've made and tested a PR, which can be viewed here:

https://github.com/hatari/hatari/pull/36

I've duplicated the PR notes below:

- Trying to put a clear comment about every assignment that is arbitrary or unusual, indicating both what host layout it's from, and what ST key it's mapped to. List all regions involved, not just one.
- I had avoided having a separate "default" keymap below US, because I was because I was trying to reduce the number of arbitrary decisions we have to maintain here, and because I was treating each layout as a complete set, not overlays to a fallback routine like this. However, if we wish to do this, I think that is OK, but I have some commentary and suggestions:
  - I've added comments to the individual region code to indicate which arbitrary additions to the default are being relied upon, so that if we need to maintain one we can see better what is affected.
  - The point of the "default" should be to reduce code, so I think when making arbitrary decisions we should pick the ST scancode which applies to the most maps, resulting in fewest overrides. This is not the same as deciding "only XXX language has this key, so the default must be for XXX host and XXX TOS", which leads to frustratingly arbitrary choices about which language priority, and that's precisely what inspired me to do this in the first place, so we wouldn't have to have arguments about whether German minus is more "default" than US minus.
    - Each language will be an override on the default, so the "default" set really only has code significance, and this arbitrary "default" choice will not impact the user in any way. Therefore: pick the scancode which will result in the fewest overrides.
    - Some keys only belong to one host language, however this is a symbolic SDL mapping from any host keyboard to a specific ST TOS language. So, even if a key belongs to one host only, it may still have valid mappings on other TOS languages. Therefore, defer to the fewest-overrides note above. This should apply to all keys with an SDLK_* semantic enumeration.
    - When a key belongs to only one host language and has no natural mappings to other ST TOS languages, there we can use that language's ST code as a default. This should be limited to just those extra symbols which have no SDLK semantic enumeration.
  - SDLK_EXCLAIM mapped to 0x09 with the comment "on azerty?". I believe this is only present on FR host, but the majority of TOS will map to 0x02. However, additional note about French: there are 3 keys on the FR ST keyboard which have no natural correspondence with the FR AZERTY host keyboard. Because of this there were 3 keys I assigned an arbitrary mapping, so that it is always possible to press every FR ST key from a standard FR AZERTY host keyboard. This key was assigned to 0x0D. Explanation here: https://listengine.tuxfamily.org/lists.tuxfamily.org/hatari-devel/2024/02/msg00050.html
  - SDL_QUOTEDBL present on FR host only, I believe, but the majority is 0x03.
  - SDLK_HASH present on DE, UK only, but the majority is 0x2B.
  - SDLK_DOLLAR present on CHFR, CHDE only, but majority is 0x05.
  - SDLK_AMPERSAND is not something I see on AZERTY, not sure what host has this, but the majority is 0x07.
  - SDLK_QUOTE the majority is 0x0C.
  - SDLK_PLUS 0x43 is the wrong semantic mapping, this is not KP_PLUS. Majority is 0x0D.
  - SDLK_MINUS majority is 0x35.
  - SDLK_SLASH majority is 0x08.
  - SDLK_SEMICOLON majority is 0x33.
  - SDLK_EQUALS majority ix 0x0B.
  - SDLK_GREATER majority is 0x60.
  - SDLK_QUESTION majority is 0x0C.
  - SDLK_UNDERSCORE majority is 0x35.
  - SDLK_KP_EQUALS is a numpad key with no natural mapping. 0x61 (ST Undo) was chosen with no comment, which feels like a mistake. Changing it to 0x72 as a duplicate of KP_ENTER but if this wasn't a mistake it should have an explicit comment indicating that it's for Undo.
  - Finally, the default fallback in Keymap_SetCountry must be a specific mapping, not a "default" that is an arbitrary combination of mismatched elements. I suggest US as the default, just because historically the default mapping was essentially US already.
- Spanish international fallback differences, these are not in conflict so I suggest keeping both, but we may have tested slightly different layouts?
  - 161 was missing from yours, ¡ on the ES layout I tested, mapped to ST °§. It's an arbitrary mapping, but ¡¿ on a Spanish host keyboard has no natural mapping to ST which has them on 1 and 2, and ST °§ is otherwise inaccessible by any natural mapping.
  - 176 was missing from mine, not on the ES layout I tested (º in your comment), mapped to ST \.
  - 186 was missing from yours, º on the ES layout I tested, mapped to ST \.
- French international differences seem to conflict with mine, and I can't reconcile your differences with my research. These all had valid key mappings for other keyboards already, but not the AZERTY French layout I tested. I can only seem to find them in reference for the BÉPO French variant, and not AZERTY, and all of them are redundant to the top row numeral keys anyway. I've added them instead as redundances in the FR symbolic map instead, and restored the conflicted fallbacks to more appropriate languages. Please comment on whether I have made an incorrect assumption here:
  - 224 à in IT/CHFR.
  - 231 Ç in ES.
  - 232 è in IT/CHFR.
  - 233 é in CHFR.
  - AZERTY FR reference: http://www.kbdlayout.info/kbdfrna
  - BÉPO FR reference: http://www.kbdlayout.info/kbdfrnb
- US mapping completely absent from code? This needed to be recreated. The "default" mapping had been changed significantly from a proper US mapping already before I instigated the "majority" rule.
- DE mapping missing overrides: SDLK_QUOTE, SDLK_AT, SDLK_CARET, SDLK_UNDERSCORE, SDLK_BACKQUOTE, SDLK_LEFTBRACKET,SDLK_BACKSLASH, SDLK_RIGHTBRACKET, SDLK_CARET, SDLK_UNDERSCORE, SDLK_BACKQUOTE.
- FR mapping:
  - SDLK_ASTERISK, 178, 249 as noted above.
  - Missing overrides: SDLK_PLUS, SDLK_PERIOD, SDLK_SLASH, SDLK_QUESTION, SDLK_BACKSLASH, SDLK_UNDERSCORE.
  - Override for 167 seems to be from CHFR host keyboard, noting it.
  - 224, 231, 232, 233 assumed as BÉPO only, added as FR only override rather than replacing important defaults belonging to other languages as noted above.
- UK mapping missing overrides: SDLK_AMPERSAND, SDLK_COLON, SDLK_LESS, SDLK_BACKSLASH, SDLK_CARET.
- ES mapping missing overrides: SDLK_QUOTEDBL, SDLK_AMPERSAND, SDLK_QUOTE, SDLK_SLASH, SDLK_COLON, SDLK_QUESTION, SDLK_CARET
- IT mapping missing overrides: SDLK_HASH, SDLK_AT, SDLK_UNDERSCORE, SDLK_BACKQUOTE
- SE mappings:
  - Missing overrides: SDLK_HASH, SDLK_ASTERISK, SDLK_UNDERSCORE, SDLK_BACKQUOTE
  - 252 override is valid, but not present on SE host keyboards. Making comment to note this.
  - Like French I added one arbitrary mapping for a SE host keyboard that doesn't have a natural ST mapping and would be unpressable. 167 SE § as ST \.
- CH mappings: SDLK_EXCLAIM, SDLK_HASH, SDLK_DOLLAR, SDLK_ASTERISK, SDLK_PLUS, SDLK_AT, SDLK_RIGHTBRACKET, SDLK_UNDERSCORE, SDLK_BACKQUOTE

I'll try to finish my research for FI, NO, DK, SA, NL, CS, HU so that I can compare against and review what you've added for some of those, and maybe supplement the rest if I can.


-- Brad Smith


On Thu, Oct 3, 2024 at 10:08 AM Thomas Huth <th.huth@xxxxxxxxx> wrote:
Am Mon, 11 Sep 2023 02:00:56 +0300
schrieb Eero Tamminen <oak@xxxxxxxxxxxxxx>:
....
> On 9.9.2023 21.53, Brad Smith wrote:
> ...problem description removed...
> > What I've been working on, is providing a set of 16 symbolic maps for the
> > keyboards known to me ( https://tho-otto.de/keyboards/ ) and allowing
> > Hatari to automatically select the chosen one based on the loaded TOS, or
> > override if the user chooses. 
>
> There are multiple things deciding the TOS keyboard layout.   TOS can be
> single language / layout, or support multiple ones.  In latter case,
> it's determined by TOS country code, or if machine has NVRAM, then by
> NVRAM keyboard layout setting.
>
> I can add logic (function) for that, once the mappings themselves work fine.
>
> > Because the number of TOS languages is finite
> > and small, it's a reasonable amount of code to provide this. With SDL
> > providing the semantic mapping, we eliminate one side of the host vs. TOS
> > permutations and it's reduced to a solvable problem.
> >
> > I was thinking about this because I had to work through all 16 layouts to
> > provide them as on-screen keyboards in my Libretro adaptation of Hatari (
> > https://github.com/bbbradsmith/hatariB ). It gave me an idea of the scope
> > of the work, and where all the exceptions lie. I think it's feasible. I've
> > already done a couple of layouts and they seem to be working very well. I
> > just need some time to finish going over all of them. It's not complicated
> > work, just takes time to get through all the data entry and testing. 
>
> Whatever changes you already have related to this, could you send them
> as initial draft patch series?
>
> I'd like to see how you've integrated the changes to Hatari, and how
> much additional code / tables there is so far.

 Hi!

I recently had a look what Brad had in his public repository, and since the
work seemed to have stalled, I picked up the patches, reworked them quite a
bit and finally committed the results to the Hatari repository now.
Some languages are still missing (like Czech), since I don't have a clue how
the letters are mapped there on the SDL side (they don't seem to be part of
the latin1 encoding that is used by SDL for other european languages), but
apart from that, the symbolic mapping should now hopefully be fine for most
TOS languages. Please let me know if something now does not work as
expected anymore.

 Thomas

PS: There is a dutch TOS 1.04 available in the internet which seems to use
the wrong language code in the ROM header ... so that does not work with
the symbolic mapping in Hatari yet. No clue whether we should add a hack
for that in Hatari, though, or whether we should recommend the users to fix
up the bad value in the TOS header instead...





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/