From 9a0966d96620e36f224deaaa523d2b8dbb46ccd8 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Thu, 30 Mar 2017 18:00:17 -0700 Subject: [PATCH] Removed some property usage --- DS4Windows/DS4Control/Mapping.cs | 28 +++++++-------- DS4Windows/DS4Control/ScpUtil.cs | 58 +++++++++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 15 deletions(-) diff --git a/DS4Windows/DS4Control/Mapping.cs b/DS4Windows/DS4Control/Mapping.cs index 9047c89..80d21a9 100644 --- a/DS4Windows/DS4Control/Mapping.cs +++ b/DS4Windows/DS4Control/Mapping.cs @@ -381,7 +381,7 @@ namespace DS4Windows int x; int y; int curve; - int lsCurve = LSCurve[device]; + int lsCurve = getLSCurve(device); if (lsCurve > 0) { x = cState.LX; @@ -415,7 +415,7 @@ namespace DS4Windows dState.LY = (byte)Math.Round(curvey, 0); } - int rsCurve = RSCurve[device]; + int rsCurve = getRSCurve(device); if (rsCurve > 0) { x = cState.RX; @@ -448,8 +448,8 @@ namespace DS4Windows dState.RY = (byte)Math.Round(curvey, 0); } - int lsDeadzone = LSDeadzone[device]; - int lsAntiDead = LSAntiDeadzone[device]; + int lsDeadzone = getLSDeadzone(device); + int lsAntiDead = getLSAntiDeadzone(device); if (lsDeadzone > 0 || lsAntiDead > 0) { double lsSquared = Math.Pow(cState.LX - 127.5f, 2) + Math.Pow(cState.LY - 127.5f, 2); @@ -514,8 +514,8 @@ namespace DS4Windows } } - int rsDeadzone = RSDeadzone[device]; - int rsAntiDead = RSAntiDeadzone[device]; + int rsDeadzone = getRSDeadzone(device); + int rsAntiDead = getRSAntiDeadzone(device); if (rsDeadzone > 0 || rsAntiDead > 0) { double rsSquared = Math.Pow(cState.RX - 127.5f, 2) + Math.Pow(cState.RY - 127.5f, 2); @@ -582,8 +582,8 @@ namespace DS4Windows } } - byte l2Deadzone = L2Deadzone[device]; - int l2AntiDeadzone = L2AntiDeadzone[device]; + byte l2Deadzone = getL2Deadzone(device); + int l2AntiDeadzone = getL2AntiDeadzone(device); if (l2Deadzone > 0 || l2AntiDeadzone > 0) { double tempL2Output = (cState.L2 / 255.0); @@ -625,8 +625,8 @@ namespace DS4Windows */ } - byte r2Deadzone = R2Deadzone[device]; - int r2AntiDeadzone = R2AntiDeadzone[device]; + byte r2Deadzone = getR2Deadzone(device); + int r2AntiDeadzone = getR2AntiDeadzone(device); if (r2Deadzone > 0 || r2AntiDeadzone > 0) { double tempR2Output = (cState.R2 / 255.0); @@ -658,25 +658,25 @@ namespace DS4Windows } } - double lsSens = LSSens[device]; + double lsSens = getLSSens(device); if (lsSens != 1.0) { dState.LX = (byte)Clamp(0, lsSens * (dState.LX - 127.5f) + 127.5f, 255); dState.LY = (byte)Clamp(0, lsSens * (dState.LY - 127.5f) + 127.5f, 255); } - double rsSens = RSSens[device]; + double rsSens = getRSSens(device); if (rsSens != 1.0) { dState.RX = (byte)Clamp(0, rsSens * (dState.RX - 127.5f) + 127.5f, 255); dState.RY = (byte)Clamp(0, rsSens * (dState.RY - 127.5f) + 127.5f, 255); } - double l2Sens = L2Sens[device]; + double l2Sens = getL2Sens(device); if (l2Sens != 1.0) dState.L2 = (byte)Clamp(0, l2Sens * dState.L2, 255); - double r2Sens = R2Sens[device]; + double r2Sens = getR2Sens(device); if (r2Sens != 1.0) dState.R2 = (byte)Clamp(0, r2Sens * dState.R2, 255); diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index dea86c3..8db62b0 100644 --- a/DS4Windows/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -350,24 +350,80 @@ namespace DS4Windows public static bool[] LowerRCOn => m_Config.lowerRCOn; public static bool[] TouchpadJitterCompensation => m_Config.touchpadJitterCompensation; - public static byte[] L2Deadzone => m_Config.l2Deadzone; + public static byte[] L2Deadzone => m_Config.l2Deadzone; + public static byte getL2Deadzone(int index) + { + return m_Config.l2Deadzone[index]; + } public static byte[] R2Deadzone => m_Config.r2Deadzone; + public static byte getR2Deadzone(int index) + { + return m_Config.r2Deadzone[index]; + } public static double[] SXDeadzone => m_Config.SXDeadzone; public static double[] SZDeadzone => m_Config.SZDeadzone; public static int[] LSDeadzone => m_Config.LSDeadzone; + public static int getLSDeadzone(int index) + { + return m_Config.LSDeadzone[index]; + } public static int[] RSDeadzone => m_Config.RSDeadzone; + public static int getRSDeadzone(int index) + { + return m_Config.RSDeadzone[index]; + } public static int[] LSAntiDeadzone => m_Config.LSAntiDeadzone; + public static int getLSAntiDeadzone(int index) + { + return m_Config.LSAntiDeadzone[index]; + } public static int[] RSAntiDeadzone => m_Config.RSAntiDeadzone; + public static int getRSAntiDeadzone(int index) + { + return m_Config.RSAntiDeadzone[index]; + } public static int[] L2AntiDeadzone => m_Config.l2AntiDeadzone; + public static int getL2AntiDeadzone(int index) + { + return m_Config.l2AntiDeadzone[index]; + } public static int[] R2AntiDeadzone => m_Config.r2AntiDeadzone; + public static int getR2AntiDeadzone(int index) + { + return m_Config.r2AntiDeadzone[index]; + } public static int[] LSCurve => m_Config.lsCurve; + public static int getLSCurve(int index) + { + return m_Config.lsCurve[index]; + } public static int[] RSCurve => m_Config.rsCurve; + public static int getRSCurve(int index) + { + return m_Config.rsCurve[index]; + } public static double[] L2Sens => m_Config.l2Sens; + public static double getL2Sens(int index) + { + return m_Config.l2Sens[index]; + } public static double[] R2Sens => m_Config.r2Sens; + public static double getR2Sens(int index) + { + return m_Config.r2Sens[index]; + } public static double[] SXSens => m_Config.SXSens; public static double[] SZSens => m_Config.SZSens; public static double[] LSSens => m_Config.LSSens; + public static double getLSSens(int index) + { + return m_Config.LSSens[index]; + } public static double[] RSSens => m_Config.RSSens; + public static double getRSSens(int index) + { + return m_Config.RSSens[index]; + } public static bool[] MouseAccel => m_Config.mouseAccel; public static string[] LaunchProgram => m_Config.launchProgram; public static string[] ProfilePath => m_Config.profilePath;