fix xpad triggers to actually be useful? I dont know if they ever were before. Triggers are like halfs of axes, but our whole input system isnt built to handle halfs of axes; so with this, I make them appear to be whole axes in a -1..1 range.
This commit is contained in:
parent
5df212817c
commit
c1a6a16bb1
|
@ -169,15 +169,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
//constant for adapting a +/- 32768 range to a +/-10000-based range
|
||||
const float f = 32768 / 10000.0f;
|
||||
|
||||
//constant for adapting a 0-255 range to a 0-10000-based range
|
||||
const float f255 = 255 / 10000.0f;
|
||||
//since our whole input framework really only understands whole axes, let's make the triggers look like an axis
|
||||
float ltrig = g.bLeftTrigger / 255.0f * 2 - 1;
|
||||
float rtrig = g.bRightTrigger / 255.0f * 2 - 1;
|
||||
ltrig *= 10000;
|
||||
rtrig *= 10000;
|
||||
|
||||
yield return new Tuple<string, float>("LeftThumbX", g.sThumbLX / f);
|
||||
yield return new Tuple<string, float>("LeftThumbY", g.sThumbLY / f);
|
||||
yield return new Tuple<string, float>("RightThumbX", g.sThumbRX / f);
|
||||
yield return new Tuple<string, float>("RightThumbY", g.sThumbRY / f);
|
||||
yield return new Tuple<string, float>("LeftTrigger", g.bLeftTrigger / f255);
|
||||
yield return new Tuple<string, float>("RightTrigger", g.bRightTrigger / f255);
|
||||
yield return new Tuple<string, float>("LeftTrigger", ltrig);
|
||||
yield return new Tuple<string, float>("RightTrigger", rtrig);
|
||||
yield break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue