summaryrefslogtreecommitdiff
path: root/src/input_common/drivers
diff options
context:
space:
mode:
authorGravatar Morph2022-02-05 00:40:28 -0500
committerGravatar Morph2022-02-05 13:18:41 -0500
commitcb30fe50cd074fe05dd1d6e4b0d58116d3d98489 (patch)
tree58450d743d317369266bbbea44734725d8b83ea6 /src/input_common/drivers
parentcommon: Implement NewUUID (diff)
downloadyuzu-cb30fe50cd074fe05dd1d6e4b0d58116d3d98489.tar.gz
yuzu-cb30fe50cd074fe05dd1d6e4b0d58116d3d98489.tar.xz
yuzu-cb30fe50cd074fe05dd1d6e4b0d58116d3d98489.zip
input/hid: Migrate to the new UUID implementation
Diffstat (limited to 'src/input_common/drivers')
-rw-r--r--src/input_common/drivers/gc_adapter.cpp2
-rw-r--r--src/input_common/drivers/keyboard.cpp6
-rw-r--r--src/input_common/drivers/mouse.cpp2
-rw-r--r--src/input_common/drivers/sdl_driver.cpp6
-rw-r--r--src/input_common/drivers/tas_input.cpp4
-rw-r--r--src/input_common/drivers/touch_screen.cpp2
-rw-r--r--src/input_common/drivers/udp_client.cpp8
-rw-r--r--src/input_common/drivers/udp_client.h4
8 files changed, 17 insertions, 17 deletions
diff --git a/src/input_common/drivers/gc_adapter.cpp b/src/input_common/drivers/gc_adapter.cpp
index 7ab4540a8..7a269b526 100644
--- a/src/input_common/drivers/gc_adapter.cpp
+++ b/src/input_common/drivers/gc_adapter.cpp
@@ -248,7 +248,7 @@ bool GCAdapter::Setup() {
248 std::size_t port = 0; 248 std::size_t port = 0;
249 for (GCController& pad : pads) { 249 for (GCController& pad : pads) {
250 pad.identifier = { 250 pad.identifier = {
251 .guid = Common::UUID{Common::INVALID_UUID}, 251 .guid = Common::NewUUID{},
252 .port = port++, 252 .port = port++,
253 .pad = 0, 253 .pad = 0,
254 }; 254 };
diff --git a/src/input_common/drivers/keyboard.cpp b/src/input_common/drivers/keyboard.cpp
index 4c1e5bbec..449509270 100644
--- a/src/input_common/drivers/keyboard.cpp
+++ b/src/input_common/drivers/keyboard.cpp
@@ -9,17 +9,17 @@
9namespace InputCommon { 9namespace InputCommon {
10 10
11constexpr PadIdentifier key_identifier = { 11constexpr PadIdentifier key_identifier = {
12 .guid = Common::UUID{Common::INVALID_UUID}, 12 .guid = Common::NewUUID{},
13 .port = 0, 13 .port = 0,
14 .pad = 0, 14 .pad = 0,
15}; 15};
16constexpr PadIdentifier keyboard_key_identifier = { 16constexpr PadIdentifier keyboard_key_identifier = {
17 .guid = Common::UUID{Common::INVALID_UUID}, 17 .guid = Common::NewUUID{},
18 .port = 1, 18 .port = 1,
19 .pad = 0, 19 .pad = 0,
20}; 20};
21constexpr PadIdentifier keyboard_modifier_identifier = { 21constexpr PadIdentifier keyboard_modifier_identifier = {
22 .guid = Common::UUID{Common::INVALID_UUID}, 22 .guid = Common::NewUUID{},
23 .port = 1, 23 .port = 1,
24 .pad = 1, 24 .pad = 1,
25}; 25};
diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp
index d8ae7f0c1..ae63088ba 100644
--- a/src/input_common/drivers/mouse.cpp
+++ b/src/input_common/drivers/mouse.cpp
@@ -20,7 +20,7 @@ constexpr int motion_wheel_y = 4;
20constexpr int touch_axis_x = 10; 20constexpr int touch_axis_x = 10;
21constexpr int touch_axis_y = 11; 21constexpr int touch_axis_y = 11;
22constexpr PadIdentifier identifier = { 22constexpr PadIdentifier identifier = {
23 .guid = Common::UUID{Common::INVALID_UUID}, 23 .guid = Common::NewUUID{},
24 .port = 0, 24 .port = 0,
25 .pad = 0, 25 .pad = 0,
26}; 26};
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp
index b031a8523..b9a8317d4 100644
--- a/src/input_common/drivers/sdl_driver.cpp
+++ b/src/input_common/drivers/sdl_driver.cpp
@@ -120,7 +120,7 @@ public:
120 */ 120 */
121 const PadIdentifier GetPadIdentifier() const { 121 const PadIdentifier GetPadIdentifier() const {
122 return { 122 return {
123 .guid = Common::UUID{guid}, 123 .guid = Common::NewUUID{guid},
124 .port = static_cast<std::size_t>(port), 124 .port = static_cast<std::size_t>(port),
125 .pad = 0, 125 .pad = 0,
126 }; 126 };
@@ -502,7 +502,7 @@ std::vector<Common::ParamPackage> SDLDriver::GetInputDevices() const {
502Common::Input::VibrationError SDLDriver::SetRumble( 502Common::Input::VibrationError SDLDriver::SetRumble(
503 const PadIdentifier& identifier, const Common::Input::VibrationStatus& vibration) { 503 const PadIdentifier& identifier, const Common::Input::VibrationStatus& vibration) {
504 const auto joystick = 504 const auto joystick =
505 GetSDLJoystickByGUID(identifier.guid.Format(), static_cast<int>(identifier.port)); 505 GetSDLJoystickByGUID(identifier.guid.RawString(), static_cast<int>(identifier.port));
506 const auto process_amplitude_exp = [](f32 amplitude, f32 factor) { 506 const auto process_amplitude_exp = [](f32 amplitude, f32 factor) {
507 return (amplitude + std::pow(amplitude, factor)) * 0.5f * 0xFFFF; 507 return (amplitude + std::pow(amplitude, factor)) * 0.5f * 0xFFFF;
508 }; 508 };
@@ -599,7 +599,7 @@ Common::ParamPackage SDLDriver::BuildParamPackageForAnalog(PadIdentifier identif
599 Common::ParamPackage params; 599 Common::ParamPackage params;
600 params.Set("engine", GetEngineName()); 600 params.Set("engine", GetEngineName());
601 params.Set("port", static_cast<int>(identifier.port)); 601 params.Set("port", static_cast<int>(identifier.port));
602 params.Set("guid", identifier.guid.Format()); 602 params.Set("guid", identifier.guid.RawString());
603 params.Set("axis_x", axis_x); 603 params.Set("axis_x", axis_x);
604 params.Set("axis_y", axis_y); 604 params.Set("axis_y", axis_y);
605 params.Set("offset_x", offset_x); 605 params.Set("offset_x", offset_x);
diff --git a/src/input_common/drivers/tas_input.cpp b/src/input_common/drivers/tas_input.cpp
index 944e141bf..6d36cf5da 100644
--- a/src/input_common/drivers/tas_input.cpp
+++ b/src/input_common/drivers/tas_input.cpp
@@ -50,7 +50,7 @@ constexpr std::array<std::pair<std::string_view, TasButton>, 18> text_to_tas_but
50Tas::Tas(std::string input_engine_) : InputEngine(std::move(input_engine_)) { 50Tas::Tas(std::string input_engine_) : InputEngine(std::move(input_engine_)) {
51 for (size_t player_index = 0; player_index < PLAYER_NUMBER; player_index++) { 51 for (size_t player_index = 0; player_index < PLAYER_NUMBER; player_index++) {
52 PadIdentifier identifier{ 52 PadIdentifier identifier{
53 .guid = Common::UUID{}, 53 .guid = Common::NewUUID{},
54 .port = player_index, 54 .port = player_index,
55 .pad = 0, 55 .pad = 0,
56 }; 56 };
@@ -203,7 +203,7 @@ void Tas::UpdateThread() {
203 } 203 }
204 204
205 PadIdentifier identifier{ 205 PadIdentifier identifier{
206 .guid = Common::UUID{}, 206 .guid = Common::NewUUID{},
207 .port = player_index, 207 .port = player_index,
208 .pad = 0, 208 .pad = 0,
209 }; 209 };
diff --git a/src/input_common/drivers/touch_screen.cpp b/src/input_common/drivers/touch_screen.cpp
index 880781825..1030e74d9 100644
--- a/src/input_common/drivers/touch_screen.cpp
+++ b/src/input_common/drivers/touch_screen.cpp
@@ -8,7 +8,7 @@
8namespace InputCommon { 8namespace InputCommon {
9 9
10constexpr PadIdentifier identifier = { 10constexpr PadIdentifier identifier = {
11 .guid = Common::UUID{Common::INVALID_UUID}, 11 .guid = Common::NewUUID{},
12 .port = 0, 12 .port = 0,
13 .pad = 0, 13 .pad = 0,
14}; 14};
diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp
index 333173e3d..cbcfa7a4b 100644
--- a/src/input_common/drivers/udp_client.cpp
+++ b/src/input_common/drivers/udp_client.cpp
@@ -351,10 +351,10 @@ PadIdentifier UDPClient::GetPadIdentifier(std::size_t pad_index) const {
351 }; 351 };
352} 352}
353 353
354Common::UUID UDPClient::GetHostUUID(const std::string& host) const { 354Common::NewUUID UDPClient::GetHostUUID(const std::string& host) const {
355 const auto ip = boost::asio::ip::make_address_v4(host); 355 const auto ip = boost::asio::ip::make_address_v4(host);
356 const auto hex_host = fmt::format("{:06x}", ip.to_uint()); 356 const auto hex_host = fmt::format("00000000-0000-0000-0000-0000{:06x}", ip.to_uint());
357 return Common::UUID{hex_host}; 357 return Common::NewUUID{hex_host};
358} 358}
359 359
360void UDPClient::Reset() { 360void UDPClient::Reset() {
@@ -385,7 +385,7 @@ std::vector<Common::ParamPackage> UDPClient::GetInputDevices() const {
385 Common::ParamPackage identifier{}; 385 Common::ParamPackage identifier{};
386 identifier.Set("engine", GetEngineName()); 386 identifier.Set("engine", GetEngineName());
387 identifier.Set("display", fmt::format("UDP Controller {}", pad_identifier.pad)); 387 identifier.Set("display", fmt::format("UDP Controller {}", pad_identifier.pad));
388 identifier.Set("guid", pad_identifier.guid.Format()); 388 identifier.Set("guid", pad_identifier.guid.RawString());
389 identifier.Set("port", static_cast<int>(pad_identifier.port)); 389 identifier.Set("port", static_cast<int>(pad_identifier.port));
390 identifier.Set("pad", static_cast<int>(pad_identifier.pad)); 390 identifier.Set("pad", static_cast<int>(pad_identifier.pad));
391 devices.emplace_back(identifier); 391 devices.emplace_back(identifier);
diff --git a/src/input_common/drivers/udp_client.h b/src/input_common/drivers/udp_client.h
index e9c178139..98abeedd1 100644
--- a/src/input_common/drivers/udp_client.h
+++ b/src/input_common/drivers/udp_client.h
@@ -126,7 +126,7 @@ private:
126 struct ClientConnection { 126 struct ClientConnection {
127 ClientConnection(); 127 ClientConnection();
128 ~ClientConnection(); 128 ~ClientConnection();
129 Common::UUID uuid{"7F000001"}; 129 Common::NewUUID uuid{"00000000-0000-0000-0000-00007F000001"};
130 std::string host{"127.0.0.1"}; 130 std::string host{"127.0.0.1"};
131 u16 port{26760}; 131 u16 port{26760};
132 s8 active{-1}; 132 s8 active{-1};
@@ -148,7 +148,7 @@ private:
148 void OnPadData(Response::PadData, std::size_t client); 148 void OnPadData(Response::PadData, std::size_t client);
149 void StartCommunication(std::size_t client, const std::string& host, u16 port); 149 void StartCommunication(std::size_t client, const std::string& host, u16 port);
150 PadIdentifier GetPadIdentifier(std::size_t pad_index) const; 150 PadIdentifier GetPadIdentifier(std::size_t pad_index) const;
151 Common::UUID GetHostUUID(const std::string& host) const; 151 Common::NewUUID GetHostUUID(const std::string& host) const;
152 152
153 Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const; 153 Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const;
154 154