mirror of
https://github.com/adamdruppe/arsd.git
synced 2025-04-27 13:50:00 +03:00
windows bug on full extension of stick
This commit is contained in:
parent
246aa4c486
commit
4394cb25b2
1 changed files with 11 additions and 0 deletions
11
joystick.d
11
joystick.d
|
@ -415,6 +415,14 @@ struct JoystickUpdate {
|
||||||
}
|
}
|
||||||
|
|
||||||
static short normalizeAxis(short value) {
|
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)
|
if(value > -1600 && value < 1600)
|
||||||
return 0; // the deadzone gives too much useless junk
|
return 0; // the deadzone gives too much useless junk
|
||||||
return cast(short) (value >>> 11);
|
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.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) ? cast(short)-cast(int)digitalFallbackValue :
|
||||||
what.Gamepad.sThumbLY;
|
what.Gamepad.sThumbLY;
|
||||||
|
|
||||||
|
if(got == short.min)
|
||||||
|
got++; // to avoid overflow on the axis inversion below
|
||||||
|
|
||||||
return normalizeAxis(cast(short)-cast(int)got);
|
return normalizeAxis(cast(short)-cast(int)got);
|
||||||
case PS1AnalogAxes.horizontalRightStick:
|
case PS1AnalogAxes.horizontalRightStick:
|
||||||
return normalizeAxis(what.Gamepad.sThumbRX);
|
return normalizeAxis(what.Gamepad.sThumbRX);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue