Merge branch 'jay' into vigem-udpserver

This commit is contained in:
Travis Nickles 2019-03-10 09:33:00 -05:00
commit 0ea8cef46e
18 changed files with 3977 additions and 945 deletions

View File

@ -405,17 +405,21 @@ namespace DS4Windows
device.SyncChange += this.On_SyncChange; device.SyncChange += this.On_SyncChange;
device.SyncChange += DS4Devices.UpdateSerial; device.SyncChange += DS4Devices.UpdateSerial;
device.SerialChange += this.On_SerialChange; device.SerialChange += this.On_SerialChange;
if (device.isValidSerial() && containsLinkedProfile(device.getMacAddress())) if (!useTempProfile[i])
{ {
ProfilePath[i] = getLinkedProfile(device.getMacAddress()); if (device.isValidSerial() && containsLinkedProfile(device.getMacAddress()))
} {
else ProfilePath[i] = getLinkedProfile(device.getMacAddress());
{ }
ProfilePath[i] = OlderProfilePath[i]; else
{
ProfilePath[i] = OlderProfilePath[i];
}
LoadProfile(i, false, this, false, false);
} }
touchPad[i] = new Mouse(i, device); touchPad[i] = new Mouse(i, device);
LoadProfile(i, false, this, false, false);
device.LightBarColor = getMainColor(i); device.LightBarColor = getMainColor(i);
if (!getDInputOnly(i) && device.isSynced()) if (!getDInputOnly(i) && device.isSynced())
@ -548,6 +552,10 @@ namespace DS4Windows
tempDevice.StopUpdate(); tempDevice.StopUpdate();
tempDevice.DisconnectDongle(true); tempDevice.DisconnectDongle(true);
} }
else
{
tempDevice.StopUpdate();
}
} }
else else
{ {
@ -635,17 +643,21 @@ namespace DS4Windows
device.SyncChange += this.On_SyncChange; device.SyncChange += this.On_SyncChange;
device.SyncChange += DS4Devices.UpdateSerial; device.SyncChange += DS4Devices.UpdateSerial;
device.SerialChange += this.On_SerialChange; device.SerialChange += this.On_SerialChange;
if (device.isValidSerial() && containsLinkedProfile(device.getMacAddress())) if (!useTempProfile[Index])
{ {
ProfilePath[Index] = getLinkedProfile(device.getMacAddress()); if (device.isValidSerial() && containsLinkedProfile(device.getMacAddress()))
} {
else ProfilePath[Index] = getLinkedProfile(device.getMacAddress());
{ }
ProfilePath[Index] = OlderProfilePath[Index]; else
{
ProfilePath[Index] = OlderProfilePath[Index];
}
LoadProfile(Index, false, this, false, false);
} }
touchPad[Index] = new Mouse(Index, device); touchPad[Index] = new Mouse(Index, device);
LoadProfile(Index, false, this, false, false);
device.LightBarColor = getMainColor(Index); device.LightBarColor = getMainColor(Index);
int tempIdx = Index; int tempIdx = Index;
@ -1159,7 +1171,7 @@ namespace DS4Windows
cState = Mapping.SetCurveAndDeadzone(ind, cState, TempState[ind]); cState = Mapping.SetCurveAndDeadzone(ind, cState, TempState[ind]);
if (!recordingMacro && (!string.IsNullOrEmpty(tempprofilename[ind]) || if (!recordingMacro && (useTempProfile[ind] ||
containsCustomAction(ind) || containsCustomExtras(ind) || containsCustomAction(ind) || containsCustomExtras(ind) ||
getProfileActionCount(ind) > 0)) getProfileActionCount(ind) > 0))
{ {
@ -1181,7 +1193,7 @@ namespace DS4Windows
if (processingData[ind].Rumble[1] == 0x08) if (processingData[ind].Rumble[1] == 0x08)
{ {
setRumble(Big, Small, ind); SetDevRumble(device, Big, Small, ind);
} }
} }
*/ */
@ -1377,8 +1389,22 @@ namespace DS4Windows
Debug(this, args); Debug(this, args);
} }
//sets the rumble adjusted with rumble boost // sets the rumble adjusted with rumble boost. General use method
public virtual void setRumble(byte heavyMotor, byte lightMotor, int deviceNum) public virtual void setRumble(byte heavyMotor, byte lightMotor, int deviceNum)
{
if (deviceNum < 4)
{
DS4Device device = DS4Controllers[deviceNum];
if (device != null)
SetDevRumble(device, heavyMotor, lightMotor, deviceNum);
//device.setRumble((byte)lightBoosted, (byte)heavyBoosted);
}
}
// sets the rumble adjusted with rumble boost. Method more used for
// report handling. Avoid constant checking for a device.
public void SetDevRumble(DS4Device device,
byte heavyMotor, byte lightMotor, int deviceNum)
{ {
byte boost = getRumbleBoost(deviceNum); byte boost = getRumbleBoost(deviceNum);
uint lightBoosted = ((uint)lightMotor * (uint)boost) / 100; uint lightBoosted = ((uint)lightMotor * (uint)boost) / 100;
@ -1388,12 +1414,7 @@ namespace DS4Windows
if (heavyBoosted > 255) if (heavyBoosted > 255)
heavyBoosted = 255; heavyBoosted = 255;
if (deviceNum < 4) device.setRumble((byte)lightBoosted, (byte)heavyBoosted);
{
DS4Device device = DS4Controllers[deviceNum];
if (device != null)
device.setRumble((byte)lightBoosted, (byte)heavyBoosted);
}
} }
public DS4State getDS4State(int ind) public DS4State getDS4State(int ind)
@ -1404,6 +1425,11 @@ namespace DS4Windows
public DS4State getDS4StateMapped(int ind) public DS4State getDS4StateMapped(int ind)
{ {
return MappedState[ind]; return MappedState[ind];
} }
public DS4State getDS4StateTemp(int ind)
{
return TempState[ind];
}
} }
} }

View File

@ -10,7 +10,7 @@ namespace DS4Windows
{ {
private readonly static byte[/* Light On duration */, /* Light Off duration */] BatteryIndicatorDurations = private readonly static byte[/* Light On duration */, /* Light Off duration */] BatteryIndicatorDurations =
{ {
{ 0, 0 }, // 0 is for "charging" OR anything sufficiently-"charged" { 28, 252 }, // on 10% of the time at 0
{ 28, 252 }, { 28, 252 },
{ 56, 224 }, { 56, 224 },
{ 84, 196 }, { 84, 196 },
@ -19,7 +19,8 @@ namespace DS4Windows
{ 168, 112 }, { 168, 112 },
{ 196, 84 }, { 196, 84 },
{ 224, 56 }, // on 80% of the time at 80, etc. { 224, 56 }, // on 80% of the time at 80, etc.
{ 252, 28 } // on 90% of the time at 90 { 252, 28 }, // on 90% of the time at 90
{ 0, 0 } // use on 100%. 0 is for "charging" OR anything sufficiently-"charged"
}; };
static double[] counters = new double[4] { 0, 0, 0, 0 }; static double[] counters = new double[4] { 0, 0, 0, 0 };
@ -298,7 +299,7 @@ namespace DS4Windows
{ {
int level = device.getBattery() / 10; int level = device.getBattery() / 10;
if (level >= 10) if (level >= 10)
level = 0; // all values of ~0% or >~100% are rendered the same level = 10; // all values of >~100% are rendered the same
haptics.LightBarFlashDurationOn = BatteryIndicatorDurations[level, 0]; haptics.LightBarFlashDurationOn = BatteryIndicatorDurations[level, 0];
haptics.LightBarFlashDurationOff = BatteryIndicatorDurations[level, 1]; haptics.LightBarFlashDurationOff = BatteryIndicatorDurations[level, 1];

View File

@ -79,6 +79,88 @@ namespace DS4Windows
new Queue<ControlToXInput>(), new Queue<ControlToXInput>() new Queue<ControlToXInput>(), new Queue<ControlToXInput>()
}; };
struct DS4Vector2
{
public double x;
public double y;
public DS4Vector2(double x, double y)
{
this.x = x;
this.y = y;
}
}
class DS4SquareStick
{
public DS4Vector2 current;
public DS4Vector2 squared;
public DS4SquareStick()
{
current = new DS4Vector2(0.0, 0.0);
squared = new DS4Vector2(0.0, 0.0);
}
public void CircleToSquare()
{
const double PiOverFour = Math.PI / 4.0;
const double roundness = 5.0;
// Determine the theta angle
double angle = Math.Atan2(current.y, -current.x);
angle += Math.PI;
double cosAng = Math.Cos(angle);
// Scale according to which wall we're clamping to
// X+ wall
if (angle <= PiOverFour || angle > 7.0 * PiOverFour)
{
double tempVal = 1.0 / cosAng;
//Console.WriteLine("1 ANG: {0} | TEMP: {1}", angle, tempVal);
squared.x = current.x * tempVal;
squared.y = current.y * tempVal;
}
// Y+ wall
else if (angle > PiOverFour && angle <= 3.0 * PiOverFour)
{
double tempVal = 1.0 / Math.Sin(angle);
//Console.WriteLine("2 ANG: {0} | TEMP: {1}", angle, tempVal);
squared.x = current.x * tempVal;
squared.y = current.y * tempVal;
}
// X- wall
else if (angle > 3.0 * PiOverFour && angle <= 5.0 * PiOverFour)
{
double tempVal = -1.0 / cosAng;
//Console.WriteLine("3 ANG: {0} | TEMP: {1}", angle, tempVal);
squared.x = current.x * tempVal;
squared.y = current.y * tempVal;
}
// Y- wall
else if (angle > 5.0 * PiOverFour && angle <= 7.0 * PiOverFour)
{
double tempVal = -1.0 / Math.Sin(angle);
//Console.WriteLine("4 ANG: {0} | TEMP: {1}", angle, tempVal);
squared.x = current.x * tempVal;
squared.y = current.y * tempVal;
}
else return;
//double lengthOld = Math.Sqrt((x * x) + (y * y));
double length = current.x / cosAng;
//Console.WriteLine("LENGTH TEST ({0}) ({1}) {2}", lengthOld, length, (lengthOld == length).ToString());
double factor = Math.Pow(length, roundness);
//double ogX = current.x, ogY = current.y;
current.x += (squared.x - current.x) * factor;
current.y += (squared.y - current.y) * factor;
//Console.WriteLine("INPUT: {0} {1} | {2} {3} | {4} {5} | {6} {7}",
// ogX, ogY, current.x, current.y, squared.x, squared.y, length, factor);
}
}
static DS4SquareStick[] outSqrStk = new DS4SquareStick[4] { new DS4SquareStick(),
new DS4SquareStick(), new DS4SquareStick(), new DS4SquareStick()};
static ReaderWriterLockSlim syncStateLock = new ReaderWriterLockSlim(); static ReaderWriterLockSlim syncStateLock = new ReaderWriterLockSlim();
public static SyntheticState globalState = new SyntheticState(); public static SyntheticState globalState = new SyntheticState();
@ -788,8 +870,26 @@ namespace DS4Windows
if (r2Sens != 1.0) if (r2Sens != 1.0)
dState.R2 = (byte)Global.Clamp(0, r2Sens * dState.R2, 255); dState.R2 = (byte)Global.Clamp(0, r2Sens * dState.R2, 255);
if (getSquareStickLS(device) && (dState.LX != 128 || dState.LY != 128))
{
double capX = dState.LX >= 128 ? 127.0 : 128.0;
double capY = dState.LY >= 128 ? 127.0 : 128.0;
double tempX = (dState.LX - 128.0) / capX;
double tempY = (dState.LY - 128.0) / capY;
DS4SquareStick sqstick = outSqrStk[device];
sqstick.current.x = tempX; sqstick.current.y = tempY;
sqstick.CircleToSquare();
//Console.WriteLine("Input ({0}) | Output ({1})", tempY, sqstick.current.y);
tempX = sqstick.current.x < -1.0 ? -1.0 : sqstick.current.x > 1.0
? 1.0 : sqstick.current.x;
tempY = sqstick.current.y < -1.0 ? -1.0 : sqstick.current.y > 1.0
? 1.0 : sqstick.current.y;
dState.LX = (byte)(tempX * capX + 128.0);
dState.LY = (byte)(tempY * capY + 128.0);
}
int lsOutCurveMode = lsOutCurveModeArray[device] = getLsOutCurveMode(device); int lsOutCurveMode = lsOutCurveModeArray[device] = getLsOutCurveMode(device);
if (lsOutCurveMode > 0) if (lsOutCurveMode > 0 && (dState.LX != 128 || dState.LY != 128))
{ {
double capX = dState.LX >= 128 ? 127.0 : 128.0; double capX = dState.LX >= 128 ? 127.0 : 128.0;
double capY = dState.LY >= 128 ? 127.0 : 128.0; double capY = dState.LY >= 128 ? 127.0 : 128.0;
@ -859,8 +959,26 @@ namespace DS4Windows
} }
} }
if (getSquareStickRS(device) && (dState.RX != 128 || dState.RY != 128))
{
double capX = dState.RX >= 128 ? 127.0 : 128.0;
double capY = dState.RY >= 128 ? 127.0 : 128.0;
double tempX = (dState.RX - 128.0) / capX;
double tempY = (dState.RY - 128.0) / capY;
DS4SquareStick sqstick = outSqrStk[device];
sqstick.current.x = tempX; sqstick.current.y = tempY;
sqstick.CircleToSquare();
tempX = sqstick.current.x < -1.0 ? -1.0 : sqstick.current.x > 1.0
? 1.0 : sqstick.current.x;
tempY = sqstick.current.y < -1.0 ? -1.0 : sqstick.current.y > 1.0
? 1.0 : sqstick.current.y;
//Console.WriteLine("Input ({0}) | Output ({1})", tempY, sqstick.current.y);
dState.RX = (byte)(tempX * capX + 128.0);
dState.RY = (byte)(tempY * capY + 128.0);
}
int rsOutCurveMode = rsOutCurveModeArray[device] = getRsOutCurveMode(device); int rsOutCurveMode = rsOutCurveModeArray[device] = getRsOutCurveMode(device);
if (rsOutCurveMode > 0) if (rsOutCurveMode > 0 && (dState.RX != 128 || dState.RY != 128))
{ {
double capX = dState.RX >= 128 ? 127.0 : 128.0; double capX = dState.RX >= 128 ? 127.0 : 128.0;
double capY = dState.RY >= 128 ? 127.0 : 128.0; double capY = dState.RY >= 128 ? 127.0 : 128.0;
@ -931,7 +1049,7 @@ namespace DS4Windows
} }
int l2OutCurveMode = tempIntArray[device] = getL2OutCurveMode(device); int l2OutCurveMode = tempIntArray[device] = getL2OutCurveMode(device);
if (l2OutCurveMode > 0) if (l2OutCurveMode > 0 && dState.L2 != 0)
{ {
double temp = dState.L2 / 255.0; double temp = dState.L2 / 255.0;
if (l2OutCurveMode == 1) if (l2OutCurveMode == 1)
@ -952,7 +1070,7 @@ namespace DS4Windows
} }
int r2OutCurveMode = tempIntArray[device] = getR2OutCurveMode(device); int r2OutCurveMode = tempIntArray[device] = getR2OutCurveMode(device);
if (r2OutCurveMode > 0) if (r2OutCurveMode > 0 && dState.R2 != 0)
{ {
double temp = dState.R2 / 255.0; double temp = dState.R2 / 255.0;
if (r2OutCurveMode == 1) if (r2OutCurveMode == 1)
@ -1029,7 +1147,7 @@ namespace DS4Windows
} }
int sxOutCurveMode = tempIntArray[device] = getSXOutCurveMode(device); int sxOutCurveMode = tempIntArray[device] = getSXOutCurveMode(device);
if (sxOutCurveMode > 0) if (sxOutCurveMode > 0 && dState.Motion.outputAccelX != 0)
{ {
double temp = dState.Motion.outputAccelX / 128.0; double temp = dState.Motion.outputAccelX / 128.0;
double sign = Math.Sign(temp); double sign = Math.Sign(temp);
@ -1055,7 +1173,7 @@ namespace DS4Windows
} }
int szOutCurveMode = tempIntArray[device] = getSZOutCurveMode(device); int szOutCurveMode = tempIntArray[device] = getSZOutCurveMode(device);
if (szOutCurveMode > 0) if (szOutCurveMode > 0 && dState.Motion.outputAccelZ != 0)
{ {
double temp = dState.Motion.outputAccelZ / 128.0; double temp = dState.Motion.outputAccelZ / 128.0;
double sign = Math.Sign(temp); double sign = Math.Sign(temp);
@ -1199,9 +1317,9 @@ namespace DS4Windows
//DS4StateFieldMapping outputfieldMapping = new DS4StateFieldMapping(cState, eState, tp); //DS4StateFieldMapping outputfieldMapping = new DS4StateFieldMapping(cState, eState, tp);
SyntheticState deviceState = Mapping.deviceState[device]; SyntheticState deviceState = Mapping.deviceState[device];
if (getProfileActionCount(device) > 0 || !string.IsNullOrEmpty(tempprofilename[device])) if (getProfileActionCount(device) > 0 || useTempProfile[device])
MapCustomAction(device, cState, MappedState, eState, tp, ctrl, fieldMapping, outputfieldMapping); MapCustomAction(device, cState, MappedState, eState, tp, ctrl, fieldMapping, outputfieldMapping);
if (ctrl.DS4Controllers[device] == null) return; //if (ctrl.DS4Controllers[device] == null) return;
//cState.CopyTo(MappedState); //cState.CopyTo(MappedState);
@ -1778,7 +1896,7 @@ namespace DS4Windows
{ {
actionFound = true; actionFound = true;
if (!actionDone[index].dev[device] && string.IsNullOrEmpty(tempprofilename[device])) if (!actionDone[index].dev[device] && !useTempProfile[device])
{ {
actionDone[index].dev[device] = true; actionDone[index].dev[device] = true;
untriggeraction[device] = action; untriggeraction[device] = action;
@ -2168,7 +2286,7 @@ namespace DS4Windows
if ((action.controls == action.ucontrols && !actionDone[index].dev[device]) || //if trigger and end trigger are the same if ((action.controls == action.ucontrols && !actionDone[index].dev[device]) || //if trigger and end trigger are the same
action.controls != action.ucontrols) action.controls != action.ucontrols)
{ {
if (!string.IsNullOrEmpty(tempprofilename[device])) if (useTempProfile[device])
{ {
//foreach (DS4Controls dc in action.uTrigger) //foreach (DS4Controls dc in action.uTrigger)
for (int i = 0, arlen = action.uTrigger.Count; i < arlen; i++) for (int i = 0, arlen = action.uTrigger.Count; i < arlen; i++)

View File

@ -237,6 +237,7 @@ namespace DS4Windows
public static bool runHotPlug = false; public static bool runHotPlug = false;
public const int XINPUT_UNPLUG_SETTLE_TIME = 250; // Inhibit races that occur with the asynchronous teardown of ScpVBus -> X360 driver instance. public const int XINPUT_UNPLUG_SETTLE_TIME = 250; // Inhibit races that occur with the asynchronous teardown of ScpVBus -> X360 driver instance.
public static string[] tempprofilename = new string[5] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty }; public static string[] tempprofilename = new string[5] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
public static bool[] useTempProfile = new bool[5] { false, false, false, false, false };
public static bool[] tempprofileDistance = new bool[5] { false, false, false, false, false }; public static bool[] tempprofileDistance = new bool[5] { false, false, false, false, false };
public static bool[] useDInputOnly = new bool[5] { true, true, true, true, true }; public static bool[] useDInputOnly = new bool[5] { true, true, true, true, true };
public static bool[] linkedProfileCheck = new bool[4] { true, true, true, true }; public static bool[] linkedProfileCheck = new bool[4] { true, true, true, true };
@ -1059,6 +1060,18 @@ namespace DS4Windows
return m_Config.btPollRate[index]; return m_Config.btPollRate[index];
} }
public static bool[] squareStickLS => m_Config.sqLSStickMode;
public static bool getSquareStickLS(int device)
{
return m_Config.sqLSStickMode[device];
}
public static bool[] squareStickRS => m_Config.sqRSStickMode;
public static bool getSquareStickRS(int device)
{
return m_Config.sqRSStickMode[device];
}
public static int[] lsOutCurveMode => m_Config.lsOutCurveMode; public static int[] lsOutCurveMode => m_Config.lsOutCurveMode;
public static int getLsOutCurveMode(int index) public static int getLsOutCurveMode(int index)
{ {
@ -1296,6 +1309,7 @@ namespace DS4Windows
{ {
m_Config.LoadProfile(device, launchprogram, control, "", xinputChange, postLoad); m_Config.LoadProfile(device, launchprogram, control, "", xinputChange, postLoad);
tempprofilename[device] = string.Empty; tempprofilename[device] = string.Empty;
useTempProfile[device] = false;
tempprofileDistance[device] = false; tempprofileDistance[device] = false;
} }
@ -1304,6 +1318,7 @@ namespace DS4Windows
{ {
m_Config.LoadProfile(device, launchprogram, control, appdatapath + @"\Profiles\" + name + ".xml"); m_Config.LoadProfile(device, launchprogram, control, appdatapath + @"\Profiles\" + name + ".xml");
tempprofilename[device] = name; tempprofilename[device] = name;
useTempProfile[device] = true;
tempprofileDistance[device] = name.ToLower().Contains("distance"); tempprofileDistance[device] = name.ToLower().Contains("distance");
} }
@ -1500,6 +1515,8 @@ namespace DS4Windows
MouseCursor.GYRO_MOUSE_DEADZONE }; MouseCursor.GYRO_MOUSE_DEADZONE };
public bool[] gyroMouseToggle = new bool[5] { false, false, false, public bool[] gyroMouseToggle = new bool[5] { false, false, false,
false, false }; false, false };
public bool[] sqLSStickMode = new bool[5] { false, false, false, false, false };
public bool[] sqRSStickMode = new bool[5] { false, false, false, false, false };
public int[] lsOutCurveMode = new int[5] { 0, 0, 0, 0, 0 }; public int[] lsOutCurveMode = new int[5] { 0, 0, 0, 0, 0 };
public int[] rsOutCurveMode = new int[5] { 0, 0, 0, 0, 0 }; public int[] rsOutCurveMode = new int[5] { 0, 0, 0, 0, 0 };
public int[] l2OutCurveMode = new int[5] { 0, 0, 0, 0, 0 }; public int[] l2OutCurveMode = new int[5] { 0, 0, 0, 0, 0 };
@ -1847,6 +1864,9 @@ namespace DS4Windows
XmlNode xmlLsOutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "LSOutputCurveMode", null); xmlLsOutputCurveMode.InnerText = stickOutputCurveString(lsOutCurveMode[device]); Node.AppendChild(xmlLsOutputCurveMode); XmlNode xmlLsOutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "LSOutputCurveMode", null); xmlLsOutputCurveMode.InnerText = stickOutputCurveString(lsOutCurveMode[device]); Node.AppendChild(xmlLsOutputCurveMode);
XmlNode xmlRsOutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "RSOutputCurveMode", null); xmlRsOutputCurveMode.InnerText = stickOutputCurveString(rsOutCurveMode[device]); Node.AppendChild(xmlRsOutputCurveMode); XmlNode xmlRsOutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "RSOutputCurveMode", null); xmlRsOutputCurveMode.InnerText = stickOutputCurveString(rsOutCurveMode[device]); Node.AppendChild(xmlRsOutputCurveMode);
XmlNode xmlLsSquareStickMode = m_Xdoc.CreateNode(XmlNodeType.Element, "LSSquareStick", null); xmlLsSquareStickMode.InnerText = sqLSStickMode[device].ToString(); Node.AppendChild(xmlLsSquareStickMode);
XmlNode xmlRsSquareStickMode = m_Xdoc.CreateNode(XmlNodeType.Element, "RSSquareStick", null); xmlRsSquareStickMode.InnerText = sqRSStickMode[device].ToString(); Node.AppendChild(xmlRsSquareStickMode);
XmlNode xmlL2OutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "L2OutputCurveMode", null); xmlL2OutputCurveMode.InnerText = axisOutputCurveString(l2OutCurveMode[device]); Node.AppendChild(xmlL2OutputCurveMode); XmlNode xmlL2OutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "L2OutputCurveMode", null); xmlL2OutputCurveMode.InnerText = axisOutputCurveString(l2OutCurveMode[device]); Node.AppendChild(xmlL2OutputCurveMode);
XmlNode xmlR2OutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "R2OutputCurveMode", null); xmlR2OutputCurveMode.InnerText = axisOutputCurveString(r2OutCurveMode[device]); Node.AppendChild(xmlR2OutputCurveMode); XmlNode xmlR2OutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "R2OutputCurveMode", null); xmlR2OutputCurveMode.InnerText = axisOutputCurveString(r2OutCurveMode[device]); Node.AppendChild(xmlR2OutputCurveMode);
@ -2770,6 +2790,12 @@ namespace DS4Windows
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSOutputCurveMode"); rsOutCurveMode[device] = stickOutputCurveId(Item.InnerText); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSOutputCurveMode"); rsOutCurveMode[device] = stickOutputCurveId(Item.InnerText); }
catch { rsOutCurveMode[device] = 0; missingSetting = true; } catch { rsOutCurveMode[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSSquareStick"); bool.TryParse(Item.InnerText, out sqLSStickMode[device]); }
catch { sqLSStickMode[device] = false; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSSquareStick"); bool.TryParse(Item.InnerText, out sqRSStickMode[device]); }
catch { sqRSStickMode[device] = false; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/L2OutputCurveMode"); l2OutCurveMode[device] = axisOutputCurveId(Item.InnerText); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/L2OutputCurveMode"); l2OutCurveMode[device] = axisOutputCurveId(Item.InnerText); }
catch { l2OutCurveMode[device] = 0; missingSetting = true; } catch { l2OutCurveMode[device] = 0; missingSetting = true; }
@ -3967,8 +3993,8 @@ namespace DS4Windows
m_Leds[device] = new DS4Color(tempColor); m_Leds[device] = new DS4Color(tempColor);
m_ChargingLeds[device] = new DS4Color(Color.Black); m_ChargingLeds[device] = new DS4Color(Color.Black);
m_FlashLeds[device] = new DS4Color(Color.Black); m_FlashLeds[device] = new DS4Color(Color.Black);
useCustomLeds[device] = false; //useCustomLeds[device] = false;
m_CustomLeds[device] = new DS4Color(Color.Blue); //m_CustomLeds[device] = new DS4Color(Color.Blue);
chargingType[device] = 0; chargingType[device] = 0;
launchProgram[device] = string.Empty; launchProgram[device] = string.Empty;
@ -3989,6 +4015,8 @@ namespace DS4Windows
gyroSmoothing[device] = false; gyroSmoothing[device] = false;
gyroSmoothWeight[device] = 0.5; gyroSmoothWeight[device] = 0.5;
gyroMouseHorizontalAxis[device] = 0; gyroMouseHorizontalAxis[device] = 0;
sqLSStickMode[device] = false;
sqRSStickMode[device] = false;
lsOutCurveMode[device] = 0; lsOutCurveMode[device] = 0;
rsOutCurveMode[device] = 0; rsOutCurveMode[device] = 0;
l2OutCurveMode[device] = 0; l2OutCurveMode[device] = 0;

View File

@ -132,7 +132,7 @@ namespace DS4Windows
private const int WM_INITDIALOG = 0x0110; private const int WM_INITDIALOG = 0x0110;
private List<ApiWindow> EditWindows = null; private List<ApiWindow> EditWindows = null;
public delegate void ColorUpdateHandler(object sender, EventArgs e); public delegate void ColorUpdateHandler(Color colValue, EventArgs e);
public event ColorUpdateHandler OnUpdateColor; public event ColorUpdateHandler OnUpdateColor;
[DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] [DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]

View File

@ -2359,11 +2359,10 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
DS4LightBar.forcelight[currentCustomLed] = false; DS4LightBar.forcelight[currentCustomLed] = false;
} }
private void advColor_CustomColorUpdate(object sender, EventArgs e) private void advColor_CustomColorUpdate(Color color, EventArgs e)
{ {
if (sender is Color && currentCustomLed < 4) if (currentCustomLed < 4)
{ {
Color color = (Color)sender;
DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B }; DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B };
DS4LightBar.forcedColor[currentCustomLed] = dcolor; DS4LightBar.forcedColor[currentCustomLed] = dcolor;
DS4LightBar.forcedFlash[currentCustomLed] = 0; DS4LightBar.forcedFlash[currentCustomLed] = 0;

View File

@ -458,11 +458,10 @@ namespace DS4Windows
DS4LightBar.forcelight[device] = false; DS4LightBar.forcelight[device] = false;
} }
private void advColorDialog_OnUpdateColor(object sender, EventArgs e) private void advColorDialog_OnUpdateColor(Color color, EventArgs e)
{ {
if (sender is Color && device < 4) if (device < 4)
{ {
Color color = (Color)sender;
DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B }; DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B };
DS4LightBar.forcedColor[device] = dcolor; DS4LightBar.forcedColor[device] = dcolor;
DS4LightBar.forcedFlash[device] = 0; DS4LightBar.forcedFlash[device] = 0;

View File

@ -397,6 +397,9 @@
this.shareTouchInvStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.shareTouchInvStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.psTouchInvStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.psTouchInvStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.advColorDialog = new DS4Windows.AdvancedColorDialog(); this.advColorDialog = new DS4Windows.AdvancedColorDialog();
this.squStickTabPage = new System.Windows.Forms.TabPage();
this.lsSquStickCk = new System.Windows.Forms.CheckBox();
this.rsSquStickCk = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.nUDRainbow)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRainbow)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tBBlueBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tBBlueBar)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tBGreenBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tBGreenBar)).BeginInit();
@ -491,6 +494,7 @@
((System.ComponentModel.ISupportInitialize)(this.nUDSZS)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDSZS)).BeginInit();
this.cMGyroTriggers.SuspendLayout(); this.cMGyroTriggers.SuspendLayout();
this.cMTouchDisableInvert.SuspendLayout(); this.cMTouchDisableInvert.SuspendLayout();
this.squStickTabPage.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// lowColorChooserButton // lowColorChooserButton
@ -2826,6 +2830,7 @@
this.tCSens.Controls.Add(this.tPDeadzone); this.tCSens.Controls.Add(this.tPDeadzone);
this.tCSens.Controls.Add(this.antiDeadzoneTabPage); this.tCSens.Controls.Add(this.antiDeadzoneTabPage);
this.tCSens.Controls.Add(this.maxZoneTabPage); this.tCSens.Controls.Add(this.maxZoneTabPage);
this.tCSens.Controls.Add(this.squStickTabPage);
this.tCSens.Controls.Add(this.tPOutCurve); this.tCSens.Controls.Add(this.tPOutCurve);
this.tCSens.Controls.Add(this.tPCurve); this.tCSens.Controls.Add(this.tPCurve);
this.tCSens.Controls.Add(this.tpRotation); this.tCSens.Controls.Add(this.tpRotation);
@ -4227,6 +4232,28 @@
resources.ApplyResources(this.psTouchInvStripMenuItem, "psTouchInvStripMenuItem"); resources.ApplyResources(this.psTouchInvStripMenuItem, "psTouchInvStripMenuItem");
this.psTouchInvStripMenuItem.CheckedChanged += new System.EventHandler(this.TouchDisableInvert_CheckedChanged); this.psTouchInvStripMenuItem.CheckedChanged += new System.EventHandler(this.TouchDisableInvert_CheckedChanged);
// //
// squStickTabPage
//
this.squStickTabPage.Controls.Add(this.rsSquStickCk);
this.squStickTabPage.Controls.Add(this.lsSquStickCk);
resources.ApplyResources(this.squStickTabPage, "squStickTabPage");
this.squStickTabPage.Name = "squStickTabPage";
this.squStickTabPage.UseVisualStyleBackColor = true;
//
// lsSquStickCk
//
resources.ApplyResources(this.lsSquStickCk, "lsSquStickCk");
this.lsSquStickCk.Name = "lsSquStickCk";
this.lsSquStickCk.UseVisualStyleBackColor = true;
this.lsSquStickCk.Click += new System.EventHandler(this.lsSquStickCk_Click);
//
// rsSquStickCk
//
resources.ApplyResources(this.rsSquStickCk, "rsSquStickCk");
this.rsSquStickCk.Name = "rsSquStickCk";
this.rsSquStickCk.UseVisualStyleBackColor = true;
this.rsSquStickCk.Click += new System.EventHandler(this.rsSquStickCk_Click);
//
// Options // Options
// //
resources.ApplyResources(this, "$this"); resources.ApplyResources(this, "$this");
@ -4294,6 +4321,7 @@
this.pnlLSTrack.ResumeLayout(false); this.pnlLSTrack.ResumeLayout(false);
this.pnlRSTrack.ResumeLayout(false); this.pnlRSTrack.ResumeLayout(false);
this.fLPTiltControls.ResumeLayout(false); this.fLPTiltControls.ResumeLayout(false);
this.fLPTiltControls.PerformLayout();
this.tCControls.ResumeLayout(false); this.tCControls.ResumeLayout(false);
this.tPControls.ResumeLayout(false); this.tPControls.ResumeLayout(false);
this.pnlController.ResumeLayout(false); this.pnlController.ResumeLayout(false);
@ -4350,6 +4378,7 @@
((System.ComponentModel.ISupportInitialize)(this.nUDSZS)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDSZS)).EndInit();
this.cMGyroTriggers.ResumeLayout(false); this.cMGyroTriggers.ResumeLayout(false);
this.cMTouchDisableInvert.ResumeLayout(false); this.cMTouchDisableInvert.ResumeLayout(false);
this.squStickTabPage.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -4725,5 +4754,8 @@
private System.Windows.Forms.Label label27; private System.Windows.Forms.Label label27;
private System.Windows.Forms.NumericUpDown gyroMouseDzNUD; private System.Windows.Forms.NumericUpDown gyroMouseDzNUD;
private System.Windows.Forms.CheckBox toggleGyroMCb; private System.Windows.Forms.CheckBox toggleGyroMCb;
private System.Windows.Forms.TabPage squStickTabPage;
private System.Windows.Forms.CheckBox rsSquStickCk;
private System.Windows.Forms.CheckBox lsSquStickCk;
} }
} }

View File

@ -631,6 +631,9 @@ namespace DS4Windows
btnBrowse.Text = Path.GetFileNameWithoutExtension(LaunchProgram[device]); btnBrowse.Text = Path.GetFileNameWithoutExtension(LaunchProgram[device]);
} }
lsSquStickCk.Checked = squareStickLS[device];
rsSquStickCk.Checked = squareStickRS[device];
cBDinput.Checked = DinputOnly[device]; cBDinput.Checked = DinputOnly[device];
olddinputcheck = cBDinput.Checked; olddinputcheck = cBDinput.Checked;
cbStartTouchpadOff.Checked = StartTouchpadOff[device]; cbStartTouchpadOff.Checked = StartTouchpadOff[device];
@ -807,6 +810,9 @@ namespace DS4Windows
nUDSXS.Value = 1; nUDSXS.Value = 1;
nUDSZS.Value = 1; nUDSZS.Value = 1;
lsSquStickCk.Checked = false;
rsSquStickCk.Checked = false;
cBLaunchProgram.Checked = false; cBLaunchProgram.Checked = false;
pBProgram.Image = null; pBProgram.Image = null;
btnBrowse.Text = Properties.Resources.Browse; btnBrowse.Text = Properties.Resources.Browse;
@ -948,6 +954,7 @@ namespace DS4Windows
DS4StateExposed exposeState = Program.rootHub.ExposedState[tempDeviceNum]; DS4StateExposed exposeState = Program.rootHub.ExposedState[tempDeviceNum];
DS4State baseState = Program.rootHub.getDS4State(tempDeviceNum); DS4State baseState = Program.rootHub.getDS4State(tempDeviceNum);
DS4State interState = Program.rootHub.getDS4StateTemp(tempDeviceNum);
SetDynamicTrackBarValue(tBsixaxisGyroX, (exposeState.getGyroYaw() + tBsixaxisGyroX.Value * 2) / 3); SetDynamicTrackBarValue(tBsixaxisGyroX, (exposeState.getGyroYaw() + tBsixaxisGyroX.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisGyroY, (exposeState.getGyroPitch() + tBsixaxisGyroY.Value * 2) / 3); SetDynamicTrackBarValue(tBsixaxisGyroY, (exposeState.getGyroPitch() + tBsixaxisGyroY.Value * 2) / 3);
@ -959,137 +966,75 @@ namespace DS4Windows
int x = baseState.LX; int x = baseState.LX;
int y = baseState.LY; int y = baseState.LY;
double tempLSS = (double)nUDLSS.Value; btnLSTrack.Location = new Point((int)(dpix * x / 2.09),
btnLSTrackS.Visible = tempLSS != 1; (int)(dpiy * y / 2.09));
double tempLSCurve = (double)nUDLSCurve.Value; bool mappedLS = interState.LX != x || interState.LY != y;
if (tempLSCurve > 0.0) btnLSTrackS.Visible = mappedLS;
{
float max = x + y;
double curvex;
double curvey;
double multimax = TValue(382.5, max, tempLSCurve);
double multimin = TValue(127.5, max, tempLSCurve);
if ((x > 127.5f && y > 127.5f) || (x < 127.5f && y < 127.5f))
{
curvex = (x > 127.5f ? Math.Min(x, (x / max) * multimax) : Math.Max(x, (x / max) * multimin));
curvey = (y > 127.5f ? Math.Min(y, (y / max) * multimax) : Math.Max(y, (y / max) * multimin));
}
else
{
if (x < 127.5f)
{
curvex = Math.Min(x, (x / max) * multimax);
curvey = Math.Min(y, (-(y / max) * multimax + 510));
}
else
{
curvex = Math.Min(x, (-(x / max) * multimax + 510));
curvey = Math.Min(y, (y / max) * multimax);
}
}
btnLSTrack.Location = new Point((int)(dpix * curvex / 2.09), (int)(dpiy * curvey / 2.09));
}
else
{
btnLSTrack.Location = new Point((int)(dpix * x / 2.09), (int)(dpiy * y / 2.09));
btnLSTrackS.Visible = tempLSS != 1;
}
if (tempLSS != 1) if (mappedLS)
{ {
btnLSTrackS.Location = new Point((int)(tempLSS * (btnLSTrack.Location.X - pnlLSTrack.Size.Width / 2f) + pnlLSTrack.Size.Width / 2f), btnLSTrackS.Location = new Point((int)(dpix * interState.LX / 2.09), (int)(dpiy * interState.LY / 2.09));
(int)(tempLSS * (btnLSTrack.Location.Y - pnlLSTrack.Size.Height / 2f) + pnlLSTrack.Size.Height / 2f));
} }
x = baseState.RX; x = baseState.RX;
y = baseState.RY; y = baseState.RY;
double tempRSS = (double)nUDRSS.Value; bool mappedRS = interState.RX != x || interState.RY != y;
btnRSTrackS.Visible = tempRSS != 1; btnRSTrackS.Visible = mappedRS;
double tempRSCurve = (double)nUDRSCurve.Value;
if (tempRSCurve > 0.0) btnRSTrack.Location = new Point((int)(dpix * x / 2.09), (int)(dpiy * y / 2.09));
if (mappedRS)
{ {
float max = x + y; btnRSTrackS.Location = new Point((int)(dpix * interState.RX / 2.09), (int)(dpiy * interState.RY / 2.09));
double curvex;
double curvey;
double multimax = TValue(382.5, max, tempRSCurve);
double multimin = TValue(127.5, max, tempRSCurve);
if ((x > 127.5f && y > 127.5f) || (x < 127.5f && y < 127.5f))
{
curvex = (x > 127.5f ? Math.Min(x, (x / max) * multimax) : Math.Max(x, (x / max) * multimin));
curvey = (y > 127.5f ? Math.Min(y, (y / max) * multimax) : Math.Max(y, (y / max) * multimin));
}
else
{
if (x < 127.5f)
{
curvex = Math.Min(x, (x / max) * multimax);
curvey = Math.Min(y, (-(y / max) * multimax + 510));
}
else
{
curvex = Math.Min(x, (-(x / max) * multimax + 510));
curvey = Math.Min(y, (y / max) * multimax);
}
}
btnRSTrack.Location = new Point((int)(dpix * curvex / 2.09), (int)(dpiy * curvey / 2.09));
}
else
{
btnRSTrack.Location = new Point((int)(dpix * x / 2.09), (int)(dpiy * y / 2.09));
btnRSTrackS.Visible = tempRSS != 1;
}
if (tempRSS != 1)
{
btnRSTrackS.Location = new Point((int)(tempRSS * (btnRSTrack.Location.X - pnlRSTrack.Size.Width / 2f) + pnlRSTrack.Size.Width / 2f),
(int)(tempRSS * (btnRSTrack.Location.Y - pnlRSTrack.Size.Height / 2f) + pnlRSTrack.Size.Height / 2f));
} }
x = exposeState.getAccelX() + 127; x = exposeState.getAccelX() + 127;
y = exposeState.getAccelZ() + 127; y = exposeState.getAccelZ() + 127;
btnSATrack.Location = new Point((int)(dpix * Global.Clamp(0, x / 2.09, pnlSATrack.Size.Width)), (int)(dpiy * Global.Clamp(0, y / 2.09, pnlSATrack.Size.Height))); btnSATrack.Location = new Point((int)(dpix * Global.Clamp(0, x / 2.09, pnlSATrack.Size.Width)),
(int)(dpiy * Global.Clamp(0, y / 2.09, pnlSATrack.Size.Height)));
double tempSXS = (double)nUDSXS.Value; bool mappedSix = interState.Motion.accelX != 0 || interState.Motion.accelZ != 0;
double tempSZS = (double)nUDSZS.Value; btnSATrackS.Visible = mappedSix;
btnSATrackS.Visible = tempSXS != 1 || tempSZS != 1; if (mappedSix)
if (tempSXS != 1 || tempSZS != 1)
{ {
btnSATrackS.Location = new Point((int)(tempSXS * (btnSATrack.Location.X - pnlSATrack.Size.Width / 2f) + pnlSATrack.Size.Width / 2f), btnSATrackS.Location = new Point((int)(dpix * Global.Clamp(0, (interState.Motion.accelX + 127) / 2.09, pnlSATrack.Size.Width)),
(int)(tempSZS * (btnSATrack.Location.Y - pnlSATrack.Size.Height / 2f) + pnlSATrack.Size.Height / 2f)); (int)(dpiy * Global.Clamp(0, (interState.Motion.accelZ + 127) / 2.09, pnlSATrack.Size.Height)));
} }
double tempL2 = (double)nUDL2.Value;
double tempL2S = (double)nUDL2S.Value;
tBL2.Value = baseState.L2; tBL2.Value = baseState.L2;
lbL2Track.Location = new Point(tBL2.Location.X - (int)(dpix * 25), lbL2Track.Location = new Point(tBL2.Location.X - (int)(dpix * 25),
Math.Max((int)(((tBL2.Location.Y + tBL2.Size.Height) - (tBL2.Value * tempL2S) / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20), (int)(tBL2.Location.Y + tBL2.Size.Height - interState.L2 / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2.0)) - (dpix * 20)));
(int)(1 * ((tBL2.Location.Y + tBL2.Size.Height) - 255 / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20)));
if (tBL2.Value * tempL2S >= 255) //lbL2Track.Location = new Point(tBL2.Location.X - (int)(dpix * 25),
// Math.Max((int)(((tBL2.Location.Y + tBL2.Size.Height) - (tBL2.Value * tempL2S) / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20),
// (int)(1 * ((tBL2.Location.Y + tBL2.Size.Height) - 255 / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20)));
if (interState.L2 >= 255)
lbL2Track.ForeColor = Color.Green; lbL2Track.ForeColor = Color.Green;
else if (tBL2.Value * tempL2S < tempL2 * 255) else if (interState.L2 == 0)
lbL2Track.ForeColor = Color.Red; lbL2Track.ForeColor = Color.Red;
else else
lbL2Track.ForeColor = Color.Black; lbL2Track.ForeColor = Color.Black;
double tempR2 = (double)nUDR2.Value;
double tempR2S = (double)nUDR2S.Value;
tBR2.Value = baseState.R2; tBR2.Value = baseState.R2;
lbR2Track.Location = new Point(tBR2.Location.X + (int)(dpix * 25), lbR2Track.Location = new Point(tBR2.Location.X + (int)(dpix * 25),
Math.Max((int)(1 * ((tBR2.Location.Y + tBR2.Size.Height) - (tBR2.Value * tempR2S) / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20), (int)(tBR2.Location.Y + tBR2.Size.Height - interState.R2 / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2.0)) - (dpix * 20)));
(int)(1 * ((tBR2.Location.Y + tBR2.Size.Height) - 255 / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20))); //lbR2Track.Location = new Point(tBR2.Location.X + (int)(dpix * 25),
// Math.Max((int)(1 * ((tBR2.Location.Y + tBR2.Size.Height) - (tBR2.Value * tempR2S) / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20),
// (int)(1 * ((tBR2.Location.Y + tBR2.Size.Height) - 255 / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20)));
if (tBR2.Value * tempR2S >= 255) if (interState.R2 >= 255)
lbR2Track.ForeColor = Color.Green; lbR2Track.ForeColor = Color.Green;
else if (tBR2.Value * tempR2S < tempR2 * 255) else if (interState.R2 == 0)
lbR2Track.ForeColor = Color.Red; lbR2Track.ForeColor = Color.Red;
else else
lbR2Track.ForeColor = Color.Black; lbR2Track.ForeColor = Color.Black;
double latency = ds.Latency; double latency = ds.Latency;
int warnInterval = ds.getWarnInterval(); int warnInterval = ds.getWarnInterval();
lbInputDelay.Text = Properties.Resources.InputDelay.Replace("*number*", latency.ToString()); lbInputDelay.Text = Properties.Resources.InputDelay.Replace("*number*",
latency.ToString());
if (latency > warnInterval) if (latency > warnInterval)
{ {
lbInputDelay.BackColor = Color.Red; lbInputDelay.BackColor = Color.Red;
@ -1312,6 +1257,8 @@ namespace DS4Windows
SZMaxzone[device] = (double)nUDSixAxisZMaxZone.Value; SZMaxzone[device] = (double)nUDSixAxisZMaxZone.Value;
SXAntiDeadzone[device] = (double)nUDSixaxisXAntiDead.Value; SXAntiDeadzone[device] = (double)nUDSixaxisXAntiDead.Value;
SZAntiDeadzone[device] = (double)nUDSixaxisZAntiDead.Value; SZAntiDeadzone[device] = (double)nUDSixaxisZAntiDead.Value;
squareStickLS[device] = lsSquStickCk.Checked;
squareStickRS[device] = rsSquStickCk.Checked;
MouseAccel[device] = cBMouseAccel.Checked; MouseAccel[device] = cBMouseAccel.Checked;
DinputOnly[device] = cBDinput.Checked; DinputOnly[device] = cBDinput.Checked;
StartTouchpadOff[device] = cbStartTouchpadOff.Checked; StartTouchpadOff[device] = cbStartTouchpadOff.Checked;
@ -1484,11 +1431,10 @@ namespace DS4Windows
ChargingColor[device] = new DS4Color(chargingBackColor); ChargingColor[device] = new DS4Color(chargingBackColor);
} }
private void advColorDialog_OnUpdateColor(object sender, EventArgs e) private void advColorDialog_OnUpdateColor(Color color, EventArgs e)
{ {
if (sender is Color && device < 4) if (device < 4)
{ {
Color color = (Color)sender;
DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B }; DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B };
DS4LightBar.forcedColor[device] = dcolor; DS4LightBar.forcedColor[device] = dcolor;
DS4LightBar.forcedFlash[device] = 0; DS4LightBar.forcedFlash[device] = 0;
@ -3099,6 +3045,22 @@ namespace DS4Windows
} }
} }
private void lsSquStickCk_Click(object sender, EventArgs e)
{
if (loading == false)
{
squareStickLS[device] = lsSquStickCk.Checked;
}
}
private void rsSquStickCk_Click(object sender, EventArgs e)
{
if (loading == false)
{
squareStickRS[device] = rsSquStickCk.Checked;
}
}
private void trackFrictionNUD_ValueChanged(object sender, EventArgs e) private void trackFrictionNUD_ValueChanged(object sender, EventArgs e)
{ {
if (loading == false) if (loading == false)

File diff suppressed because it is too large Load Diff

View File

@ -1356,11 +1356,10 @@ namespace DS4Windows
cHMacro.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); cHMacro.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
} }
private void advColorDialog_OnUpdateColor(object sender, EventArgs e) private void advColorDialog_OnUpdateColor(Color color, EventArgs e)
{ {
if (sender is Color && Program.rootHub.DS4Controllers[0] != null) if (Program.rootHub.DS4Controllers[0] != null)
{ {
Color color = (Color)sender;
DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B }; DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B };
DS4LightBar.forcedColor[0] = dcolor; DS4LightBar.forcedColor[0] = dcolor;
DS4LightBar.forcedFlash[0] = 0; DS4LightBar.forcedFlash[0] = 0;

View File

@ -57,6 +57,10 @@ namespace DS4Windows
LoadAction(); LoadAction();
loadingAction = false; loadingAction = false;
} }
advColorDialog = new AdvancedColorDialog();
advColorDialog.FullOpen = true;
advColorDialog.OnUpdateColor += new AdvancedColorDialog.ColorUpdateHandler(this.advColorDialog_OnUpdateColor);
} }
void LoadAction() void LoadAction()
@ -487,11 +491,10 @@ namespace DS4Windows
e.Graphics.FillRectangle(linGrBrush, 0, 0, pBGraident.Width, pBGraident.Height); e.Graphics.FillRectangle(linGrBrush, 0, 0, pBGraident.Width, pBGraident.Height);
} }
private void advColorDialog_OnUpdateColor(object sender, EventArgs e) private void advColorDialog_OnUpdateColor(Color color, EventArgs e)
{ {
if (sender is Color && device < 4) if (device < 4)
{ {
Color color = (Color)sender;
DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B }; DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B };
DS4LightBar.forcedColor[device] = dcolor; DS4LightBar.forcedColor[device] = dcolor;
DS4LightBar.forcedFlash[device] = 0; DS4LightBar.forcedFlash[device] = 0;

View File

@ -33,7 +33,7 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.12")] [assembly: AssemblyVersion("1.6.13")]
[assembly: AssemblyFileVersion("1.6.12")] [assembly: AssemblyFileVersion("1.6.13")]
[assembly: NeutralResourcesLanguage("en")] [assembly: NeutralResourcesLanguage("en")]

View File

@ -1482,7 +1482,7 @@ namespace DS4Windows.Properties {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to You must quit other applications like Steam, Uplay, NVIDIA IN-GAME before activating the &apos;Hide DS4 Controller&apos; option.. /// Looks up a localized string similar to You must quit other applications like UWP apps (Netflix), Steam, Uplay, NVIDIA IN-GAME before activating the &apos;Hide DS4 Controller&apos; option. For more info check https://github.com/Ryochan7/DS4Windows/wiki/Exclusive-Mode-(Hide-DS4-Controller-config-option)-tips-and-issues.
/// </summary> /// </summary>
public static string QuitOtherPrograms { public static string QuitOtherPrograms {
get { get {

View File

@ -566,7 +566,7 @@
<value>EXPERIMENTAL: Auto-Disable BT when connecting to USB</value> <value>EXPERIMENTAL: Auto-Disable BT when connecting to USB</value>
</data> </data>
<data name="QuitOtherPrograms" xml:space="preserve"> <data name="QuitOtherPrograms" xml:space="preserve">
<value>You must quit other applications like Steam, Uplay, NVIDIA IN-GAME before activating the 'Hide DS4 Controller' option.</value> <value>You must quit other applications like UWP apps (Netflix), Steam, Uplay, NVIDIA IN-GAME before activating the 'Hide DS4 Controller' option. For more info check https://github.com/Ryochan7/DS4Windows/wiki/Exclusive-Mode-(Hide-DS4-Controller-config-option)-tips-and-issues</value>
</data> </data>
<data name="rainbow" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="rainbow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\rainbow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\rainbow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>

View File

@ -1 +1 @@
1.6.12 1.6.13

View File

@ -92,3 +92,14 @@ be made during code review to try to tweak the changes in order to improve
application performance. However, there is a chance that a pull request will be application performance. However, there is a chance that a pull request will be
rejected if no reasonable solution can be found to incorporate code changes. rejected if no reasonable solution can be found to incorporate code changes.
## Tip Jar
If you would like to send some coin my way, here are some means by
which to do so.
**PayPal:** https://paypal.me/ryochan7
**Bitcoin:** 1DnMJwjdd7JRfHJap2mmTmADYm38SzR2z9
**Dogecoin:** D9fhbXp9bCHEhuS8vX1BmVu6t7Y2nVNUCK
**Litecoin:** La5mniW7SFMH2RhqDgUty3RwkBSYbjbnJ6
**Monero:** 49RvRMiMewaeez1Y2auxHmfMaAUYfhUpBem4ohzRJd9b5acPcxzh1icjnhZfjnYd1S7NQ57reQ7cP1swGre3rpfzUgJhEB7

View File

@ -1,10 +1,11 @@
# TODO # TODO
* Look into adding periodic rumble updates when data does not change * ~~Look into adding periodic rumble updates when data does not change~~
* ~~Look into newer version of HidGuardian~~ * ~~Look into newer version of HidGuardian~~
* Look into distributing profile properties around various objects * ~~Look into distributing profile properties around various objects
rather than using a lot of getters to obtain properties each poll. rather than using a lot of getters to obtain properties each poll.
It will complicate the architecture a little bit but hopefully It will complicate the architecture a little bit but hopefully
any speed difference will make up for it. any speed difference will make up for it.~~
* Remove old welcome dialog and make new driver installer executable. * Remove old welcome dialog and make new driver installer executable.
Use newer standards (WPF) and bundle app with DS4Windows Use newer standards (WPF) and bundle app with DS4Windows