diff options
Diffstat (limited to '')
-rw-r--r-- | src/input_common/drivers/joycon.cpp | 4 | ||||
-rw-r--r-- | src/input_common/drivers/mouse.cpp | 27 | ||||
-rw-r--r-- | src/input_common/drivers/virtual_amiibo.h | 2 |
3 files changed, 21 insertions, 12 deletions
diff --git a/src/input_common/drivers/joycon.cpp b/src/input_common/drivers/joycon.cpp index b4cd39a20..8b57ebe07 100644 --- a/src/input_common/drivers/joycon.cpp +++ b/src/input_common/drivers/joycon.cpp @@ -307,8 +307,8 @@ Common::Input::DriverResult Joycons::SetPollingMode(const PadIdentifier& identif switch (polling_mode) { case Common::Input::PollingMode::Active: return static_cast<Common::Input::DriverResult>(handle->SetActiveMode()); - case Common::Input::PollingMode::Pasive: - return static_cast<Common::Input::DriverResult>(handle->SetPasiveMode()); + case Common::Input::PollingMode::Passive: + return static_cast<Common::Input::DriverResult>(handle->SetPassiveMode()); case Common::Input::PollingMode::IR: return static_cast<Common::Input::DriverResult>(handle->SetIrMode()); case Common::Input::PollingMode::NFC: diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp index 8b7f9aee9..94e92c37d 100644 --- a/src/input_common/drivers/mouse.cpp +++ b/src/input_common/drivers/mouse.cpp @@ -3,6 +3,7 @@ #include <thread> #include <fmt/format.h> +#include <math.h> #include "common/param_package.h" #include "common/settings.h" @@ -11,8 +12,9 @@ namespace InputCommon { constexpr int update_time = 10; -constexpr float default_stick_sensitivity = 0.022f; -constexpr float default_motion_sensitivity = 0.008f; +constexpr float default_stick_sensitivity = 0.0044f; +constexpr float default_motion_sensitivity = 0.0003f; +constexpr float maximum_rotation_speed = 2.0f; constexpr int mouse_axis_x = 0; constexpr int mouse_axis_y = 1; constexpr int wheel_axis_x = 2; @@ -99,11 +101,13 @@ void Mouse::UpdateMotionInput() { const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * default_motion_sensitivity; - // Slow movement by 7% - if (Settings::values.mouse_panning) { - last_motion_change *= 0.93f; - } else { - last_motion_change.z *= 0.93f; + const float rotation_velocity = std::sqrt(last_motion_change.x * last_motion_change.x + + last_motion_change.y * last_motion_change.y); + + if (rotation_velocity > maximum_rotation_speed / sensitivity) { + const float multiplier = maximum_rotation_speed / rotation_velocity / sensitivity; + last_motion_change.x = last_motion_change.x * multiplier; + last_motion_change.y = last_motion_change.y * multiplier; } const BasicMotion motion_data{ @@ -116,6 +120,12 @@ void Mouse::UpdateMotionInput() { .delta_timestamp = update_time * 1000, }; + if (Settings::values.mouse_panning) { + last_motion_change.x = 0; + last_motion_change.y = 0; + } + last_motion_change.z = 0; + SetMotion(motion_identifier, 0, motion_data); } @@ -125,7 +135,7 @@ void Mouse::Move(int x, int y, int center_x, int center_y) { auto mouse_change = (Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y)).Cast<float>(); - Common::Vec3<float> motion_change{-mouse_change.y, -mouse_change.x, last_motion_change.z}; + last_motion_change += {-mouse_change.y, -mouse_change.x, last_motion_change.z}; const auto move_distance = mouse_change.Length(); if (move_distance == 0) { @@ -141,7 +151,6 @@ void Mouse::Move(int x, int y, int center_x, int center_y) { // Average mouse movements last_mouse_change = (last_mouse_change * 0.91f) + (mouse_change * 0.09f); - last_motion_change = (last_motion_change * 0.69f) + (motion_change * 0.31f); const auto last_move_distance = last_mouse_change.Length(); diff --git a/src/input_common/drivers/virtual_amiibo.h b/src/input_common/drivers/virtual_amiibo.h index 13cacfc0a..488d00b31 100644 --- a/src/input_common/drivers/virtual_amiibo.h +++ b/src/input_common/drivers/virtual_amiibo.h @@ -60,6 +60,6 @@ private: std::string file_path{}; State state{State::Initialized}; std::vector<u8> nfc_data; - Common::Input::PollingMode polling_mode{Common::Input::PollingMode::Pasive}; + Common::Input::PollingMode polling_mode{Common::Input::PollingMode::Passive}; }; } // namespace InputCommon |