Adds an option to switch between controller calibrated joystick and a predetermined value (#527)
* Fixes an issue some users where having when they enabled Non Original Controller #524 * Update Joycon.cs Overwite deadzone 2 * Using enum to switch between Co-authored-by: Shuken <shukenmg@iuvenisstudios.ga> Co-authored-by: David Khachaturov <d77777k@gmail.com>
This commit is contained in:
parent
e0e2499f04
commit
af3761ab3e
3 changed files with 42 additions and 5 deletions
|
@ -72,8 +72,14 @@
|
|||
<add key="UseHIDG" value="false" />
|
||||
|
||||
<!-- Determines whether or not to enable (experimental - currently default controller to pro) support for 3rd-party controllers. -->
|
||||
<!-- Default: false -->
|
||||
<add key="NonOriginalController" value="false" />
|
||||
<!-- Can be set to: False, DefaultCalibration, ControllerCalibration -->
|
||||
<!-- Disabled => Disables support for 3rd-party controllers. Uses joystick calibration data from the controller. -->
|
||||
<!-- DefaultCalibration => Enables support for 3rd-party controllers. Uses hard coded joystick calibration data. -->
|
||||
<!-- ControllerCalibration => Enables support for 3rd-party controllers. Uses joystick calibration data from the controller. -->
|
||||
<!-- Not case sensitive. -->
|
||||
<!-- Default: Disabled -->
|
||||
<add key="NonOriginalController" value="Disabled" />
|
||||
|
||||
<!-- The program will keep the HOME button LED ring light on at all times. -->
|
||||
<!-- Default: true -->
|
||||
<add key="HomeLEDOn" value="true"/>
|
||||
|
|
|
@ -834,14 +834,15 @@ 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.nonOriginal ? new ushort[6] { 2048, 2048, 2048, 2048, 2048, 2048 } : stick_cal;
|
||||
ushort dz = form.nonOriginal ? (ushort)200 : deadzone;
|
||||
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);
|
||||
|
||||
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));
|
||||
stick2 = CenterSticks(stick2_precal, form.nonOriginal ? cal : stick2_cal, deadzone2);
|
||||
ushort dz2 = form.useControllerStickCalibration ? deadzone2 : (ushort)200;
|
||||
stick2 = CenterSticks(stick2_precal, form.useControllerStickCalibration ? stick2_cal : cal, dz2);
|
||||
}
|
||||
|
||||
// Read other Joycon's sticks
|
||||
|
|
|
@ -15,6 +15,7 @@ using System.Xml.Linq;
|
|||
|
||||
namespace BetterJoyForCemu {
|
||||
public partial class MainForm : Form {
|
||||
public bool useControllerStickCalibration;
|
||||
public bool nonOriginal = Boolean.Parse(ConfigurationManager.AppSettings["NonOriginalController"]);
|
||||
public bool allowCalibration = Boolean.Parse(ConfigurationManager.AppSettings["AllowCalibration"]);
|
||||
public List<Button> con, loc;
|
||||
|
@ -27,12 +28,19 @@ namespace BetterJoyForCemu {
|
|||
public float shakeSesitivity = float.Parse(ConfigurationManager.AppSettings["ShakeInputSensitivity"]);
|
||||
public float shakeDelay = float.Parse(ConfigurationManager.AppSettings["ShakeInputDelay"]);
|
||||
|
||||
public enum NonOriginalController : int {
|
||||
Disabled = 0,
|
||||
DefaultCalibration = 1,
|
||||
ControllerCalibration = 2,
|
||||
}
|
||||
|
||||
public MainForm() {
|
||||
xG = new List<int>(); yG = new List<int>(); zG = new List<int>();
|
||||
xA = new List<int>(); yA = new List<int>(); zA = new List<int>();
|
||||
caliData = new List<KeyValuePair<string, float[]>> {
|
||||
new KeyValuePair<string, float[]>("0", new float[6] {0,0,0,-710,0,0})
|
||||
};
|
||||
SetNonOriginalControllerSettings();
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
|
@ -62,6 +70,28 @@ namespace BetterJoyForCemu {
|
|||
}
|
||||
}
|
||||
|
||||
private void SetNonOriginalControllerSettings() {
|
||||
Enum.TryParse(ConfigurationManager.AppSettings["NonOriginalController"], true, out NonOriginalController nonOriginalController);
|
||||
switch ((int)nonOriginalController) {
|
||||
case 0:
|
||||
nonOriginal = false;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
nonOriginal = true;
|
||||
break;
|
||||
}
|
||||
switch ((int)nonOriginalController) {
|
||||
case 0:
|
||||
case 2:
|
||||
useControllerStickCalibration = true;
|
||||
break;
|
||||
case 1:
|
||||
useControllerStickCalibration = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void HideToTray() {
|
||||
this.WindowState = FormWindowState.Minimized;
|
||||
notifyIcon.Visible = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue