diff options
| author | 2022-02-05 00:40:28 -0500 | |
|---|---|---|
| committer | 2022-02-05 13:18:41 -0500 | |
| commit | cb30fe50cd074fe05dd1d6e4b0d58116d3d98489 (patch) | |
| tree | 58450d743d317369266bbbea44734725d8b83ea6 /src/core | |
| parent | common: Implement NewUUID (diff) | |
| download | yuzu-cb30fe50cd074fe05dd1d6e4b0d58116d3d98489.tar.gz yuzu-cb30fe50cd074fe05dd1d6e4b0d58116d3d98489.tar.xz yuzu-cb30fe50cd074fe05dd1d6e4b0d58116d3d98489.zip | |
input/hid: Migrate to the new UUID implementation
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 23 | ||||
| -rw-r--r-- | src/core/hid/emulated_controller.h | 6 | ||||
| -rw-r--r-- | src/core/hid/hid_types.h | 2 |
3 files changed, 16 insertions, 15 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index a7cdf45e6..44e9f22b9 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -204,7 +204,7 @@ void EmulatedController::ReloadInput() { | |||
| 204 | if (!button_devices[index]) { | 204 | if (!button_devices[index]) { |
| 205 | continue; | 205 | continue; |
| 206 | } | 206 | } |
| 207 | const auto uuid = Common::UUID{button_params[index].Get("guid", "")}; | 207 | const auto uuid = Common::NewUUID{button_params[index].Get("guid", "")}; |
| 208 | button_devices[index]->SetCallback({ | 208 | button_devices[index]->SetCallback({ |
| 209 | .on_change = | 209 | .on_change = |
| 210 | [this, index, uuid](const Common::Input::CallbackStatus& callback) { | 210 | [this, index, uuid](const Common::Input::CallbackStatus& callback) { |
| @@ -218,7 +218,7 @@ void EmulatedController::ReloadInput() { | |||
| 218 | if (!stick_devices[index]) { | 218 | if (!stick_devices[index]) { |
| 219 | continue; | 219 | continue; |
| 220 | } | 220 | } |
| 221 | const auto uuid = Common::UUID{stick_params[index].Get("guid", "")}; | 221 | const auto uuid = Common::NewUUID{stick_params[index].Get("guid", "")}; |
| 222 | stick_devices[index]->SetCallback({ | 222 | stick_devices[index]->SetCallback({ |
| 223 | .on_change = | 223 | .on_change = |
| 224 | [this, index, uuid](const Common::Input::CallbackStatus& callback) { | 224 | [this, index, uuid](const Common::Input::CallbackStatus& callback) { |
| @@ -232,7 +232,7 @@ void EmulatedController::ReloadInput() { | |||
| 232 | if (!trigger_devices[index]) { | 232 | if (!trigger_devices[index]) { |
| 233 | continue; | 233 | continue; |
| 234 | } | 234 | } |
| 235 | const auto uuid = Common::UUID{trigger_params[index].Get("guid", "")}; | 235 | const auto uuid = Common::NewUUID{trigger_params[index].Get("guid", "")}; |
| 236 | trigger_devices[index]->SetCallback({ | 236 | trigger_devices[index]->SetCallback({ |
| 237 | .on_change = | 237 | .on_change = |
| 238 | [this, index, uuid](const Common::Input::CallbackStatus& callback) { | 238 | [this, index, uuid](const Common::Input::CallbackStatus& callback) { |
| @@ -269,7 +269,8 @@ void EmulatedController::ReloadInput() { | |||
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | // Use a common UUID for TAS | 271 | // Use a common UUID for TAS |
| 272 | const auto tas_uuid = Common::UUID{0x0, 0x7A5}; | 272 | static constexpr Common::NewUUID TAS_UUID = Common::NewUUID{ |
| 273 | {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xA5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; | ||
| 273 | 274 | ||
| 274 | // Register TAS devices. No need to force update | 275 | // Register TAS devices. No need to force update |
| 275 | for (std::size_t index = 0; index < tas_button_devices.size(); ++index) { | 276 | for (std::size_t index = 0; index < tas_button_devices.size(); ++index) { |
| @@ -278,8 +279,8 @@ void EmulatedController::ReloadInput() { | |||
| 278 | } | 279 | } |
| 279 | tas_button_devices[index]->SetCallback({ | 280 | tas_button_devices[index]->SetCallback({ |
| 280 | .on_change = | 281 | .on_change = |
| 281 | [this, index, tas_uuid](const Common::Input::CallbackStatus& callback) { | 282 | [this, index](const Common::Input::CallbackStatus& callback) { |
| 282 | SetButton(callback, index, tas_uuid); | 283 | SetButton(callback, index, TAS_UUID); |
| 283 | }, | 284 | }, |
| 284 | }); | 285 | }); |
| 285 | } | 286 | } |
| @@ -290,8 +291,8 @@ void EmulatedController::ReloadInput() { | |||
| 290 | } | 291 | } |
| 291 | tas_stick_devices[index]->SetCallback({ | 292 | tas_stick_devices[index]->SetCallback({ |
| 292 | .on_change = | 293 | .on_change = |
| 293 | [this, index, tas_uuid](const Common::Input::CallbackStatus& callback) { | 294 | [this, index](const Common::Input::CallbackStatus& callback) { |
| 294 | SetStick(callback, index, tas_uuid); | 295 | SetStick(callback, index, TAS_UUID); |
| 295 | }, | 296 | }, |
| 296 | }); | 297 | }); |
| 297 | } | 298 | } |
| @@ -489,7 +490,7 @@ void EmulatedController::SetMotionParam(std::size_t index, Common::ParamPackage | |||
| 489 | } | 490 | } |
| 490 | 491 | ||
| 491 | void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback, std::size_t index, | 492 | void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback, std::size_t index, |
| 492 | Common::UUID uuid) { | 493 | Common::NewUUID uuid) { |
| 493 | if (index >= controller.button_values.size()) { | 494 | if (index >= controller.button_values.size()) { |
| 494 | return; | 495 | return; |
| 495 | } | 496 | } |
| @@ -638,7 +639,7 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback | |||
| 638 | } | 639 | } |
| 639 | 640 | ||
| 640 | void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback, std::size_t index, | 641 | void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback, std::size_t index, |
| 641 | Common::UUID uuid) { | 642 | Common::NewUUID uuid) { |
| 642 | if (index >= controller.stick_values.size()) { | 643 | if (index >= controller.stick_values.size()) { |
| 643 | return; | 644 | return; |
| 644 | } | 645 | } |
| @@ -688,7 +689,7 @@ void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback, | |||
| 688 | } | 689 | } |
| 689 | 690 | ||
| 690 | void EmulatedController::SetTrigger(const Common::Input::CallbackStatus& callback, | 691 | void EmulatedController::SetTrigger(const Common::Input::CallbackStatus& callback, |
| 691 | std::size_t index, Common::UUID uuid) { | 692 | std::size_t index, Common::NewUUID uuid) { |
| 692 | if (index >= controller.trigger_values.size()) { | 693 | if (index >= controller.trigger_values.size()) { |
| 693 | return; | 694 | return; |
| 694 | } | 695 | } |
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index d8642c5b3..ed61e9522 100644 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h | |||
| @@ -354,7 +354,7 @@ private: | |||
| 354 | * @param index Button ID of the to be updated | 354 | * @param index Button ID of the to be updated |
| 355 | */ | 355 | */ |
| 356 | void SetButton(const Common::Input::CallbackStatus& callback, std::size_t index, | 356 | void SetButton(const Common::Input::CallbackStatus& callback, std::size_t index, |
| 357 | Common::UUID uuid); | 357 | Common::NewUUID uuid); |
| 358 | 358 | ||
| 359 | /** | 359 | /** |
| 360 | * Updates the analog stick status of the controller | 360 | * Updates the analog stick status of the controller |
| @@ -362,7 +362,7 @@ private: | |||
| 362 | * @param index stick ID of the to be updated | 362 | * @param index stick ID of the to be updated |
| 363 | */ | 363 | */ |
| 364 | void SetStick(const Common::Input::CallbackStatus& callback, std::size_t index, | 364 | void SetStick(const Common::Input::CallbackStatus& callback, std::size_t index, |
| 365 | Common::UUID uuid); | 365 | Common::NewUUID uuid); |
| 366 | 366 | ||
| 367 | /** | 367 | /** |
| 368 | * Updates the trigger status of the controller | 368 | * Updates the trigger status of the controller |
| @@ -370,7 +370,7 @@ private: | |||
| 370 | * @param index trigger ID of the to be updated | 370 | * @param index trigger ID of the to be updated |
| 371 | */ | 371 | */ |
| 372 | void SetTrigger(const Common::Input::CallbackStatus& callback, std::size_t index, | 372 | void SetTrigger(const Common::Input::CallbackStatus& callback, std::size_t index, |
| 373 | Common::UUID uuid); | 373 | Common::NewUUID uuid); |
| 374 | 374 | ||
| 375 | /** | 375 | /** |
| 376 | * Updates the motion status of the controller | 376 | * Updates the motion status of the controller |
diff --git a/src/core/hid/hid_types.h b/src/core/hid/hid_types.h index 778b328b9..a4ccdf11c 100644 --- a/src/core/hid/hid_types.h +++ b/src/core/hid/hid_types.h | |||
| @@ -7,8 +7,8 @@ | |||
| 7 | #include "common/bit_field.h" | 7 | #include "common/bit_field.h" |
| 8 | #include "common/common_funcs.h" | 8 | #include "common/common_funcs.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "common/new_uuid.h" | ||
| 10 | #include "common/point.h" | 11 | #include "common/point.h" |
| 11 | #include "common/uuid.h" | ||
| 12 | 12 | ||
| 13 | namespace Core::HID { | 13 | namespace Core::HID { |
| 14 | 14 | ||