diff --git a/Falcon BMS Alternative Launcher/Input/CommonConstants.cs b/Falcon BMS Alternative Launcher/Input/CommonConstants.cs index d967c8d..2d92e07 100644 --- a/Falcon BMS Alternative Launcher/Input/CommonConstants.cs +++ b/Falcon BMS Alternative Launcher/Input/CommonConstants.cs @@ -29,5 +29,8 @@ public static class CommonConstants public static readonly int AXISMIN = 0; public static readonly int AXISMAX = 65536; + + public static readonly int BINAXISMIN = 0; + public static readonly int BINAXISMAX = 15000; } } diff --git a/Falcon BMS Alternative Launcher/Override/OverrideSetting.cs b/Falcon BMS Alternative Launcher/Override/OverrideSetting.cs index 1f9a2e8..8bcd971 100644 --- a/Falcon BMS Alternative Launcher/Override/OverrideSetting.cs +++ b/Falcon BMS Alternative Launcher/Override/OverrideSetting.cs @@ -445,17 +445,20 @@ protected virtual void SaveJoystickCal(Hashtable inGameAxis, DeviceControl devic double iAB = deviceControl.joyAssign[((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber()].detentPosition.GetAB(); double iIdle = deviceControl.joyAssign[((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber()].detentPosition.GetIDLE(); - const double MAXIN = 65536; - const double MAXOUT = 14848; + iAB = iAB * CommonConstants.BINAXISMAX / CommonConstants.AXISMAX; + iIdle = iIdle * CommonConstants.BINAXISMAX / CommonConstants.AXISMAX; - iAB = -iAB * (MAXOUT / MAXIN) + MAXOUT; - iIdle = -iIdle * (MAXOUT / MAXIN) + MAXOUT; + if (((InGameAxAssgn)inGameAxis[nme.ToString()]).GetInvert() == false) + { + iAB = CommonConstants.BINAXISMAX - iAB; + iIdle = CommonConstants.BINAXISMAX - iIdle; + } byte[] ab = BitConverter.GetBytes((int)iAB).Reverse().ToArray(); byte[] idle = BitConverter.GetBytes((int)iIdle).Reverse().ToArray(); - bs[1] = ab[1]; - bs[5] = idle[1]; + bs[1] = ab[2]; + bs[5] = idle[2]; } } } diff --git a/Falcon BMS Alternative Launcher/Override/OverrideSettingFor434.cs b/Falcon BMS Alternative Launcher/Override/OverrideSettingFor434.cs index 75e3d24..8c891a3 100644 --- a/Falcon BMS Alternative Launcher/Override/OverrideSettingFor434.cs +++ b/Falcon BMS Alternative Launcher/Override/OverrideSettingFor434.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.IO; +using System.Linq; using System.Text; using System.Xml.Serialization; @@ -58,20 +59,23 @@ protected override void SaveJoystickCal(Hashtable inGameAxis, DeviceControl devi { if (((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber() >= 0) { - double iAB = deviceControl.joyAssign[((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber()].detentPosition.GetAB(); + double iAB = deviceControl.joyAssign[((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber()].detentPosition.GetAB(); double iIdle = deviceControl.joyAssign[((InGameAxAssgn)inGameAxis[nme.ToString()]).GetDeviceNumber()].detentPosition.GetIDLE(); - const double MAXIN = 65536; - const double MAXOUT = 14848; + iAB = iAB * CommonConstants.BINAXISMAX / CommonConstants.AXISMAX; + iIdle = iIdle * CommonConstants.BINAXISMAX / CommonConstants.AXISMAX; - iAB = -iAB * (MAXOUT / MAXIN) + MAXOUT; - iIdle = -iIdle * (MAXOUT / MAXIN) + MAXOUT; + if (((InGameAxAssgn)inGameAxis[nme.ToString()]).GetInvert() == false) + { + iAB = CommonConstants.BINAXISMAX - iAB; + iIdle = CommonConstants.BINAXISMAX - iIdle; + } - byte[] ab = BitConverter.GetBytes((int)iAB); - byte[] idle = BitConverter.GetBytes((int)iIdle); + byte[] ab = BitConverter.GetBytes((int)iAB).Reverse().ToArray(); + byte[] idle = BitConverter.GetBytes((int)iIdle).Reverse().ToArray(); - bs[1] = ab[1]; - bs[5] = idle[1]; + bs[1] = ab[2]; + bs[5] = idle[2]; } } } diff --git a/Falcon BMS Alternative Launcher/Windows/AxisAssignWindow.xaml.cs b/Falcon BMS Alternative Launcher/Windows/AxisAssignWindow.xaml.cs index 9c2749d..6ab7f02 100644 --- a/Falcon BMS Alternative Launcher/Windows/AxisAssignWindow.xaml.cs +++ b/Falcon BMS Alternative Launcher/Windows/AxisAssignWindow.xaml.cs @@ -518,25 +518,31 @@ private void SetAB_Click(object sender, RoutedEventArgs e) { if (status != Status.ShowAxisStatus) return; - int ABposition; - ABposition = CommonConstants.AXISMAX - MainWindow.deviceControl.joyAssign[devNumTmp].JoyAxisState(phyAxNumTmp); - if (MainWindow.deviceControl.joyAssign[devNumTmp].JoyAxisState(phyAxNumTmp) > CommonConstants.AXISMAX) - ABposition = CommonConstants.AXISMAX; - AB = ABposition; - if (AB > CommonConstants.AXISMAX - CommonConstants.AXISMAX / 128) + + if (Invert.IsChecked == true) + AB = CommonConstants.AXISMIN + MainWindow.deviceControl.joyAssign[devNumTmp].JoyAxisState(phyAxNumTmp); + else + AB = CommonConstants.AXISMAX - MainWindow.deviceControl.joyAssign[devNumTmp].JoyAxisState(phyAxNumTmp); + + if (AB > CommonConstants.AXISMAX) AB = CommonConstants.AXISMAX; + if (AB < CommonConstants.AXISMIN) + AB = CommonConstants.AXISMIN; } private void SetIDLE_Click(object sender, RoutedEventArgs e) { if (status != Status.ShowAxisStatus) return; - int IDLEposition; - IDLEposition = CommonConstants.AXISMAX - MainWindow.deviceControl.joyAssign[devNumTmp].JoyAxisState(phyAxNumTmp); - if (MainWindow.deviceControl.joyAssign[devNumTmp].JoyAxisState(phyAxNumTmp) < 0) - IDLEposition = CommonConstants.AXISMIN; - IDLE = IDLEposition; - if (IDLE < CommonConstants.AXISMAX / 128) + + if (Invert.IsChecked == true) + IDLE = CommonConstants.AXISMIN + MainWindow.deviceControl.joyAssign[devNumTmp].JoyAxisState(phyAxNumTmp); + else + IDLE = CommonConstants.AXISMAX - MainWindow.deviceControl.joyAssign[devNumTmp].JoyAxisState(phyAxNumTmp); + + if (IDLE > CommonConstants.AXISMAX) + IDLE = CommonConstants.AXISMAX; + if (IDLE < CommonConstants.AXISMIN) IDLE = CommonConstants.AXISMIN; }