View Issue Details

IDProjectCategoryView StatusLast Update
0027139RunnerAndroidPublic2021-07-30 11:29
ReporterYellowAfterlifeAssigned ToCoreTech 
PriorityVery LowSeverityC - GeneralReproducibility100%
Status ResolvedResolutionSuspended 
PlatformAndroidOSWindows 8OS Version8.1
Product VersionPre-2.1.3 
Target VersionFixed in Version 
Summary0027139: Android: keyboard_check() does not remap vast majority of key codes
DescriptionWhile experimenting with an external bluetooth keyboard on Android, it came to my attention that GMS makes no attempts to remap the key codes for anything other than arrow keys and back-button (which, for some reason, is mapped to vk_back instead of vk_browser_back). That means that you have to map vks to android key codes manually, but does not produce an acceptable result because GM-remapped back-button clashes with digit 1, while arrow keys overlap the middle of letter range codes.

Below is a lookup table initialization for majority of the missing codes.
Android key codes from https://source.android.com/devices/input/keyboard-devices#code-tables
Windows key codes from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
Tested with a Logitech K380 wireless keyboard on Windows and Android (tester project attached).
The only keys missing here are the non-digit numpad keys, which the said keyboard lacks (while Android documentation has ambiguous names for some of them)

// r[] = 3; // home
r[166] = 4; // back (incorrectly mapped from backspace..?)
for (i = 0; i < 10; i++) r[ord("0") + i] = 7 + i; // ..16
r[38] = 19; // up
r[40] = 20; // down
r[37] = 21; // left
r[39] = 22; // right
r[175] = 24; // volume-up
r[174] = 25; // volume-down
for (i = 0; i < 26; i++) r[ord("A") + i] = 29 + i
r[188] = 55; // <,
r[190] = 56; // >.
r[164] = 57; // lalt
r[135] = 58; // ralt
r[160] = 59; // lshift
r[161] = 60; // rshift
r[9] = 61; // tab
r[32] = 62; // space
r[13] = 66; // enter
r[8] = 67; // bksp
r[192] = 68; // ~
r[189] = 69; // -_
r[187] = 70; // +=
r[219] = 71; // [{
r[221] = 72; // ]}
r[220] = 73; // \|
r[186] = 74; // ;:
r[222] = 75; // '"
r[191] = 76; // /?
// r[] = 82; // menu
r[170] = 84; // search
r[179] = 85; // media-play-pause
r[178] = 86; // media-stop
r[176] = 87; // media-next
r[177] = 88; // media-prev
// r[] = 89; // rewind
// r[] = 90; // fast forward
r[33] = 92; // pgup
r[34] = 93; // pgdn
r[27] = 111; // esc
r[46] = 112; // del
r[162] = 113; // lctrl
r[163] = 114; // rctrl
r[91] = 115; // caps lock
r[145] = 116; // scroll lock
// r[] = 117; // lmeta (not usable?)
// r[] = 118; // rmeta (not usable?)
// r[] = 119; // function?
r[44] = 120; // printscr/sysrq
r[19] = 121; // pause/break
r[36] = 122; // home
r[35] = 123; // end
r[45] = 124; // insert
r[167] = 125; // forward
for (i = 0; i < 12; i++) r[vk_f1 + i] = 131 + i; // ..142
for (i = 0; i < 10; i++) r[vk_numpad0 + i] = 144 + i; // ..153
r[173] = 164; // mute
TagsNo tags attached.
1.4 Found In7.7.1535
2.x Runtime Found In2.0.7.110
2.x Runtime Verified In

Activities

YellowAfterlife

2017-07-18 19:53

Viewer  

a_bug.gmz (233,322 bytes)

Russell Kay

2017-07-21 22:04

Manager   ~0054470

Err... we don't support any keyboards on Android at all, if anything is coming through then it is a bit of a fluke (possibly someone has started adding support and not carried it through)

Russell Kay

2018-05-23 10:10

Manager   ~0059990

In the light of the Virtual Keyboard is this still a problem?

Russell Kay

2018-06-14 15:03

Manager   ~0060291

Android Virtual Keyboard support nullifies this bug

YellowAfterlife

2018-06-30 13:32

Viewer   ~0060762

I'm late

Android Virtual Keyboard support does not nullify this bug - it applies to how input is interpreted from hardware buttons - for instance, if your device has a physical keyboard (either an external/bluetooth one or a built-in one), you can use keyboard_check and alike perfectly fine... except the keycodes are all mixed up and have overlapping index spaces.

SamH

2021-07-30 11:29

Developer   ~0066549

Unable to confirm now, as missing required keyboard. If this still happens in the current GMS2 release, then we will investigate a fresh report. Closing.