summaryrefslogtreecommitdiffstats
path: root/src/input_common/drivers
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2022-02-05 06:40:28 +0100
committerMorph <39850852+Morph1984@users.noreply.github.com>2022-02-05 19:18:41 +0100
commitcb30fe50cd074fe05dd1d6e4b0d58116d3d98489 (patch)
tree58450d743d317369266bbbea44734725d8b83ea6 /src/input_common/drivers
parentcommon: Implement NewUUID (diff)
downloadyuzu-cb30fe50cd074fe05dd1d6e4b0d58116d3d98489.tar
yuzu-cb30fe50cd074fe05dd1d6e4b0d58116d3d98489.tar.gz
yuzu-cb30fe50cd074fe05dd1d6e4b0d58116d3d98489.tar.bz2
yuzu-cb30fe50cd074fe05dd1d6e4b0d58116d3d98489.tar.lz
yuzu-cb30fe50cd074fe05dd1d6e4b0d58116d3d98489.tar.xz
yuzu-cb30fe50cd074fe05dd1d6e4b0d58116d3d98489.tar.zst
yuzu-cb30fe50cd074fe05dd1d6e4b0d58116d3d98489.zip
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() {
std::size_t port = 0;
for (GCController& pad : pads) {
pad.identifier = {
- .guid = Common::UUID{Common::INVALID_UUID},
+ .guid = Common::NewUUID{},
.port = port++,
.pad = 0,
};
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 @@
namespace InputCommon {
constexpr PadIdentifier key_identifier = {
- .guid = Common::UUID{Common::INVALID_UUID},
+ .guid = Common::NewUUID{},
.port = 0,
.pad = 0,
};
constexpr PadIdentifier keyboard_key_identifier = {
- .guid = Common::UUID{Common::INVALID_UUID},
+ .guid = Common::NewUUID{},
.port = 1,
.pad = 0,
};
constexpr PadIdentifier keyboard_modifier_identifier = {
- .guid = Common::UUID{Common::INVALID_UUID},
+ .guid = Common::NewUUID{},
.port = 1,
.pad = 1,
};
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;
constexpr int touch_axis_x = 10;
constexpr int touch_axis_y = 11;
constexpr PadIdentifier identifier = {
- .guid = Common::UUID{Common::INVALID_UUID},
+ .guid = Common::NewUUID{},
.port = 0,
.pad = 0,
};
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:
*/
const PadIdentifier GetPadIdentifier() const {
return {
- .guid = Common::UUID{guid},
+ .guid = Common::NewUUID{guid},
.port = static_cast<std::size_t>(port),
.pad = 0,
};
@@ -502,7 +502,7 @@ std::vector<Common::ParamPackage> SDLDriver::GetInputDevices() const {
Common::Input::VibrationError SDLDriver::SetRumble(
const PadIdentifier& identifier, const Common::Input::VibrationStatus& vibration) {
const auto joystick =
- GetSDLJoystickByGUID(identifier.guid.Format(), static_cast<int>(identifier.port));
+ GetSDLJoystickByGUID(identifier.guid.RawString(), static_cast<int>(identifier.port));
const auto process_amplitude_exp = [](f32 amplitude, f32 factor) {
return (amplitude + std::pow(amplitude, factor)) * 0.5f * 0xFFFF;
};
@@ -599,7 +599,7 @@ Common::ParamPackage SDLDriver::BuildParamPackageForAnalog(PadIdentifier identif
Common::ParamPackage params;
params.Set("engine", GetEngineName());
params.Set("port", static_cast<int>(identifier.port));
- params.Set("guid", identifier.guid.Format());
+ params.Set("guid", identifier.guid.RawString());
params.Set("axis_x", axis_x);
params.Set("axis_y", axis_y);
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
Tas::Tas(std::string input_engine_) : InputEngine(std::move(input_engine_)) {
for (size_t player_index = 0; player_index < PLAYER_NUMBER; player_index++) {
PadIdentifier identifier{
- .guid = Common::UUID{},
+ .guid = Common::NewUUID{},
.port = player_index,
.pad = 0,
};
@@ -203,7 +203,7 @@ void Tas::UpdateThread() {
}
PadIdentifier identifier{
- .guid = Common::UUID{},
+ .guid = Common::NewUUID{},
.port = player_index,
.pad = 0,
};
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 @@
namespace InputCommon {
constexpr PadIdentifier identifier = {
- .guid = Common::UUID{Common::INVALID_UUID},
+ .guid = Common::NewUUID{},
.port = 0,
.pad = 0,
};
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 {
};
}
-Common::UUID UDPClient::GetHostUUID(const std::string& host) const {
+Common::NewUUID UDPClient::GetHostUUID(const std::string& host) const {
const auto ip = boost::asio::ip::make_address_v4(host);
- const auto hex_host = fmt::format("{:06x}", ip.to_uint());
- return Common::UUID{hex_host};
+ const auto hex_host = fmt::format("00000000-0000-0000-0000-0000{:06x}", ip.to_uint());
+ return Common::NewUUID{hex_host};
}
void UDPClient::Reset() {
@@ -385,7 +385,7 @@ std::vector<Common::ParamPackage> UDPClient::GetInputDevices() const {
Common::ParamPackage identifier{};
identifier.Set("engine", GetEngineName());
identifier.Set("display", fmt::format("UDP Controller {}", pad_identifier.pad));
- identifier.Set("guid", pad_identifier.guid.Format());
+ identifier.Set("guid", pad_identifier.guid.RawString());
identifier.Set("port", static_cast<int>(pad_identifier.port));
identifier.Set("pad", static_cast<int>(pad_identifier.pad));
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:
struct ClientConnection {
ClientConnection();
~ClientConnection();
- Common::UUID uuid{"7F000001"};
+ Common::NewUUID uuid{"00000000-0000-0000-0000-00007F000001"};
std::string host{"127.0.0.1"};
u16 port{26760};
s8 active{-1};
@@ -148,7 +148,7 @@ private:
void OnPadData(Response::PadData, std::size_t client);
void StartCommunication(std::size_t client, const std::string& host, u16 port);
PadIdentifier GetPadIdentifier(std::size_t pad_index) const;
- Common::UUID GetHostUUID(const std::string& host) const;
+ Common::NewUUID GetHostUUID(const std::string& host) const;
Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const;