diff options
| author | 2021-11-14 10:45:07 -0600 | |
|---|---|---|
| committer | 2021-11-24 20:30:28 -0600 | |
| commit | bca299e8e0489867f7d4bbfd264e221e7e61ae1e (patch) | |
| tree | 312f145bfcaffa9b7ecc2710443fa3737bf379e4 /src/core | |
| parent | core/hid: Improve accuracy of the keyboard implementation (diff) | |
| download | yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar.gz yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar.xz yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.zip | |
input_common: Allow keyboard to be backwards compatible
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() { | |||
| 29 | mouse_button_devices.begin(), | 29 | mouse_button_devices.begin(), |
| 30 | Common::Input::CreateDevice<Common::Input::InputDevice>); | 30 | Common::Input::CreateDevice<Common::Input::InputDevice>); |
| 31 | 31 | ||
| 32 | std::transform(Settings::values.keyboard_keys.begin(), Settings::values.keyboard_keys.end(), | 32 | std::size_t key_index = 0; |
| 33 | keyboard_devices.begin(), | 33 | for (auto& keyboard_device : keyboard_devices) { |
| 34 | Common::Input::CreateDeviceFromString<Common::Input::InputDevice>); | 34 | // Keyboard keys are only mapped on port 1, pad 0 |
| 35 | Common::ParamPackage keyboard_params; | ||
| 36 | keyboard_params.Set("engine", "keyboard"); | ||
| 37 | keyboard_params.Set("button", static_cast<int>(key_index)); | ||
| 38 | keyboard_params.Set("port", 1); | ||
| 39 | keyboard_params.Set("pad", 0); | ||
| 40 | keyboard_device = Common::Input::CreateDevice<Common::Input::InputDevice>(keyboard_params); | ||
| 41 | key_index++; | ||
| 42 | } | ||
| 35 | 43 | ||
| 36 | std::transform(Settings::values.keyboard_mods.begin(), Settings::values.keyboard_mods.end(), | 44 | key_index = 0; |
| 37 | keyboard_modifier_devices.begin(), | 45 | for (auto& keyboard_device : keyboard_modifier_devices) { |
| 38 | Common::Input::CreateDeviceFromString<Common::Input::InputDevice>); | 46 | // Keyboard moddifiers are only mapped on port 1, pad 1 |
| 47 | Common::ParamPackage keyboard_params; | ||
| 48 | keyboard_params.Set("engine", "keyboard"); | ||
| 49 | keyboard_params.Set("button", static_cast<int>(key_index)); | ||
| 50 | keyboard_params.Set("port", 1); | ||
| 51 | keyboard_params.Set("pad", 1); | ||
| 52 | keyboard_device = Common::Input::CreateDevice<Common::Input::InputDevice>(keyboard_params); | ||
| 53 | key_index++; | ||
| 54 | } | ||
| 39 | 55 | ||
| 40 | for (std::size_t index = 0; index < mouse_button_devices.size(); ++index) { | 56 | for (std::size_t index = 0; index < mouse_button_devices.size(); ++index) { |
| 41 | if (!mouse_button_devices[index]) { | 57 | if (!mouse_button_devices[index]) { |