Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Nintroller/Controllers/Guitar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public Guitar(Wiimote wm)
CALIB_Whammy_Max = 0;

CALIB_Enable_TouchStrip = false;
CALIB_JoyCenterInitialized = false;

oldTouchStripValue = GTR_TOUCH_STRIP_None;

Expand Down Expand Up @@ -122,6 +123,7 @@ public bool Select
}

public bool CALIB_Enable_TouchStrip;
private bool CALIB_JoyCenterInitialized;

public float CALIB_Tilt_Neutral;
public float CALIB_Tilt_TiltedREEEE;
Expand Down Expand Up @@ -247,6 +249,15 @@ public void Update(byte[] data)
Joy.rawX = (byte)(data[offset] & 0x3F);
Joy.rawY = (byte)(data[offset + 1] & 0x03F);

if (!CALIB_JoyCenterInitialized)
{
// Guitar stick neutral varies enough across hardware that the hardcoded
// classic-controller center can register a false held direction.
Joy.centerX = Joy.rawX;
Joy.centerY = Joy.rawY;
CALIB_JoyCenterInitialized = true;
}

if (Joy.rawX > Joy.maxX)
Joy.maxX = Joy.rawX;
else if (Joy.rawX < Joy.minX)
Expand Down Expand Up @@ -600,6 +611,7 @@ public void SetCalibration(Calibrations.CalibrationPreset preset)


Joy.Calibrate(Calibrations.Defaults.GuitarDefault.Joy);
CALIB_JoyCenterInitialized = false;

//SetCalibration(Calibrations.Defaults.ClassicControllerProDefault);
}
Expand Down Expand Up @@ -661,6 +673,8 @@ public void SetCalibration(string calibrationString)
}
}
}

CALIB_JoyCenterInitialized = true;
}
}
}
Expand Down