diff options
Diffstat (limited to 'src/input_common/udp')
| -rw-r--r-- | src/input_common/udp/client.cpp | 10 | ||||
| -rw-r--r-- | src/input_common/udp/client.h | 3 | ||||
| -rw-r--r-- | src/input_common/udp/udp.cpp | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp index 3f4eaf448..91e13482d 100644 --- a/src/input_common/udp/client.cpp +++ b/src/input_common/udp/client.cpp | |||
| @@ -170,10 +170,18 @@ void Client::OnPadData(Response::PadData data) { | |||
| 170 | // directions correspond to the ones of the Switch | 170 | // directions correspond to the ones of the Switch |
| 171 | Common::Vec3f accel = Common::MakeVec<float>(data.accel.x, data.accel.y, data.accel.z); | 171 | Common::Vec3f accel = Common::MakeVec<float>(data.accel.x, data.accel.y, data.accel.z); |
| 172 | Common::Vec3f gyro = Common::MakeVec<float>(data.gyro.pitch, data.gyro.yaw, data.gyro.roll); | 172 | Common::Vec3f gyro = Common::MakeVec<float>(data.gyro.pitch, data.gyro.yaw, data.gyro.roll); |
| 173 | |||
| 174 | // TODO: Calculate the correct rotation vector and orientation matrix | ||
| 175 | const auto rotation = Common::MakeVec(0.0f, 0.0f, 0.0f); | ||
| 176 | const std::array orientation{ | ||
| 177 | Common::Vec3f(1.0f, 0.0f, 0.0f), | ||
| 178 | Common::Vec3f(0.0f, 1.0f, 0.0f), | ||
| 179 | Common::Vec3f(0.0f, 0.0f, 1.0f), | ||
| 180 | }; | ||
| 173 | { | 181 | { |
| 174 | std::lock_guard guard(status->update_mutex); | 182 | std::lock_guard guard(status->update_mutex); |
| 175 | 183 | ||
| 176 | status->motion_status = {accel, gyro}; | 184 | status->motion_status = {accel, gyro, rotation, orientation}; |
| 177 | 185 | ||
| 178 | // TODO: add a setting for "click" touch. Click touch refers to a device that differentiates | 186 | // TODO: add a setting for "click" touch. Click touch refers to a device that differentiates |
| 179 | // between a simple "tap" and a hard press that causes the touch screen to click. | 187 | // between a simple "tap" and a hard press that causes the touch screen to click. |
diff --git a/src/input_common/udp/client.h b/src/input_common/udp/client.h index b8c654755..a73283ae8 100644 --- a/src/input_common/udp/client.h +++ b/src/input_common/udp/client.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 15 | #include "common/thread.h" | 15 | #include "common/thread.h" |
| 16 | #include "common/vector_math.h" | 16 | #include "common/vector_math.h" |
| 17 | #include "core/frontend/input.h" | ||
| 17 | 18 | ||
| 18 | namespace InputCommon::CemuhookUDP { | 19 | namespace InputCommon::CemuhookUDP { |
| 19 | 20 | ||
| @@ -30,7 +31,7 @@ struct Version; | |||
| 30 | 31 | ||
| 31 | struct DeviceStatus { | 32 | struct DeviceStatus { |
| 32 | std::mutex update_mutex; | 33 | std::mutex update_mutex; |
| 33 | std::tuple<Common::Vec3<float>, Common::Vec3<float>> motion_status; | 34 | Input::MotionStatus motion_status; |
| 34 | std::tuple<float, float, bool> touch_status; | 35 | std::tuple<float, float, bool> touch_status; |
| 35 | 36 | ||
| 36 | // calibration data for scaling the device's touch area to 3ds | 37 | // calibration data for scaling the device's touch area to 3ds |
diff --git a/src/input_common/udp/udp.cpp b/src/input_common/udp/udp.cpp index 4b347e47e..03bae5752 100644 --- a/src/input_common/udp/udp.cpp +++ b/src/input_common/udp/udp.cpp | |||
| @@ -29,7 +29,7 @@ private: | |||
| 29 | class UDPMotionDevice final : public Input::MotionDevice { | 29 | class UDPMotionDevice final : public Input::MotionDevice { |
| 30 | public: | 30 | public: |
| 31 | explicit UDPMotionDevice(std::shared_ptr<DeviceStatus> status_) : status(std::move(status_)) {} | 31 | explicit UDPMotionDevice(std::shared_ptr<DeviceStatus> status_) : status(std::move(status_)) {} |
| 32 | std::tuple<Common::Vec3<float>, Common::Vec3<float>> GetStatus() const override { | 32 | Input::MotionStatus GetStatus() const override { |
| 33 | std::lock_guard guard(status->update_mutex); | 33 | std::lock_guard guard(status->update_mutex); |
| 34 | return status->motion_status; | 34 | return status->motion_status; |
| 35 | } | 35 | } |