summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-01-25 17:56:47 -0500
committerGitHub <noreply@github.com>2023-01-25 17:56:47 -0500
commitabda68f3a4e13f658fff0779927b0c7b0b24937f (patch)
tree10ec9c9305250fd7c3bb7b506a1d4499d6b204ae /src/core
parentb82a09896815c6c7c1c6f33673256860c16d0f9f (diff)
parentcc821bfae1b02ec3e86b85097f71a2e38c12f8a5 (diff)
Merge pull request #9676 from german77/revert-stick-range
Revert #9617 and fix it on input_common
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hid/emulated_controller.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 6e9812e6e..0e06468da 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -11,7 +11,6 @@
namespace Core::HID {
constexpr s32 HID_JOYSTICK_MAX = 0x7fff;
-constexpr s32 HID_JOYSTICK_MIN = 0x7ffe;
constexpr s32 HID_TRIGGER_MAX = 0x7fff;
// Use a common UUID for TAS and Virtual Gamepad
constexpr Common::UUID TAS_UUID =
@@ -864,16 +863,9 @@ void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback,
return;
}
- const auto FloatToShort = [](float a) {
- if (a > 0) {
- return static_cast<s32>(a * HID_JOYSTICK_MAX);
- }
- return static_cast<s32>(a * HID_JOYSTICK_MIN);
- };
-
const AnalogStickState stick{
- .x = FloatToShort(controller.stick_values[index].x.value),
- .y = FloatToShort(controller.stick_values[index].y.value),
+ .x = static_cast<s32>(controller.stick_values[index].x.value * HID_JOYSTICK_MAX),
+ .y = static_cast<s32>(controller.stick_values[index].y.value * HID_JOYSTICK_MAX),
};
switch (index) {