Re: [hatari-devel] Keyboard scancode table inconsistencies

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


Hi,

On 10.10.2021 11.04, Thomas Huth wrote:
Am Sun, 10 Oct 2021 02:05:23 +0300
schrieb Eero Tamminen <oak@xxxxxxxxxxxxxx>:
I looked at the issue reported by Thorsten:
https://www.atari-forum.com/viewtopic.php?p=423439#p423439

And noticed that of the three tables involved in
handling key input, all had slightly differing
sizes and according to Thorsten the smaller ones
are too small for all the keys that actually need
to be interpreted.

Attached is patch to make them all the same size.

Any objections / ideas why they were not the same size?

That patch/idea is certainly not right. You're mixing up the SDL scan
codes with the Atari scan codes here, that's two completely different
number spaces. "y" with scan code "0x79" is certainly an SDL scan code,
on the Atari side, the "y" key normally has scan code 0x15 instead
(unless you're on a German keyboard, where it is 0x2c, I think).

In Hatari code, exactly the same value that is
used to index KeyStates[] in keymap.c:
https://git.tuxfamily.org/hatari/hatari.git/tree/src/keymap.c#n559

Is passed to IKBD_PressSTKey(), and used as-is
to index ScanCodeState[] in ikbd.c:
https://git.tuxfamily.org/hatari/hatari.git/tree/src/ikbd.c#n1726

So there actually should be some sync with them
to avoid accidental array overwrites.


As to LoadedKeymap[] array size being taken from
same define (KBD_MAX_SCANCODE) as ScanCodeState[]
size (with offset of 1), that tie-in was already
in Hatari code, I did change it, just increased
the array size.

Note that 0x72 definitely is not the largest scan
code that SDL2 may have.  Those go into hundreds:
https://github.com/LuaDist/sdl/blob/master/include/SDL_scancode.h


If you want to help to improve keyboard mapping, you should likely
rather help to get these patches here into a better shape:
  https://github.com/hatari/hatari/pull/11

Ah, this actually fixes the latter issue.
I'll take a look at the patches.

(It does not seem to change anything related
to the IKBD vs Keymap ST scancode array size
mismatch.  I'll look into that again, after
I've handled the pull request.)


Not sure whether this will help with the problem from the reporter on
atari-forum.com, too, though.


	- Eero



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