diff options
| author | 2021-11-29 21:10:02 -0600 | |
|---|---|---|
| committer | 2021-11-29 21:10:02 -0600 | |
| commit | 46e3ed5a483eac404ff1e2103ecc4e93e815d45b (patch) | |
| tree | b5317954b6692942ba01b262616a7979141c95fc | |
| parent | input_common: Fix error with thread name (diff) | |
| parent | input_interpreter: Make use of NpadButton instead of a u64 (diff) | |
| download | yuzu-46e3ed5a483eac404ff1e2103ecc4e93e815d45b.tar.gz yuzu-46e3ed5a483eac404ff1e2103ecc4e93e815d45b.tar.xz yuzu-46e3ed5a483eac404ff1e2103ecc4e93e815d45b.zip | |
Merge pull request #7472 from Morph1984/post-kraken-cleanup
core: hid: Post kraken cleanup
| -rw-r--r-- | src/core/hid/emulated_console.h | 28 | ||||
| -rw-r--r-- | src/core/hid/emulated_controller.h | 58 | ||||
| -rw-r--r-- | src/core/hid/emulated_devices.h | 40 | ||||
| -rw-r--r-- | src/core/hid/hid_core.cpp | 26 | ||||
| -rw-r--r-- | src/core/hid/hid_core.h | 6 | ||||
| -rw-r--r-- | src/core/hid/hid_types.h | 2 | ||||
| -rw-r--r-- | src/core/hid/input_converter.h | 23 | ||||
| -rw-r--r-- | src/core/hid/input_interpreter.cpp | 16 | ||||
| -rw-r--r-- | src/core/hid/input_interpreter.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 4 | ||||
| -rw-r--r-- | src/core/memory/cheat_engine.cpp | 3 | ||||
| -rw-r--r-- | src/yuzu/applets/qt_controller.cpp | 13 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 32 |
14 files changed, 149 insertions, 112 deletions
diff --git a/src/core/hid/emulated_console.h b/src/core/hid/emulated_console.h index 25c183eee..bb3d7ab90 100644 --- a/src/core/hid/emulated_console.h +++ b/src/core/hid/emulated_console.h | |||
| @@ -78,9 +78,9 @@ struct ConsoleUpdateCallback { | |||
| 78 | class EmulatedConsole { | 78 | class EmulatedConsole { |
| 79 | public: | 79 | public: |
| 80 | /** | 80 | /** |
| 81 | * Contains all input data related to the console like motion and touch input | 81 | * Contains all input data within the emulated switch console tablet such as touch and motion |
| 82 | */ | 82 | */ |
| 83 | EmulatedConsole(); | 83 | explicit EmulatedConsole(); |
| 84 | ~EmulatedConsole(); | 84 | ~EmulatedConsole(); |
| 85 | 85 | ||
| 86 | YUZU_NON_COPYABLE(EmulatedConsole); | 86 | YUZU_NON_COPYABLE(EmulatedConsole); |
| @@ -89,14 +89,16 @@ public: | |||
| 89 | /// Removes all callbacks created from input devices | 89 | /// Removes all callbacks created from input devices |
| 90 | void UnloadInput(); | 90 | void UnloadInput(); |
| 91 | 91 | ||
| 92 | /// Sets the emulated console into configuring mode. Locking all HID service events from being | 92 | /** |
| 93 | /// moddified | 93 | * Sets the emulated console into configuring mode |
| 94 | * This prevents the modification of the HID state of the emulated console by input commands | ||
| 95 | */ | ||
| 94 | void EnableConfiguration(); | 96 | void EnableConfiguration(); |
| 95 | 97 | ||
| 96 | /// Returns the emulated console to the normal behaivour | 98 | /// Returns the emulated console into normal mode, allowing the modification of the HID state |
| 97 | void DisableConfiguration(); | 99 | void DisableConfiguration(); |
| 98 | 100 | ||
| 99 | /// Returns true if the emulated console is on configuring mode | 101 | /// Returns true if the emulated console is in configuring mode |
| 100 | bool IsConfiguring() const; | 102 | bool IsConfiguring() const; |
| 101 | 103 | ||
| 102 | /// Reload all input devices | 104 | /// Reload all input devices |
| @@ -116,7 +118,7 @@ public: | |||
| 116 | 118 | ||
| 117 | /** | 119 | /** |
| 118 | * Updates the current mapped motion device | 120 | * Updates the current mapped motion device |
| 119 | * @param ParamPackage with controller data to be mapped | 121 | * @param param ParamPackage with controller data to be mapped |
| 120 | */ | 122 | */ |
| 121 | void SetMotionParam(Common::ParamPackage param); | 123 | void SetMotionParam(Common::ParamPackage param); |
| 122 | 124 | ||
| @@ -134,14 +136,14 @@ public: | |||
| 134 | 136 | ||
| 135 | /** | 137 | /** |
| 136 | * Adds a callback to the list of events | 138 | * Adds a callback to the list of events |
| 137 | * @param ConsoleUpdateCallback that will be triggered | 139 | * @param update_callback A ConsoleUpdateCallback that will be triggered |
| 138 | * @return an unique key corresponding to the callback index in the list | 140 | * @return an unique key corresponding to the callback index in the list |
| 139 | */ | 141 | */ |
| 140 | int SetCallback(ConsoleUpdateCallback update_callback); | 142 | int SetCallback(ConsoleUpdateCallback update_callback); |
| 141 | 143 | ||
| 142 | /** | 144 | /** |
| 143 | * Removes a callback from the list stopping any future events to this object | 145 | * Removes a callback from the list stopping any future events to this object |
| 144 | * @param Key corresponding to the callback index in the list | 146 | * @param key Key corresponding to the callback index in the list |
| 145 | */ | 147 | */ |
| 146 | void DeleteCallback(int key); | 148 | void DeleteCallback(int key); |
| 147 | 149 | ||
| @@ -151,20 +153,20 @@ private: | |||
| 151 | 153 | ||
| 152 | /** | 154 | /** |
| 153 | * Updates the motion status of the console | 155 | * Updates the motion status of the console |
| 154 | * @param A CallbackStatus containing gyro and accelerometer data | 156 | * @param callback A CallbackStatus containing gyro and accelerometer data |
| 155 | */ | 157 | */ |
| 156 | void SetMotion(Common::Input::CallbackStatus callback); | 158 | void SetMotion(Common::Input::CallbackStatus callback); |
| 157 | 159 | ||
| 158 | /** | 160 | /** |
| 159 | * Updates the touch status of the console | 161 | * Updates the touch status of the console |
| 160 | * @param callback: A CallbackStatus containing the touch position | 162 | * @param callback A CallbackStatus containing the touch position |
| 161 | * @param index: Finger ID to be updated | 163 | * @param index Finger ID to be updated |
| 162 | */ | 164 | */ |
| 163 | void SetTouch(Common::Input::CallbackStatus callback, std::size_t index); | 165 | void SetTouch(Common::Input::CallbackStatus callback, std::size_t index); |
| 164 | 166 | ||
| 165 | /** | 167 | /** |
| 166 | * Triggers a callback that something has changed on the console status | 168 | * Triggers a callback that something has changed on the console status |
| 167 | * @param Input type of the event to trigger | 169 | * @param type Input type of the event to trigger |
| 168 | */ | 170 | */ |
| 169 | void TriggerOnChange(ConsoleTriggerType type); | 171 | void TriggerOnChange(ConsoleTriggerType type); |
| 170 | 172 | ||
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index 2c5d51bc8..5887e3e38 100644 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h | |||
| @@ -132,8 +132,8 @@ struct ControllerUpdateCallback { | |||
| 132 | class EmulatedController { | 132 | class EmulatedController { |
| 133 | public: | 133 | public: |
| 134 | /** | 134 | /** |
| 135 | * Contains all input data related to this controller. Like buttons, joysticks, motion. | 135 | * Contains all input data (buttons, joysticks, vibration, and motion) within this controller. |
| 136 | * @param Npad id type for this specific controller | 136 | * @param npad_id_type npad id type for this specific controller |
| 137 | */ | 137 | */ |
| 138 | explicit EmulatedController(NpadIdType npad_id_type_); | 138 | explicit EmulatedController(NpadIdType npad_id_type_); |
| 139 | ~EmulatedController(); | 139 | ~EmulatedController(); |
| @@ -155,7 +155,7 @@ public: | |||
| 155 | 155 | ||
| 156 | /** | 156 | /** |
| 157 | * Gets the NpadStyleIndex for this controller | 157 | * Gets the NpadStyleIndex for this controller |
| 158 | * @param If true tmp_npad_type will be returned | 158 | * @param get_temporary_value If true tmp_npad_type will be returned |
| 159 | * @return NpadStyleIndex set on the controller | 159 | * @return NpadStyleIndex set on the controller |
| 160 | */ | 160 | */ |
| 161 | NpadStyleIndex GetNpadStyleIndex(bool get_temporary_value = false) const; | 161 | NpadStyleIndex GetNpadStyleIndex(bool get_temporary_value = false) const; |
| @@ -168,7 +168,7 @@ public: | |||
| 168 | 168 | ||
| 169 | /** | 169 | /** |
| 170 | * Is the emulated connected | 170 | * Is the emulated connected |
| 171 | * @param If true tmp_is_connected will be returned | 171 | * @param get_temporary_value If true tmp_is_connected will be returned |
| 172 | * @return true if the controller has the connected status | 172 | * @return true if the controller has the connected status |
| 173 | */ | 173 | */ |
| 174 | bool IsConnected(bool get_temporary_value = false) const; | 174 | bool IsConnected(bool get_temporary_value = false) const; |
| @@ -179,14 +179,16 @@ public: | |||
| 179 | /// Removes all callbacks created from input devices | 179 | /// Removes all callbacks created from input devices |
| 180 | void UnloadInput(); | 180 | void UnloadInput(); |
| 181 | 181 | ||
| 182 | /// Sets the emulated console into configuring mode. Locking all HID service events from being | 182 | /** |
| 183 | /// moddified | 183 | * Sets the emulated controller into configuring mode |
| 184 | * This prevents the modification of the HID state of the emulated controller by input commands | ||
| 185 | */ | ||
| 184 | void EnableConfiguration(); | 186 | void EnableConfiguration(); |
| 185 | 187 | ||
| 186 | /// Returns the emulated console to the normal behaivour | 188 | /// Returns the emulated controller into normal mode, allowing the modification of the HID state |
| 187 | void DisableConfiguration(); | 189 | void DisableConfiguration(); |
| 188 | 190 | ||
| 189 | /// Returns true if the emulated device is on configuring mode | 191 | /// Returns true if the emulated controller is in configuring mode |
| 190 | bool IsConfiguring() const; | 192 | bool IsConfiguring() const; |
| 191 | 193 | ||
| 192 | /// Reload all input devices | 194 | /// Reload all input devices |
| @@ -215,19 +217,19 @@ public: | |||
| 215 | 217 | ||
| 216 | /** | 218 | /** |
| 217 | * Updates the current mapped button device | 219 | * Updates the current mapped button device |
| 218 | * @param ParamPackage with controller data to be mapped | 220 | * @param param ParamPackage with controller data to be mapped |
| 219 | */ | 221 | */ |
| 220 | void SetButtonParam(std::size_t index, Common::ParamPackage param); | 222 | void SetButtonParam(std::size_t index, Common::ParamPackage param); |
| 221 | 223 | ||
| 222 | /** | 224 | /** |
| 223 | * Updates the current mapped stick device | 225 | * Updates the current mapped stick device |
| 224 | * @param ParamPackage with controller data to be mapped | 226 | * @param param ParamPackage with controller data to be mapped |
| 225 | */ | 227 | */ |
| 226 | void SetStickParam(std::size_t index, Common::ParamPackage param); | 228 | void SetStickParam(std::size_t index, Common::ParamPackage param); |
| 227 | 229 | ||
| 228 | /** | 230 | /** |
| 229 | * Updates the current mapped motion device | 231 | * Updates the current mapped motion device |
| 230 | * @param ParamPackage with controller data to be mapped | 232 | * @param param ParamPackage with controller data to be mapped |
| 231 | */ | 233 | */ |
| 232 | void SetMotionParam(std::size_t index, Common::ParamPackage param); | 234 | void SetMotionParam(std::size_t index, Common::ParamPackage param); |
| 233 | 235 | ||
| @@ -270,13 +272,13 @@ public: | |||
| 270 | /// Returns the latest battery status from the controller | 272 | /// Returns the latest battery status from the controller |
| 271 | BatteryLevelState GetBattery() const; | 273 | BatteryLevelState GetBattery() const; |
| 272 | 274 | ||
| 273 | /* | 275 | /** |
| 274 | * Sends a specific vibration to the output device | 276 | * Sends a specific vibration to the output device |
| 275 | * @return returns true if vibration had no errors | 277 | * @return returns true if vibration had no errors |
| 276 | */ | 278 | */ |
| 277 | bool SetVibration(std::size_t device_index, VibrationValue vibration); | 279 | bool SetVibration(std::size_t device_index, VibrationValue vibration); |
| 278 | 280 | ||
| 279 | /* | 281 | /** |
| 280 | * Sends a small vibration to the output device | 282 | * Sends a small vibration to the output device |
| 281 | * @return returns true if SetVibration was successfull | 283 | * @return returns true if SetVibration was successfull |
| 282 | */ | 284 | */ |
| @@ -290,14 +292,14 @@ public: | |||
| 290 | 292 | ||
| 291 | /** | 293 | /** |
| 292 | * Adds a callback to the list of events | 294 | * Adds a callback to the list of events |
| 293 | * @param ConsoleUpdateCallback that will be triggered | 295 | * @param update_callback A ConsoleUpdateCallback that will be triggered |
| 294 | * @return an unique key corresponding to the callback index in the list | 296 | * @return an unique key corresponding to the callback index in the list |
| 295 | */ | 297 | */ |
| 296 | int SetCallback(ControllerUpdateCallback update_callback); | 298 | int SetCallback(ControllerUpdateCallback update_callback); |
| 297 | 299 | ||
| 298 | /** | 300 | /** |
| 299 | * Removes a callback from the list stopping any future events to this object | 301 | * Removes a callback from the list stopping any future events to this object |
| 300 | * @param Key corresponding to the callback index in the list | 302 | * @param key Key corresponding to the callback index in the list |
| 301 | */ | 303 | */ |
| 302 | void DeleteCallback(int key); | 304 | void DeleteCallback(int key); |
| 303 | 305 | ||
| @@ -310,43 +312,43 @@ private: | |||
| 310 | 312 | ||
| 311 | /** | 313 | /** |
| 312 | * Updates the button status of the controller | 314 | * Updates the button status of the controller |
| 313 | * @param callback: A CallbackStatus containing the button status | 315 | * @param callback A CallbackStatus containing the button status |
| 314 | * @param index: Button ID of the to be updated | 316 | * @param index Button ID of the to be updated |
| 315 | */ | 317 | */ |
| 316 | void SetButton(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); | 318 | void SetButton(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); |
| 317 | 319 | ||
| 318 | /** | 320 | /** |
| 319 | * Updates the analog stick status of the controller | 321 | * Updates the analog stick status of the controller |
| 320 | * @param callback: A CallbackStatus containing the analog stick status | 322 | * @param callback A CallbackStatus containing the analog stick status |
| 321 | * @param index: stick ID of the to be updated | 323 | * @param index stick ID of the to be updated |
| 322 | */ | 324 | */ |
| 323 | void SetStick(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); | 325 | void SetStick(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); |
| 324 | 326 | ||
| 325 | /** | 327 | /** |
| 326 | * Updates the trigger status of the controller | 328 | * Updates the trigger status of the controller |
| 327 | * @param callback: A CallbackStatus containing the trigger status | 329 | * @param callback A CallbackStatus containing the trigger status |
| 328 | * @param index: trigger ID of the to be updated | 330 | * @param index trigger ID of the to be updated |
| 329 | */ | 331 | */ |
| 330 | void SetTrigger(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); | 332 | void SetTrigger(Common::Input::CallbackStatus callback, std::size_t index, Common::UUID uuid); |
| 331 | 333 | ||
| 332 | /** | 334 | /** |
| 333 | * Updates the motion status of the controller | 335 | * Updates the motion status of the controller |
| 334 | * @param callback: A CallbackStatus containing gyro and accelerometer data | 336 | * @param callback A CallbackStatus containing gyro and accelerometer data |
| 335 | * @param index: motion ID of the to be updated | 337 | * @param index motion ID of the to be updated |
| 336 | */ | 338 | */ |
| 337 | void SetMotion(Common::Input::CallbackStatus callback, std::size_t index); | 339 | void SetMotion(Common::Input::CallbackStatus callback, std::size_t index); |
| 338 | 340 | ||
| 339 | /** | 341 | /** |
| 340 | * Updates the battery status of the controller | 342 | * Updates the battery status of the controller |
| 341 | * @param callback: A CallbackStatus containing the battery status | 343 | * @param callback A CallbackStatus containing the battery status |
| 342 | * @param index: Button ID of the to be updated | 344 | * @param index Button ID of the to be updated |
| 343 | */ | 345 | */ |
| 344 | void SetBattery(Common::Input::CallbackStatus callback, std::size_t index); | 346 | void SetBattery(Common::Input::CallbackStatus callback, std::size_t index); |
| 345 | 347 | ||
| 346 | /** | 348 | /** |
| 347 | * Triggers a callback that something has changed on the controller status | 349 | * Triggers a callback that something has changed on the controller status |
| 348 | * @param type: Input type of the event to trigger | 350 | * @param type Input type of the event to trigger |
| 349 | * @param is_service_update: indicates if this event should be sended to only services | 351 | * @param is_service_update indicates if this event should only be sent to HID services |
| 350 | */ | 352 | */ |
| 351 | void TriggerOnChange(ControllerTriggerType type, bool is_service_update); | 353 | void TriggerOnChange(ControllerTriggerType type, bool is_service_update); |
| 352 | 354 | ||
| @@ -357,7 +359,7 @@ private: | |||
| 357 | f32 motion_sensitivity{0.01f}; | 359 | f32 motion_sensitivity{0.01f}; |
| 358 | bool force_update_motion{false}; | 360 | bool force_update_motion{false}; |
| 359 | 361 | ||
| 360 | // Temporary values to avoid doing changes while the controller is on configuration mode | 362 | // Temporary values to avoid doing changes while the controller is in configuring mode |
| 361 | NpadStyleIndex tmp_npad_type{NpadStyleIndex::None}; | 363 | NpadStyleIndex tmp_npad_type{NpadStyleIndex::None}; |
| 362 | bool tmp_is_connected{false}; | 364 | bool tmp_is_connected{false}; |
| 363 | 365 | ||
diff --git a/src/core/hid/emulated_devices.h b/src/core/hid/emulated_devices.h index 05a945d08..c72327681 100644 --- a/src/core/hid/emulated_devices.h +++ b/src/core/hid/emulated_devices.h | |||
| @@ -75,9 +75,9 @@ class EmulatedDevices { | |||
| 75 | public: | 75 | public: |
| 76 | /** | 76 | /** |
| 77 | * Contains all input data related to external devices that aren't necesarily a controller | 77 | * Contains all input data related to external devices that aren't necesarily a controller |
| 78 | * like keyboard and mouse | 78 | * This includes devices such as the keyboard or mouse |
| 79 | */ | 79 | */ |
| 80 | EmulatedDevices(); | 80 | explicit EmulatedDevices(); |
| 81 | ~EmulatedDevices(); | 81 | ~EmulatedDevices(); |
| 82 | 82 | ||
| 83 | YUZU_NON_COPYABLE(EmulatedDevices); | 83 | YUZU_NON_COPYABLE(EmulatedDevices); |
| @@ -86,14 +86,16 @@ public: | |||
| 86 | /// Removes all callbacks created from input devices | 86 | /// Removes all callbacks created from input devices |
| 87 | void UnloadInput(); | 87 | void UnloadInput(); |
| 88 | 88 | ||
| 89 | /// Sets the emulated console into configuring mode. Locking all HID service events from being | 89 | /** |
| 90 | /// moddified | 90 | * Sets the emulated devices into configuring mode |
| 91 | * This prevents the modification of the HID state of the emulated devices by input commands | ||
| 92 | */ | ||
| 91 | void EnableConfiguration(); | 93 | void EnableConfiguration(); |
| 92 | 94 | ||
| 93 | /// Returns the emulated console to the normal behaivour | 95 | /// Returns the emulated devices into normal mode, allowing the modification of the HID state |
| 94 | void DisableConfiguration(); | 96 | void DisableConfiguration(); |
| 95 | 97 | ||
| 96 | /// Returns true if the emulated device is on configuring mode | 98 | /// Returns true if the emulated device is in configuring mode |
| 97 | bool IsConfiguring() const; | 99 | bool IsConfiguring() const; |
| 98 | 100 | ||
| 99 | /// Reload all input devices | 101 | /// Reload all input devices |
| @@ -134,14 +136,14 @@ public: | |||
| 134 | 136 | ||
| 135 | /** | 137 | /** |
| 136 | * Adds a callback to the list of events | 138 | * Adds a callback to the list of events |
| 137 | * @param InterfaceUpdateCallback that will be triggered | 139 | * @param update_callback InterfaceUpdateCallback that will be triggered |
| 138 | * @return an unique key corresponding to the callback index in the list | 140 | * @return an unique key corresponding to the callback index in the list |
| 139 | */ | 141 | */ |
| 140 | int SetCallback(InterfaceUpdateCallback update_callback); | 142 | int SetCallback(InterfaceUpdateCallback update_callback); |
| 141 | 143 | ||
| 142 | /** | 144 | /** |
| 143 | * Removes a callback from the list stopping any future events to this object | 145 | * Removes a callback from the list stopping any future events to this object |
| 144 | * @param Key corresponding to the callback index in the list | 146 | * @param key Key corresponding to the callback index in the list |
| 145 | */ | 147 | */ |
| 146 | void DeleteCallback(int key); | 148 | void DeleteCallback(int key); |
| 147 | 149 | ||
| @@ -151,42 +153,42 @@ private: | |||
| 151 | 153 | ||
| 152 | /** | 154 | /** |
| 153 | * Updates the touch status of the keyboard device | 155 | * Updates the touch status of the keyboard device |
| 154 | * @param callback: A CallbackStatus containing the key status | 156 | * @param callback A CallbackStatus containing the key status |
| 155 | * @param index: key ID to be updated | 157 | * @param index key ID to be updated |
| 156 | */ | 158 | */ |
| 157 | void SetKeyboardButton(Common::Input::CallbackStatus callback, std::size_t index); | 159 | void SetKeyboardButton(Common::Input::CallbackStatus callback, std::size_t index); |
| 158 | 160 | ||
| 159 | /** | 161 | /** |
| 160 | * Updates the keyboard status of the keyboard device | 162 | * Updates the keyboard status of the keyboard device |
| 161 | * @param callback: A CallbackStatus containing the modifier key status | 163 | * @param callback A CallbackStatus containing the modifier key status |
| 162 | * @param index: modifier key ID to be updated | 164 | * @param index modifier key ID to be updated |
| 163 | */ | 165 | */ |
| 164 | void SetKeyboardModifier(Common::Input::CallbackStatus callback, std::size_t index); | 166 | void SetKeyboardModifier(Common::Input::CallbackStatus callback, std::size_t index); |
| 165 | 167 | ||
| 166 | /** | 168 | /** |
| 167 | * Updates the mouse button status of the mouse device | 169 | * Updates the mouse button status of the mouse device |
| 168 | * @param callback: A CallbackStatus containing the button status | 170 | * @param callback A CallbackStatus containing the button status |
| 169 | * @param index: Button ID to be updated | 171 | * @param index Button ID to be updated |
| 170 | */ | 172 | */ |
| 171 | void SetMouseButton(Common::Input::CallbackStatus callback, std::size_t index); | 173 | void SetMouseButton(Common::Input::CallbackStatus callback, std::size_t index); |
| 172 | 174 | ||
| 173 | /** | 175 | /** |
| 174 | * Updates the mouse wheel status of the mouse device | 176 | * Updates the mouse wheel status of the mouse device |
| 175 | * @param callback: A CallbackStatus containing the wheel status | 177 | * @param callback A CallbackStatus containing the wheel status |
| 176 | * @param index: wheel ID to be updated | 178 | * @param index wheel ID to be updated |
| 177 | */ | 179 | */ |
| 178 | void SetMouseAnalog(Common::Input::CallbackStatus callback, std::size_t index); | 180 | void SetMouseAnalog(Common::Input::CallbackStatus callback, std::size_t index); |
| 179 | 181 | ||
| 180 | /** | 182 | /** |
| 181 | * Updates the mouse position status of the mouse device | 183 | * Updates the mouse position status of the mouse device |
| 182 | * @param callback: A CallbackStatus containing the position status | 184 | * @param callback A CallbackStatus containing the position status |
| 183 | * @param index: stick ID to be updated | 185 | * @param index stick ID to be updated |
| 184 | */ | 186 | */ |
| 185 | void SetMouseStick(Common::Input::CallbackStatus callback); | 187 | void SetMouseStick(Common::Input::CallbackStatus callback); |
| 186 | 188 | ||
| 187 | /** | 189 | /** |
| 188 | * Triggers a callback that something has changed on the device status | 190 | * Triggers a callback that something has changed on the device status |
| 189 | * @param Input type of the event to trigger | 191 | * @param type Input type of the event to trigger |
| 190 | */ | 192 | */ |
| 191 | void TriggerOnChange(DeviceTriggerType type); | 193 | void TriggerOnChange(DeviceTriggerType type); |
| 192 | 194 | ||
diff --git a/src/core/hid/hid_core.cpp b/src/core/hid/hid_core.cpp index 741a69c3c..946adde00 100644 --- a/src/core/hid/hid_core.cpp +++ b/src/core/hid/hid_core.cpp | |||
| @@ -135,6 +135,32 @@ NpadIdType HIDCore::GetFirstNpadId() const { | |||
| 135 | return NpadIdType::Player1; | 135 | return NpadIdType::Player1; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | void HIDCore::EnableAllControllerConfiguration() { | ||
| 139 | player_1->EnableConfiguration(); | ||
| 140 | player_2->EnableConfiguration(); | ||
| 141 | player_3->EnableConfiguration(); | ||
| 142 | player_4->EnableConfiguration(); | ||
| 143 | player_5->EnableConfiguration(); | ||
| 144 | player_6->EnableConfiguration(); | ||
| 145 | player_7->EnableConfiguration(); | ||
| 146 | player_8->EnableConfiguration(); | ||
| 147 | other->EnableConfiguration(); | ||
| 148 | handheld->EnableConfiguration(); | ||
| 149 | } | ||
| 150 | |||
| 151 | void HIDCore::DisableAllControllerConfiguration() { | ||
| 152 | player_1->DisableConfiguration(); | ||
| 153 | player_2->DisableConfiguration(); | ||
| 154 | player_3->DisableConfiguration(); | ||
| 155 | player_4->DisableConfiguration(); | ||
| 156 | player_5->DisableConfiguration(); | ||
| 157 | player_6->DisableConfiguration(); | ||
| 158 | player_7->DisableConfiguration(); | ||
| 159 | player_8->DisableConfiguration(); | ||
| 160 | other->DisableConfiguration(); | ||
| 161 | handheld->DisableConfiguration(); | ||
| 162 | } | ||
| 163 | |||
| 138 | void HIDCore::ReloadInputDevices() { | 164 | void HIDCore::ReloadInputDevices() { |
| 139 | player_1->ReloadFromSettings(); | 165 | player_1->ReloadFromSettings(); |
| 140 | player_2->ReloadFromSettings(); | 166 | player_2->ReloadFromSettings(); |
diff --git a/src/core/hid/hid_core.h b/src/core/hid/hid_core.h index 609f40f3b..140a0e962 100644 --- a/src/core/hid/hid_core.h +++ b/src/core/hid/hid_core.h | |||
| @@ -45,6 +45,12 @@ public: | |||
| 45 | /// Returns the first connected npad id | 45 | /// Returns the first connected npad id |
| 46 | NpadIdType GetFirstNpadId() const; | 46 | NpadIdType GetFirstNpadId() const; |
| 47 | 47 | ||
| 48 | /// Sets all emulated controllers into configuring mode. | ||
| 49 | void EnableAllControllerConfiguration(); | ||
| 50 | |||
| 51 | /// Sets all emulated controllers into normal mode. | ||
| 52 | void DisableAllControllerConfiguration(); | ||
| 53 | |||
| 48 | /// Reloads all input devices from settings | 54 | /// Reloads all input devices from settings |
| 49 | void ReloadInputDevices(); | 55 | void ReloadInputDevices(); |
| 50 | 56 | ||
diff --git a/src/core/hid/hid_types.h b/src/core/hid/hid_types.h index acf54e233..780659b86 100644 --- a/src/core/hid/hid_types.h +++ b/src/core/hid/hid_types.h | |||
| @@ -63,6 +63,8 @@ enum class NpadButton : u64 { | |||
| 63 | LagonCUp = 1ULL << 32, | 63 | LagonCUp = 1ULL << 32, |
| 64 | LagonCRight = 1ULL << 33, | 64 | LagonCRight = 1ULL << 33, |
| 65 | LagonCDown = 1ULL << 34, | 65 | LagonCDown = 1ULL << 34, |
| 66 | |||
| 67 | All = 0xFFFFFFFFFFFFFFFFULL, | ||
| 66 | }; | 68 | }; |
| 67 | DECLARE_ENUM_FLAG_OPERATORS(NpadButton); | 69 | DECLARE_ENUM_FLAG_OPERATORS(NpadButton); |
| 68 | 70 | ||
diff --git a/src/core/hid/input_converter.h b/src/core/hid/input_converter.h index 1492489d7..d24582226 100644 --- a/src/core/hid/input_converter.h +++ b/src/core/hid/input_converter.h | |||
| @@ -21,7 +21,7 @@ namespace Core::HID { | |||
| 21 | /** | 21 | /** |
| 22 | * Converts raw input data into a valid battery status. | 22 | * Converts raw input data into a valid battery status. |
| 23 | * | 23 | * |
| 24 | * @param Supported callbacks: Analog, Battery, Trigger. | 24 | * @param callback Supported callbacks: Analog, Battery, Trigger. |
| 25 | * @return A valid BatteryStatus object. | 25 | * @return A valid BatteryStatus object. |
| 26 | */ | 26 | */ |
| 27 | Common::Input::BatteryStatus TransformToBattery(const Common::Input::CallbackStatus& callback); | 27 | Common::Input::BatteryStatus TransformToBattery(const Common::Input::CallbackStatus& callback); |
| @@ -29,7 +29,7 @@ Common::Input::BatteryStatus TransformToBattery(const Common::Input::CallbackSta | |||
| 29 | /** | 29 | /** |
| 30 | * Converts raw input data into a valid button status. Applies invert properties to the output. | 30 | * Converts raw input data into a valid button status. Applies invert properties to the output. |
| 31 | * | 31 | * |
| 32 | * @param Supported callbacks: Analog, Button, Trigger. | 32 | * @param callback Supported callbacks: Analog, Button, Trigger. |
| 33 | * @return A valid TouchStatus object. | 33 | * @return A valid TouchStatus object. |
| 34 | */ | 34 | */ |
| 35 | Common::Input::ButtonStatus TransformToButton(const Common::Input::CallbackStatus& callback); | 35 | Common::Input::ButtonStatus TransformToButton(const Common::Input::CallbackStatus& callback); |
| @@ -37,7 +37,7 @@ Common::Input::ButtonStatus TransformToButton(const Common::Input::CallbackStatu | |||
| 37 | /** | 37 | /** |
| 38 | * Converts raw input data into a valid motion status. | 38 | * Converts raw input data into a valid motion status. |
| 39 | * | 39 | * |
| 40 | * @param Supported callbacks: Motion. | 40 | * @param callback Supported callbacks: Motion. |
| 41 | * @return A valid TouchStatus object. | 41 | * @return A valid TouchStatus object. |
| 42 | */ | 42 | */ |
| 43 | Common::Input::MotionStatus TransformToMotion(const Common::Input::CallbackStatus& callback); | 43 | Common::Input::MotionStatus TransformToMotion(const Common::Input::CallbackStatus& callback); |
| @@ -46,7 +46,7 @@ Common::Input::MotionStatus TransformToMotion(const Common::Input::CallbackStatu | |||
| 46 | * Converts raw input data into a valid stick status. Applies offset, deadzone, range and invert | 46 | * Converts raw input data into a valid stick status. Applies offset, deadzone, range and invert |
| 47 | * properties to the output. | 47 | * properties to the output. |
| 48 | * | 48 | * |
| 49 | * @param Supported callbacks: Stick. | 49 | * @param callback Supported callbacks: Stick. |
| 50 | * @return A valid StickStatus object. | 50 | * @return A valid StickStatus object. |
| 51 | */ | 51 | */ |
| 52 | Common::Input::StickStatus TransformToStick(const Common::Input::CallbackStatus& callback); | 52 | Common::Input::StickStatus TransformToStick(const Common::Input::CallbackStatus& callback); |
| @@ -54,7 +54,7 @@ Common::Input::StickStatus TransformToStick(const Common::Input::CallbackStatus& | |||
| 54 | /** | 54 | /** |
| 55 | * Converts raw input data into a valid touch status. | 55 | * Converts raw input data into a valid touch status. |
| 56 | * | 56 | * |
| 57 | * @param Supported callbacks: Touch. | 57 | * @param callback Supported callbacks: Touch. |
| 58 | * @return A valid TouchStatus object. | 58 | * @return A valid TouchStatus object. |
| 59 | */ | 59 | */ |
| 60 | Common::Input::TouchStatus TransformToTouch(const Common::Input::CallbackStatus& callback); | 60 | Common::Input::TouchStatus TransformToTouch(const Common::Input::CallbackStatus& callback); |
| @@ -63,7 +63,7 @@ Common::Input::TouchStatus TransformToTouch(const Common::Input::CallbackStatus& | |||
| 63 | * Converts raw input data into a valid trigger status. Applies offset, deadzone, range and | 63 | * Converts raw input data into a valid trigger status. Applies offset, deadzone, range and |
| 64 | * invert properties to the output. Button status uses the threshold property if necessary. | 64 | * invert properties to the output. Button status uses the threshold property if necessary. |
| 65 | * | 65 | * |
| 66 | * @param Supported callbacks: Analog, Button, Trigger. | 66 | * @param callback Supported callbacks: Analog, Button, Trigger. |
| 67 | * @return A valid TriggerStatus object. | 67 | * @return A valid TriggerStatus object. |
| 68 | */ | 68 | */ |
| 69 | Common::Input::TriggerStatus TransformToTrigger(const Common::Input::CallbackStatus& callback); | 69 | Common::Input::TriggerStatus TransformToTrigger(const Common::Input::CallbackStatus& callback); |
| @@ -72,22 +72,23 @@ Common::Input::TriggerStatus TransformToTrigger(const Common::Input::CallbackSta | |||
| 72 | * Converts raw input data into a valid analog status. Applies offset, deadzone, range and | 72 | * Converts raw input data into a valid analog status. Applies offset, deadzone, range and |
| 73 | * invert properties to the output. | 73 | * invert properties to the output. |
| 74 | * | 74 | * |
| 75 | * @param Supported callbacks: Analog. | 75 | * @param callback Supported callbacks: Analog. |
| 76 | * @return A valid AnalogStatus object. | 76 | * @return A valid AnalogStatus object. |
| 77 | */ | 77 | */ |
| 78 | Common::Input::AnalogStatus TransformToAnalog(const Common::Input::CallbackStatus& callback); | 78 | Common::Input::AnalogStatus TransformToAnalog(const Common::Input::CallbackStatus& callback); |
| 79 | 79 | ||
| 80 | /** | 80 | /** |
| 81 | * Converts raw analog data into a valid analog value | 81 | * Converts raw analog data into a valid analog value |
| 82 | * @param An analog object containing raw data and properties, bool that determines if the value | 82 | * @param analog An analog object containing raw data and properties |
| 83 | * needs to be clamped between -1.0f and 1.0f. | 83 | * @param clamp_value determines if the value needs to be clamped between -1.0f and 1.0f. |
| 84 | */ | 84 | */ |
| 85 | void SanitizeAnalog(Common::Input::AnalogStatus& analog, bool clamp_value); | 85 | void SanitizeAnalog(Common::Input::AnalogStatus& analog, bool clamp_value); |
| 86 | 86 | ||
| 87 | /** | 87 | /** |
| 88 | * Converts raw stick data into a valid stick value | 88 | * Converts raw stick data into a valid stick value |
| 89 | * @param Two analog objects containing raw data and properties, bool that determines if the value | 89 | * @param analog_x raw analog data and properties for the x-axis |
| 90 | * needs to be clamped into the unit circle. | 90 | * @param analog_y raw analog data and properties for the y-axis |
| 91 | * @param clamp_value bool that determines if the value needs to be clamped into the unit circle. | ||
| 91 | */ | 92 | */ |
| 92 | void SanitizeStick(Common::Input::AnalogStatus& analog_x, Common::Input::AnalogStatus& analog_y, | 93 | void SanitizeStick(Common::Input::AnalogStatus& analog_x, Common::Input::AnalogStatus& analog_y, |
| 93 | bool clamp_value); | 94 | bool clamp_value); |
diff --git a/src/core/hid/input_interpreter.cpp b/src/core/hid/input_interpreter.cpp index 870422d82..2dbda8814 100644 --- a/src/core/hid/input_interpreter.cpp +++ b/src/core/hid/input_interpreter.cpp | |||
| @@ -20,7 +20,7 @@ InputInterpreter::InputInterpreter(Core::System& system) | |||
| 20 | InputInterpreter::~InputInterpreter() = default; | 20 | InputInterpreter::~InputInterpreter() = default; |
| 21 | 21 | ||
| 22 | void InputInterpreter::PollInput() { | 22 | void InputInterpreter::PollInput() { |
| 23 | const u64 button_state = npad.GetAndResetPressState(); | 23 | const auto button_state = npad.GetAndResetPressState(); |
| 24 | 24 | ||
| 25 | previous_index = current_index; | 25 | previous_index = current_index; |
| 26 | current_index = (current_index + 1) % button_states.size(); | 26 | current_index = (current_index + 1) % button_states.size(); |
| @@ -32,30 +32,30 @@ void InputInterpreter::ResetButtonStates() { | |||
| 32 | previous_index = 0; | 32 | previous_index = 0; |
| 33 | current_index = 0; | 33 | current_index = 0; |
| 34 | 34 | ||
| 35 | button_states[0] = 0xFFFFFFFFFFFFFFFF; | 35 | button_states[0] = Core::HID::NpadButton::All; |
| 36 | 36 | ||
| 37 | for (std::size_t i = 1; i < button_states.size(); ++i) { | 37 | for (std::size_t i = 1; i < button_states.size(); ++i) { |
| 38 | button_states[i] = 0; | 38 | button_states[i] = Core::HID::NpadButton::None; |
| 39 | } | 39 | } |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | bool InputInterpreter::IsButtonPressed(Core::HID::NpadButton button) const { | 42 | bool InputInterpreter::IsButtonPressed(Core::HID::NpadButton button) const { |
| 43 | return (button_states[current_index] & static_cast<u64>(button)) != 0; | 43 | return True(button_states[current_index] & button); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | bool InputInterpreter::IsButtonPressedOnce(Core::HID::NpadButton button) const { | 46 | bool InputInterpreter::IsButtonPressedOnce(Core::HID::NpadButton button) const { |
| 47 | const bool current_press = (button_states[current_index] & static_cast<u64>(button)) != 0; | 47 | const bool current_press = True(button_states[current_index] & button); |
| 48 | const bool previous_press = (button_states[previous_index] & static_cast<u64>(button)) != 0; | 48 | const bool previous_press = True(button_states[previous_index] & button); |
| 49 | 49 | ||
| 50 | return current_press && !previous_press; | 50 | return current_press && !previous_press; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | bool InputInterpreter::IsButtonHeld(Core::HID::NpadButton button) const { | 53 | bool InputInterpreter::IsButtonHeld(Core::HID::NpadButton button) const { |
| 54 | u64 held_buttons{button_states[0]}; | 54 | Core::HID::NpadButton held_buttons{button_states[0]}; |
| 55 | 55 | ||
| 56 | for (std::size_t i = 1; i < button_states.size(); ++i) { | 56 | for (std::size_t i = 1; i < button_states.size(); ++i) { |
| 57 | held_buttons &= button_states[i]; | 57 | held_buttons &= button_states[i]; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | return (held_buttons & static_cast<u64>(button)) != 0; | 60 | return True(held_buttons & button); |
| 61 | } | 61 | } |
diff --git a/src/core/hid/input_interpreter.h b/src/core/hid/input_interpreter.h index 1c2e02142..70c34d474 100644 --- a/src/core/hid/input_interpreter.h +++ b/src/core/hid/input_interpreter.h | |||
| @@ -105,7 +105,7 @@ private: | |||
| 105 | Service::HID::Controller_NPad& npad; | 105 | Service::HID::Controller_NPad& npad; |
| 106 | 106 | ||
| 107 | /// Stores 9 consecutive button states polled from HID. | 107 | /// Stores 9 consecutive button states polled from HID. |
| 108 | std::array<u64, 9> button_states{}; | 108 | std::array<Core::HID::NpadButton, 9> button_states{}; |
| 109 | 109 | ||
| 110 | std::size_t previous_index{}; | 110 | std::size_t previous_index{}; |
| 111 | std::size_t current_index{}; | 111 | std::size_t current_index{}; |
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 04b3a68c3..6916930f7 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -510,7 +510,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 510 | libnx_state.r_stick = pad_state.r_stick; | 510 | libnx_state.r_stick = pad_state.r_stick; |
| 511 | npad.system_ext_lifo.WriteNextEntry(pad_state); | 511 | npad.system_ext_lifo.WriteNextEntry(pad_state); |
| 512 | 512 | ||
| 513 | press_state |= static_cast<u32>(pad_state.npad_buttons.raw); | 513 | press_state |= static_cast<u64>(pad_state.npad_buttons.raw); |
| 514 | 514 | ||
| 515 | std::memcpy(data + NPAD_OFFSET + (i * sizeof(NpadInternalState)), | 515 | std::memcpy(data + NPAD_OFFSET + (i * sizeof(NpadInternalState)), |
| 516 | &controller.shared_memory_entry, sizeof(NpadInternalState)); | 516 | &controller.shared_memory_entry, sizeof(NpadInternalState)); |
| @@ -635,7 +635,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing | |||
| 635 | // This buffer only is updated on handheld on HW | 635 | // This buffer only is updated on handheld on HW |
| 636 | npad.sixaxis_handheld_lifo.WriteNextEntry(sixaxis_handheld_state); | 636 | npad.sixaxis_handheld_lifo.WriteNextEntry(sixaxis_handheld_state); |
| 637 | } else { | 637 | } else { |
| 638 | // Hanheld doesn't update this buffer on HW | 638 | // Handheld doesn't update this buffer on HW |
| 639 | npad.sixaxis_fullkey_lifo.WriteNextEntry(sixaxis_fullkey_state); | 639 | npad.sixaxis_fullkey_lifo.WriteNextEntry(sixaxis_fullkey_state); |
| 640 | } | 640 | } |
| 641 | 641 | ||
| @@ -1149,8 +1149,8 @@ void Controller_NPad::ClearAllControllers() { | |||
| 1149 | } | 1149 | } |
| 1150 | } | 1150 | } |
| 1151 | 1151 | ||
| 1152 | u32 Controller_NPad::GetAndResetPressState() { | 1152 | Core::HID::NpadButton Controller_NPad::GetAndResetPressState() { |
| 1153 | return press_state.exchange(0); | 1153 | return static_cast<Core::HID::NpadButton>(press_state.exchange(0)); |
| 1154 | } | 1154 | } |
| 1155 | 1155 | ||
| 1156 | bool Controller_NPad::IsControllerSupported(Core::HID::NpadStyleIndex controller) const { | 1156 | bool Controller_NPad::IsControllerSupported(Core::HID::NpadStyleIndex controller) const { |
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 9fa113bb6..de5fa5a64 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h | |||
| @@ -179,7 +179,7 @@ public: | |||
| 179 | 179 | ||
| 180 | // Logical OR for all buttons presses on all controllers | 180 | // Logical OR for all buttons presses on all controllers |
| 181 | // Specifically for cheat engine and other features. | 181 | // Specifically for cheat engine and other features. |
| 182 | u32 GetAndResetPressState(); | 182 | Core::HID::NpadButton GetAndResetPressState(); |
| 183 | 183 | ||
| 184 | static bool IsNpadIdValid(Core::HID::NpadIdType npad_id); | 184 | static bool IsNpadIdValid(Core::HID::NpadIdType npad_id); |
| 185 | static bool IsDeviceHandleValid(const Core::HID::SixAxisSensorHandle& device_handle); | 185 | static bool IsDeviceHandleValid(const Core::HID::SixAxisSensorHandle& device_handle); |
| @@ -503,7 +503,7 @@ private: | |||
| 503 | NpadControllerData& GetControllerFromNpadIdType(Core::HID::NpadIdType npad_id); | 503 | NpadControllerData& GetControllerFromNpadIdType(Core::HID::NpadIdType npad_id); |
| 504 | const NpadControllerData& GetControllerFromNpadIdType(Core::HID::NpadIdType npad_id) const; | 504 | const NpadControllerData& GetControllerFromNpadIdType(Core::HID::NpadIdType npad_id) const; |
| 505 | 505 | ||
| 506 | std::atomic<u32> press_state{}; | 506 | std::atomic<u64> press_state{}; |
| 507 | 507 | ||
| 508 | std::array<NpadControllerData, 10> controller_data{}; | 508 | std::array<NpadControllerData, 10> controller_data{}; |
| 509 | KernelHelpers::ServiceContext& service_context; | 509 | KernelHelpers::ServiceContext& service_context; |
diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp index 20f0e90f5..12446c9ac 100644 --- a/src/core/memory/cheat_engine.cpp +++ b/src/core/memory/cheat_engine.cpp | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | namespace Core::Memory { | 19 | namespace Core::Memory { |
| 20 | namespace { | 20 | namespace { |
| 21 | constexpr auto CHEAT_ENGINE_NS = std::chrono::nanoseconds{1000000000 / 12}; | 21 | constexpr auto CHEAT_ENGINE_NS = std::chrono::nanoseconds{1000000000 / 12}; |
| 22 | constexpr u32 KEYPAD_BITMASK = 0x3FFFFFF; | ||
| 23 | 22 | ||
| 24 | std::string_view ExtractName(std::string_view data, std::size_t start_index, char match) { | 23 | std::string_view ExtractName(std::string_view data, std::size_t start_index, char match) { |
| 25 | auto end_index = start_index; | 24 | auto end_index = start_index; |
| @@ -61,7 +60,7 @@ u64 StandardVmCallbacks::HidKeysDown() { | |||
| 61 | applet_resource | 60 | applet_resource |
| 62 | ->GetController<Service::HID::Controller_NPad>(Service::HID::HidController::NPad) | 61 | ->GetController<Service::HID::Controller_NPad>(Service::HID::HidController::NPad) |
| 63 | .GetAndResetPressState(); | 62 | .GetAndResetPressState(); |
| 64 | return press_state & KEYPAD_BITMASK; | 63 | return static_cast<u64>(press_state & HID::NpadButton::All); |
| 65 | } | 64 | } |
| 66 | 65 | ||
| 67 | void StandardVmCallbacks::DebugLog(u8 id, u64 value) { | 66 | void StandardVmCallbacks::DebugLog(u8 id, u64 value) { |
diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp index 7e80e7836..c5685db2e 100644 --- a/src/yuzu/applets/qt_controller.cpp +++ b/src/yuzu/applets/qt_controller.cpp | |||
| @@ -139,7 +139,6 @@ QtControllerSelectorDialog::QtControllerSelectorDialog( | |||
| 139 | DisableUnsupportedPlayers(); | 139 | DisableUnsupportedPlayers(); |
| 140 | 140 | ||
| 141 | for (std::size_t player_index = 0; player_index < NUM_PLAYERS; ++player_index) { | 141 | for (std::size_t player_index = 0; player_index < NUM_PLAYERS; ++player_index) { |
| 142 | system.HIDCore().GetEmulatedControllerByIndex(player_index)->EnableConfiguration(); | ||
| 143 | SetEmulatedControllers(player_index); | 142 | SetEmulatedControllers(player_index); |
| 144 | } | 143 | } |
| 145 | 144 | ||
| @@ -205,9 +204,6 @@ QtControllerSelectorDialog::QtControllerSelectorDialog( | |||
| 205 | // If all the parameters are met AND only allows a single player, | 204 | // If all the parameters are met AND only allows a single player, |
| 206 | // stop the constructor here as we do not need to continue. | 205 | // stop the constructor here as we do not need to continue. |
| 207 | if (CheckIfParametersMet() && parameters.enable_single_mode) { | 206 | if (CheckIfParametersMet() && parameters.enable_single_mode) { |
| 208 | for (std::size_t player_index = 0; player_index < NUM_PLAYERS; ++player_index) { | ||
| 209 | system.HIDCore().GetEmulatedControllerByIndex(player_index)->DisableConfiguration(); | ||
| 210 | } | ||
| 211 | return; | 207 | return; |
| 212 | } | 208 | } |
| 213 | 209 | ||
| @@ -221,7 +217,9 @@ QtControllerSelectorDialog::QtControllerSelectorDialog( | |||
| 221 | resize(0, 0); | 217 | resize(0, 0); |
| 222 | } | 218 | } |
| 223 | 219 | ||
| 224 | QtControllerSelectorDialog::~QtControllerSelectorDialog() = default; | 220 | QtControllerSelectorDialog::~QtControllerSelectorDialog() { |
| 221 | system.HIDCore().DisableAllControllerConfiguration(); | ||
| 222 | } | ||
| 225 | 223 | ||
| 226 | int QtControllerSelectorDialog::exec() { | 224 | int QtControllerSelectorDialog::exec() { |
| 227 | if (parameters_met && parameters.enable_single_mode) { | 225 | if (parameters_met && parameters.enable_single_mode) { |
| @@ -237,12 +235,11 @@ void QtControllerSelectorDialog::ApplyConfiguration() { | |||
| 237 | 235 | ||
| 238 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); | 236 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); |
| 239 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); | 237 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); |
| 240 | for (std::size_t player_index = 0; player_index < NUM_PLAYERS; ++player_index) { | ||
| 241 | system.HIDCore().GetEmulatedControllerByIndex(player_index)->DisableConfiguration(); | ||
| 242 | } | ||
| 243 | } | 238 | } |
| 244 | 239 | ||
| 245 | void QtControllerSelectorDialog::LoadConfiguration() { | 240 | void QtControllerSelectorDialog::LoadConfiguration() { |
| 241 | system.HIDCore().EnableAllControllerConfiguration(); | ||
| 242 | |||
| 246 | const auto* handheld = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); | 243 | const auto* handheld = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); |
| 247 | for (std::size_t index = 0; index < NUM_PLAYERS; ++index) { | 244 | for (std::size_t index = 0; index < NUM_PLAYERS; ++index) { |
| 248 | const auto* controller = system.HIDCore().GetEmulatedControllerByIndex(index); | 245 | const auto* controller = system.HIDCore().GetEmulatedControllerByIndex(index); |
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 16284d5a6..34099bc83 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -246,15 +246,15 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 246 | if (player_index == 0) { | 246 | if (player_index == 0) { |
| 247 | auto* emulated_controller_p1 = | 247 | auto* emulated_controller_p1 = |
| 248 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); | 248 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); |
| 249 | auto* emulated_controller_hanheld = | 249 | auto* emulated_controller_handheld = |
| 250 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld); | 250 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld); |
| 251 | emulated_controller_p1->SaveCurrentConfig(); | 251 | emulated_controller_p1->SaveCurrentConfig(); |
| 252 | emulated_controller_p1->EnableConfiguration(); | 252 | emulated_controller_p1->EnableConfiguration(); |
| 253 | emulated_controller_hanheld->SaveCurrentConfig(); | 253 | emulated_controller_handheld->SaveCurrentConfig(); |
| 254 | emulated_controller_hanheld->EnableConfiguration(); | 254 | emulated_controller_handheld->EnableConfiguration(); |
| 255 | if (emulated_controller_hanheld->IsConnected(true)) { | 255 | if (emulated_controller_handheld->IsConnected(true)) { |
| 256 | emulated_controller_p1->Disconnect(); | 256 | emulated_controller_p1->Disconnect(); |
| 257 | emulated_controller = emulated_controller_hanheld; | 257 | emulated_controller = emulated_controller_handheld; |
| 258 | } else { | 258 | } else { |
| 259 | emulated_controller = emulated_controller_p1; | 259 | emulated_controller = emulated_controller_p1; |
| 260 | } | 260 | } |
| @@ -590,19 +590,19 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 590 | if (player_index == 0) { | 590 | if (player_index == 0) { |
| 591 | auto* emulated_controller_p1 = | 591 | auto* emulated_controller_p1 = |
| 592 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); | 592 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); |
| 593 | auto* emulated_controller_hanheld = | 593 | auto* emulated_controller_handheld = |
| 594 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld); | 594 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld); |
| 595 | bool is_connected = emulated_controller->IsConnected(true); | 595 | bool is_connected = emulated_controller->IsConnected(true); |
| 596 | 596 | ||
| 597 | emulated_controller_p1->SetNpadStyleIndex(type); | 597 | emulated_controller_p1->SetNpadStyleIndex(type); |
| 598 | emulated_controller_hanheld->SetNpadStyleIndex(type); | 598 | emulated_controller_handheld->SetNpadStyleIndex(type); |
| 599 | if (is_connected) { | 599 | if (is_connected) { |
| 600 | if (type == Core::HID::NpadStyleIndex::Handheld) { | 600 | if (type == Core::HID::NpadStyleIndex::Handheld) { |
| 601 | emulated_controller_p1->Disconnect(); | 601 | emulated_controller_p1->Disconnect(); |
| 602 | emulated_controller_hanheld->Connect(); | 602 | emulated_controller_handheld->Connect(); |
| 603 | emulated_controller = emulated_controller_hanheld; | 603 | emulated_controller = emulated_controller_handheld; |
| 604 | } else { | 604 | } else { |
| 605 | emulated_controller_hanheld->Disconnect(); | 605 | emulated_controller_handheld->Disconnect(); |
| 606 | emulated_controller_p1->Connect(); | 606 | emulated_controller_p1->Connect(); |
| 607 | emulated_controller = emulated_controller_p1; | 607 | emulated_controller = emulated_controller_p1; |
| 608 | } | 608 | } |
| @@ -650,10 +650,10 @@ ConfigureInputPlayer::~ConfigureInputPlayer() { | |||
| 650 | if (player_index == 0) { | 650 | if (player_index == 0) { |
| 651 | auto* emulated_controller_p1 = | 651 | auto* emulated_controller_p1 = |
| 652 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); | 652 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); |
| 653 | auto* emulated_controller_hanheld = | 653 | auto* emulated_controller_handheld = |
| 654 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld); | 654 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld); |
| 655 | emulated_controller_p1->DisableConfiguration(); | 655 | emulated_controller_p1->DisableConfiguration(); |
| 656 | emulated_controller_hanheld->DisableConfiguration(); | 656 | emulated_controller_handheld->DisableConfiguration(); |
| 657 | } else { | 657 | } else { |
| 658 | emulated_controller->DisableConfiguration(); | 658 | emulated_controller->DisableConfiguration(); |
| 659 | } | 659 | } |
| @@ -663,14 +663,14 @@ void ConfigureInputPlayer::ApplyConfiguration() { | |||
| 663 | if (player_index == 0) { | 663 | if (player_index == 0) { |
| 664 | auto* emulated_controller_p1 = | 664 | auto* emulated_controller_p1 = |
| 665 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); | 665 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); |
| 666 | auto* emulated_controller_hanheld = | 666 | auto* emulated_controller_handheld = |
| 667 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld); | 667 | hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld); |
| 668 | emulated_controller_p1->DisableConfiguration(); | 668 | emulated_controller_p1->DisableConfiguration(); |
| 669 | emulated_controller_p1->SaveCurrentConfig(); | 669 | emulated_controller_p1->SaveCurrentConfig(); |
| 670 | emulated_controller_p1->EnableConfiguration(); | 670 | emulated_controller_p1->EnableConfiguration(); |
| 671 | emulated_controller_hanheld->DisableConfiguration(); | 671 | emulated_controller_handheld->DisableConfiguration(); |
| 672 | emulated_controller_hanheld->SaveCurrentConfig(); | 672 | emulated_controller_handheld->SaveCurrentConfig(); |
| 673 | emulated_controller_hanheld->EnableConfiguration(); | 673 | emulated_controller_handheld->EnableConfiguration(); |
| 674 | return; | 674 | return; |
| 675 | } | 675 | } |
| 676 | emulated_controller->DisableConfiguration(); | 676 | emulated_controller->DisableConfiguration(); |