I was experimenting in MAME running under Ubuntu LInux and using the extra multimedia keys on my keyboard.
You can use quite a few multimedia keys, quite a few more if you run “pkill gsd-media-keys” which kills the gnome system daemon that handles the media keys.
Then things like volume up and down get passed through to SDL and then to MAME.
Which led me to write a program that allowed me to virtually type any keycode from /usr/include/linux/input-event-codes.h by using uinput.
Some of the keys not working led me to discover the table where the translation from EV_KEY to SDL_SCANCODE was taking place.
(like KEY_COMPUTER doesn’t work in ubuntu, and KEY_CONFIG registers as KEY_F13)
It would seem that the table handling the translation is defined in:
libsdl2_2.30.0+dfsg.orig/SDL2-2.30.0/src/events/scancodes_xfree86.h
/* This is largely identical to the Linux keycode mapping */
static const SDL_Scancode xfree86_scancode_table2[] = {
/* 0, 0x000 */ SDL_SCANCODE_UNKNOWN, /* NoSymbol */
/* 1, 0x001 */ SDL_SCANCODE_ESCAPE, /* Escape */
/* 245, 0x0f5 */ SDL_SCANCODE_UNKNOWN, /* XF86DisplayOff */
/* 246, 0x0f6 */ SDL_SCANCODE_UNKNOWN, /* XF86WWAN */
/* 247, 0x0f7 */ SDL_SCANCODE_UNKNOWN, /* XF86RFKill */
and runs up to 247 maximum.
This is a static table and I was interested in making this table dynamic where it could be reconfigured without recompiling sdl.
The “standard” linux keycodes go up to 0x2ff=767 where this table cuts off at 247.
Theoretically you could open up a huge number of keycodes by adding codes to include/SDL_scancodes.h
SDL_SCANCODE_CALL = 289, /**< Used for accepting phone calls. */
SDL_SCANCODE_ENDCALL = 290, /**< Used for rejecting phone calls. */
/* @} *//* Mobile keys */
/* Add any other keys here. */
SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
for array bounds */
Here, the scancodes go up to 512.
I find these extra keys quite useful, for under MAME, certain keys get intercepted by the GUI, like left GUI, so you can use a multimedia key to assign to this.
For example, there’s a whole range of key numbers that are assigned to buttons, like BTN_TRIGGER_HAPPY1 0x2c1
BTN_TRIGGER_HAPPY40 0x2e7
Since all of the keys/buttons get passed through as simple numbers it should be straightforward to expand the range of possible keycodes.
My next project is to figure out how to compile my own SDL.
https://forums.bannister.org/ubbthreads.php?ubb=showflat&Number=124912#Post124912