Skip to content

Commit

Permalink
Handle RawInput also
Browse files Browse the repository at this point in the history
  • Loading branch information
vkedwardli committed Sep 23, 2023
1 parent ec303a3 commit 247d76d
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion core/sdl/sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,27 @@ void input_sdl_handle()
checkRawInput();
if (event.key.repeat == 0)
{
auto is_key_mapped = [](u32 code) -> bool { return (sdl_keyboard->get_input_mapping()->get_button_id(0, code) != EMU_BTN_NONE); };
auto is_key_mapped = [](u32 code) -> bool {
#if defined(_WIN32) && !defined(TARGET_UWP)
if (config::UseRawInput)
{
for (int i = 0; i < GamepadDevice::GetGamepadCount(); i++)
{
auto gamepad = GamepadDevice::GetGamepad(i);
if (dynamic_cast<rawinput::RawKeyboard*>(gamepad.get()) != nullptr)
{
bool mapped = (gamepad->get_input_mapping()->get_button_id(0, code) != EMU_BTN_NONE);
if (mapped) return true;
}
}
return false;
}
else
#endif
{
return (sdl_keyboard->get_input_mapping()->get_button_id(0, code) != EMU_BTN_NONE);
}
};

if (event.type == SDL_KEYDOWN
&& ((event.key.keysym.sym == SDLK_RETURN && (event.key.keysym.mod & KMOD_ALT))
Expand Down

0 comments on commit 247d76d

Please sign in to comment.