diff options
| -rw-r--r-- | src/input_common/drivers/udp_client.cpp | 10 | ||||
| -rw-r--r-- | src/input_common/drivers/udp_client.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 6 |
3 files changed, 16 insertions, 2 deletions
diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp index 192ab336b..7cab707da 100644 --- a/src/input_common/drivers/udp_client.cpp +++ b/src/input_common/drivers/udp_client.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <random> | 5 | #include <random> |
| 6 | #include <boost/asio.hpp> | 6 | #include <boost/asio.hpp> |
| 7 | #include <fmt/format.h> | ||
| 7 | 8 | ||
| 8 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 9 | #include "common/param_package.h" | 10 | #include "common/param_package.h" |
| @@ -279,6 +280,7 @@ void UDPClient::StartCommunication(std::size_t client, const std::string& host, | |||
| 279 | [this](Response::PortInfo info) { OnPortInfo(info); }, | 280 | [this](Response::PortInfo info) { OnPortInfo(info); }, |
| 280 | [this, client](Response::PadData data) { OnPadData(data, client); }}; | 281 | [this, client](Response::PadData data) { OnPadData(data, client); }}; |
| 281 | LOG_INFO(Input, "Starting communication with UDP input server on {}:{}", host, port); | 282 | LOG_INFO(Input, "Starting communication with UDP input server on {}:{}", host, port); |
| 283 | clients[client].uuid = GetHostUUID(host); | ||
| 282 | clients[client].host = host; | 284 | clients[client].host = host; |
| 283 | clients[client].port = port; | 285 | clients[client].port = port; |
| 284 | clients[client].active = 0; | 286 | clients[client].active = 0; |
| @@ -293,12 +295,18 @@ void UDPClient::StartCommunication(std::size_t client, const std::string& host, | |||
| 293 | const PadIdentifier UDPClient::GetPadIdentifier(std::size_t pad_index) const { | 295 | const PadIdentifier UDPClient::GetPadIdentifier(std::size_t pad_index) const { |
| 294 | const std::size_t client = pad_index / PADS_PER_CLIENT; | 296 | const std::size_t client = pad_index / PADS_PER_CLIENT; |
| 295 | return { | 297 | return { |
| 296 | .guid = Common::UUID{clients[client].host}, | 298 | .guid = clients[client].uuid, |
| 297 | .port = static_cast<std::size_t>(clients[client].port), | 299 | .port = static_cast<std::size_t>(clients[client].port), |
| 298 | .pad = pad_index, | 300 | .pad = pad_index, |
| 299 | }; | 301 | }; |
| 300 | } | 302 | } |
| 301 | 303 | ||
| 304 | const Common::UUID UDPClient::GetHostUUID(const std::string host) const { | ||
| 305 | const auto ip = boost::asio::ip::address_v4::from_string(host); | ||
| 306 | const auto hex_host = fmt::format("{:06x}", ip.to_ulong()); | ||
| 307 | return Common::UUID{hex_host}; | ||
| 308 | } | ||
| 309 | |||
| 302 | void UDPClient::Reset() { | 310 | void UDPClient::Reset() { |
| 303 | for (auto& client : clients) { | 311 | for (auto& client : clients) { |
| 304 | if (client.thread.joinable()) { | 312 | if (client.thread.joinable()) { |
diff --git a/src/input_common/drivers/udp_client.h b/src/input_common/drivers/udp_client.h index 639325b17..1f02adba5 100644 --- a/src/input_common/drivers/udp_client.h +++ b/src/input_common/drivers/udp_client.h | |||
| @@ -69,6 +69,7 @@ private: | |||
| 69 | struct ClientConnection { | 69 | struct ClientConnection { |
| 70 | ClientConnection(); | 70 | ClientConnection(); |
| 71 | ~ClientConnection(); | 71 | ~ClientConnection(); |
| 72 | Common::UUID uuid{"7F000001"}; | ||
| 72 | std::string host{"127.0.0.1"}; | 73 | std::string host{"127.0.0.1"}; |
| 73 | u16 port{26760}; | 74 | u16 port{26760}; |
| 74 | s8 active{-1}; | 75 | s8 active{-1}; |
| @@ -87,6 +88,7 @@ private: | |||
| 87 | void OnPadData(Response::PadData, std::size_t client); | 88 | void OnPadData(Response::PadData, std::size_t client); |
| 88 | void StartCommunication(std::size_t client, const std::string& host, u16 port); | 89 | void StartCommunication(std::size_t client, const std::string& host, u16 port); |
| 89 | const PadIdentifier GetPadIdentifier(std::size_t pad_index) const; | 90 | const PadIdentifier GetPadIdentifier(std::size_t pad_index) const; |
| 91 | const Common::UUID GetHostUUID(const std::string host) const; | ||
| 90 | 92 | ||
| 91 | // Allocate clients for 8 udp servers | 93 | // Allocate clients for 8 udp servers |
| 92 | static constexpr std::size_t MAX_UDP_CLIENTS = 8; | 94 | static constexpr std::size_t MAX_UDP_CLIENTS = 8; |
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index acb29a6b4..9a1b3575e 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -1178,7 +1178,7 @@ void ConfigureInputPlayer::HandleClick( | |||
| 1178 | } | 1178 | } |
| 1179 | 1179 | ||
| 1180 | timeout_timer->start(2500); // Cancel after 2.5 seconds | 1180 | timeout_timer->start(2500); // Cancel after 2.5 seconds |
| 1181 | poll_timer->start(50); // Check for new inputs every 50ms | 1181 | poll_timer->start(25); // Check for new inputs every 25ms |
| 1182 | } | 1182 | } |
| 1183 | 1183 | ||
| 1184 | void ConfigureInputPlayer::SetPollingResult(const Common::ParamPackage& params, bool abort) { | 1184 | void ConfigureInputPlayer::SetPollingResult(const Common::ParamPackage& params, bool abort) { |
| @@ -1205,6 +1205,10 @@ bool ConfigureInputPlayer::IsInputAcceptable(const Common::ParamPackage& params) | |||
| 1205 | return true; | 1205 | return true; |
| 1206 | } | 1206 | } |
| 1207 | 1207 | ||
| 1208 | if (params.Has("motion")) { | ||
| 1209 | return true; | ||
| 1210 | } | ||
| 1211 | |||
| 1208 | // Keyboard/Mouse | 1212 | // Keyboard/Mouse |
| 1209 | if (ui->comboDevices->currentIndex() == 1 || ui->comboDevices->currentIndex() == 2) { | 1213 | if (ui->comboDevices->currentIndex() == 1 || ui->comboDevices->currentIndex() == 2) { |
| 1210 | return params.Get("engine", "") == "keyboard" || params.Get("engine", "") == "mouse"; | 1214 | return params.Get("engine", "") == "keyboard" || params.Get("engine", "") == "mouse"; |