diff options
| -rw-r--r-- | src/common/settings_input.h | 35 | ||||
| -rw-r--r-- | src/core/hid/emulated_devices.cpp | 3 | ||||
| -rw-r--r-- | src/core/hid/hid_types.h | 398 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/keyboard.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 35 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.h | 2 | ||||
| -rw-r--r-- | src/input_common/drivers/keyboard.cpp | 53 | ||||
| -rw-r--r-- | src/input_common/drivers/keyboard.h | 7 | ||||
| -rw-r--r-- | src/input_common/main.cpp | 9 | ||||
| -rw-r--r-- | src/input_common/main.h | 3 | ||||
| -rw-r--r-- | src/yuzu/bootmanager.cpp | 276 | ||||
| -rw-r--r-- | src/yuzu/bootmanager.h | 6 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 167 |
13 files changed, 682 insertions, 313 deletions
diff --git a/src/common/settings_input.h b/src/common/settings_input.h index 2c0eb31d3..a2982fca4 100644 --- a/src/common/settings_input.h +++ b/src/common/settings_input.h | |||
| @@ -129,7 +129,6 @@ extern const std::array<const char*, NumMouseButtons> mapping; | |||
| 129 | namespace NativeKeyboard { | 129 | namespace NativeKeyboard { |
| 130 | enum Keys { | 130 | enum Keys { |
| 131 | None, | 131 | None, |
| 132 | Error, | ||
| 133 | 132 | ||
| 134 | A = 4, | 133 | A = 4, |
| 135 | B, | 134 | B, |
| @@ -167,22 +166,22 @@ enum Keys { | |||
| 167 | N8, | 166 | N8, |
| 168 | N9, | 167 | N9, |
| 169 | N0, | 168 | N0, |
| 170 | Enter, | 169 | Return, |
| 171 | Escape, | 170 | Escape, |
| 172 | Backspace, | 171 | Backspace, |
| 173 | Tab, | 172 | Tab, |
| 174 | Space, | 173 | Space, |
| 175 | Minus, | 174 | Minus, |
| 176 | Equal, | 175 | Plus, |
| 177 | LeftBrace, | 176 | OpenBracket, |
| 178 | RightBrace, | 177 | CloseBracket, |
| 179 | Backslash, | 178 | Pipe, |
| 180 | Tilde, | 179 | Tilde, |
| 181 | Semicolon, | 180 | Semicolon, |
| 182 | Apostrophe, | 181 | Quote, |
| 183 | Grave, | 182 | Backquote, |
| 184 | Comma, | 183 | Comma, |
| 185 | Dot, | 184 | Period, |
| 186 | Slash, | 185 | Slash, |
| 187 | CapsLockKey, | 186 | CapsLockKey, |
| 188 | 187 | ||
| @@ -199,7 +198,7 @@ enum Keys { | |||
| 199 | F11, | 198 | F11, |
| 200 | F12, | 199 | F12, |
| 201 | 200 | ||
| 202 | SystemRequest, | 201 | PrintScreen, |
| 203 | ScrollLockKey, | 202 | ScrollLockKey, |
| 204 | Pause, | 203 | Pause, |
| 205 | Insert, | 204 | Insert, |
| @@ -268,8 +267,18 @@ enum Keys { | |||
| 268 | ScrollLockActive, | 267 | ScrollLockActive, |
| 269 | KPComma, | 268 | KPComma, |
| 270 | 269 | ||
| 271 | KPLeftParenthesis, | 270 | Ro = 0x87, |
| 272 | KPRightParenthesis, | 271 | KatakanaHiragana, |
| 272 | Yen, | ||
| 273 | Henkan, | ||
| 274 | Muhenkan, | ||
| 275 | NumPadCommaPc98, | ||
| 276 | |||
| 277 | HangulEnglish = 0x90, | ||
| 278 | Hanja, | ||
| 279 | KatakanaKey, | ||
| 280 | HiraganaKey, | ||
| 281 | ZenkakuHankaku, | ||
| 273 | 282 | ||
| 274 | LeftControlKey = 0xE0, | 283 | LeftControlKey = 0xE0, |
| 275 | LeftShiftKey, | 284 | LeftShiftKey, |
| @@ -318,6 +327,8 @@ enum Modifiers { | |||
| 318 | CapsLock, | 327 | CapsLock, |
| 319 | ScrollLock, | 328 | ScrollLock, |
| 320 | NumLock, | 329 | NumLock, |
| 330 | Katakana, | ||
| 331 | Hiragana, | ||
| 321 | 332 | ||
| 322 | NumKeyboardMods, | 333 | NumKeyboardMods, |
| 323 | }; | 334 | }; |
diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp index e97470240..0d840a003 100644 --- a/src/core/hid/emulated_devices.cpp +++ b/src/core/hid/emulated_devices.cpp | |||
| @@ -170,13 +170,14 @@ void EmulatedDevices::SetKeyboardButton(Common::Input::CallbackStatus callback, | |||
| 170 | return; | 170 | return; |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | // Index should be converted from NativeKeyboard to KeyboardKeyIndex | ||
| 173 | UpdateKey(index, current_status.value); | 174 | UpdateKey(index, current_status.value); |
| 174 | 175 | ||
| 175 | TriggerOnChange(DeviceTriggerType::Keyboard); | 176 | TriggerOnChange(DeviceTriggerType::Keyboard); |
| 176 | } | 177 | } |
| 177 | 178 | ||
| 178 | void EmulatedDevices::UpdateKey(std::size_t key_index, bool status) { | 179 | void EmulatedDevices::UpdateKey(std::size_t key_index, bool status) { |
| 179 | constexpr u8 KEYS_PER_BYTE = 8; | 180 | constexpr std::size_t KEYS_PER_BYTE = 8; |
| 180 | auto& entry = device_status.keyboard_state.key[key_index / KEYS_PER_BYTE]; | 181 | auto& entry = device_status.keyboard_state.key[key_index / KEYS_PER_BYTE]; |
| 181 | const u8 mask = static_cast<u8>(1 << (key_index % KEYS_PER_BYTE)); | 182 | const u8 mask = static_cast<u8>(1 << (key_index % KEYS_PER_BYTE)); |
| 182 | if (status) { | 183 | if (status) { |
diff --git a/src/core/hid/hid_types.h b/src/core/hid/hid_types.h index 41bc65ce2..af95f3aff 100644 --- a/src/core/hid/hid_types.h +++ b/src/core/hid/hid_types.h | |||
| @@ -12,6 +12,195 @@ | |||
| 12 | 12 | ||
| 13 | namespace Core::HID { | 13 | namespace Core::HID { |
| 14 | 14 | ||
| 15 | enum class DeviceIndex : u8 { | ||
| 16 | Left = 0, | ||
| 17 | Right = 1, | ||
| 18 | None = 2, | ||
| 19 | MaxDeviceIndex = 3, | ||
| 20 | }; | ||
| 21 | |||
| 22 | // This is nn::hid::NpadButton | ||
| 23 | enum class NpadButton : u64 { | ||
| 24 | None = 0, | ||
| 25 | A = 1U << 0, | ||
| 26 | B = 1U << 1, | ||
| 27 | X = 1U << 2, | ||
| 28 | Y = 1U << 3, | ||
| 29 | StickL = 1U << 4, | ||
| 30 | StickR = 1U << 5, | ||
| 31 | L = 1U << 6, | ||
| 32 | R = 1U << 7, | ||
| 33 | ZL = 1U << 8, | ||
| 34 | ZR = 1U << 9, | ||
| 35 | Plus = 1U << 10, | ||
| 36 | Minus = 1U << 11, | ||
| 37 | |||
| 38 | Left = 1U << 12, | ||
| 39 | Up = 1U << 13, | ||
| 40 | Right = 1U << 14, | ||
| 41 | Down = 1U << 15, | ||
| 42 | |||
| 43 | StickLLeft = 1U << 16, | ||
| 44 | StickLUp = 1U << 17, | ||
| 45 | StickLRight = 1U << 18, | ||
| 46 | StickLDown = 1U << 19, | ||
| 47 | |||
| 48 | StickRLeft = 1U << 20, | ||
| 49 | StickRUp = 1U << 21, | ||
| 50 | StickRRight = 1U << 22, | ||
| 51 | StickRDown = 1U << 23, | ||
| 52 | |||
| 53 | LeftSL = 1U << 24, | ||
| 54 | LeftSR = 1U << 25, | ||
| 55 | |||
| 56 | RightSL = 1U << 26, | ||
| 57 | RightSR = 1U << 27, | ||
| 58 | |||
| 59 | Palma = 1U << 28, | ||
| 60 | Verification = 1U << 29, | ||
| 61 | HandheldLeftB = 1U << 30, | ||
| 62 | LagonCLeft = 1U << 31, | ||
| 63 | LagonCUp = 1ULL << 32, | ||
| 64 | LagonCRight = 1ULL << 33, | ||
| 65 | LagonCDown = 1ULL << 34, | ||
| 66 | }; | ||
| 67 | DECLARE_ENUM_FLAG_OPERATORS(NpadButton); | ||
| 68 | |||
| 69 | enum class KeyboardKeyIndex : u32 { | ||
| 70 | A = 4, | ||
| 71 | B = 5, | ||
| 72 | C = 6, | ||
| 73 | D = 7, | ||
| 74 | E = 8, | ||
| 75 | F = 9, | ||
| 76 | G = 10, | ||
| 77 | H = 11, | ||
| 78 | I = 12, | ||
| 79 | J = 13, | ||
| 80 | K = 14, | ||
| 81 | L = 15, | ||
| 82 | M = 16, | ||
| 83 | N = 17, | ||
| 84 | O = 18, | ||
| 85 | P = 19, | ||
| 86 | Q = 20, | ||
| 87 | R = 21, | ||
| 88 | S = 22, | ||
| 89 | T = 23, | ||
| 90 | U = 24, | ||
| 91 | V = 25, | ||
| 92 | W = 26, | ||
| 93 | X = 27, | ||
| 94 | Y = 28, | ||
| 95 | Z = 29, | ||
| 96 | D1 = 30, | ||
| 97 | D2 = 31, | ||
| 98 | D3 = 32, | ||
| 99 | D4 = 33, | ||
| 100 | D5 = 34, | ||
| 101 | D6 = 35, | ||
| 102 | D7 = 36, | ||
| 103 | D8 = 37, | ||
| 104 | D9 = 38, | ||
| 105 | D0 = 39, | ||
| 106 | Return = 40, | ||
| 107 | Escape = 41, | ||
| 108 | Backspace = 42, | ||
| 109 | Tab = 43, | ||
| 110 | Space = 44, | ||
| 111 | Minus = 45, | ||
| 112 | Plus = 46, | ||
| 113 | OpenBracket = 47, | ||
| 114 | CloseBracket = 48, | ||
| 115 | Pipe = 49, | ||
| 116 | Tilde = 50, | ||
| 117 | Semicolon = 51, | ||
| 118 | Quote = 52, | ||
| 119 | Backquote = 53, | ||
| 120 | Comma = 54, | ||
| 121 | Period = 55, | ||
| 122 | Slash = 56, | ||
| 123 | CapsLock = 57, | ||
| 124 | F1 = 58, | ||
| 125 | F2 = 59, | ||
| 126 | F3 = 60, | ||
| 127 | F4 = 61, | ||
| 128 | F5 = 62, | ||
| 129 | F6 = 63, | ||
| 130 | F7 = 64, | ||
| 131 | F8 = 65, | ||
| 132 | F9 = 66, | ||
| 133 | F10 = 67, | ||
| 134 | F11 = 68, | ||
| 135 | F12 = 69, | ||
| 136 | PrintScreen = 70, | ||
| 137 | ScrollLock = 71, | ||
| 138 | Pause = 72, | ||
| 139 | Insert = 73, | ||
| 140 | Home = 74, | ||
| 141 | PageUp = 75, | ||
| 142 | Delete = 76, | ||
| 143 | End = 77, | ||
| 144 | PageDown = 78, | ||
| 145 | RightArrow = 79, | ||
| 146 | LeftArrow = 80, | ||
| 147 | DownArrow = 81, | ||
| 148 | UpArrow = 82, | ||
| 149 | NumLock = 83, | ||
| 150 | NumPadDivide = 84, | ||
| 151 | NumPadMultiply = 85, | ||
| 152 | NumPadSubtract = 86, | ||
| 153 | NumPadAdd = 87, | ||
| 154 | NumPadEnter = 88, | ||
| 155 | NumPad1 = 89, | ||
| 156 | NumPad2 = 90, | ||
| 157 | NumPad3 = 91, | ||
| 158 | NumPad4 = 92, | ||
| 159 | NumPad5 = 93, | ||
| 160 | NumPad6 = 94, | ||
| 161 | NumPad7 = 95, | ||
| 162 | NumPad8 = 96, | ||
| 163 | NumPad9 = 97, | ||
| 164 | NumPad0 = 98, | ||
| 165 | NumPadDot = 99, | ||
| 166 | Backslash = 100, | ||
| 167 | Application = 101, | ||
| 168 | Power = 102, | ||
| 169 | NumPadEquals = 103, | ||
| 170 | F13 = 104, | ||
| 171 | F14 = 105, | ||
| 172 | F15 = 106, | ||
| 173 | F16 = 107, | ||
| 174 | F17 = 108, | ||
| 175 | F18 = 109, | ||
| 176 | F19 = 110, | ||
| 177 | F20 = 111, | ||
| 178 | F21 = 112, | ||
| 179 | F22 = 113, | ||
| 180 | F23 = 114, | ||
| 181 | F24 = 115, | ||
| 182 | NumPadComma = 133, | ||
| 183 | Ro = 135, | ||
| 184 | KatakanaHiragana = 136, | ||
| 185 | Yen = 137, | ||
| 186 | Henkan = 138, | ||
| 187 | Muhenkan = 139, | ||
| 188 | NumPadCommaPc98 = 140, | ||
| 189 | HangulEnglish = 144, | ||
| 190 | Hanja = 145, | ||
| 191 | Katakana = 146, | ||
| 192 | Hiragana = 147, | ||
| 193 | ZenkakuHankaku = 148, | ||
| 194 | LeftControl = 224, | ||
| 195 | LeftShift = 225, | ||
| 196 | LeftAlt = 226, | ||
| 197 | LeftGui = 227, | ||
| 198 | RightControl = 228, | ||
| 199 | RightShift = 229, | ||
| 200 | RightAlt = 230, | ||
| 201 | RightGui = 231, | ||
| 202 | }; | ||
| 203 | |||
| 15 | // This is nn::hid::NpadIdType | 204 | // This is nn::hid::NpadIdType |
| 16 | enum class NpadIdType : u32 { | 205 | enum class NpadIdType : u32 { |
| 17 | Player1 = 0x0, | 206 | Player1 = 0x0, |
| @@ -28,62 +217,6 @@ enum class NpadIdType : u32 { | |||
| 28 | Invalid = 0xFFFFFFFF, | 217 | Invalid = 0xFFFFFFFF, |
| 29 | }; | 218 | }; |
| 30 | 219 | ||
| 31 | /// Converts a NpadIdType to an array index. | ||
| 32 | constexpr size_t NpadIdTypeToIndex(NpadIdType npad_id_type) { | ||
| 33 | switch (npad_id_type) { | ||
| 34 | case NpadIdType::Player1: | ||
| 35 | return 0; | ||
| 36 | case NpadIdType::Player2: | ||
| 37 | return 1; | ||
| 38 | case NpadIdType::Player3: | ||
| 39 | return 2; | ||
| 40 | case NpadIdType::Player4: | ||
| 41 | return 3; | ||
| 42 | case NpadIdType::Player5: | ||
| 43 | return 4; | ||
| 44 | case NpadIdType::Player6: | ||
| 45 | return 5; | ||
| 46 | case NpadIdType::Player7: | ||
| 47 | return 6; | ||
| 48 | case NpadIdType::Player8: | ||
| 49 | return 7; | ||
| 50 | case NpadIdType::Handheld: | ||
| 51 | return 8; | ||
| 52 | case NpadIdType::Other: | ||
| 53 | return 9; | ||
| 54 | default: | ||
| 55 | return 0; | ||
| 56 | } | ||
| 57 | } | ||
| 58 | |||
| 59 | /// Converts an array index to a NpadIdType | ||
| 60 | constexpr NpadIdType IndexToNpadIdType(size_t index) { | ||
| 61 | switch (index) { | ||
| 62 | case 0: | ||
| 63 | return NpadIdType::Player1; | ||
| 64 | case 1: | ||
| 65 | return NpadIdType::Player2; | ||
| 66 | case 2: | ||
| 67 | return NpadIdType::Player3; | ||
| 68 | case 3: | ||
| 69 | return NpadIdType::Player4; | ||
| 70 | case 4: | ||
| 71 | return NpadIdType::Player5; | ||
| 72 | case 5: | ||
| 73 | return NpadIdType::Player6; | ||
| 74 | case 6: | ||
| 75 | return NpadIdType::Player7; | ||
| 76 | case 7: | ||
| 77 | return NpadIdType::Player8; | ||
| 78 | case 8: | ||
| 79 | return NpadIdType::Handheld; | ||
| 80 | case 9: | ||
| 81 | return NpadIdType::Other; | ||
| 82 | default: | ||
| 83 | return NpadIdType::Invalid; | ||
| 84 | } | ||
| 85 | } | ||
| 86 | |||
| 87 | // This is nn::hid::NpadStyleIndex | 220 | // This is nn::hid::NpadStyleIndex |
| 88 | enum class NpadStyleIndex : u8 { | 221 | enum class NpadStyleIndex : u8 { |
| 89 | None = 0, | 222 | None = 0, |
| @@ -124,6 +257,27 @@ enum class NpadStyleSet : u32 { | |||
| 124 | }; | 257 | }; |
| 125 | static_assert(sizeof(NpadStyleSet) == 4, "NpadStyleSet is an invalid size"); | 258 | static_assert(sizeof(NpadStyleSet) == 4, "NpadStyleSet is an invalid size"); |
| 126 | 259 | ||
| 260 | // This is nn::hid::VibrationDevicePosition | ||
| 261 | enum class VibrationDevicePosition : u32 { | ||
| 262 | None = 0, | ||
| 263 | Left = 1, | ||
| 264 | Right = 2, | ||
| 265 | }; | ||
| 266 | |||
| 267 | // This is nn::hid::VibrationDeviceType | ||
| 268 | enum class VibrationDeviceType : u32 { | ||
| 269 | Unknown = 0, | ||
| 270 | LinearResonantActuator = 1, | ||
| 271 | GcErm = 2, | ||
| 272 | }; | ||
| 273 | |||
| 274 | // This is nn::hid::VibrationGcErmCommand | ||
| 275 | enum class VibrationGcErmCommand : u64 { | ||
| 276 | Stop = 0, | ||
| 277 | Start = 1, | ||
| 278 | StopHard = 2, | ||
| 279 | }; | ||
| 280 | |||
| 127 | // This is nn::hid::NpadStyleTag | 281 | // This is nn::hid::NpadStyleTag |
| 128 | struct NpadStyleTag { | 282 | struct NpadStyleTag { |
| 129 | union { | 283 | union { |
| @@ -220,53 +374,6 @@ struct LedPattern { | |||
| 220 | }; | 374 | }; |
| 221 | }; | 375 | }; |
| 222 | 376 | ||
| 223 | // This is nn::hid::NpadButton | ||
| 224 | enum class NpadButton : u64 { | ||
| 225 | None = 0, | ||
| 226 | A = 1U << 0, | ||
| 227 | B = 1U << 1, | ||
| 228 | X = 1U << 2, | ||
| 229 | Y = 1U << 3, | ||
| 230 | StickL = 1U << 4, | ||
| 231 | StickR = 1U << 5, | ||
| 232 | L = 1U << 6, | ||
| 233 | R = 1U << 7, | ||
| 234 | ZL = 1U << 8, | ||
| 235 | ZR = 1U << 9, | ||
| 236 | Plus = 1U << 10, | ||
| 237 | Minus = 1U << 11, | ||
| 238 | |||
| 239 | Left = 1U << 12, | ||
| 240 | Up = 1U << 13, | ||
| 241 | Right = 1U << 14, | ||
| 242 | Down = 1U << 15, | ||
| 243 | |||
| 244 | StickLLeft = 1U << 16, | ||
| 245 | StickLUp = 1U << 17, | ||
| 246 | StickLRight = 1U << 18, | ||
| 247 | StickLDown = 1U << 19, | ||
| 248 | |||
| 249 | StickRLeft = 1U << 20, | ||
| 250 | StickRUp = 1U << 21, | ||
| 251 | StickRRight = 1U << 22, | ||
| 252 | StickRDown = 1U << 23, | ||
| 253 | |||
| 254 | LeftSL = 1U << 24, | ||
| 255 | LeftSR = 1U << 25, | ||
| 256 | |||
| 257 | RightSL = 1U << 26, | ||
| 258 | RightSR = 1U << 27, | ||
| 259 | |||
| 260 | Palma = 1U << 28, | ||
| 261 | Verification = 1U << 29, | ||
| 262 | HandheldLeftB = 1U << 30, | ||
| 263 | LagonCLeft = 1U << 31, | ||
| 264 | LagonCUp = 1ULL << 32, | ||
| 265 | LagonCRight = 1ULL << 33, | ||
| 266 | LagonCDown = 1ULL << 34, | ||
| 267 | }; | ||
| 268 | DECLARE_ENUM_FLAG_OPERATORS(NpadButton); | ||
| 269 | |||
| 270 | struct NpadButtonState { | 377 | struct NpadButtonState { |
| 271 | union { | 378 | union { |
| 272 | NpadButton raw{}; | 379 | NpadButton raw{}; |
| @@ -342,13 +449,6 @@ struct DebugPadButton { | |||
| 342 | }; | 449 | }; |
| 343 | static_assert(sizeof(DebugPadButton) == 0x4, "DebugPadButton is an invalid size"); | 450 | static_assert(sizeof(DebugPadButton) == 0x4, "DebugPadButton is an invalid size"); |
| 344 | 451 | ||
| 345 | enum class DeviceIndex : u8 { | ||
| 346 | Left = 0, | ||
| 347 | Right = 1, | ||
| 348 | None = 2, | ||
| 349 | MaxDeviceIndex = 3, | ||
| 350 | }; | ||
| 351 | |||
| 352 | // This is nn::hid::ConsoleSixAxisSensorHandle | 452 | // This is nn::hid::ConsoleSixAxisSensorHandle |
| 353 | struct ConsoleSixAxisSensorHandle { | 453 | struct ConsoleSixAxisSensorHandle { |
| 354 | u8 unknown_1; | 454 | u8 unknown_1; |
| @@ -383,20 +483,6 @@ struct VibrationDeviceHandle { | |||
| 383 | }; | 483 | }; |
| 384 | static_assert(sizeof(VibrationDeviceHandle) == 4, "SixAxisSensorHandle is an invalid size"); | 484 | static_assert(sizeof(VibrationDeviceHandle) == 4, "SixAxisSensorHandle is an invalid size"); |
| 385 | 485 | ||
| 386 | // This is nn::hid::VibrationDeviceType | ||
| 387 | enum class VibrationDeviceType : u32 { | ||
| 388 | Unknown = 0, | ||
| 389 | LinearResonantActuator = 1, | ||
| 390 | GcErm = 2, | ||
| 391 | }; | ||
| 392 | |||
| 393 | // This is nn::hid::VibrationDevicePosition | ||
| 394 | enum class VibrationDevicePosition : u32 { | ||
| 395 | None = 0, | ||
| 396 | Left = 1, | ||
| 397 | Right = 2, | ||
| 398 | }; | ||
| 399 | |||
| 400 | // This is nn::hid::VibrationValue | 486 | // This is nn::hid::VibrationValue |
| 401 | struct VibrationValue { | 487 | struct VibrationValue { |
| 402 | f32 low_amplitude; | 488 | f32 low_amplitude; |
| @@ -406,13 +492,6 @@ struct VibrationValue { | |||
| 406 | }; | 492 | }; |
| 407 | static_assert(sizeof(VibrationValue) == 0x10, "VibrationValue has incorrect size."); | 493 | static_assert(sizeof(VibrationValue) == 0x10, "VibrationValue has incorrect size."); |
| 408 | 494 | ||
| 409 | // This is nn::hid::VibrationGcErmCommand | ||
| 410 | enum class VibrationGcErmCommand : u64 { | ||
| 411 | Stop = 0, | ||
| 412 | Start = 1, | ||
| 413 | StopHard = 2, | ||
| 414 | }; | ||
| 415 | |||
| 416 | // This is nn::hid::VibrationDeviceInfo | 495 | // This is nn::hid::VibrationDeviceInfo |
| 417 | struct VibrationDeviceInfo { | 496 | struct VibrationDeviceInfo { |
| 418 | VibrationDeviceType type{}; | 497 | VibrationDeviceType type{}; |
| @@ -482,4 +561,61 @@ struct MouseState { | |||
| 482 | MouseAttribute attribute; | 561 | MouseAttribute attribute; |
| 483 | }; | 562 | }; |
| 484 | static_assert(sizeof(MouseState) == 0x28, "MouseState is an invalid size"); | 563 | static_assert(sizeof(MouseState) == 0x28, "MouseState is an invalid size"); |
| 564 | |||
| 565 | /// Converts a NpadIdType to an array index. | ||
| 566 | constexpr size_t NpadIdTypeToIndex(NpadIdType npad_id_type) { | ||
| 567 | switch (npad_id_type) { | ||
| 568 | case NpadIdType::Player1: | ||
| 569 | return 0; | ||
| 570 | case NpadIdType::Player2: | ||
| 571 | return 1; | ||
| 572 | case NpadIdType::Player3: | ||
| 573 | return 2; | ||
| 574 | case NpadIdType::Player4: | ||
| 575 | return 3; | ||
| 576 | case NpadIdType::Player5: | ||
| 577 | return 4; | ||
| 578 | case NpadIdType::Player6: | ||
| 579 | return 5; | ||
| 580 | case NpadIdType::Player7: | ||
| 581 | return 6; | ||
| 582 | case NpadIdType::Player8: | ||
| 583 | return 7; | ||
| 584 | case NpadIdType::Handheld: | ||
| 585 | return 8; | ||
| 586 | case NpadIdType::Other: | ||
| 587 | return 9; | ||
| 588 | default: | ||
| 589 | return 0; | ||
| 590 | } | ||
| 591 | } | ||
| 592 | |||
| 593 | /// Converts an array index to a NpadIdType | ||
| 594 | constexpr NpadIdType IndexToNpadIdType(size_t index) { | ||
| 595 | switch (index) { | ||
| 596 | case 0: | ||
| 597 | return NpadIdType::Player1; | ||
| 598 | case 1: | ||
| 599 | return NpadIdType::Player2; | ||
| 600 | case 2: | ||
| 601 | return NpadIdType::Player3; | ||
| 602 | case 3: | ||
| 603 | return NpadIdType::Player4; | ||
| 604 | case 4: | ||
| 605 | return NpadIdType::Player5; | ||
| 606 | case 5: | ||
| 607 | return NpadIdType::Player6; | ||
| 608 | case 6: | ||
| 609 | return NpadIdType::Player7; | ||
| 610 | case 7: | ||
| 611 | return NpadIdType::Player8; | ||
| 612 | case 8: | ||
| 613 | return NpadIdType::Handheld; | ||
| 614 | case 9: | ||
| 615 | return NpadIdType::Other; | ||
| 616 | default: | ||
| 617 | return NpadIdType::Invalid; | ||
| 618 | } | ||
| 619 | } | ||
| 620 | |||
| 485 | } // namespace Core::HID | 621 | } // namespace Core::HID |
diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp index d6505dbc5..0ef8af0e6 100644 --- a/src/core/hle/service/hid/controllers/keyboard.cpp +++ b/src/core/hle/service/hid/controllers/keyboard.cpp | |||
| @@ -42,6 +42,7 @@ void Controller_Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing, | |||
| 42 | 42 | ||
| 43 | next_state.key = keyboard_state; | 43 | next_state.key = keyboard_state; |
| 44 | next_state.modifier = keyboard_modifier_state; | 44 | next_state.modifier = keyboard_modifier_state; |
| 45 | // This is always enabled on HW. Check what it actually does | ||
| 45 | next_state.modifier.unknown.Assign(1); | 46 | next_state.modifier.unknown.Assign(1); |
| 46 | } | 47 | } |
| 47 | 48 | ||
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 496b55d0e..e740b4331 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -35,8 +35,9 @@ namespace Service::HID { | |||
| 35 | 35 | ||
| 36 | // Updating period for each HID device. | 36 | // Updating period for each HID device. |
| 37 | // Period time is obtained by measuring the number of samples in a second on HW using a homebrew | 37 | // Period time is obtained by measuring the number of samples in a second on HW using a homebrew |
| 38 | constexpr auto pad_update_ns = std::chrono::nanoseconds{4 * 1000 * 1000}; // (4ms, 250Hz) | 38 | constexpr auto pad_update_ns = std::chrono::nanoseconds{4 * 1000 * 1000}; // (4ms, 250Hz) |
| 39 | constexpr auto motion_update_ns = std::chrono::nanoseconds{5 * 1000 * 1000}; // (5ms, 200Hz) | 39 | constexpr auto keyboard_update_ns = std::chrono::nanoseconds{8 * 1000 * 1000}; // (8ms, 125Hz) |
| 40 | constexpr auto motion_update_ns = std::chrono::nanoseconds{5 * 1000 * 1000}; // (5ms, 200Hz) | ||
| 40 | constexpr std::size_t SHARED_MEMORY_SIZE = 0x40000; | 41 | constexpr std::size_t SHARED_MEMORY_SIZE = 0x40000; |
| 41 | 42 | ||
| 42 | IAppletResource::IAppletResource(Core::System& system_, | 43 | IAppletResource::IAppletResource(Core::System& system_, |
| @@ -78,14 +79,21 @@ IAppletResource::IAppletResource(Core::System& system_, | |||
| 78 | const auto guard = LockService(); | 79 | const auto guard = LockService(); |
| 79 | UpdateControllers(user_data, ns_late); | 80 | UpdateControllers(user_data, ns_late); |
| 80 | }); | 81 | }); |
| 82 | keyboard_update_event = Core::Timing::CreateEvent( | ||
| 83 | "HID::UpdatekeyboardCallback", | ||
| 84 | [this](std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { | ||
| 85 | const auto guard = LockService(); | ||
| 86 | UpdateKeyboard(user_data, ns_late); | ||
| 87 | }); | ||
| 81 | motion_update_event = Core::Timing::CreateEvent( | 88 | motion_update_event = Core::Timing::CreateEvent( |
| 82 | "HID::MotionPadCallback", | 89 | "HID::UpdateMotionCallback", |
| 83 | [this](std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { | 90 | [this](std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { |
| 84 | const auto guard = LockService(); | 91 | const auto guard = LockService(); |
| 85 | UpdateMotion(user_data, ns_late); | 92 | UpdateMotion(user_data, ns_late); |
| 86 | }); | 93 | }); |
| 87 | 94 | ||
| 88 | system.CoreTiming().ScheduleEvent(pad_update_ns, pad_update_event); | 95 | system.CoreTiming().ScheduleEvent(pad_update_ns, pad_update_event); |
| 96 | system.CoreTiming().ScheduleEvent(keyboard_update_ns, keyboard_update_event); | ||
| 89 | system.CoreTiming().ScheduleEvent(motion_update_ns, motion_update_event); | 97 | system.CoreTiming().ScheduleEvent(motion_update_ns, motion_update_event); |
| 90 | 98 | ||
| 91 | system.HIDCore().ReloadInputDevices(); | 99 | system.HIDCore().ReloadInputDevices(); |
| @@ -101,6 +109,7 @@ void IAppletResource::DeactivateController(HidController controller) { | |||
| 101 | 109 | ||
| 102 | IAppletResource::~IAppletResource() { | 110 | IAppletResource::~IAppletResource() { |
| 103 | system.CoreTiming().UnscheduleEvent(pad_update_event, 0); | 111 | system.CoreTiming().UnscheduleEvent(pad_update_event, 0); |
| 112 | system.CoreTiming().UnscheduleEvent(keyboard_update_event, 0); | ||
| 104 | system.CoreTiming().UnscheduleEvent(motion_update_event, 0); | 113 | system.CoreTiming().UnscheduleEvent(motion_update_event, 0); |
| 105 | } | 114 | } |
| 106 | 115 | ||
| @@ -117,18 +126,36 @@ void IAppletResource::UpdateControllers(std::uintptr_t user_data, | |||
| 117 | auto& core_timing = system.CoreTiming(); | 126 | auto& core_timing = system.CoreTiming(); |
| 118 | 127 | ||
| 119 | for (const auto& controller : controllers) { | 128 | for (const auto& controller : controllers) { |
| 129 | // Keyboard has it's own update event | ||
| 130 | if (controller == controllers[static_cast<size_t>(HidController::Keyboard)]) { | ||
| 131 | continue; | ||
| 132 | } | ||
| 120 | controller->OnUpdate(core_timing, system.Kernel().GetHidSharedMem().GetPointer(), | 133 | controller->OnUpdate(core_timing, system.Kernel().GetHidSharedMem().GetPointer(), |
| 121 | SHARED_MEMORY_SIZE); | 134 | SHARED_MEMORY_SIZE); |
| 122 | } | 135 | } |
| 123 | 136 | ||
| 124 | // If ns_late is higher than the update rate ignore the delay | 137 | // If ns_late is higher than the update rate ignore the delay |
| 125 | if (ns_late > motion_update_ns) { | 138 | if (ns_late > pad_update_ns) { |
| 126 | ns_late = {}; | 139 | ns_late = {}; |
| 127 | } | 140 | } |
| 128 | 141 | ||
| 129 | core_timing.ScheduleEvent(pad_update_ns - ns_late, pad_update_event); | 142 | core_timing.ScheduleEvent(pad_update_ns - ns_late, pad_update_event); |
| 130 | } | 143 | } |
| 131 | 144 | ||
| 145 | void IAppletResource::UpdateKeyboard(std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { | ||
| 146 | auto& core_timing = system.CoreTiming(); | ||
| 147 | |||
| 148 | controllers[static_cast<size_t>(HidController::Keyboard)]->OnUpdate( | ||
| 149 | core_timing, system.Kernel().GetHidSharedMem().GetPointer(), SHARED_MEMORY_SIZE); | ||
| 150 | |||
| 151 | // If ns_late is higher than the update rate ignore the delay | ||
| 152 | if (ns_late > keyboard_update_ns) { | ||
| 153 | ns_late = {}; | ||
| 154 | } | ||
| 155 | |||
| 156 | core_timing.ScheduleEvent(keyboard_update_ns - ns_late, keyboard_update_event); | ||
| 157 | } | ||
| 158 | |||
| 132 | void IAppletResource::UpdateMotion(std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { | 159 | void IAppletResource::UpdateMotion(std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { |
| 133 | auto& core_timing = system.CoreTiming(); | 160 | auto& core_timing = system.CoreTiming(); |
| 134 | 161 | ||
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index 973e6a8ac..bbad165f8 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h | |||
| @@ -70,11 +70,13 @@ private: | |||
| 70 | 70 | ||
| 71 | void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx); | 71 | void GetSharedMemoryHandle(Kernel::HLERequestContext& ctx); |
| 72 | void UpdateControllers(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); | 72 | void UpdateControllers(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); |
| 73 | void UpdateKeyboard(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); | ||
| 73 | void UpdateMotion(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); | 74 | void UpdateMotion(std::uintptr_t user_data, std::chrono::nanoseconds ns_late); |
| 74 | 75 | ||
| 75 | KernelHelpers::ServiceContext& service_context; | 76 | KernelHelpers::ServiceContext& service_context; |
| 76 | 77 | ||
| 77 | std::shared_ptr<Core::Timing::EventType> pad_update_event; | 78 | std::shared_ptr<Core::Timing::EventType> pad_update_event; |
| 79 | std::shared_ptr<Core::Timing::EventType> keyboard_update_event; | ||
| 78 | std::shared_ptr<Core::Timing::EventType> motion_update_event; | 80 | std::shared_ptr<Core::Timing::EventType> motion_update_event; |
| 79 | 81 | ||
| 80 | std::array<std::unique_ptr<ControllerBase>, static_cast<size_t>(HidController::MaxControllers)> | 82 | std::array<std::unique_ptr<ControllerBase>, static_cast<size_t>(HidController::MaxControllers)> |
diff --git a/src/input_common/drivers/keyboard.cpp b/src/input_common/drivers/keyboard.cpp index 549704e89..328fe1ac1 100644 --- a/src/input_common/drivers/keyboard.cpp +++ b/src/input_common/drivers/keyboard.cpp | |||
| @@ -3,26 +3,71 @@ | |||
| 3 | // Refer to the license.txt file included | 3 | // Refer to the license.txt file included |
| 4 | 4 | ||
| 5 | #include "common/param_package.h" | 5 | #include "common/param_package.h" |
| 6 | #include "common/settings_input.h" | ||
| 6 | #include "input_common/drivers/keyboard.h" | 7 | #include "input_common/drivers/keyboard.h" |
| 7 | 8 | ||
| 8 | namespace InputCommon { | 9 | namespace InputCommon { |
| 9 | 10 | ||
| 10 | constexpr PadIdentifier identifier = { | 11 | constexpr PadIdentifier key_identifier = { |
| 11 | .guid = Common::UUID{Common::INVALID_UUID}, | 12 | .guid = Common::UUID{Common::INVALID_UUID}, |
| 12 | .port = 0, | 13 | .port = 0, |
| 13 | .pad = 0, | 14 | .pad = 0, |
| 14 | }; | 15 | }; |
| 16 | constexpr PadIdentifier modifier_identifier = { | ||
| 17 | .guid = Common::UUID{Common::INVALID_UUID}, | ||
| 18 | .port = 0, | ||
| 19 | .pad = 1, | ||
| 20 | }; | ||
| 15 | 21 | ||
| 16 | Keyboard::Keyboard(const std::string& input_engine_) : InputEngine(input_engine_) { | 22 | Keyboard::Keyboard(const std::string& input_engine_) : InputEngine(input_engine_) { |
| 17 | PreSetController(identifier); | 23 | PreSetController(key_identifier); |
| 24 | PreSetController(modifier_identifier); | ||
| 18 | } | 25 | } |
| 19 | 26 | ||
| 20 | void Keyboard::PressKey(int key_code) { | 27 | void Keyboard::PressKey(int key_code) { |
| 21 | SetButton(identifier, key_code, true); | 28 | SetButton(key_identifier, key_code, true); |
| 22 | } | 29 | } |
| 23 | 30 | ||
| 24 | void Keyboard::ReleaseKey(int key_code) { | 31 | void Keyboard::ReleaseKey(int key_code) { |
| 25 | SetButton(identifier, key_code, false); | 32 | SetButton(key_identifier, key_code, false); |
| 33 | } | ||
| 34 | |||
| 35 | void Keyboard::SetModifiers(int key_modifiers) { | ||
| 36 | for (int i = 0; i < 32; ++i) { | ||
| 37 | bool key_value = ((key_modifiers >> i) & 0x1) != 0; | ||
| 38 | SetButton(modifier_identifier, i, key_value); | ||
| 39 | // Use the modifier to press the key button equivalent | ||
| 40 | switch (i) { | ||
| 41 | case Settings::NativeKeyboard::LeftControl: | ||
| 42 | SetButton(key_identifier, Settings::NativeKeyboard::LeftControlKey, key_value); | ||
| 43 | break; | ||
| 44 | case Settings::NativeKeyboard::LeftShift: | ||
| 45 | SetButton(key_identifier, Settings::NativeKeyboard::LeftShiftKey, key_value); | ||
| 46 | break; | ||
| 47 | case Settings::NativeKeyboard::LeftAlt: | ||
| 48 | SetButton(key_identifier, Settings::NativeKeyboard::LeftAltKey, key_value); | ||
| 49 | break; | ||
| 50 | case Settings::NativeKeyboard::LeftMeta: | ||
| 51 | SetButton(key_identifier, Settings::NativeKeyboard::LeftMetaKey, key_value); | ||
| 52 | break; | ||
| 53 | case Settings::NativeKeyboard::RightControl: | ||
| 54 | SetButton(key_identifier, Settings::NativeKeyboard::RightControlKey, key_value); | ||
| 55 | break; | ||
| 56 | case Settings::NativeKeyboard::RightShift: | ||
| 57 | SetButton(key_identifier, Settings::NativeKeyboard::RightShiftKey, key_value); | ||
| 58 | break; | ||
| 59 | case Settings::NativeKeyboard::RightAlt: | ||
| 60 | SetButton(key_identifier, Settings::NativeKeyboard::RightAltKey, key_value); | ||
| 61 | break; | ||
| 62 | case Settings::NativeKeyboard::RightMeta: | ||
| 63 | SetButton(key_identifier, Settings::NativeKeyboard::RightMetaKey, key_value); | ||
| 64 | break; | ||
| 65 | default: | ||
| 66 | // Other modifier keys should be pressed with PressKey since they stay enabled until | ||
| 67 | // next press | ||
| 68 | break; | ||
| 69 | } | ||
| 70 | } | ||
| 26 | } | 71 | } |
| 27 | 72 | ||
| 28 | void Keyboard::ReleaseAllKeys() { | 73 | void Keyboard::ReleaseAllKeys() { |
diff --git a/src/input_common/drivers/keyboard.h b/src/input_common/drivers/keyboard.h index 46fe78576..2ab92fd6c 100644 --- a/src/input_common/drivers/keyboard.h +++ b/src/input_common/drivers/keyboard.h | |||
| @@ -28,6 +28,13 @@ public: | |||
| 28 | */ | 28 | */ |
| 29 | void ReleaseKey(int key_code); | 29 | void ReleaseKey(int key_code); |
| 30 | 30 | ||
| 31 | /** | ||
| 32 | * Sets the status of all keyboard modifier keys | ||
| 33 | * @param key_modifiers the code of the key to release | ||
| 34 | */ | ||
| 35 | void SetModifiers(int key_modifiers); | ||
| 36 | |||
| 37 | /// Sets all keys to the non pressed state | ||
| 31 | void ReleaseAllKeys(); | 38 | void ReleaseAllKeys(); |
| 32 | 39 | ||
| 33 | /// Used for automapping features | 40 | /// Used for automapping features |
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index df36a337c..ae2518f53 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp | |||
| @@ -402,6 +402,15 @@ std::string GenerateKeyboardParam(int key_code) { | |||
| 402 | return param.Serialize(); | 402 | return param.Serialize(); |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | std::string GenerateModdifierKeyboardParam(int key_code) { | ||
| 406 | Common::ParamPackage param; | ||
| 407 | param.Set("engine", "keyboard"); | ||
| 408 | param.Set("code", key_code); | ||
| 409 | param.Set("toggle", false); | ||
| 410 | param.Set("pad", 1); | ||
| 411 | return param.Serialize(); | ||
| 412 | } | ||
| 413 | |||
| 405 | std::string GenerateAnalogParamFromKeys(int key_up, int key_down, int key_left, int key_right, | 414 | std::string GenerateAnalogParamFromKeys(int key_up, int key_down, int key_left, int key_right, |
| 406 | int key_modifier, float modifier_scale) { | 415 | int key_modifier, float modifier_scale) { |
| 407 | Common::ParamPackage circle_pad_param{ | 416 | Common::ParamPackage circle_pad_param{ |
diff --git a/src/input_common/main.h b/src/input_common/main.h index a4a24d076..9ea395465 100644 --- a/src/input_common/main.h +++ b/src/input_common/main.h | |||
| @@ -134,6 +134,9 @@ private: | |||
| 134 | /// Generates a serialized param package for creating a keyboard button device. | 134 | /// Generates a serialized param package for creating a keyboard button device. |
| 135 | std::string GenerateKeyboardParam(int key_code); | 135 | std::string GenerateKeyboardParam(int key_code); |
| 136 | 136 | ||
| 137 | /// Generates a serialized param package for creating a moddifier keyboard button device. | ||
| 138 | std::string GenerateModdifierKeyboardParam(int key_code); | ||
| 139 | |||
| 137 | /// Generates a serialized param package for creating an analog device taking input from keyboard. | 140 | /// Generates a serialized param package for creating an analog device taking input from keyboard. |
| 138 | std::string GenerateAnalogParamFromKeys(int key_up, int key_down, int key_left, int key_right, | 141 | std::string GenerateAnalogParamFromKeys(int key_up, int key_down, int key_left, int key_right, |
| 139 | int key_modifier, float modifier_scale); | 142 | int key_modifier, float modifier_scale); |
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 3c5590a01..61513a5b4 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp | |||
| @@ -392,15 +392,287 @@ void GRenderWindow::closeEvent(QCloseEvent* event) { | |||
| 392 | QWidget::closeEvent(event); | 392 | QWidget::closeEvent(event); |
| 393 | } | 393 | } |
| 394 | 394 | ||
| 395 | int GRenderWindow::QtKeyToSwitchKey(Qt::Key qt_key) { | ||
| 396 | switch (qt_key) { | ||
| 397 | case Qt::Key_A: | ||
| 398 | return Settings::NativeKeyboard::A; | ||
| 399 | case Qt::Key_B: | ||
| 400 | return Settings::NativeKeyboard::B; | ||
| 401 | case Qt::Key_C: | ||
| 402 | return Settings::NativeKeyboard::C; | ||
| 403 | case Qt::Key_D: | ||
| 404 | return Settings::NativeKeyboard::D; | ||
| 405 | case Qt::Key_E: | ||
| 406 | return Settings::NativeKeyboard::E; | ||
| 407 | case Qt::Key_F: | ||
| 408 | return Settings::NativeKeyboard::F; | ||
| 409 | case Qt::Key_G: | ||
| 410 | return Settings::NativeKeyboard::G; | ||
| 411 | case Qt::Key_H: | ||
| 412 | return Settings::NativeKeyboard::H; | ||
| 413 | case Qt::Key_I: | ||
| 414 | return Settings::NativeKeyboard::I; | ||
| 415 | case Qt::Key_J: | ||
| 416 | return Settings::NativeKeyboard::J; | ||
| 417 | case Qt::Key_K: | ||
| 418 | return Settings::NativeKeyboard::K; | ||
| 419 | case Qt::Key_L: | ||
| 420 | return Settings::NativeKeyboard::L; | ||
| 421 | case Qt::Key_M: | ||
| 422 | return Settings::NativeKeyboard::M; | ||
| 423 | case Qt::Key_N: | ||
| 424 | return Settings::NativeKeyboard::N; | ||
| 425 | case Qt::Key_O: | ||
| 426 | return Settings::NativeKeyboard::O; | ||
| 427 | case Qt::Key_P: | ||
| 428 | return Settings::NativeKeyboard::P; | ||
| 429 | case Qt::Key_Q: | ||
| 430 | return Settings::NativeKeyboard::Q; | ||
| 431 | case Qt::Key_R: | ||
| 432 | return Settings::NativeKeyboard::R; | ||
| 433 | case Qt::Key_S: | ||
| 434 | return Settings::NativeKeyboard::S; | ||
| 435 | case Qt::Key_T: | ||
| 436 | return Settings::NativeKeyboard::T; | ||
| 437 | case Qt::Key_U: | ||
| 438 | return Settings::NativeKeyboard::U; | ||
| 439 | case Qt::Key_V: | ||
| 440 | return Settings::NativeKeyboard::V; | ||
| 441 | case Qt::Key_W: | ||
| 442 | return Settings::NativeKeyboard::W; | ||
| 443 | case Qt::Key_X: | ||
| 444 | return Settings::NativeKeyboard::X; | ||
| 445 | case Qt::Key_Y: | ||
| 446 | return Settings::NativeKeyboard::Y; | ||
| 447 | case Qt::Key_Z: | ||
| 448 | return Settings::NativeKeyboard::Z; | ||
| 449 | case Qt::Key_1: | ||
| 450 | return Settings::NativeKeyboard::N1; | ||
| 451 | case Qt::Key_2: | ||
| 452 | return Settings::NativeKeyboard::N2; | ||
| 453 | case Qt::Key_3: | ||
| 454 | return Settings::NativeKeyboard::N3; | ||
| 455 | case Qt::Key_4: | ||
| 456 | return Settings::NativeKeyboard::N4; | ||
| 457 | case Qt::Key_5: | ||
| 458 | return Settings::NativeKeyboard::N5; | ||
| 459 | case Qt::Key_6: | ||
| 460 | return Settings::NativeKeyboard::N6; | ||
| 461 | case Qt::Key_7: | ||
| 462 | return Settings::NativeKeyboard::N7; | ||
| 463 | case Qt::Key_8: | ||
| 464 | return Settings::NativeKeyboard::N8; | ||
| 465 | case Qt::Key_9: | ||
| 466 | return Settings::NativeKeyboard::N9; | ||
| 467 | case Qt::Key_0: | ||
| 468 | return Settings::NativeKeyboard::N0; | ||
| 469 | case Qt::Key_Return: | ||
| 470 | return Settings::NativeKeyboard::Return; | ||
| 471 | case Qt::Key_Escape: | ||
| 472 | return Settings::NativeKeyboard::Escape; | ||
| 473 | case Qt::Key_Backspace: | ||
| 474 | return Settings::NativeKeyboard::Backspace; | ||
| 475 | case Qt::Key_Tab: | ||
| 476 | return Settings::NativeKeyboard::Tab; | ||
| 477 | case Qt::Key_Space: | ||
| 478 | return Settings::NativeKeyboard::Space; | ||
| 479 | case Qt::Key_Minus: | ||
| 480 | return Settings::NativeKeyboard::Minus; | ||
| 481 | case Qt::Key_Plus: | ||
| 482 | case Qt::Key_questiondown: | ||
| 483 | return Settings::NativeKeyboard::Plus; | ||
| 484 | case Qt::Key_BracketLeft: | ||
| 485 | case Qt::Key_BraceLeft: | ||
| 486 | return Settings::NativeKeyboard::OpenBracket; | ||
| 487 | case Qt::Key_BracketRight: | ||
| 488 | case Qt::Key_BraceRight: | ||
| 489 | return Settings::NativeKeyboard::CloseBracket; | ||
| 490 | case Qt::Key_Bar: | ||
| 491 | return Settings::NativeKeyboard::Pipe; | ||
| 492 | case Qt::Key_Dead_Tilde: | ||
| 493 | return Settings::NativeKeyboard::Tilde; | ||
| 494 | case Qt::Key_Ntilde: | ||
| 495 | case Qt::Key_Semicolon: | ||
| 496 | return Settings::NativeKeyboard::Semicolon; | ||
| 497 | case Qt::Key_Apostrophe: | ||
| 498 | return Settings::NativeKeyboard::Quote; | ||
| 499 | case Qt::Key_Dead_Grave: | ||
| 500 | return Settings::NativeKeyboard::Backquote; | ||
| 501 | case Qt::Key_Comma: | ||
| 502 | return Settings::NativeKeyboard::Comma; | ||
| 503 | case Qt::Key_Period: | ||
| 504 | return Settings::NativeKeyboard::Period; | ||
| 505 | case Qt::Key_Slash: | ||
| 506 | return Settings::NativeKeyboard::Slash; | ||
| 507 | case Qt::Key_CapsLock: | ||
| 508 | return Settings::NativeKeyboard::CapsLock; | ||
| 509 | case Qt::Key_F1: | ||
| 510 | return Settings::NativeKeyboard::F1; | ||
| 511 | case Qt::Key_F2: | ||
| 512 | return Settings::NativeKeyboard::F2; | ||
| 513 | case Qt::Key_F3: | ||
| 514 | return Settings::NativeKeyboard::F3; | ||
| 515 | case Qt::Key_F4: | ||
| 516 | return Settings::NativeKeyboard::F4; | ||
| 517 | case Qt::Key_F5: | ||
| 518 | return Settings::NativeKeyboard::F5; | ||
| 519 | case Qt::Key_F6: | ||
| 520 | return Settings::NativeKeyboard::F6; | ||
| 521 | case Qt::Key_F7: | ||
| 522 | return Settings::NativeKeyboard::F7; | ||
| 523 | case Qt::Key_F8: | ||
| 524 | return Settings::NativeKeyboard::F8; | ||
| 525 | case Qt::Key_F9: | ||
| 526 | return Settings::NativeKeyboard::F9; | ||
| 527 | case Qt::Key_F10: | ||
| 528 | return Settings::NativeKeyboard::F10; | ||
| 529 | case Qt::Key_F11: | ||
| 530 | return Settings::NativeKeyboard::F11; | ||
| 531 | case Qt::Key_F12: | ||
| 532 | return Settings::NativeKeyboard::F12; | ||
| 533 | case Qt::Key_Print: | ||
| 534 | return Settings::NativeKeyboard::PrintScreen; | ||
| 535 | case Qt::Key_ScrollLock: | ||
| 536 | return Settings::NativeKeyboard::ScrollLock; | ||
| 537 | case Qt::Key_Pause: | ||
| 538 | return Settings::NativeKeyboard::Pause; | ||
| 539 | case Qt::Key_Insert: | ||
| 540 | return Settings::NativeKeyboard::Insert; | ||
| 541 | case Qt::Key_Home: | ||
| 542 | return Settings::NativeKeyboard::Home; | ||
| 543 | case Qt::Key_PageUp: | ||
| 544 | return Settings::NativeKeyboard::PageUp; | ||
| 545 | case Qt::Key_Delete: | ||
| 546 | return Settings::NativeKeyboard::Delete; | ||
| 547 | case Qt::Key_End: | ||
| 548 | return Settings::NativeKeyboard::End; | ||
| 549 | case Qt::Key_PageDown: | ||
| 550 | return Settings::NativeKeyboard::PageDown; | ||
| 551 | case Qt::Key_Right: | ||
| 552 | return Settings::NativeKeyboard::Right; | ||
| 553 | case Qt::Key_Left: | ||
| 554 | return Settings::NativeKeyboard::Left; | ||
| 555 | case Qt::Key_Down: | ||
| 556 | return Settings::NativeKeyboard::Down; | ||
| 557 | case Qt::Key_Up: | ||
| 558 | return Settings::NativeKeyboard::Up; | ||
| 559 | case Qt::Key_NumLock: | ||
| 560 | return Settings::NativeKeyboard::NumLock; | ||
| 561 | // Numpad keys are missing here | ||
| 562 | case Qt::Key_F13: | ||
| 563 | return Settings::NativeKeyboard::F13; | ||
| 564 | case Qt::Key_F14: | ||
| 565 | return Settings::NativeKeyboard::F14; | ||
| 566 | case Qt::Key_F15: | ||
| 567 | return Settings::NativeKeyboard::F15; | ||
| 568 | case Qt::Key_F16: | ||
| 569 | return Settings::NativeKeyboard::F16; | ||
| 570 | case Qt::Key_F17: | ||
| 571 | return Settings::NativeKeyboard::F17; | ||
| 572 | case Qt::Key_F18: | ||
| 573 | return Settings::NativeKeyboard::F18; | ||
| 574 | case Qt::Key_F19: | ||
| 575 | return Settings::NativeKeyboard::F19; | ||
| 576 | case Qt::Key_F20: | ||
| 577 | return Settings::NativeKeyboard::F20; | ||
| 578 | case Qt::Key_F21: | ||
| 579 | return Settings::NativeKeyboard::F21; | ||
| 580 | case Qt::Key_F22: | ||
| 581 | return Settings::NativeKeyboard::F22; | ||
| 582 | case Qt::Key_F23: | ||
| 583 | return Settings::NativeKeyboard::F23; | ||
| 584 | case Qt::Key_F24: | ||
| 585 | return Settings::NativeKeyboard::F24; | ||
| 586 | // case Qt::: | ||
| 587 | // return Settings::NativeKeyboard::KPComma; | ||
| 588 | // case Qt::: | ||
| 589 | // return Settings::NativeKeyboard::Ro; | ||
| 590 | case Qt::Key_Hiragana_Katakana: | ||
| 591 | return Settings::NativeKeyboard::KatakanaHiragana; | ||
| 592 | case Qt::Key_yen: | ||
| 593 | return Settings::NativeKeyboard::Yen; | ||
| 594 | case Qt::Key_Henkan: | ||
| 595 | return Settings::NativeKeyboard::Henkan; | ||
| 596 | case Qt::Key_Muhenkan: | ||
| 597 | return Settings::NativeKeyboard::Muhenkan; | ||
| 598 | // case Qt::: | ||
| 599 | // return Settings::NativeKeyboard::NumPadCommaPc98; | ||
| 600 | case Qt::Key_Hangul: | ||
| 601 | return Settings::NativeKeyboard::HangulEnglish; | ||
| 602 | case Qt::Key_Hangul_Hanja: | ||
| 603 | return Settings::NativeKeyboard::Hanja; | ||
| 604 | case Qt::Key_Katakana: | ||
| 605 | return Settings::NativeKeyboard::KatakanaKey; | ||
| 606 | case Qt::Key_Hiragana: | ||
| 607 | return Settings::NativeKeyboard::HiraganaKey; | ||
| 608 | case Qt::Key_Zenkaku_Hankaku: | ||
| 609 | return Settings::NativeKeyboard::ZenkakuHankaku; | ||
| 610 | // Modifier keys are handled by the modifier property | ||
| 611 | default: | ||
| 612 | return 0; | ||
| 613 | } | ||
| 614 | } | ||
| 615 | |||
| 616 | int GRenderWindow::QtModifierToSwitchModdifier(quint32 qt_moddifiers) { | ||
| 617 | int moddifier = 0; | ||
| 618 | // The values are obtained through testing, Qt doesn't seem to provide a proper enum | ||
| 619 | if ((qt_moddifiers & 0x1) != 0) { | ||
| 620 | moddifier |= 1 << Settings::NativeKeyboard::LeftShift; | ||
| 621 | } | ||
| 622 | if ((qt_moddifiers & 0x2) != 0) { | ||
| 623 | moddifier |= 1 << Settings::NativeKeyboard::LeftControl; | ||
| 624 | } | ||
| 625 | if ((qt_moddifiers & 0x4) != 0) { | ||
| 626 | moddifier |= 1 << Settings::NativeKeyboard::LeftAlt; | ||
| 627 | } | ||
| 628 | if ((qt_moddifiers & 0x08) != 0) { | ||
| 629 | moddifier |= 1 << Settings::NativeKeyboard::LeftMeta; | ||
| 630 | } | ||
| 631 | if ((qt_moddifiers & 0x10) != 0) { | ||
| 632 | moddifier |= 1 << Settings::NativeKeyboard::RightShift; | ||
| 633 | } | ||
| 634 | if ((qt_moddifiers & 0x20) != 0) { | ||
| 635 | moddifier |= 1 << Settings::NativeKeyboard::RightControl; | ||
| 636 | } | ||
| 637 | if ((qt_moddifiers & 0x40) != 0) { | ||
| 638 | moddifier |= 1 << Settings::NativeKeyboard::RightAlt; | ||
| 639 | } | ||
| 640 | if ((qt_moddifiers & 0x80) != 0) { | ||
| 641 | moddifier |= 1 << Settings::NativeKeyboard::RightMeta; | ||
| 642 | } | ||
| 643 | if ((qt_moddifiers & 0x100) != 0) { | ||
| 644 | moddifier |= 1 << Settings::NativeKeyboard::CapsLock; | ||
| 645 | } | ||
| 646 | if ((qt_moddifiers & 0x200) != 0) { | ||
| 647 | moddifier |= 1 << Settings::NativeKeyboard::NumLock; | ||
| 648 | } | ||
| 649 | // Verify the last two keys | ||
| 650 | if ((qt_moddifiers & 0x400) != 0) { | ||
| 651 | moddifier |= 1 << Settings::NativeKeyboard::Katakana; | ||
| 652 | } | ||
| 653 | if ((qt_moddifiers & 0x800) != 0) { | ||
| 654 | moddifier |= 1 << Settings::NativeKeyboard::Hiragana; | ||
| 655 | } | ||
| 656 | return moddifier; | ||
| 657 | } | ||
| 658 | |||
| 395 | void GRenderWindow::keyPressEvent(QKeyEvent* event) { | 659 | void GRenderWindow::keyPressEvent(QKeyEvent* event) { |
| 396 | if (!event->isAutoRepeat()) { | 660 | if (!event->isAutoRepeat()) { |
| 397 | input_subsystem->GetKeyboard()->PressKey(event->key()); | 661 | const auto moddifier = QtModifierToSwitchModdifier(event->nativeModifiers()); |
| 662 | // Replace event->key() with event->nativeVirtualKey() since the second one provides raw key | ||
| 663 | // buttons | ||
| 664 | const auto key = QtKeyToSwitchKey(Qt::Key(event->key())); | ||
| 665 | input_subsystem->GetKeyboard()->SetModifiers(moddifier); | ||
| 666 | input_subsystem->GetKeyboard()->PressKey(key); | ||
| 398 | } | 667 | } |
| 399 | } | 668 | } |
| 400 | 669 | ||
| 401 | void GRenderWindow::keyReleaseEvent(QKeyEvent* event) { | 670 | void GRenderWindow::keyReleaseEvent(QKeyEvent* event) { |
| 402 | if (!event->isAutoRepeat()) { | 671 | if (!event->isAutoRepeat()) { |
| 403 | input_subsystem->GetKeyboard()->ReleaseKey(event->key()); | 672 | const auto moddifier = QtModifierToSwitchModdifier(event->nativeModifiers()); |
| 673 | const auto key = QtKeyToSwitchKey(Qt::Key(event->key())); | ||
| 674 | input_subsystem->GetKeyboard()->SetModifiers(moddifier); | ||
| 675 | input_subsystem->GetKeyboard()->ReleaseKey(key); | ||
| 404 | } | 676 | } |
| 405 | } | 677 | } |
| 406 | 678 | ||
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index 95594f81c..c42d139be 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h | |||
| @@ -158,6 +158,12 @@ public: | |||
| 158 | 158 | ||
| 159 | void resizeEvent(QResizeEvent* event) override; | 159 | void resizeEvent(QResizeEvent* event) override; |
| 160 | 160 | ||
| 161 | /// Converts a Qt keybard key into NativeKeyboard key | ||
| 162 | static int QtKeyToSwitchKey(Qt::Key qt_keys); | ||
| 163 | |||
| 164 | /// Converts a Qt modifier keys into NativeKeyboard modifier keys | ||
| 165 | static int QtModifierToSwitchModdifier(quint32 qt_moddifiers); | ||
| 166 | |||
| 161 | void keyPressEvent(QKeyEvent* event) override; | 167 | void keyPressEvent(QKeyEvent* event) override; |
| 162 | void keyReleaseEvent(QKeyEvent* event) override; | 168 | void keyReleaseEvent(QKeyEvent* event) override; |
| 163 | 169 | ||
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 7669fe474..ccf274895 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -65,157 +65,6 @@ const std::array<int, Settings::NativeMouseButton::NumMouseButtons> Config::defa | |||
| 65 | Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_Apostrophe, Qt::Key_Minus, Qt::Key_Equal, | 65 | Qt::Key_BracketLeft, Qt::Key_BracketRight, Qt::Key_Apostrophe, Qt::Key_Minus, Qt::Key_Equal, |
| 66 | }; | 66 | }; |
| 67 | 67 | ||
| 68 | const std::array<int, Settings::NativeKeyboard::NumKeyboardKeys> Config::default_keyboard_keys = { | ||
| 69 | 0, | ||
| 70 | 0, | ||
| 71 | 0, | ||
| 72 | 0, | ||
| 73 | Qt::Key_A, | ||
| 74 | Qt::Key_B, | ||
| 75 | Qt::Key_C, | ||
| 76 | Qt::Key_D, | ||
| 77 | Qt::Key_E, | ||
| 78 | Qt::Key_F, | ||
| 79 | Qt::Key_G, | ||
| 80 | Qt::Key_H, | ||
| 81 | Qt::Key_I, | ||
| 82 | Qt::Key_J, | ||
| 83 | Qt::Key_K, | ||
| 84 | Qt::Key_L, | ||
| 85 | Qt::Key_M, | ||
| 86 | Qt::Key_N, | ||
| 87 | Qt::Key_O, | ||
| 88 | Qt::Key_P, | ||
| 89 | Qt::Key_Q, | ||
| 90 | Qt::Key_R, | ||
| 91 | Qt::Key_S, | ||
| 92 | Qt::Key_T, | ||
| 93 | Qt::Key_U, | ||
| 94 | Qt::Key_V, | ||
| 95 | Qt::Key_W, | ||
| 96 | Qt::Key_X, | ||
| 97 | Qt::Key_Y, | ||
| 98 | Qt::Key_Z, | ||
| 99 | Qt::Key_1, | ||
| 100 | Qt::Key_2, | ||
| 101 | Qt::Key_3, | ||
| 102 | Qt::Key_4, | ||
| 103 | Qt::Key_5, | ||
| 104 | Qt::Key_6, | ||
| 105 | Qt::Key_7, | ||
| 106 | Qt::Key_8, | ||
| 107 | Qt::Key_9, | ||
| 108 | Qt::Key_0, | ||
| 109 | Qt::Key_Enter, | ||
| 110 | Qt::Key_Escape, | ||
| 111 | Qt::Key_Backspace, | ||
| 112 | Qt::Key_Tab, | ||
| 113 | Qt::Key_Space, | ||
| 114 | Qt::Key_Minus, | ||
| 115 | Qt::Key_Equal, | ||
| 116 | Qt::Key_BracketLeft, | ||
| 117 | Qt::Key_BracketRight, | ||
| 118 | Qt::Key_Backslash, | ||
| 119 | Qt::Key_Dead_Tilde, | ||
| 120 | Qt::Key_Semicolon, | ||
| 121 | Qt::Key_Apostrophe, | ||
| 122 | Qt::Key_Dead_Grave, | ||
| 123 | Qt::Key_Comma, | ||
| 124 | Qt::Key_Period, | ||
| 125 | Qt::Key_Slash, | ||
| 126 | Qt::Key_CapsLock, | ||
| 127 | |||
| 128 | Qt::Key_F1, | ||
| 129 | Qt::Key_F2, | ||
| 130 | Qt::Key_F3, | ||
| 131 | Qt::Key_F4, | ||
| 132 | Qt::Key_F5, | ||
| 133 | Qt::Key_F6, | ||
| 134 | Qt::Key_F7, | ||
| 135 | Qt::Key_F8, | ||
| 136 | Qt::Key_F9, | ||
| 137 | Qt::Key_F10, | ||
| 138 | Qt::Key_F11, | ||
| 139 | Qt::Key_F12, | ||
| 140 | |||
| 141 | Qt::Key_SysReq, | ||
| 142 | Qt::Key_ScrollLock, | ||
| 143 | Qt::Key_Pause, | ||
| 144 | Qt::Key_Insert, | ||
| 145 | Qt::Key_Home, | ||
| 146 | Qt::Key_PageUp, | ||
| 147 | Qt::Key_Delete, | ||
| 148 | Qt::Key_End, | ||
| 149 | Qt::Key_PageDown, | ||
| 150 | Qt::Key_Right, | ||
| 151 | Qt::Key_Left, | ||
| 152 | Qt::Key_Down, | ||
| 153 | Qt::Key_Up, | ||
| 154 | |||
| 155 | Qt::Key_NumLock, | ||
| 156 | Qt::Key_Slash, | ||
| 157 | Qt::Key_Asterisk, | ||
| 158 | Qt::Key_Minus, | ||
| 159 | Qt::Key_Plus, | ||
| 160 | Qt::Key_Enter, | ||
| 161 | Qt::Key_1, | ||
| 162 | Qt::Key_2, | ||
| 163 | Qt::Key_3, | ||
| 164 | Qt::Key_4, | ||
| 165 | Qt::Key_5, | ||
| 166 | Qt::Key_6, | ||
| 167 | Qt::Key_7, | ||
| 168 | Qt::Key_8, | ||
| 169 | Qt::Key_9, | ||
| 170 | Qt::Key_0, | ||
| 171 | Qt::Key_Period, | ||
| 172 | |||
| 173 | 0, | ||
| 174 | 0, | ||
| 175 | Qt::Key_PowerOff, | ||
| 176 | Qt::Key_Equal, | ||
| 177 | |||
| 178 | Qt::Key_F13, | ||
| 179 | Qt::Key_F14, | ||
| 180 | Qt::Key_F15, | ||
| 181 | Qt::Key_F16, | ||
| 182 | Qt::Key_F17, | ||
| 183 | Qt::Key_F18, | ||
| 184 | Qt::Key_F19, | ||
| 185 | Qt::Key_F20, | ||
| 186 | Qt::Key_F21, | ||
| 187 | Qt::Key_F22, | ||
| 188 | Qt::Key_F23, | ||
| 189 | Qt::Key_F24, | ||
| 190 | |||
| 191 | Qt::Key_Open, | ||
| 192 | Qt::Key_Help, | ||
| 193 | Qt::Key_Menu, | ||
| 194 | 0, | ||
| 195 | Qt::Key_Stop, | ||
| 196 | Qt::Key_AudioRepeat, | ||
| 197 | Qt::Key_Undo, | ||
| 198 | Qt::Key_Cut, | ||
| 199 | Qt::Key_Copy, | ||
| 200 | Qt::Key_Paste, | ||
| 201 | Qt::Key_Find, | ||
| 202 | Qt::Key_VolumeMute, | ||
| 203 | Qt::Key_VolumeUp, | ||
| 204 | Qt::Key_VolumeDown, | ||
| 205 | Qt::Key_CapsLock, | ||
| 206 | Qt::Key_NumLock, | ||
| 207 | Qt::Key_ScrollLock, | ||
| 208 | Qt::Key_Comma, | ||
| 209 | |||
| 210 | Qt::Key_ParenLeft, | ||
| 211 | Qt::Key_ParenRight, | ||
| 212 | }; | ||
| 213 | |||
| 214 | const std::array<int, Settings::NativeKeyboard::NumKeyboardMods> Config::default_keyboard_mods = { | ||
| 215 | Qt::Key_Control, Qt::Key_Shift, Qt::Key_Alt, Qt::Key_ApplicationLeft, | ||
| 216 | Qt::Key_Control, Qt::Key_Shift, Qt::Key_AltGr, Qt::Key_ApplicationRight, | ||
| 217 | }; | ||
| 218 | |||
| 219 | // This shouldn't have anything except static initializers (no functions). So | 68 | // This shouldn't have anything except static initializers (no functions). So |
| 220 | // QKeySequence(...).toString() is NOT ALLOWED HERE. | 69 | // QKeySequence(...).toString() is NOT ALLOWED HERE. |
| 221 | // This must be in alphabetical order according to action name as it must have the same order as | 70 | // This must be in alphabetical order according to action name as it must have the same order as |
| @@ -496,14 +345,14 @@ void Config::ReadDebugValues() { | |||
| 496 | void Config::ReadKeyboardValues() { | 345 | void Config::ReadKeyboardValues() { |
| 497 | ReadBasicSetting(Settings::values.keyboard_enabled); | 346 | ReadBasicSetting(Settings::values.keyboard_enabled); |
| 498 | 347 | ||
| 499 | std::transform(default_keyboard_keys.begin(), default_keyboard_keys.end(), | 348 | for (std::size_t i = 0; i < Settings::values.keyboard_keys.size(); ++i) { |
| 500 | Settings::values.keyboard_keys.begin(), InputCommon::GenerateKeyboardParam); | 349 | Settings::values.keyboard_keys[i] = InputCommon::GenerateKeyboardParam(static_cast<int>(i)); |
| 501 | std::transform(default_keyboard_mods.begin(), default_keyboard_mods.end(), | 350 | } |
| 502 | Settings::values.keyboard_keys.begin() + | 351 | |
| 503 | Settings::NativeKeyboard::LeftControlKey, | 352 | for (std::size_t i = 0; i < Settings::values.keyboard_mods.size(); ++i) { |
| 504 | InputCommon::GenerateKeyboardParam); | 353 | Settings::values.keyboard_mods[i] = |
| 505 | std::transform(default_keyboard_mods.begin(), default_keyboard_mods.end(), | 354 | InputCommon::GenerateModdifierKeyboardParam(static_cast<int>(i)); |
| 506 | Settings::values.keyboard_mods.begin(), InputCommon::GenerateKeyboardParam); | 355 | } |
| 507 | } | 356 | } |
| 508 | 357 | ||
| 509 | void Config::ReadMouseValues() { | 358 | void Config::ReadMouseValues() { |