summaryrefslogtreecommitdiffstats
path: root/src/input_common/udp/client.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common/udp/client.h')
-rw-r--r--src/input_common/udp/client.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/input_common/udp/client.h b/src/input_common/udp/client.h
index 00c8b09f5..1cd251ec8 100644
--- a/src/input_common/udp/client.h
+++ b/src/input_common/udp/client.h
@@ -29,6 +29,7 @@ namespace Response {
struct PadData;
struct PortInfo;
struct Version;
+struct TouchPad;
} // namespace Response
enum class PadMotion {
@@ -50,7 +51,6 @@ struct UDPPadStatus {
std::string host{"127.0.0.1"};
u16 port{26760};
std::size_t pad_index{};
- PadTouch touch{PadTouch::Undefined};
PadMotion motion{PadMotion::Undefined};
f32 motion_value{0.0f};
};
@@ -93,6 +93,9 @@ public:
DeviceStatus& GetPadState(const std::string& host, u16 port, std::size_t pad);
const DeviceStatus& GetPadState(const std::string& host, u16 port, std::size_t pad) const;
+ Input::TouchStatus& GetTouchState();
+ const Input::TouchStatus& GetTouchState() const;
+
private:
struct ClientData {
std::string host{"127.0.0.1"};
@@ -122,14 +125,25 @@ private:
void StartCommunication(std::size_t client, const std::string& host, u16 port,
std::size_t pad_index, u32 client_id);
void UpdateYuzuSettings(std::size_t client, const Common::Vec3<float>& acc,
- const Common::Vec3<float>& gyro, bool touch);
+ const Common::Vec3<float>& gyro);
+
+ // Returns an unused finger id, if there is no fingers available std::nullopt will be
+ // returned
+ std::optional<size_t> GetUnusedFingerID() const;
+
+ // Merges and updates all touch inputs into the touch_status array
+ void UpdateTouchInput(Response::TouchPad& touch_pad, size_t client, size_t id);
bool configuring = false;
// Allocate clients for 8 udp servers
- const std::size_t max_udp_clients = 32;
- std::array<ClientData, 4 * 8> clients;
- Common::SPSCQueue<UDPPadStatus> pad_queue;
+ static constexpr std::size_t MAX_UDP_CLIENTS = 4 * 8;
+ // Each client can have up 2 touch inputs
+ static constexpr std::size_t MAX_TOUCH_FINGERS = MAX_UDP_CLIENTS * 2;
+ std::array<ClientData, MAX_UDP_CLIENTS> clients{};
+ Common::SPSCQueue<UDPPadStatus> pad_queue{};
+ Input::TouchStatus touch_status{};
+ std::array<size_t, MAX_TOUCH_FINGERS> finger_id{};
};
/// An async job allowing configuration of the touchpad calibration.