From 247d76d7cd06ae7e468c2158a3bb2c9a8fe9dc2f Mon Sep 17 00:00:00 2001 From: Edward Li Date: Sun, 24 Sep 2023 02:18:22 +0800 Subject: [PATCH] Handle `RawInput` also --- core/sdl/sdl.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/core/sdl/sdl.cpp b/core/sdl/sdl.cpp index f94cd5487d..32c5197b41 100644 --- a/core/sdl/sdl.cpp +++ b/core/sdl/sdl.cpp @@ -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(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))