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 } MotionMapping mapping = {}; - Common::ParamPackage motion_params; - motion_params.Set("engine", GetEngineName()); - motion_params.Set("guid", params.Get("guid", "")); - motion_params.Set("port", params.Get("port", 0)); - motion_params.Set("pad", params.Get("pad", 0)); - motion_params.Set("motion", 0); - mapping.insert_or_assign(Settings::NativeMotion::MotionLeft, std::move(motion_params)); - mapping.insert_or_assign(Settings::NativeMotion::MotionRight, std::move(motion_params)); + Common::ParamPackage left_motion_params; + left_motion_params.Set("engine", GetEngineName()); + left_motion_params.Set("guid", params.Get("guid", "")); + left_motion_params.Set("port", params.Get("port", 0)); + left_motion_params.Set("pad", params.Get("pad", 0)); + left_motion_params.Set("motion", 0); + + Common::ParamPackage right_motion_params; + right_motion_params.Set("engine", GetEngineName()); + right_motion_params.Set("guid", params.Get("guid", "")); + right_motion_params.Set("port", params.Get("port", 0)); + right_motion_params.Set("pad", params.Get("pad", 0)); + right_motion_params.Set("motion", 0); + + mapping.insert_or_assign(Settings::NativeMotion::MotionLeft, std::move(left_motion_params)); + mapping.insert_or_assign(Settings::NativeMotion::MotionRight, std::move(right_motion_params)); return mapping; } 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 if (!configuring || !mapping_callback.on_data) { return; } - if (std::abs(value.gyro_x) < 0.6f && std::abs(value.gyro_y) < 0.6f && - std::abs(value.gyro_z) < 0.6f) { + bool is_active = false; + if (std::abs(value.accel_x) > 1.5f || std::abs(value.accel_y) > 1.5f || + std::abs(value.accel_z) > 1.5f) { + is_active = true; + } + if (std::abs(value.gyro_x) > 0.6f || std::abs(value.gyro_y) > 0.6f || + std::abs(value.gyro_z) > 0.6f) { + is_active = true; + } + if (!is_active) { return; } mapping_callback.on_data(MappingData{ |