summaryrefslogtreecommitdiffstats
path: root/src/input_common/udp
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common/udp')
-rw-r--r--src/input_common/udp/client.cpp5
-rw-r--r--src/input_common/udp/udp.cpp8
2 files changed, 9 insertions, 4 deletions
diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp
index 17a9225d7..412d57896 100644
--- a/src/input_common/udp/client.cpp
+++ b/src/input_common/udp/client.cpp
@@ -225,6 +225,11 @@ void Client::OnPortInfo([[maybe_unused]] Response::PortInfo data) {
}
void Client::OnPadData(Response::PadData data, std::size_t client) {
+ // Accept packets only for the correct pad
+ if (static_cast<u8>(clients[client].pad_index) != data.info.id) {
+ return;
+ }
+
LOG_TRACE(Input, "PadData packet received");
if (data.packet_counter == clients[client].packet_sequence) {
LOG_WARNING(
diff --git a/src/input_common/udp/udp.cpp b/src/input_common/udp/udp.cpp
index 8686a059c..c5da27a38 100644
--- a/src/input_common/udp/udp.cpp
+++ b/src/input_common/udp/udp.cpp
@@ -28,14 +28,14 @@ private:
mutable std::mutex mutex;
};
-/// A motion device factory that creates motion devices from JC Adapter
+/// A motion device factory that creates motion devices from a UDP client
UDPMotionFactory::UDPMotionFactory(std::shared_ptr<CemuhookUDP::Client> client_)
: client(std::move(client_)) {}
/**
* Creates motion device
* @param params contains parameters for creating the device:
- * - "port": the nth jcpad on the adapter
+ * - "port": the UDP port number
*/
std::unique_ptr<Input::MotionDevice> UDPMotionFactory::Create(const Common::ParamPackage& params) {
auto ip = params.Get("ip", "127.0.0.1");
@@ -90,14 +90,14 @@ private:
mutable std::mutex mutex;
};
-/// A motion device factory that creates motion devices from JC Adapter
+/// A motion device factory that creates motion devices from a UDP client
UDPTouchFactory::UDPTouchFactory(std::shared_ptr<CemuhookUDP::Client> client_)
: client(std::move(client_)) {}
/**
* Creates motion device
* @param params contains parameters for creating the device:
- * - "port": the nth jcpad on the adapter
+ * - "port": the UDP port number
*/
std::unique_ptr<Input::TouchDevice> UDPTouchFactory::Create(const Common::ParamPackage& params) {
auto ip = params.Get("ip", "127.0.0.1");