diff --git a/BetterJoyForCemu/App.config b/BetterJoyForCemu/App.config index bf1a530..ecca3f9 100644 --- a/BetterJoyForCemu/App.config +++ b/BetterJoyForCemu/App.config @@ -41,18 +41,25 @@ - - - - + + + + + + + + + + + - - - + + + - - + + @@ -68,15 +75,6 @@ - - - - - - - - - diff --git a/BetterJoyForCemu/Joycon.cs b/BetterJoyForCemu/Joycon.cs index e26a0f4..9551e0b 100644 --- a/BetterJoyForCemu/Joycon.cs +++ b/BetterJoyForCemu/Joycon.cs @@ -440,6 +440,8 @@ namespace BetterJoyForCemu { } public void BlinkHomeLight() { // do not call after initial setup + if (thirdParty) + return; byte[] a = Enumerable.Repeat((byte)0xFF, 25).ToArray(); a[0] = 0x18; a[1] = 0x01; @@ -447,6 +449,8 @@ namespace BetterJoyForCemu { } public void SetHomeLight(bool on) { + if (thirdParty) + return; byte[] a = Enumerable.Repeat((byte)0xFF, 25).ToArray(); if (on) { a[0] = 0x1F; @@ -853,15 +857,12 @@ namespace BetterJoyForCemu { stick_precal[0] = (UInt16)(stick_raw[0] | ((stick_raw[1] & 0xf) << 8)); stick_precal[1] = (UInt16)((stick_raw[1] >> 4) | (stick_raw[2] << 4)); - ushort[] cal = form.useControllerStickCalibration ? stick_cal : new ushort[6] { 2048, 2048, 2048, 2048, 2048, 2048 }; - ushort dz = form.useControllerStickCalibration ? deadzone : (ushort)200; - stick = CenterSticks(stick_precal, cal, dz); + stick = CenterSticks(stick_precal, stick_cal, deadzone); if (isPro) { stick2_precal[0] = (UInt16)(stick2_raw[0] | ((stick2_raw[1] & 0xf) << 8)); stick2_precal[1] = (UInt16)((stick2_raw[1] >> 4) | (stick2_raw[2] << 4)); - ushort dz2 = form.useControllerStickCalibration ? deadzone2 : (ushort)200; - stick2 = CenterSticks(stick2_precal, form.useControllerStickCalibration ? stick2_cal : cal, dz2); + stick2 = CenterSticks(stick2_precal, stick2_cal, deadzone2); } // Read other Joycon's sticks @@ -1119,8 +1120,22 @@ namespace BetterJoyForCemu { } private void dump_calibration_data() { - if (isSnes || thirdParty) + if (isSnes || thirdParty) { + short[] temp = (short[])ConfigurationManager.AppSettings["acc_sensiti"].Split(',').Select(s => short.Parse(s)).ToArray(); + acc_sensiti[0] = temp[0]; acc_sensiti[1] = temp[1]; acc_sensiti[2] = temp[2]; + temp = (short[])ConfigurationManager.AppSettings["gyr_sensiti"].Split(',').Select(s => short.Parse(s)).ToArray(); + gyr_sensiti[0] = temp[0]; gyr_sensiti[1] = temp[1]; gyr_sensiti[2] = temp[2]; + ushort[] temp2 = (ushort[])ConfigurationManager.AppSettings["stick_cal"].Split(',').Select(s => ushort.Parse(s.Substring(2), System.Globalization.NumberStyles.HexNumber)).ToArray(); + stick_cal[0] = temp2[0]; stick_cal[1] = temp2[1]; stick_cal[2] = temp2[2]; + stick_cal[3] = temp2[3]; stick_cal[4] = temp2[4]; stick_cal[5] = temp2[5]; + deadzone = ushort.Parse(ConfigurationManager.AppSettings["deadzone"]); + temp2 = (ushort[])ConfigurationManager.AppSettings["stick2_cal"].Split(',').Select(s => ushort.Parse(s.Substring(2), System.Globalization.NumberStyles.HexNumber)).ToArray(); + stick2_cal[0] = temp2[0]; stick2_cal[1] = temp2[1]; stick2_cal[2] = temp2[2]; + stick2_cal[3] = temp2[3]; stick2_cal[4] = temp2[4]; stick2_cal[5] = temp2[5]; + deadzone2 = ushort.Parse(ConfigurationManager.AppSettings["deadzone2"]); return; + } + HIDapi.hid_set_nonblocking(handle, 0); byte[] buf_ = ReadSPI(0x80, (isLeft ? (byte)0x12 : (byte)0x1d), 9); // get user calibration data if possible bool found = false; diff --git a/BetterJoyForCemu/MainForm.cs b/BetterJoyForCemu/MainForm.cs index 9f07750..145e178 100644 --- a/BetterJoyForCemu/MainForm.cs +++ b/BetterJoyForCemu/MainForm.cs @@ -15,8 +15,6 @@ using System.Xml.Linq; namespace BetterJoyForCemu { public partial class MainForm : Form { - public bool useControllerStickCalibration; - public bool nonOriginal; public bool allowCalibration = Boolean.Parse(ConfigurationManager.AppSettings["AllowCalibration"]); public List