(Emscripten) Fix input code to ignore unknown keys

This commit is contained in:
Dylan Scott 2020-07-14 03:33:55 -04:00 committed by GitHub
parent 3297e464c4
commit b4ac13cc5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -636,10 +636,12 @@ static void rwebinput_process_keyboard_events(rwebinput_input_t *rwebinput,
else if (translated_keycode == RETROK_TAB)
character = '\t';
input_keyboard_event(keydown, translated_keycode, character, mod,
RETRO_DEVICE_KEYBOARD);
if (translated_keycode < RETROK_LAST)
if (translated_keycode != RETROK_UNKNOWN) {
input_keyboard_event(keydown, translated_keycode, character, mod,
RETRO_DEVICE_KEYBOARD);
}
if (translated_keycode < RETROK_LAST && translated_keycode != RETROK_UNKNOWN)
{
rwebinput->keys[translated_keycode] = keydown;
}