diff options
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 12 |
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 @@ | |||
| 11 | 11 | ||
| 12 | namespace Core::HID { | 12 | namespace Core::HID { |
| 13 | constexpr s32 HID_JOYSTICK_MAX = 0x7fff; | 13 | constexpr s32 HID_JOYSTICK_MAX = 0x7fff; |
| 14 | constexpr s32 HID_JOYSTICK_MIN = 0x7ffe; | ||
| 15 | constexpr s32 HID_TRIGGER_MAX = 0x7fff; | 14 | constexpr s32 HID_TRIGGER_MAX = 0x7fff; |
| 16 | // Use a common UUID for TAS and Virtual Gamepad | 15 | // Use a common UUID for TAS and Virtual Gamepad |
| 17 | constexpr Common::UUID TAS_UUID = | 16 | constexpr Common::UUID TAS_UUID = |
| @@ -864,16 +863,9 @@ void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback, | |||
| 864 | return; | 863 | return; |
| 865 | } | 864 | } |
| 866 | 865 | ||
| 867 | const auto FloatToShort = [](float a) { | ||
| 868 | if (a > 0) { | ||
| 869 | return static_cast<s32>(a * HID_JOYSTICK_MAX); | ||
| 870 | } | ||
| 871 | return static_cast<s32>(a * HID_JOYSTICK_MIN); | ||
| 872 | }; | ||
| 873 | |||
| 874 | const AnalogStickState stick{ | 866 | const AnalogStickState stick{ |
| 875 | .x = FloatToShort(controller.stick_values[index].x.value), | 867 | .x = static_cast<s32>(controller.stick_values[index].x.value * HID_JOYSTICK_MAX), |
| 876 | .y = FloatToShort(controller.stick_values[index].y.value), | 868 | .y = static_cast<s32>(controller.stick_values[index].y.value * HID_JOYSTICK_MAX), |
| 877 | }; | 869 | }; |
| 878 | 870 | ||
| 879 | switch (index) { | 871 | switch (index) { |