diff options
Diffstat (limited to 'src/input_common/udp/client.cpp')
| -rw-r--r-- | src/input_common/udp/client.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp index 2b6a68d4b..9d0b9f31d 100644 --- a/src/input_common/udp/client.cpp +++ b/src/input_common/udp/client.cpp | |||
| @@ -219,14 +219,10 @@ void Client::OnPadData(Response::PadData data) { | |||
| 219 | clients[client].motion.SetGyroscope(raw_gyroscope / 312.0f); | 219 | clients[client].motion.SetGyroscope(raw_gyroscope / 312.0f); |
| 220 | clients[client].motion.UpdateRotation(time_difference); | 220 | clients[client].motion.UpdateRotation(time_difference); |
| 221 | clients[client].motion.UpdateOrientation(time_difference); | 221 | clients[client].motion.UpdateOrientation(time_difference); |
| 222 | Common::Vec3f gyroscope = clients[client].motion.GetGyroscope(); | ||
| 223 | Common::Vec3f accelerometer = clients[client].motion.GetAcceleration(); | ||
| 224 | Common::Vec3f rotation = clients[client].motion.GetRotations(); | ||
| 225 | std::array<Common::Vec3f, 3> orientation = clients[client].motion.GetOrientation(); | ||
| 226 | 222 | ||
| 227 | { | 223 | { |
| 228 | std::lock_guard guard(clients[client].status.update_mutex); | 224 | std::lock_guard guard(clients[client].status.update_mutex); |
| 229 | clients[client].status.motion_status = {accelerometer, gyroscope, rotation, orientation}; | 225 | clients[client].status.motion_status = clients[client].motion.GetMotion(); |
| 230 | 226 | ||
| 231 | // TODO: add a setting for "click" touch. Click touch refers to a device that differentiates | 227 | // TODO: add a setting for "click" touch. Click touch refers to a device that differentiates |
| 232 | // between a simple "tap" and a hard press that causes the touch screen to click. | 228 | // between a simple "tap" and a hard press that causes the touch screen to click. |
| @@ -250,6 +246,8 @@ void Client::OnPadData(Response::PadData data) { | |||
| 250 | clients[client].status.touch_status = {x, y, is_active}; | 246 | clients[client].status.touch_status = {x, y, is_active}; |
| 251 | 247 | ||
| 252 | if (configuring) { | 248 | if (configuring) { |
| 249 | const Common::Vec3f gyroscope = clients[client].motion.GetGyroscope(); | ||
| 250 | const Common::Vec3f accelerometer = clients[client].motion.GetAcceleration(); | ||
| 253 | UpdateYuzuSettings(client, accelerometer, gyroscope, is_active); | 251 | UpdateYuzuSettings(client, accelerometer, gyroscope, is_active); |
| 254 | } | 252 | } |
| 255 | } | 253 | } |
| @@ -274,18 +272,22 @@ void Client::Reset() { | |||
| 274 | 272 | ||
| 275 | void Client::UpdateYuzuSettings(std::size_t client, const Common::Vec3<float>& acc, | 273 | void Client::UpdateYuzuSettings(std::size_t client, const Common::Vec3<float>& acc, |
| 276 | const Common::Vec3<float>& gyro, bool touch) { | 274 | const Common::Vec3<float>& gyro, bool touch) { |
| 275 | if (gyro.Length() > 0.2f) { | ||
| 276 | LOG_DEBUG(Input, "UDP Controller {}: gyro=({}, {}, {}), accel=({}, {}, {}), touch={}", | ||
| 277 | client, gyro[0], gyro[1], gyro[2], acc[0], acc[1], acc[2], touch); | ||
| 278 | } | ||
| 277 | UDPPadStatus pad; | 279 | UDPPadStatus pad; |
| 278 | if (touch) { | 280 | if (touch) { |
| 279 | pad.touch = PadTouch::Click; | 281 | pad.touch = PadTouch::Click; |
| 280 | pad_queue[client].Push(pad); | 282 | pad_queue[client].Push(pad); |
| 281 | } | 283 | } |
| 282 | for (size_t i = 0; i < 3; ++i) { | 284 | for (size_t i = 0; i < 3; ++i) { |
| 283 | if (gyro[i] > 6.0f || gyro[i] < -6.0f) { | 285 | if (gyro[i] > 5.0f || gyro[i] < -5.0f) { |
| 284 | pad.motion = static_cast<PadMotion>(i); | 286 | pad.motion = static_cast<PadMotion>(i); |
| 285 | pad.motion_value = gyro[i]; | 287 | pad.motion_value = gyro[i]; |
| 286 | pad_queue[client].Push(pad); | 288 | pad_queue[client].Push(pad); |
| 287 | } | 289 | } |
| 288 | if (acc[i] > 2.0f || acc[i] < -2.0f) { | 290 | if (acc[i] > 1.75f || acc[i] < -1.75f) { |
| 289 | pad.motion = static_cast<PadMotion>(i + 3); | 291 | pad.motion = static_cast<PadMotion>(i + 3); |
| 290 | pad.motion_value = acc[i]; | 292 | pad.motion_value = acc[i]; |
| 291 | pad_queue[client].Push(pad); | 293 | pad_queue[client].Push(pad); |