diff options
Diffstat (limited to 'src/input_common')
| -rw-r--r-- | src/input_common/drivers/udp_client.cpp | 24 | ||||
| -rw-r--r-- | src/input_common/input_engine.cpp | 12 |
2 files changed, 26 insertions, 10 deletions
diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp index a1ce4525d..c8a12c7d5 100644 --- a/src/input_common/drivers/udp_client.cpp +++ b/src/input_common/drivers/udp_client.cpp | |||
| @@ -442,14 +442,22 @@ MotionMapping UDPClient::GetMotionMappingForDevice(const Common::ParamPackage& p | |||
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | MotionMapping mapping = {}; | 444 | MotionMapping mapping = {}; |
| 445 | Common::ParamPackage motion_params; | 445 | Common::ParamPackage left_motion_params; |
| 446 | motion_params.Set("engine", GetEngineName()); | 446 | left_motion_params.Set("engine", GetEngineName()); |
| 447 | motion_params.Set("guid", params.Get("guid", "")); | 447 | left_motion_params.Set("guid", params.Get("guid", "")); |
| 448 | motion_params.Set("port", params.Get("port", 0)); | 448 | left_motion_params.Set("port", params.Get("port", 0)); |
| 449 | motion_params.Set("pad", params.Get("pad", 0)); | 449 | left_motion_params.Set("pad", params.Get("pad", 0)); |
| 450 | motion_params.Set("motion", 0); | 450 | left_motion_params.Set("motion", 0); |
| 451 | mapping.insert_or_assign(Settings::NativeMotion::MotionLeft, std::move(motion_params)); | 451 | |
| 452 | mapping.insert_or_assign(Settings::NativeMotion::MotionRight, std::move(motion_params)); | 452 | Common::ParamPackage right_motion_params; |
| 453 | right_motion_params.Set("engine", GetEngineName()); | ||
| 454 | right_motion_params.Set("guid", params.Get("guid", "")); | ||
| 455 | right_motion_params.Set("port", params.Get("port", 0)); | ||
| 456 | right_motion_params.Set("pad", params.Get("pad", 0)); | ||
| 457 | right_motion_params.Set("motion", 0); | ||
| 458 | |||
| 459 | mapping.insert_or_assign(Settings::NativeMotion::MotionLeft, std::move(left_motion_params)); | ||
| 460 | mapping.insert_or_assign(Settings::NativeMotion::MotionRight, std::move(right_motion_params)); | ||
| 453 | return mapping; | 461 | return mapping; |
| 454 | } | 462 | } |
| 455 | 463 | ||
diff --git a/src/input_common/input_engine.cpp b/src/input_common/input_engine.cpp index 9c17ca4f7..b57330e51 100644 --- a/src/input_common/input_engine.cpp +++ b/src/input_common/input_engine.cpp | |||
| @@ -298,8 +298,16 @@ void InputEngine::TriggerOnMotionChange(const PadIdentifier& identifier, int mot | |||
| 298 | if (!configuring || !mapping_callback.on_data) { | 298 | if (!configuring || !mapping_callback.on_data) { |
| 299 | return; | 299 | return; |
| 300 | } | 300 | } |
| 301 | if (std::abs(value.gyro_x) < 0.6f && std::abs(value.gyro_y) < 0.6f && | 301 | bool is_active = false; |
| 302 | std::abs(value.gyro_z) < 0.6f) { | 302 | if (std::abs(value.accel_x) > 1.5f || std::abs(value.accel_y) > 1.5f || |
| 303 | std::abs(value.accel_z) > 1.5f) { | ||
| 304 | is_active = true; | ||
| 305 | } | ||
| 306 | if (std::abs(value.gyro_x) > 0.6f || std::abs(value.gyro_y) > 0.6f || | ||
| 307 | std::abs(value.gyro_z) > 0.6f) { | ||
| 308 | is_active = true; | ||
| 309 | } | ||
| 310 | if (!is_active) { | ||
| 303 | return; | 311 | return; |
| 304 | } | 312 | } |
| 305 | mapping_callback.on_data(MappingData{ | 313 | mapping_callback.on_data(MappingData{ |