mirror of
https://github.com/libretro/Lakka-LibreELEC.git
synced 2025-01-05 19:47:57 +00:00
600e246a94
Lakka 5.x Switch changes (#1853) Lakka v5.x switchroot 5.1.2 (#1871) Fix Switch Issue's in upstream 5.x (#1888) Minor Switch Changes (#1893) Lakka v5.x switch 3 (#1895) Lakka v5.x switch 4 (#1898) L4T: Xorg-server: Fix build issue (#1924) Switch: remove ra patch Lakka v5.x switch 6 (#1926) Cleanups, More LibreELEC Stuff, more permission fixes, Misc switch stuff. (#1930) Switch: U-Boot: bump version to 2024-NX02 (#1946) L4T/Ayn post-upstreaming fixes - retroarch_joypad_autoconfig: remove spaces from file names - retroarch: remove Switch specific patch merged upstream - libXv: move to L4T packages folder (package removed in upstream) - bring some packages from v5.x to L4T packages - ffmpeg: remove vulkan - remove stella core from Switch build (missing C++ headers) - Ayn/Odin: use proper kernel arg to not hide kernel messages in console - connman: add wpa_supplicant support back
37 lines
1.5 KiB
Diff
37 lines
1.5 KiB
Diff
From 3f76122bbe2ec31b75c78558ca8dca84d042ca12 Mon Sep 17 00:00:00 2001
|
|
From: Nicolas Adenis-Lamarre <nicolas.adenis.lamarre@gmail.com>
|
|
Date: Wed, 28 Jun 2023 05:18:19 +0000
|
|
Subject: [PATCH] fix axis when not aligned on 0
|
|
|
|
Signed-off-by: Nicolas Adenis-Lamarre <nicolas.adenis.lamarre@gmail.com>
|
|
---
|
|
src/api/udev/JoystickUdev.cpp | 15 +++++++++++----
|
|
1 file changed, 11 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/api/udev/JoystickUdev.cpp b/src/api/udev/JoystickUdev.cpp
|
|
index 3c0c6113..ce088156 100644
|
|
--- a/src/api/udev/JoystickUdev.cpp
|
|
+++ b/src/api/udev/JoystickUdev.cpp
|
|
@@ -217,10 +217,17 @@ bool CJoystickUdev::ScanEvents(void)
|
|
const unsigned int axisIndex = it->second.axisIndex;
|
|
const input_absinfo& info = it->second.axisInfo;
|
|
|
|
- if (event.value >= 0)
|
|
- SetAxisValue(axisIndex, event.value, info.maximum);
|
|
- else
|
|
- SetAxisValue(axisIndex, event.value, -info.minimum);
|
|
+ int middle = (info.minimum+info.maximum)/2;
|
|
+ int length = (info.maximum-info.minimum)/2;
|
|
+
|
|
+ if (event.value >= middle && event.value-middle > length/2) {
|
|
+ SetAxisValue(axisIndex, event.value-middle, length);
|
|
+ }
|
|
+ else if (event.value <= middle && middle-event.value > length/2) {
|
|
+ SetAxisValue(axisIndex, -(middle-event.value), length);
|
|
+ } else {
|
|
+ SetAxisValue(axisIndex, 0, length);
|
|
+ }
|
|
}
|
|
}
|
|
break;
|