From c1a6a16bb1b0ad46e591c7106da083a441815ee3 Mon Sep 17 00:00:00 2001 From: zeromus Date: Thu, 3 May 2018 15:02:09 -0500 Subject: [PATCH] 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. --- BizHawk.Client.EmuHawk/Input/GamePad360.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/BizHawk.Client.EmuHawk/Input/GamePad360.cs b/BizHawk.Client.EmuHawk/Input/GamePad360.cs index 00078cdeac..2d77a44485 100644 --- a/BizHawk.Client.EmuHawk/Input/GamePad360.cs +++ b/BizHawk.Client.EmuHawk/Input/GamePad360.cs @@ -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("LeftThumbX", g.sThumbLX / f); yield return new Tuple("LeftThumbY", g.sThumbLY / f); yield return new Tuple("RightThumbX", g.sThumbRX / f); yield return new Tuple("RightThumbY", g.sThumbRY / f); - yield return new Tuple("LeftTrigger", g.bLeftTrigger / f255); - yield return new Tuple("RightTrigger", g.bRightTrigger / f255); + yield return new Tuple("LeftTrigger", ltrig); + yield return new Tuple("RightTrigger", rtrig); yield break; }