Added analog stick deadzone, truly added trigger deadzones

This commit is contained in:
jays2kings 2014-05-21 17:42:25 -04:00
parent ac2498bdf2
commit 268defb6b9
6 changed files with 237 additions and 143 deletions

View File

@ -468,56 +468,56 @@ namespace DS4Control
case X360Controls.LXNeg: case X360Controls.LXNeg:
if (LXChanged) if (LXChanged)
{ {
MappedState.LX = getXYAxisMapping(customButton.Key, cState); MappedState.LX = getXYAxisMapping(customButton.Key, cState, device);
LX = true; LX = true;
} }
break; break;
case X360Controls.LYNeg: case X360Controls.LYNeg:
if (LYChanged) if (LYChanged)
{ {
MappedState.LY = getXYAxisMapping(customButton.Key, cState); MappedState.LY = getXYAxisMapping(customButton.Key, cState, device);
LY = true; LY = true;
} }
break; break;
case X360Controls.RXNeg: case X360Controls.RXNeg:
if (RXChanged) if (RXChanged)
{ {
MappedState.RX = getXYAxisMapping(customButton.Key, cState); MappedState.RX = getXYAxisMapping(customButton.Key, cState, device);
RX = true; RX = true;
} }
break; break;
case X360Controls.RYNeg: case X360Controls.RYNeg:
if (RYChanged) if (RYChanged)
{ {
MappedState.RY = getXYAxisMapping(customButton.Key, cState); MappedState.RY = getXYAxisMapping(customButton.Key, cState, device);
RY = true; RY = true;
} }
break; break;
case X360Controls.LXPos: case X360Controls.LXPos:
if (LXChanged) if (LXChanged)
{ {
MappedState.LX = getXYAxisMapping(customButton.Key, cState, true); MappedState.LX = getXYAxisMapping(customButton.Key, cState, device, true);
LX = true; LX = true;
} }
break; break;
case X360Controls.LYPos: case X360Controls.LYPos:
if (LYChanged) if (LYChanged)
{ {
MappedState.LY = getXYAxisMapping(customButton.Key, cState, true); MappedState.LY = getXYAxisMapping(customButton.Key, cState, device, true);
LY = true; LY = true;
} }
break; break;
case X360Controls.RXPos: case X360Controls.RXPos:
if (RXChanged) if (RXChanged)
{ {
MappedState.RX = getXYAxisMapping(customButton.Key, cState, true); MappedState.RX = getXYAxisMapping(customButton.Key, cState, device, true);
RX = true; RX = true;
} }
break; break;
case X360Controls.RYPos: case X360Controls.RYPos:
if (RYChanged) if (RYChanged)
{ {
MappedState.RY = getXYAxisMapping(customButton.Key, cState, true); MappedState.RY = getXYAxisMapping(customButton.Key, cState, device, true);
RY = true; RY = true;
} }
break; break;
@ -614,32 +614,32 @@ namespace DS4Control
switch (control) switch (control)
{ {
case DS4Controls.LXNeg: case DS4Controls.LXNeg:
axisVal = cState.LX; axisVal = (byte)cState.LX;
break; break;
case DS4Controls.LXPos: case DS4Controls.LXPos:
positive = true; positive = true;
axisVal = cState.LX; axisVal = (byte)cState.LX;
break; break;
case DS4Controls.RXNeg: case DS4Controls.RXNeg:
axisVal = cState.RX; axisVal = (byte)cState.RX;
break; break;
case DS4Controls.RXPos: case DS4Controls.RXPos:
positive = true; positive = true;
axisVal = cState.RX; axisVal = (byte)cState.RX;
break; break;
case DS4Controls.LYNeg: case DS4Controls.LYNeg:
axisVal = cState.LY; axisVal = (byte)cState.LY;
break; break;
case DS4Controls.LYPos: case DS4Controls.LYPos:
positive = true; positive = true;
axisVal = cState.LY; axisVal = (byte)cState.LY;
break; break;
case DS4Controls.RYNeg: case DS4Controls.RYNeg:
axisVal = cState.RY; axisVal = (byte)cState.RY;
break; break;
case DS4Controls.RYPos: case DS4Controls.RYPos:
positive = true; positive = true;
axisVal = cState.RY; axisVal = (byte)cState.RY;
break; break;
case DS4Controls.Share: axisVal = (byte)(cState.Share ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break; case DS4Controls.Share: axisVal = (byte)(cState.Share ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.Options: axisVal = (byte)(cState.Options ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break; case DS4Controls.Options: axisVal = (byte)(cState.Options ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
@ -656,8 +656,8 @@ namespace DS4Control
case DS4Controls.Square: axisVal = (byte)(cState.Square ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break; case DS4Controls.Square: axisVal = (byte)(cState.Square ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.Triangle: axisVal = (byte)(cState.Triangle ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break; case DS4Controls.Triangle: axisVal = (byte)(cState.Triangle ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.Circle: axisVal = (byte)(cState.Circle ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break; case DS4Controls.Circle: axisVal = (byte)(cState.Circle ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.L2: positive = true; axisVal = cState.L2; break; case DS4Controls.L2: positive = true; axisVal = (byte)cState.L2; break;
case DS4Controls.R2: positive = true; axisVal = cState.R2; break; case DS4Controls.R2: positive = true; axisVal = (byte)cState.R2; break;
} }
axisVal = axisVal - 127; axisVal = axisVal - 127;
int delta = 0; int delta = 0;
@ -678,6 +678,7 @@ namespace DS4Control
} }
static bool[] touchArea = { true, true, true, true }; static bool[] touchArea = { true, true, true, true };
public static byte getByteMapping(DS4Controls control, DS4State cState) public static byte getByteMapping(DS4Controls control, DS4State cState)
{ {
if (!cState.TouchButton) if (!cState.TouchButton)
@ -711,16 +712,16 @@ namespace DS4Control
case DS4Controls.Square: return (byte)(cState.Square ? 255 : 0); case DS4Controls.Square: return (byte)(cState.Square ? 255 : 0);
case DS4Controls.Triangle: return (byte)(cState.Triangle ? 255 : 0); case DS4Controls.Triangle: return (byte)(cState.Triangle ? 255 : 0);
case DS4Controls.Circle: return (byte)(cState.Circle ? 255 : 0); case DS4Controls.Circle: return (byte)(cState.Circle ? 255 : 0);
case DS4Controls.LXNeg: return cState.LX; case DS4Controls.LXNeg: return (byte)cState.LX;
case DS4Controls.LYNeg: return cState.LY; case DS4Controls.LYNeg: return (byte)cState.LY;
case DS4Controls.RXNeg: return cState.RX; case DS4Controls.RXNeg: return (byte)cState.RX;
case DS4Controls.RYNeg: return cState.RY; case DS4Controls.RYNeg: return (byte)cState.RY;
case DS4Controls.LXPos: return (byte)(cState.LX - 127 < 0 ? 0 : (cState.LX - 127)); case DS4Controls.LXPos: return (byte)(cState.LX - 127 < 0 ? 0 : (cState.LX - 127));
case DS4Controls.LYPos: return (byte)(cState.LY - 123 < 0 ? 0 : (cState.LY - 123)); case DS4Controls.LYPos: return (byte)(cState.LY - 123 < 0 ? 0 : (cState.LY - 123));
case DS4Controls.RXPos: return (byte)(cState.RX - 125 < 0 ? 0 : (cState.RX - 125)); case DS4Controls.RXPos: return (byte)(cState.RX - 129 < 0 ? 0 : (cState.RX - 125));
case DS4Controls.RYPos: return (byte)(cState.RY - 127 < 0 ? 0 : (cState.RY - 127)); case DS4Controls.RYPos: return (byte)(cState.RY - 125 < 0 ? 0 : (cState.RY - 127));
case DS4Controls.L2: return cState.L2; case DS4Controls.L2: return (byte)cState.L2;
case DS4Controls.R2: return cState.R2; case DS4Controls.R2: return (byte)cState.R2;
} }
if (cState.TouchButton) if (cState.TouchButton)
{ {
@ -772,14 +773,14 @@ namespace DS4Control
case DS4Controls.Square: return cState.Square; case DS4Controls.Square: return cState.Square;
case DS4Controls.Triangle: return cState.Triangle; case DS4Controls.Triangle: return cState.Triangle;
case DS4Controls.Circle: return cState.Circle; case DS4Controls.Circle: return cState.Circle;
case DS4Controls.LXNeg: return cState.LX < 55; case DS4Controls.LXNeg: return cState.LX < 127 - 55;
case DS4Controls.LYNeg: return cState.LY < 55; case DS4Controls.LYNeg: return cState.LY < 127 - 55;
case DS4Controls.RXNeg: return cState.RX < 55; case DS4Controls.RXNeg: return cState.RX < 127 - 55;
case DS4Controls.RYNeg: return cState.RY < 55; case DS4Controls.RYNeg: return cState.RY < 127 - 55;
case DS4Controls.LXPos: return cState.LX > 200; case DS4Controls.LXPos: return cState.LX > 127 + 55;
case DS4Controls.LYPos: return cState.LY > 200; case DS4Controls.LYPos: return cState.LY > 127 + 55;
case DS4Controls.RXPos: return cState.RX > 200; case DS4Controls.RXPos: return cState.RX > 127 + 55;
case DS4Controls.RYPos: return cState.RY > 200; case DS4Controls.RYPos: return cState.RY > 127 + 55;
case DS4Controls.L2: return cState.L2 > 100; case DS4Controls.L2: return cState.L2 > 100;
case DS4Controls.R2: return cState.R2 > 100; case DS4Controls.R2: return cState.R2 > 100;
@ -802,7 +803,7 @@ namespace DS4Control
return false; return false;
} }
public static byte getXYAxisMapping(DS4Controls control, DS4State cState, bool alt = false) public static byte getXYAxisMapping(DS4Controls control, DS4State cState, int ind, bool alt = false)
{ {
byte trueVal = 0; byte trueVal = 0;
byte falseVal = 127; byte falseVal = 127;
@ -853,9 +854,13 @@ namespace DS4Control
case DS4Controls.LYNeg: return cState.LY; case DS4Controls.LYNeg: return cState.LY;
case DS4Controls.RXNeg: return cState.RX; case DS4Controls.RXNeg: return cState.RX;
case DS4Controls.RYNeg: return cState.RY; case DS4Controls.RYNeg: return cState.RY;
//case DS4Controls.LXPos: return (byte)(cState.LX - 127 < Global.getLSDeadzone(ind) ? 0 : (255 - cState.LX));
//case DS4Controls.LYPos: return (byte)(cState.LY - 127 < Global.getLSDeadzone(ind) ? 0 : (255 - cState.LY));
case DS4Controls.RXPos: return (byte)(cState.RX - 127 < 55 ? 0 : (255 - cState.RX));
//case DS4Controls.RYPos: return (byte)(cState.RY - 127 < Global.getRSDeadzone(ind) ? 0 : (255 - cState.RY));
case DS4Controls.LXPos: return (byte)(255 - cState.LX); case DS4Controls.LXPos: return (byte)(255 - cState.LX);
case DS4Controls.LYPos: return (byte)(255 - cState.LY); case DS4Controls.LYPos: return (byte)(255 - cState.LY);
case DS4Controls.RXPos: return (byte)(255 - cState.RX); //case DS4Controls.RXPos: return (byte)(255 - cState.RX);
case DS4Controls.RYPos: return (byte)(255 - cState.RY); case DS4Controls.RYPos: return (byte)(255 - cState.RY);
} }
} }
@ -865,7 +870,7 @@ namespace DS4Control
{ {
case DS4Controls.LXNeg: return (byte)(255 - cState.LX); case DS4Controls.LXNeg: return (byte)(255 - cState.LX);
case DS4Controls.LYNeg: return (byte)(255 - cState.LY); case DS4Controls.LYNeg: return (byte)(255 - cState.LY);
case DS4Controls.RXNeg: return (byte)(255 - cState.RX); case DS4Controls.RXNeg: return (byte)(cState.RX > 55 ? 0 : (255 - cState.RX));
case DS4Controls.RYNeg: return (byte)(255 - cState.RY); case DS4Controls.RYNeg: return (byte)(255 - cState.RY);
case DS4Controls.LXPos: return cState.LX; case DS4Controls.LXPos: return cState.LX;
case DS4Controls.LYPos: return cState.LY; case DS4Controls.LYPos: return cState.LY;

View File

@ -294,19 +294,34 @@ namespace DS4Control
{ {
return m_Config.m_LeftTriggerMiddle[device]; return m_Config.m_LeftTriggerMiddle[device];
} }
public static void setLeftTriggerMiddle(int device, double value) public static void setLeftTriggerMiddle(int device, byte value)
{ {
m_Config.m_LeftTriggerMiddle[device] = value; m_Config.m_LeftTriggerMiddle[device] = value;
} }
public static double getRightTriggerMiddle(int device) public static double getRightTriggerMiddle(int device)
{ {
return m_Config.m_RightTriggerMiddle[device]; return m_Config.m_RightTriggerMiddle[device];
} }
public static void setRightTriggerMiddle(int device, double value) public static void setRightTriggerMiddle(int device, byte value)
{ {
m_Config.m_RightTriggerMiddle[device] = value; m_Config.m_RightTriggerMiddle[device] = value;
} }
public static byte getLSDeadzone(int device)
{
return m_Config.LSDeadzone[device];
}
public static void setLSDeadzone(int device, byte value)
{
m_Config.LSDeadzone[device] = value;
}
public static byte getRSDeadzone(int device)
{
return m_Config.RSDeadzone[device];
}
public static void setRSDeadzone(int device, byte value)
{
m_Config.RSDeadzone[device] = value;
}
public static void setAProfile(int device, string filepath) public static void setAProfile(int device, string filepath)
{ {
m_Config.profilePath[device] = Global.appdatapath + @"\Profiles\" + filepath + ".xml"; m_Config.profilePath[device] = Global.appdatapath + @"\Profiles\" + filepath + ".xml";
@ -400,11 +415,12 @@ namespace DS4Control
public Boolean[] lowerRCOn = { false, false, false, false }; public Boolean[] lowerRCOn = { false, false, false, false };
public Boolean[] ledAsBattery = { false, false, false, false }; public Boolean[] ledAsBattery = { false, false, false, false };
public Boolean[] flashLedLowBattery = { false, false, false, false }; public Boolean[] flashLedLowBattery = { false, false, false, false };
public double[] m_LeftTriggerMiddle = { 0.5, 0.5, 0.5, 0.5 }, m_RightTriggerMiddle = { 0.5, 0.5, 0.5, 0.5 }; public Byte[] m_LeftTriggerMiddle = { 0, 0, 0, 0 }, m_RightTriggerMiddle = { 0, 0, 0, 0 };
public String[] profilePath = { String.Empty, String.Empty, String.Empty, String.Empty }; public String[] profilePath = { String.Empty, String.Empty, String.Empty, String.Empty };
public Byte[] m_Rumble = { 100, 100, 100, 100 }; public Byte[] m_Rumble = { 100, 100, 100, 100 };
public Byte[] touchSensitivity = { 100, 100, 100, 100 }; public Byte[] touchSensitivity = { 100, 100, 100, 100 };
public Byte[] tapSensitivity = {0, 0, 0, 0}; public Byte[] LSDeadzone = { 0, 0, 0, 0 }, RSDeadzone = { 0, 0, 0, 0 };
public Byte[] tapSensitivity = { 0, 0, 0, 0 };
public bool[] doubleTap = { false, false, false, false }; public bool[] doubleTap = { false, false, false, false };
public int[] scrollSensitivity = { 0, 0, 0, 0 }; public int[] scrollSensitivity = { 0, 0, 0, 0 };
public double[] rainbow = { 0, 0, 0, 0 }; public double[] rainbow = { 0, 0, 0, 0 };
@ -437,14 +453,12 @@ namespace DS4Control
public BackingStore() public BackingStore()
{ {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{
{ {
customMapKeyTypes[i] = new Dictionary<DS4Controls, DS4KeyType>(); customMapKeyTypes[i] = new Dictionary<DS4Controls, DS4KeyType>();
customMapKeys[i] = new Dictionary<DS4Controls, UInt16>(); customMapKeys[i] = new Dictionary<DS4Controls, UInt16>();
customMapButtons[i] = new Dictionary<DS4Controls, X360Controls>(); customMapButtons[i] = new Dictionary<DS4Controls, X360Controls>();
} }
} }
}
public X360Controls GetCustomButton(int device, DS4Controls controlName) public X360Controls GetCustomButton(int device, DS4Controls controlName)
{ {
@ -508,6 +522,8 @@ namespace DS4Control
XmlNode xmlRightTriggerMiddle = m_Xdoc.CreateNode(XmlNodeType.Element, "RightTriggerMiddle", null); xmlRightTriggerMiddle.InnerText = m_RightTriggerMiddle[device].ToString(); Node.AppendChild(xmlRightTriggerMiddle); XmlNode xmlRightTriggerMiddle = m_Xdoc.CreateNode(XmlNodeType.Element, "RightTriggerMiddle", null); xmlRightTriggerMiddle.InnerText = m_RightTriggerMiddle[device].ToString(); Node.AppendChild(xmlRightTriggerMiddle);
XmlNode xmlButtonMouseSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "ButtonMouseSensitivity", null); xmlButtonMouseSensitivity.InnerText = buttonMouseSensitivity[device].ToString(); Node.AppendChild(xmlButtonMouseSensitivity); XmlNode xmlButtonMouseSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "ButtonMouseSensitivity", null); xmlButtonMouseSensitivity.InnerText = buttonMouseSensitivity[device].ToString(); Node.AppendChild(xmlButtonMouseSensitivity);
XmlNode xmlRainbow = m_Xdoc.CreateNode(XmlNodeType.Element, "Rainbow", null); xmlRainbow.InnerText = rainbow[device].ToString(); Node.AppendChild(xmlRainbow); XmlNode xmlRainbow = m_Xdoc.CreateNode(XmlNodeType.Element, "Rainbow", null); xmlRainbow.InnerText = rainbow[device].ToString(); Node.AppendChild(xmlRainbow);
XmlNode xmlLSD = m_Xdoc.CreateNode(XmlNodeType.Element, "LSDeadZone", null); xmlLSD.InnerText = LSDeadzone[device].ToString(); Node.AppendChild(xmlLSD);
XmlNode xmlRSD = m_Xdoc.CreateNode(XmlNodeType.Element, "RSDeadZone", null); xmlRSD.InnerText = RSDeadzone[device].ToString(); Node.AppendChild(xmlRSD);
XmlNode NodeControl = m_Xdoc.CreateNode(XmlNodeType.Element, "Control", null); XmlNode NodeControl = m_Xdoc.CreateNode(XmlNodeType.Element, "Control", null);
@ -714,14 +730,18 @@ namespace DS4Control
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/scrollSensitivity"); Int32.TryParse(Item.InnerText, out scrollSensitivity[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/scrollSensitivity"); Int32.TryParse(Item.InnerText, out scrollSensitivity[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LeftTriggerMiddle"); Double.TryParse(Item.InnerText, out m_LeftTriggerMiddle[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LeftTriggerMiddle"); Byte.TryParse(Item.InnerText, out m_LeftTriggerMiddle[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RightTriggerMiddle"); Double.TryParse(Item.InnerText, out m_RightTriggerMiddle[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RightTriggerMiddle"); Byte.TryParse(Item.InnerText, out m_RightTriggerMiddle[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ButtonMouseSensitivity"); Int32.TryParse(Item.InnerText, out buttonMouseSensitivity[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ButtonMouseSensitivity"); Int32.TryParse(Item.InnerText, out buttonMouseSensitivity[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Rainbow"); Double.TryParse(Item.InnerText, out rainbow[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Rainbow"); Double.TryParse(Item.InnerText, out rainbow[device]); }
catch { rainbow[device] = 0; missingSetting = true; } catch { rainbow[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LSDeadZone"); Byte.TryParse(Item.InnerText, out LSDeadzone[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RSDeadZone"); Byte.TryParse(Item.InnerText, out RSDeadzone[device]); }
catch { missingSetting = true; }
DS4KeyType keyType; DS4KeyType keyType;
UInt16 wvk; UInt16 wvk;
@ -859,14 +879,18 @@ namespace DS4Control
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/scrollSensitivity"); Int32.TryParse(Item.InnerText, out scrollSensitivity[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/scrollSensitivity"); Int32.TryParse(Item.InnerText, out scrollSensitivity[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LeftTriggerMiddle"); Double.TryParse(Item.InnerText, out m_LeftTriggerMiddle[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LeftTriggerMiddle"); Byte.TryParse(Item.InnerText, out m_LeftTriggerMiddle[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RightTriggerMiddle"); Double.TryParse(Item.InnerText, out m_RightTriggerMiddle[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RightTriggerMiddle"); Byte.TryParse(Item.InnerText, out m_RightTriggerMiddle[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ButtonMouseSensitivity"); Int32.TryParse(Item.InnerText, out buttonMouseSensitivity[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ButtonMouseSensitivity"); Int32.TryParse(Item.InnerText, out buttonMouseSensitivity[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Rainbow"); Double.TryParse(Item.InnerText, out rainbow[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Rainbow"); Double.TryParse(Item.InnerText, out rainbow[device]); }
catch { rainbow[device] = 0; missingSetting = true; } catch { rainbow[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LSDeadZone"); Byte.TryParse(Item.InnerText, out LSDeadzone[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RSDeadZone"); Byte.TryParse(Item.InnerText, out RSDeadzone[device]); }
catch { missingSetting = true; }
DS4KeyType keyType; DS4KeyType keyType;
UInt16 wvk; UInt16 wvk;

View File

@ -129,26 +129,37 @@ namespace DS4Control
if (state.PS) Output[11] |= (Byte)(1 << 2); // Guide if (state.PS) Output[11] |= (Byte)(1 << 2); // Guide
if (state.L2 > Global.getLeftTriggerMiddle(device))
Output[12] = state.L2; // Left Trigger Output[12] = state.L2; // Left Trigger
if (state.R2 > Global.getRightTriggerMiddle(device))
Output[13] = state.R2; // Right Trigger Output[13] = state.R2; // Right Trigger
Int32 ThumbLX = Scale(state.LX, false); Int32 ThumbLX = Scale(state.LX, false);
Int32 ThumbLY = -Scale(state.LY, false); Int32 ThumbLY = -Scale(state.LY, false);
Int32 ThumbRX = Scale(state.RX, false); Int32 ThumbRX = Scale(state.RX, false);
Int32 ThumbRY = -Scale(state.RY, false); Int32 ThumbRY = -Scale(state.RY, false);
if (state.LX > 127 + Global.getLSDeadzone(device) || state.LX < 127 - Global.getLSDeadzone(device))
{
Output[14] = (Byte)((ThumbLX >> 0) & 0xFF); // LX Output[14] = (Byte)((ThumbLX >> 0) & 0xFF); // LX
Output[15] = (Byte)((ThumbLX >> 8) & 0xFF); Output[15] = (Byte)((ThumbLX >> 8) & 0xFF);
}
if (state.LY > 127 + Global.getLSDeadzone(device) || state.LY < 127 - Global.getLSDeadzone(device))
{
Output[16] = (Byte)((ThumbLY >> 0) & 0xFF); // LY Output[16] = (Byte)((ThumbLY >> 0) & 0xFF); // LY
Output[17] = (Byte)((ThumbLY >> 8) & 0xFF); Output[17] = (Byte)((ThumbLY >> 8) & 0xFF);
}
if (state.RX > 127 + Global.getRSDeadzone(device) || state.RX < 127 - Global.getRSDeadzone(device))
{
Output[18] = (Byte)((ThumbRX >> 0) & 0xFF); // RX Output[18] = (Byte)((ThumbRX >> 0) & 0xFF); // RX
Output[19] = (Byte)((ThumbRX >> 8) & 0xFF); Output[19] = (Byte)((ThumbRX >> 8) & 0xFF);
}
if (state.LY > 127 + Global.getLSDeadzone(device) || state.RY < 127 - Global.getRSDeadzone(device))
{
Output[20] = (Byte)((ThumbRY >> 0) & 0xFF); // RY Output[20] = (Byte)((ThumbRY >> 0) & 0xFF); // RY
Output[21] = (Byte)((ThumbRY >> 8) & 0xFF); Output[21] = (Byte)((ThumbRY >> 8) & 0xFF);
} }
}
public Boolean Plugin(Int32 Serial) public Boolean Plugin(Int32 Serial)
{ {

View File

@ -134,6 +134,10 @@
this.tBProfile = new System.Windows.Forms.TextBox(); this.tBProfile = new System.Windows.Forms.TextBox();
this.btnSaveProfile = new System.Windows.Forms.Button(); this.btnSaveProfile = new System.Windows.Forms.Button();
this.lBSeperator = new System.Windows.Forms.Label(); this.lBSeperator = new System.Windows.Forms.Label();
this.numUDLS = new System.Windows.Forms.NumericUpDown();
this.lbRS = new System.Windows.Forms.Label();
this.lbLS = new System.Windows.Forms.Label();
this.numUDRS = new System.Windows.Forms.NumericUpDown();
this.advColorDialog = new ScpServer.AdvancedColorDialog(); this.advColorDialog = new ScpServer.AdvancedColorDialog();
this.MainPanel.SuspendLayout(); this.MainPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pBController)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pBController)).BeginInit();
@ -167,6 +171,8 @@
this.lowBatteryPanel.SuspendLayout(); this.lowBatteryPanel.SuspendLayout();
this.LightbarPanel.SuspendLayout(); this.LightbarPanel.SuspendLayout();
this.SixaxisPanel.SuspendLayout(); this.SixaxisPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numUDLS)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numUDRS)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// bnTouchUpper // bnTouchUpper
@ -912,7 +918,7 @@
"Right Stick Right :"}); "Right Stick Right :"});
this.lBControls.Location = new System.Drawing.Point(258, 42); this.lBControls.Location = new System.Drawing.Point(258, 42);
this.lBControls.Name = "lBControls"; this.lBControls.Name = "lBControls";
this.lBControls.Size = new System.Drawing.Size(169, 173); this.lBControls.Size = new System.Drawing.Size(169, 160);
this.lBControls.TabIndex = 180; this.lBControls.TabIndex = 180;
this.lBControls.DoubleClick += new System.EventHandler(this.Show_ControlsList); this.lBControls.DoubleClick += new System.EventHandler(this.Show_ControlsList);
this.lBControls.KeyDown += new System.Windows.Forms.KeyEventHandler(this.List_KeyDown); this.lBControls.KeyDown += new System.Windows.Forms.KeyEventHandler(this.List_KeyDown);
@ -963,7 +969,7 @@
this.flashLed.TabIndex = 163; this.flashLed.TabIndex = 163;
this.flashLed.Text = "Battery Level Flash"; this.flashLed.Text = "Battery Level Flash";
this.flashLed.UseVisualStyleBackColor = true; this.flashLed.UseVisualStyleBackColor = true;
this.flashLed.CheckedChanged += new System.EventHandler(this.flashLed_CheckedChanged); this.flashLed.CheckedChanged += new System.EventHandler(this.flashWhenLowBattery_CheckedChanged);
// //
// blueBar // blueBar
// //
@ -991,7 +997,6 @@
this.greenBar.TickFrequency = 25; this.greenBar.TickFrequency = 25;
this.greenBar.TickStyle = System.Windows.Forms.TickStyle.None; this.greenBar.TickStyle = System.Windows.Forms.TickStyle.None;
this.greenBar.Value = 255; this.greenBar.Value = 255;
this.greenBar.Scroll += new System.EventHandler(this.greenBar_Scroll);
this.greenBar.ValueChanged += new System.EventHandler(this.greenBar_ValueChanged); this.greenBar.ValueChanged += new System.EventHandler(this.greenBar_ValueChanged);
// //
// redBar // redBar
@ -1086,14 +1091,14 @@
// //
// numUDTap // numUDTap
// //
this.numUDTap.Location = new System.Drawing.Point(322, 346); this.numUDTap.Location = new System.Drawing.Point(328, 345);
this.numUDTap.Maximum = new decimal(new int[] { this.numUDTap.Maximum = new decimal(new int[] {
200, 200,
0, 0,
0, 0,
0}); 0});
this.numUDTap.Name = "numUDTap"; this.numUDTap.Name = "numUDTap";
this.numUDTap.Size = new System.Drawing.Size(45, 20); this.numUDTap.Size = new System.Drawing.Size(38, 20);
this.numUDTap.TabIndex = 227; this.numUDTap.TabIndex = 227;
this.numUDTap.Value = new decimal(new int[] { this.numUDTap.Value = new decimal(new int[] {
100, 100,
@ -1165,14 +1170,14 @@
// //
// numUDTouch // numUDTouch
// //
this.numUDTouch.Location = new System.Drawing.Point(127, 345); this.numUDTouch.Location = new System.Drawing.Point(126, 345);
this.numUDTouch.Maximum = new decimal(new int[] { this.numUDTouch.Maximum = new decimal(new int[] {
150, 150,
0, 0,
0, 0,
0}); 0});
this.numUDTouch.Name = "numUDTouch"; this.numUDTouch.Name = "numUDTouch";
this.numUDTouch.Size = new System.Drawing.Size(39, 20); this.numUDTouch.Size = new System.Drawing.Size(38, 20);
this.numUDTouch.TabIndex = 229; this.numUDTouch.TabIndex = 229;
this.numUDTouch.Value = new decimal(new int[] { this.numUDTouch.Value = new decimal(new int[] {
100, 100,
@ -1197,7 +1202,7 @@
this.cBlowerRCOn.AutoSize = true; this.cBlowerRCOn.AutoSize = true;
this.cBlowerRCOn.Checked = true; this.cBlowerRCOn.Checked = true;
this.cBlowerRCOn.CheckState = System.Windows.Forms.CheckState.Checked; this.cBlowerRCOn.CheckState = System.Windows.Forms.CheckState.Checked;
this.cBlowerRCOn.Location = new System.Drawing.Point(312, 288); this.cBlowerRCOn.Location = new System.Drawing.Point(312, 210);
this.cBlowerRCOn.Name = "cBlowerRCOn"; this.cBlowerRCOn.Name = "cBlowerRCOn";
this.cBlowerRCOn.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.cBlowerRCOn.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cBlowerRCOn.Size = new System.Drawing.Size(116, 17); this.cBlowerRCOn.Size = new System.Drawing.Size(116, 17);
@ -1209,12 +1214,12 @@
// touchpadJitterCompensation // touchpadJitterCompensation
// //
this.touchpadJitterCompensation.AutoSize = true; this.touchpadJitterCompensation.AutoSize = true;
this.touchpadJitterCompensation.Location = new System.Drawing.Point(328, 255); this.touchpadJitterCompensation.Location = new System.Drawing.Point(310, 256);
this.touchpadJitterCompensation.Name = "touchpadJitterCompensation"; this.touchpadJitterCompensation.Name = "touchpadJitterCompensation";
this.touchpadJitterCompensation.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.touchpadJitterCompensation.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.touchpadJitterCompensation.Size = new System.Drawing.Size(100, 30); this.touchpadJitterCompensation.Size = new System.Drawing.Size(118, 17);
this.touchpadJitterCompensation.TabIndex = 224; this.touchpadJitterCompensation.TabIndex = 224;
this.touchpadJitterCompensation.Text = "Touchpad Jitter\r\nCompensation"; this.touchpadJitterCompensation.Text = "Jitter Compensation";
this.touchpadJitterCompensation.UseVisualStyleBackColor = true; this.touchpadJitterCompensation.UseVisualStyleBackColor = true;
this.touchpadJitterCompensation.CheckedChanged += new System.EventHandler(this.touchpadJitterCompensation_CheckedChanged); this.touchpadJitterCompensation.CheckedChanged += new System.EventHandler(this.touchpadJitterCompensation_CheckedChanged);
// //
@ -1224,9 +1229,9 @@
this.lbThreshold.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbThreshold.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbThreshold.Location = new System.Drawing.Point(11, 281); this.lbThreshold.Location = new System.Drawing.Point(11, 281);
this.lbThreshold.Name = "lbThreshold"; this.lbThreshold.Name = "lbThreshold";
this.lbThreshold.Size = new System.Drawing.Size(57, 13); this.lbThreshold.Size = new System.Drawing.Size(59, 13);
this.lbThreshold.TabIndex = 195; this.lbThreshold.TabIndex = 195;
this.lbThreshold.Text = "Threshold:"; this.lbThreshold.Text = "Deadzone:";
// //
// lBL2 // lBL2
// //
@ -1269,52 +1274,52 @@
// //
this.idleDisconnectTimeout.Location = new System.Drawing.Point(114, 247); this.idleDisconnectTimeout.Location = new System.Drawing.Point(114, 247);
this.idleDisconnectTimeout.Maximum = new decimal(new int[] { this.idleDisconnectTimeout.Maximum = new decimal(new int[] {
3600, 60,
0, 0,
0, 0,
0}); 0});
this.idleDisconnectTimeout.Name = "idleDisconnectTimeout"; this.idleDisconnectTimeout.Name = "idleDisconnectTimeout";
this.idleDisconnectTimeout.Size = new System.Drawing.Size(52, 20); this.idleDisconnectTimeout.Size = new System.Drawing.Size(50, 20);
this.idleDisconnectTimeout.TabIndex = 201; this.idleDisconnectTimeout.TabIndex = 201;
this.idleDisconnectTimeout.ValueChanged += new System.EventHandler(this.idleDisconnectTimeout_ValueChanged); this.idleDisconnectTimeout.ValueChanged += new System.EventHandler(this.idleDisconnectTimeout_ValueChanged);
// //
// numUDR2 // numUDR2
// //
this.numUDR2.DecimalPlaces = 1; this.numUDR2.DecimalPlaces = 2;
this.numUDR2.Increment = new decimal(new int[] {
1,
0,
0,
65536});
this.numUDR2.Location = new System.Drawing.Point(210, 279); this.numUDR2.Location = new System.Drawing.Point(210, 279);
this.numUDR2.Maximum = new decimal(new int[] { this.numUDR2.Maximum = new decimal(new int[] {
255, 1,
0, 0,
0, 0,
0}); 0});
this.numUDR2.Name = "numUDR2"; this.numUDR2.Name = "numUDR2";
this.numUDR2.Size = new System.Drawing.Size(52, 20); this.numUDR2.Size = new System.Drawing.Size(50, 20);
this.numUDR2.TabIndex = 202; this.numUDR2.TabIndex = 202;
this.numUDR2.Value = new decimal(new int[] {
5,
0,
0,
65536});
this.numUDR2.ValueChanged += new System.EventHandler(this.numUDR2_ValueChanged); this.numUDR2.ValueChanged += new System.EventHandler(this.numUDR2_ValueChanged);
// //
// numUDL2 // numUDL2
// //
this.numUDL2.DecimalPlaces = 1; this.numUDL2.DecimalPlaces = 2;
this.numUDL2.Increment = new decimal(new int[] {
1,
0,
0,
65536});
this.numUDL2.Location = new System.Drawing.Point(114, 279); this.numUDL2.Location = new System.Drawing.Point(114, 279);
this.numUDL2.Maximum = new decimal(new int[] { this.numUDL2.Maximum = new decimal(new int[] {
255, 1,
0, 0,
0, 0,
0}); 0});
this.numUDL2.Name = "numUDL2"; this.numUDL2.Name = "numUDL2";
this.numUDL2.RightToLeft = System.Windows.Forms.RightToLeft.No; this.numUDL2.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.numUDL2.Size = new System.Drawing.Size(52, 20); this.numUDL2.Size = new System.Drawing.Size(50, 20);
this.numUDL2.TabIndex = 203; this.numUDL2.TabIndex = 203;
this.numUDL2.Value = new decimal(new int[] {
5,
0,
0,
65536});
this.numUDL2.ValueChanged += new System.EventHandler(this.numUDL2_ValueChanged); this.numUDL2.ValueChanged += new System.EventHandler(this.numUDL2_ValueChanged);
// //
// tBsixaxisAccelZ // tBsixaxisAccelZ
@ -1344,12 +1349,12 @@
this.flushHIDQueue.AccessibleName = "flushHIDQueue"; this.flushHIDQueue.AccessibleName = "flushHIDQueue";
this.flushHIDQueue.AutoSize = true; this.flushHIDQueue.AutoSize = true;
this.flushHIDQueue.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.flushHIDQueue.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.flushHIDQueue.Location = new System.Drawing.Point(316, 219); this.flushHIDQueue.Location = new System.Drawing.Point(322, 233);
this.flushHIDQueue.Name = "flushHIDQueue"; this.flushHIDQueue.Name = "flushHIDQueue";
this.flushHIDQueue.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.flushHIDQueue.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.flushHIDQueue.Size = new System.Drawing.Size(112, 30); this.flushHIDQueue.Size = new System.Drawing.Size(106, 17);
this.flushHIDQueue.TabIndex = 198; this.flushHIDQueue.TabIndex = 198;
this.flushHIDQueue.Text = "Flush HID queue\r\nafter each reading\r\n"; this.flushHIDQueue.Text = "Flush HID queue";
this.flushHIDQueue.UseVisualStyleBackColor = true; this.flushHIDQueue.UseVisualStyleBackColor = true;
this.flushHIDQueue.CheckedChanged += new System.EventHandler(this.flushHIDQueue_CheckedChanged); this.flushHIDQueue.CheckedChanged += new System.EventHandler(this.flushHIDQueue_CheckedChanged);
// //
@ -1464,7 +1469,7 @@
0, 0,
0}); 0});
this.rumbleBoostBar.Name = "rumbleBoostBar"; this.rumbleBoostBar.Name = "rumbleBoostBar";
this.rumbleBoostBar.Size = new System.Drawing.Size(52, 20); this.rumbleBoostBar.Size = new System.Drawing.Size(50, 20);
this.rumbleBoostBar.TabIndex = 211; this.rumbleBoostBar.TabIndex = 211;
this.rumbleBoostBar.Value = new decimal(new int[] { this.rumbleBoostBar.Value = new decimal(new int[] {
100, 100,
@ -1605,7 +1610,6 @@
this.lowGreenBar.TickFrequency = 25; this.lowGreenBar.TickFrequency = 25;
this.lowGreenBar.TickStyle = System.Windows.Forms.TickStyle.None; this.lowGreenBar.TickStyle = System.Windows.Forms.TickStyle.None;
this.lowGreenBar.Value = 255; this.lowGreenBar.Value = 255;
this.lowGreenBar.Scroll += new System.EventHandler(this.greenBar_Scroll);
this.lowGreenBar.ValueChanged += new System.EventHandler(this.lowGreenBar_ValueChanged); this.lowGreenBar.ValueChanged += new System.EventHandler(this.lowGreenBar_ValueChanged);
// //
// lowBlueBar // lowBlueBar
@ -1706,7 +1710,6 @@
this.tBProfile.Size = new System.Drawing.Size(269, 20); this.tBProfile.Size = new System.Drawing.Size(269, 20);
this.tBProfile.TabIndex = 238; this.tBProfile.TabIndex = 238;
this.tBProfile.Text = "<type profile name here>"; this.tBProfile.Text = "<type profile name here>";
this.tBProfile.Click += new System.EventHandler(this.tBProfile_Click);
this.tBProfile.TextChanged += new System.EventHandler(this.tBProfile_TextChanged); this.tBProfile.TextChanged += new System.EventHandler(this.tBProfile_TextChanged);
this.tBProfile.Enter += new System.EventHandler(this.tBProfile_Enter); this.tBProfile.Enter += new System.EventHandler(this.tBProfile_Enter);
this.tBProfile.Leave += new System.EventHandler(this.tBProfile_Leave); this.tBProfile.Leave += new System.EventHandler(this.tBProfile_Leave);
@ -1732,6 +1735,64 @@
this.lBSeperator.TabIndex = 240; this.lBSeperator.TabIndex = 240;
this.lBSeperator.Text = "_______________________________________________________________________"; this.lBSeperator.Text = "_______________________________________________________________________";
// //
// numUDLS
//
this.numUDLS.DecimalPlaces = 2;
this.numUDLS.Increment = new decimal(new int[] {
1,
0,
0,
65536});
this.numUDLS.Location = new System.Drawing.Point(297, 279);
this.numUDLS.Maximum = new decimal(new int[] {
1,
0,
0,
0});
this.numUDLS.Name = "numUDLS";
this.numUDLS.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.numUDLS.Size = new System.Drawing.Size(50, 20);
this.numUDLS.TabIndex = 203;
this.numUDLS.ValueChanged += new System.EventHandler(this.numUDLS_ValueChanged);
//
// lbRS
//
this.lbRS.AutoSize = true;
this.lbRS.Location = new System.Drawing.Point(349, 281);
this.lbRS.Name = "lbRS";
this.lbRS.Size = new System.Drawing.Size(22, 13);
this.lbRS.TabIndex = 197;
this.lbRS.Text = "RS";
//
// lbLS
//
this.lbLS.AutoSize = true;
this.lbLS.Location = new System.Drawing.Point(271, 281);
this.lbLS.Name = "lbLS";
this.lbLS.Size = new System.Drawing.Size(20, 13);
this.lbLS.TabIndex = 196;
this.lbLS.Text = "LS";
//
// numUDRS
//
this.numUDRS.DecimalPlaces = 2;
this.numUDRS.Increment = new decimal(new int[] {
1,
0,
0,
65536});
this.numUDRS.Location = new System.Drawing.Point(378, 279);
this.numUDRS.Maximum = new decimal(new int[] {
1,
0,
0,
0});
this.numUDRS.Name = "numUDRS";
this.numUDRS.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.numUDRS.Size = new System.Drawing.Size(50, 20);
this.numUDRS.TabIndex = 203;
this.numUDRS.ValueChanged += new System.EventHandler(this.numUDRS_ValueChanged);
//
// advColorDialog // advColorDialog
// //
this.advColorDialog.AnyColor = true; this.advColorDialog.AnyColor = true;
@ -1761,11 +1822,15 @@
this.Controls.Add(this.cBlowerRCOn); this.Controls.Add(this.cBlowerRCOn);
this.Controls.Add(this.touchpadJitterCompensation); this.Controls.Add(this.touchpadJitterCompensation);
this.Controls.Add(this.lbThreshold); this.Controls.Add(this.lbThreshold);
this.Controls.Add(this.lbLS);
this.Controls.Add(this.lBL2); this.Controls.Add(this.lBL2);
this.Controls.Add(this.lbRS);
this.Controls.Add(this.lBR2); this.Controls.Add(this.lBR2);
this.Controls.Add(this.lBControllerOff); this.Controls.Add(this.lBControllerOff);
this.Controls.Add(this.lBIdleMinutes); this.Controls.Add(this.lBIdleMinutes);
this.Controls.Add(this.idleDisconnectTimeout); this.Controls.Add(this.idleDisconnectTimeout);
this.Controls.Add(this.numUDRS);
this.Controls.Add(this.numUDLS);
this.Controls.Add(this.numUDR2); this.Controls.Add(this.numUDR2);
this.Controls.Add(this.numUDL2); this.Controls.Add(this.numUDL2);
this.Controls.Add(this.lBMouseSens); this.Controls.Add(this.lBMouseSens);
@ -1793,7 +1858,6 @@
this.Name = "Options"; this.Name = "Options";
this.Text = "Options"; this.Text = "Options";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Options_Closed); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Options_Closed);
this.Resize += new System.EventHandler(this.Options_Resize);
this.MainPanel.ResumeLayout(false); this.MainPanel.ResumeLayout(false);
this.MainPanel.PerformLayout(); this.MainPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pBController)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pBController)).EndInit();
@ -1832,6 +1896,8 @@
this.LightbarPanel.PerformLayout(); this.LightbarPanel.PerformLayout();
this.SixaxisPanel.ResumeLayout(false); this.SixaxisPanel.ResumeLayout(false);
this.SixaxisPanel.PerformLayout(); this.SixaxisPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numUDLS)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numUDRS)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -1947,6 +2013,10 @@
private System.Windows.Forms.Button btnSaveProfile; private System.Windows.Forms.Button btnSaveProfile;
private System.Windows.Forms.Label lBSeperator; private System.Windows.Forms.Label lBSeperator;
private System.Windows.Forms.Label lBControlTip; private System.Windows.Forms.Label lBControlTip;
private System.Windows.Forms.NumericUpDown numUDLS;
private System.Windows.Forms.Label lbRS;
private System.Windows.Forms.Label lbLS;
private System.Windows.Forms.NumericUpDown numUDRS;
} }
} }
 

View File

@ -50,8 +50,8 @@ namespace ScpServer
numUDTap.Value = Global.getTapSensitivity(device); numUDTap.Value = Global.getTapSensitivity(device);
cBTap.Checked = Global.getTap(device); cBTap.Checked = Global.getTap(device);
cBDoubleTap.Checked = Global.getDoubleTap(device); cBDoubleTap.Checked = Global.getDoubleTap(device);
numUDL2.Value = (decimal)Global.getLeftTriggerMiddle(device); numUDL2.Value = (decimal)Global.getLeftTriggerMiddle(device)/255;
numUDL2.Value = (decimal)Global.getRightTriggerMiddle(device); numUDR2.Value = (decimal)Global.getRightTriggerMiddle(device)/255;
touchpadJitterCompensation.Checked = Global.getTouchpadJitterCompensation(device); touchpadJitterCompensation.Checked = Global.getTouchpadJitterCompensation(device);
cBlowerRCOn.Checked = Global.getLowerRCOn(device); cBlowerRCOn.Checked = Global.getLowerRCOn(device);
flushHIDQueue.Checked = Global.getFlushHIDQueue(device); flushHIDQueue.Checked = Global.getFlushHIDQueue(device);
@ -79,7 +79,8 @@ namespace ScpServer
pBRainbow.Image = colored; pBRainbow.Image = colored;
ToggleRainbow(true); ToggleRainbow(true);
} }
numUDLS.Value = (decimal)Global.getLSDeadzone(device) / 127;
numUDRS.Value = (decimal)Global.getRSDeadzone(device) / 127;
} }
else else
Set(); Set();
@ -118,6 +119,7 @@ namespace ScpServer
tp.SetToolTip(cBDoubleTap, "Tap and hold to drag, slight delay with one tap"); tp.SetToolTip(cBDoubleTap, "Tap and hold to drag, slight delay with one tap");
tp.SetToolTip(btnLightbar, "Click to change color"); tp.SetToolTip(btnLightbar, "Click to change color");
tp.SetToolTip(lBControlTip, "You can also use your controller to change controls"); tp.SetToolTip(lBControlTip, "You can also use your controller to change controls");
tp.SetToolTip(touchpadJitterCompensation, "Use Sixaxis to help calulate touchpad movement");
advColorDialog.OnUpdateColor += advColorDialog_OnUpdateColor; advColorDialog.OnUpdateColor += advColorDialog_OnUpdateColor;
btnLeftStick.Enter += btnSticks_Enter; btnLeftStick.Enter += btnSticks_Enter;
btnRightStick.Enter += btnSticks_Enter; btnRightStick.Enter += btnSticks_Enter;
@ -214,9 +216,10 @@ namespace ScpServer
{ {
Global.saveColor(device, (byte)redBar.Value, (byte)greenBar.Value, (byte)blueBar.Value); Global.saveColor(device, (byte)redBar.Value, (byte)greenBar.Value, (byte)blueBar.Value);
Global.saveLowColor(device, (byte)lowRedBar.Value, (byte)lowGreenBar.Value, (byte)lowBlueBar.Value); Global.saveLowColor(device, (byte)lowRedBar.Value, (byte)lowGreenBar.Value, (byte)lowBlueBar.Value);
Global.setLeftTriggerMiddle(device, (double)numUDL2.Value); Global.setLeftTriggerMiddle(device, (byte)(numUDL2.Value * 255));
Global.setRightTriggerMiddle(device, (double)numUDR2.Value); Global.setRightTriggerMiddle(device, (byte)(numUDR2.Value * 255));
Global.saveRumbleBoost(device, (byte)rumbleBoostBar.Value); Global.saveRumbleBoost(device, (byte)rumbleBoostBar.Value);
Global.setFlashWhenLowBattery(device, flashLed.Checked);
Global.setTouchSensitivity(device, (byte)numUDTouch.Value); Global.setTouchSensitivity(device, (byte)numUDTouch.Value);
Global.setTouchpadJitterCompensation(device, touchpadJitterCompensation.Checked); Global.setTouchpadJitterCompensation(device, touchpadJitterCompensation.Checked);
Global.setLowerRCOn(device, cBlowerRCOn.Checked); Global.setLowerRCOn(device, cBlowerRCOn.Checked);
@ -227,6 +230,8 @@ namespace ScpServer
Global.setIdleDisconnectTimeout(device, (int)(idleDisconnectTimeout.Value * 60)); Global.setIdleDisconnectTimeout(device, (int)(idleDisconnectTimeout.Value * 60));
Global.setButtonMouseSensitivity(device, tBMouseSens.Value); Global.setButtonMouseSensitivity(device, tBMouseSens.Value);
Global.setRainbow(device, (int)numUDRainbow.Value); Global.setRainbow(device, (int)numUDRainbow.Value);
Global.setRSDeadzone(device, (byte)(numUDRS.Value * 127));
Global.setLSDeadzone(device, (byte)(numUDLS.Value * 127));
if (numUDRainbow.Value == 0) pBRainbow.Image = greyscale; if (numUDRainbow.Value == 0) pBRainbow.Image = greyscale;
else pBRainbow.Image = colored; else pBRainbow.Image = colored;
} }
@ -763,42 +768,12 @@ namespace ScpServer
private void numUDL2_ValueChanged(object sender, EventArgs e) private void numUDL2_ValueChanged(object sender, EventArgs e)
{ {
Global.setLeftTriggerMiddle(device, (double)numUDL2.Value); Global.setLeftTriggerMiddle(device, (byte)(numUDL2.Value * 255));
} }
private void numUDR2_ValueChanged(object sender, EventArgs e) private void numUDR2_ValueChanged(object sender, EventArgs e)
{ {
Global.setRightTriggerMiddle(device, (double)numUDR2.Value); Global.setRightTriggerMiddle(device, (byte)(numUDR2.Value * 255));
}
private void tBProfile_Click(object sender, EventArgs e)
{
}
private void leftMotorLabel_Click(object sender, EventArgs e)
{
}
private void rightMotorLabel_Click(object sender, EventArgs e)
{
}
private void rumbleBoostLabel_Click(object sender, EventArgs e)
{
}
private void Options_Resize(object sender, EventArgs e)
{
}
private void greenBar_Scroll(object sender, EventArgs e)
{
} }
private void flashLed_CheckedChanged(object sender, EventArgs e) private void flashLed_CheckedChanged(object sender, EventArgs e)
@ -833,5 +808,15 @@ namespace ScpServer
pBController.Image = Properties.Resources.DS4_Controller; pBController.Image = Properties.Resources.DS4_Controller;
} }
private void numUDRS_ValueChanged(object sender, EventArgs e)
{
Global.setRSDeadzone(device, (byte)(numUDRS.Value * 127));
}
private void numUDLS_ValueChanged(object sender, EventArgs e)
{
Global.setLSDeadzone(device, (byte)(numUDLS.Value * 127));
}
} }
} }

View File

@ -2,7 +2,6 @@
using System.Windows.Forms; using System.Windows.Forms;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using DS4Control; using DS4Control;
using System.Threading;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Collections.Generic; using System.Collections.Generic;
@ -15,7 +14,7 @@ namespace ScpServer
{ {
private DS4Control.Control rootHub; private DS4Control.Control rootHub;
delegate void LogDebugDelegate(DateTime Time, String Data); delegate void LogDebugDelegate(DateTime Time, String Data);
double version = 7.1; double version = 7.3;
protected Label[] Pads; protected Label[] Pads;
protected ComboBox[] cbs; protected ComboBox[] cbs;