summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2023-01-25 20:16:52 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2023-01-25 20:52:50 +0100
commitcc821bfae1b02ec3e86b85097f71a2e38c12f8a5 (patch)
tree3da326ee41f9e5831f92a9bbbe6aa80f246aa39a /src/core
parentMerge pull request #9662 from abouvier/cmake-llvm (diff)
downloadyuzu-cc821bfae1b02ec3e86b85097f71a2e38c12f8a5.tar
yuzu-cc821bfae1b02ec3e86b85097f71a2e38c12f8a5.tar.gz
yuzu-cc821bfae1b02ec3e86b85097f71a2e38c12f8a5.tar.bz2
yuzu-cc821bfae1b02ec3e86b85097f71a2e38c12f8a5.tar.lz
yuzu-cc821bfae1b02ec3e86b85097f71a2e38c12f8a5.tar.xz
yuzu-cc821bfae1b02ec3e86b85097f71a2e38c12f8a5.tar.zst
yuzu-cc821bfae1b02ec3e86b85097f71a2e38c12f8a5.zip
Diffstat (limited to '')
-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) {