Keyboard remapping fix

This commit is contained in:
Tony Jansson 2020-11-09 15:21:08 +02:00
parent 3693db2451
commit c3f3ac3dc1
1 changed files with 31 additions and 29 deletions

View File

@ -24548,41 +24548,43 @@ static void input_driver_poll(void)
{ {
unsigned remap_button = unsigned remap_button =
settings->uints.input_keymapper_ids[i][j]; settings->uints.input_keymapper_ids[i][j];
bool remap_valid = bool remap_valid =
remap_button != RETROK_UNKNOWN; remap_button != RETROK_UNKNOWN &&
if (remap_valid) !handle->keys[remap_button / 32];
{
unsigned current_button_value = if (!remap_valid)
BIT256_GET_PTR(p_new_state, j); continue;
unsigned current_button_value =
BIT256_GET_PTR(p_new_state, j);
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
if (poll_overlay && i == 0) if (poll_overlay && i == 0)
{ {
input_overlay_state_t *ol_state = input_overlay_state_t *ol_state =
overlay_pointer overlay_pointer
? &overlay_pointer->overlay_state ? &overlay_pointer->overlay_state
: NULL; : NULL;
if (ol_state) if (ol_state)
current_button_value |= current_button_value |=
BIT256_GET(ol_state->buttons, j); BIT256_GET(ol_state->buttons, j);
} }
#endif #endif
if ((current_button_value == 1) if ((current_button_value == 1)
&& (j != remap_button)) && (j != remap_button))
{ {
MAPPER_SET_KEY (handle, MAPPER_SET_KEY (handle,
remap_button); remap_button);
input_keyboard_event(true, input_keyboard_event(true,
remap_button,
0, 0, RETRO_DEVICE_KEYBOARD);
continue;
}
/* Release keyboard event*/
input_keyboard_event(false,
remap_button, remap_button,
0, 0, RETRO_DEVICE_KEYBOARD); 0, 0, RETRO_DEVICE_KEYBOARD);
continue;
} }
/* Release keyboard event*/
input_keyboard_event(false,
remap_button,
0, 0, RETRO_DEVICE_KEYBOARD);
} }
break; break;