mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-04-04 23:16:06 +00:00
Fix analog stick axis overflow issue causing full positive axis input to invert on Xbox 360 controllers
This commit is contained in:
@@ -53,7 +53,9 @@ public class EvdevAbsolute {
|
||||
return reverse?Short.MAX_VALUE:Short.MIN_VALUE;
|
||||
else {
|
||||
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