From cb30fe50cd074fe05dd1d6e4b0d58116d3d98489 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sat, 5 Feb 2022 00:40:28 -0500 Subject: input/hid: Migrate to the new UUID implementation --- src/core/hid/emulated_controller.cpp | 23 ++++++++++++----------- src/core/hid/emulated_controller.h | 6 +++--- src/core/hid/hid_types.h | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) (limited to 'src/core') 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() { if (!button_devices[index]) { continue; } - const auto uuid = Common::UUID{button_params[index].Get("guid", "")}; + const auto uuid = Common::NewUUID{button_params[index].Get("guid", "")}; button_devices[index]->SetCallback({ .on_change = [this, index, uuid](const Common::Input::CallbackStatus& callback) { @@ -218,7 +218,7 @@ void EmulatedController::ReloadInput() { if (!stick_devices[index]) { continue; } - const auto uuid = Common::UUID{stick_params[index].Get("guid", "")}; + const auto uuid = Common::NewUUID{stick_params[index].Get("guid", "")}; stick_devices[index]->SetCallback({ .on_change = [this, index, uuid](const Common::Input::CallbackStatus& callback) { @@ -232,7 +232,7 @@ void EmulatedController::ReloadInput() { if (!trigger_devices[index]) { continue; } - const auto uuid = Common::UUID{trigger_params[index].Get("guid", "")}; + const auto uuid = Common::NewUUID{trigger_params[index].Get("guid", "")}; trigger_devices[index]->SetCallback({ .on_change = [this, index, uuid](const Common::Input::CallbackStatus& callback) { @@ -269,7 +269,8 @@ void EmulatedController::ReloadInput() { } // Use a common UUID for TAS - const auto tas_uuid = Common::UUID{0x0, 0x7A5}; + static constexpr Common::NewUUID TAS_UUID = Common::NewUUID{ + {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xA5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; // Register TAS devices. No need to force update for (std::size_t index = 0; index < tas_button_devices.size(); ++index) { @@ -278,8 +279,8 @@ void EmulatedController::ReloadInput() { } tas_button_devices[index]->SetCallback({ .on_change = - [this, index, tas_uuid](const Common::Input::CallbackStatus& callback) { - SetButton(callback, index, tas_uuid); + [this, index](const Common::Input::CallbackStatus& callback) { + SetButton(callback, index, TAS_UUID); }, }); } @@ -290,8 +291,8 @@ void EmulatedController::ReloadInput() { } tas_stick_devices[index]->SetCallback({ .on_change = - [this, index, tas_uuid](const Common::Input::CallbackStatus& callback) { - SetStick(callback, index, tas_uuid); + [this, index](const Common::Input::CallbackStatus& callback) { + SetStick(callback, index, TAS_UUID); }, }); } @@ -489,7 +490,7 @@ void EmulatedController::SetMotionParam(std::size_t index, Common::ParamPackage } void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::UUID uuid) { + Common::NewUUID uuid) { if (index >= controller.button_values.size()) { return; } @@ -638,7 +639,7 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback } void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::UUID uuid) { + Common::NewUUID uuid) { if (index >= controller.stick_values.size()) { return; } @@ -688,7 +689,7 @@ void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback, } void EmulatedController::SetTrigger(const Common::Input::CallbackStatus& callback, - std::size_t index, Common::UUID uuid) { + std::size_t index, Common::NewUUID uuid) { if (index >= controller.trigger_values.size()) { return; } 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: * @param index Button ID of the to be updated */ void SetButton(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::UUID uuid); + Common::NewUUID uuid); /** * Updates the analog stick status of the controller @@ -362,7 +362,7 @@ private: * @param index stick ID of the to be updated */ void SetStick(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::UUID uuid); + Common::NewUUID uuid); /** * Updates the trigger status of the controller @@ -370,7 +370,7 @@ private: * @param index trigger ID of the to be updated */ void SetTrigger(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::UUID uuid); + Common::NewUUID uuid); /** * 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 @@ #include "common/bit_field.h" #include "common/common_funcs.h" #include "common/common_types.h" +#include "common/new_uuid.h" #include "common/point.h" -#include "common/uuid.h" namespace Core::HID { -- cgit v1.2.3