Fix Enter not working in menu on Android keyboards (#18405)

This commit is contained in:
zoltanvb 2025-11-16 20:59:32 +01:00 committed by GitHub
parent acd3fa1172
commit cf3c678de5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View File

@ -915,7 +915,17 @@ static INLINE void android_input_poll_event_type_key(
{
uint8_t *buf = android_key_state[port];
int action = AKeyEvent_getAction(event);
int keysym = keycode;
/* Handle 'duplicate' inputs that correspond
* to the same RETROK_* key */
switch (keycode)
{
case AKEYCODE_DPAD_CENTER:
keysym = AKEYCODE_ENTER;
default:
break;
}
/* some controllers send both the up and down events at once
* when the button is released for "special" buttons, like menu buttons
* work around that by only using down events for meta keys (which get
@ -924,10 +934,10 @@ static INLINE void android_input_poll_event_type_key(
switch (action)
{
case AKEY_EVENT_ACTION_UP:
BIT_CLEAR(buf, keycode);
BIT_CLEAR(buf, keysym);
break;
case AKEY_EVENT_ACTION_DOWN:
BIT_SET(buf, keycode);
BIT_SET(buf, keysym);
break;
}

View File

@ -1395,7 +1395,7 @@ const struct rarch_key_map rarch_key_map_android[] = {
{ AKEYCODE_TAB, RETROK_TAB },
{ AKEYCODE_CLEAR, RETROK_CLEAR },
{ AKEYCODE_ENTER, RETROK_RETURN },
{ AKEYCODE_DPAD_CENTER, RETROK_RETURN },
/* { AKEYCODE_DPAD_CENTER, RETROK_RETURN }, */ /* Duplicate - skip */
{ AKEYCODE_BREAK, RETROK_PAUSE },
{ AKEYCODE_ESCAPE, RETROK_ESCAPE },
{ AKEYCODE_SPACE, RETROK_SPACE },