diff options
| author | 2020-09-04 23:47:56 -0500 | |
|---|---|---|
| committer | 2020-09-05 09:42:21 -0400 | |
| commit | 797564599f98d7d1f7a190c3c72f8341d8265d58 (patch) | |
| tree | 63cf00ff9812718ee3137520aeef6797289fa34e /src/input_common/udp/client.cpp | |
| parent | Add cemu hook changes related to PR #4609 (diff) | |
| download | yuzu-797564599f98d7d1f7a190c3c72f8341d8265d58.tar.gz yuzu-797564599f98d7d1f7a190c3c72f8341d8265d58.tar.xz yuzu-797564599f98d7d1f7a190c3c72f8341d8265d58.zip | |
Minor cleanup
Diffstat (limited to 'src/input_common/udp/client.cpp')
| -rw-r--r-- | src/input_common/udp/client.cpp | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp index e0c796040..2b6a68d4b 100644 --- a/src/input_common/udp/client.cpp +++ b/src/input_common/udp/client.cpp | |||
| @@ -138,7 +138,7 @@ Client::Client() { | |||
| 138 | Settings::values.udp_input_port, pad, 24872); | 138 | Settings::values.udp_input_port, pad, 24872); |
| 139 | // Set motion parameters | 139 | // Set motion parameters |
| 140 | // SetGyroThreshold value should be dependent on GyroscopeZeroDriftMode | 140 | // SetGyroThreshold value should be dependent on GyroscopeZeroDriftMode |
| 141 | // Real HW values are unkown, 0.0001 is an aproximate to Standard | 141 | // Real HW values are unknown, 0.0001 is an approximate to Standard |
| 142 | clients[client].motion.SetGyroThreshold(0.0001f); | 142 | clients[client].motion.SetGyroThreshold(0.0001f); |
| 143 | } | 143 | } |
| 144 | } | 144 | } |
| @@ -153,8 +153,7 @@ std::vector<Common::ParamPackage> Client::GetInputDevices() const { | |||
| 153 | if (!DeviceConnected(client)) { | 153 | if (!DeviceConnected(client)) { |
| 154 | continue; | 154 | continue; |
| 155 | } | 155 | } |
| 156 | std::string name = fmt::format("UDP Controller{} {} {}", clients[client].active, | 156 | std::string name = fmt::format("UDP Controller {}", client); |
| 157 | clients[client].active == 1, client); | ||
| 158 | devices.emplace_back(Common::ParamPackage{ | 157 | devices.emplace_back(Common::ParamPackage{ |
| 159 | {"class", "cemuhookudp"}, | 158 | {"class", "cemuhookudp"}, |
| 160 | {"display", std::move(name)}, | 159 | {"display", std::move(name)}, |
| @@ -215,7 +214,7 @@ void Client::OnPadData(Response::PadData data) { | |||
| 215 | Common::Vec3f raw_gyroscope = {data.gyro.pitch, data.gyro.roll, -data.gyro.yaw}; | 214 | Common::Vec3f raw_gyroscope = {data.gyro.pitch, data.gyro.roll, -data.gyro.yaw}; |
| 216 | clients[client].motion.SetAcceleration({data.accel.x, -data.accel.z, data.accel.y}); | 215 | clients[client].motion.SetAcceleration({data.accel.x, -data.accel.z, data.accel.y}); |
| 217 | // Gyroscope values are not it the correct scale from better joy. | 216 | // Gyroscope values are not it the correct scale from better joy. |
| 218 | // By dividing by 312 allow us to make one full turn = 1 turn | 217 | // Dividing by 312 allows us to make one full turn = 1 turn |
| 219 | // This must be a configurable valued called sensitivity | 218 | // This must be a configurable valued called sensitivity |
| 220 | clients[client].motion.SetGyroscope(raw_gyroscope / 312.0f); | 219 | clients[client].motion.SetGyroscope(raw_gyroscope / 312.0f); |
| 221 | clients[client].motion.UpdateRotation(time_difference); | 220 | clients[client].motion.UpdateRotation(time_difference); |
| @@ -275,23 +274,21 @@ void Client::Reset() { | |||
| 275 | 274 | ||
| 276 | void Client::UpdateYuzuSettings(std::size_t client, const Common::Vec3<float>& acc, | 275 | void Client::UpdateYuzuSettings(std::size_t client, const Common::Vec3<float>& acc, |
| 277 | const Common::Vec3<float>& gyro, bool touch) { | 276 | const Common::Vec3<float>& gyro, bool touch) { |
| 278 | if (configuring) { | 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); |
| 281 | } | ||
| 282 | for (size_t i = 0; i < 3; ++i) { | ||
| 283 | if (gyro[i] > 6.0f || gyro[i] < -6.0f) { | ||
| 284 | pad.motion = static_cast<PadMotion>(i); | ||
| 285 | pad.motion_value = gyro[i]; | ||
| 282 | pad_queue[client].Push(pad); | 286 | pad_queue[client].Push(pad); |
| 283 | } | 287 | } |
| 284 | for (size_t i = 0; i < 3; ++i) { | 288 | if (acc[i] > 2.0f || acc[i] < -2.0f) { |
| 285 | if (gyro[i] > 6.0f || gyro[i] < -6.0f) { | 289 | pad.motion = static_cast<PadMotion>(i + 3); |
| 286 | pad.motion = static_cast<PadMotion>(i); | 290 | pad.motion_value = acc[i]; |
| 287 | pad.motion_value = gyro[i]; | 291 | pad_queue[client].Push(pad); |
| 288 | pad_queue[client].Push(pad); | ||
| 289 | } | ||
| 290 | if (acc[i] > 2.0f || acc[i] < -2.0f) { | ||
| 291 | pad.motion = static_cast<PadMotion>(i + 3); | ||
| 292 | pad.motion_value = acc[i]; | ||
| 293 | pad_queue[client].Push(pad); | ||
| 294 | } | ||
| 295 | } | 292 | } |
| 296 | } | 293 | } |
| 297 | } | 294 | } |