mirror of https://github.com/adamdruppe/arsd.git
windows bug on full extension of stick
This commit is contained in:
parent
246aa4c486
commit
4394cb25b2
11
joystick.d
11
joystick.d
|
@ -415,6 +415,14 @@ struct JoystickUpdate {
|
|||
}
|
||||
|
||||
static short normalizeAxis(short value) {
|
||||
/+
|
||||
auto v = normalizeAxisHack(value);
|
||||
import std.stdio;
|
||||
writeln(value, " :: ", v);
|
||||
return v;
|
||||
}
|
||||
static short normalizeAxisHack(short value) {
|
||||
+/
|
||||
if(value > -1600 && value < 1600)
|
||||
return 0; // the deadzone gives too much useless junk
|
||||
return cast(short) (value >>> 11);
|
||||
|
@ -523,6 +531,9 @@ struct JoystickUpdate {
|
|||
(what.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) ? cast(short)-cast(int)digitalFallbackValue :
|
||||
what.Gamepad.sThumbLY;
|
||||
|
||||
if(got == short.min)
|
||||
got++; // to avoid overflow on the axis inversion below
|
||||
|
||||
return normalizeAxis(cast(short)-cast(int)got);
|
||||
case PS1AnalogAxes.horizontalRightStick:
|
||||
return normalizeAxis(what.Gamepad.sThumbRX);
|
||||
|
|
Loading…
Reference in New Issue