mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-10-25 21:40:08 +00:00
Fix analog stick axis overflow issue causing full positive axis input to invert on Xbox 360 controllers
This commit is contained in:
1 parent
4c332d3199
commit
b8213276dc
1 file changed
+3
-1
@@ -53,7 +53,9 @@ public class EvdevAbsolute {
|
|||||||
return reverse?Short.MAX_VALUE:Short.MIN_VALUE;
|
return reverse?Short.MAX_VALUE:Short.MIN_VALUE;
|
||||||
else {
|
else {
|
||||||
value += value<avg?flat:-flat;
|
value += value<avg?flat:-flat;
|
||||||
return (short) ((value-avg) * Short.MAX_VALUE / (reverse?flat-range:range-flat));
|
|
||||||
|
// Divide the value by the range before multiplying to avoid overflowing
|
||||||
|
return (short) (((value-avg) / (float)(reverse?flat-range:range-flat)) * 0x7FFE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user