diff options
author | german77 <juangerman-13@hotmail.com> | 2021-11-14 17:45:07 +0100 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2021-11-25 03:30:28 +0100 |
commit | bca299e8e0489867f7d4bbfd264e221e7e61ae1e (patch) | |
tree | 312f145bfcaffa9b7ecc2710443fa3737bf379e4 /src/core | |
parent | core/hid: Improve accuracy of the keyboard implementation (diff) | |
download | yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar.gz yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar.bz2 yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar.lz yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar.xz yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar.zst yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/hid/emulated_devices.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp index 0d840a003..45e0bd80d 100644 --- a/src/core/hid/emulated_devices.cpp +++ b/src/core/hid/emulated_devices.cpp @@ -29,13 +29,29 @@ void EmulatedDevices::ReloadInput() { mouse_button_devices.begin(), Common::Input::CreateDevice<Common::Input::InputDevice>); - std::transform(Settings::values.keyboard_keys.begin(), Settings::values.keyboard_keys.end(), - keyboard_devices.begin(), - Common::Input::CreateDeviceFromString<Common::Input::InputDevice>); + std::size_t key_index = 0; + for (auto& keyboard_device : keyboard_devices) { + // Keyboard keys are only mapped on port 1, pad 0 + Common::ParamPackage keyboard_params; + keyboard_params.Set("engine", "keyboard"); + keyboard_params.Set("button", static_cast<int>(key_index)); + keyboard_params.Set("port", 1); + keyboard_params.Set("pad", 0); + keyboard_device = Common::Input::CreateDevice<Common::Input::InputDevice>(keyboard_params); + key_index++; + } - std::transform(Settings::values.keyboard_mods.begin(), Settings::values.keyboard_mods.end(), - keyboard_modifier_devices.begin(), - Common::Input::CreateDeviceFromString<Common::Input::InputDevice>); + key_index = 0; + for (auto& keyboard_device : keyboard_modifier_devices) { + // Keyboard moddifiers are only mapped on port 1, pad 1 + Common::ParamPackage keyboard_params; + keyboard_params.Set("engine", "keyboard"); + keyboard_params.Set("button", static_cast<int>(key_index)); + keyboard_params.Set("port", 1); + keyboard_params.Set("pad", 1); + keyboard_device = Common::Input::CreateDevice<Common::Input::InputDevice>(keyboard_params); + key_index++; + } for (std::size_t index = 0; index < mouse_button_devices.size(); ++index) { if (!mouse_button_devices[index]) { |