Sixaxis Deadzones can be reconfigured: 0.25+ recommended to lay down the controller without movement

Mouse Acceleration option
Rumble settings now more simple
Better detection of where profiles and settings are stored, if you use jheb's tool and this as a portable one, it better detects which settings are which.
Smaller filesize for profiles.
Reorder of tabs
This commit is contained in:
jays2kings 2014-06-26 14:02:01 -04:00
parent 1a8fb309ee
commit 49e2e642ed
7 changed files with 844 additions and 1088 deletions

View File

@ -456,10 +456,14 @@ namespace DS4Control
case DS4Controls.TouchLeft: return 27; case DS4Controls.TouchLeft: return 27;
case DS4Controls.TouchRight: return 28; case DS4Controls.TouchRight: return 28;
case DS4Controls.TouchUpper: return 29; case DS4Controls.TouchUpper: return 29;
case DS4Controls.GyroXNeg: return 30;
case DS4Controls.GyroXPos: return 31;
case DS4Controls.GyroZNeg: return 32;
case DS4Controls.GyroZPos: return 33;
} }
return 0; return 0;
} }
public static bool[] pressedonce = new bool[261], macrodone = new bool[30]; public static bool[] pressedonce = new bool[261], macrodone = new bool[34];
public static int test = 0; public static int test = 0;
/** Map DS4 Buttons/Axes to other DS4 Buttons/Axes (largely the same as Xinput ones) and to keyboard and mouse buttons. */ /** Map DS4 Buttons/Axes to other DS4 Buttons/Axes (largely the same as Xinput ones) and to keyboard and mouse buttons. */
public static async void MapCustom(int device, DS4State cState, DS4State MappedState, DS4StateExposed eState) public static async void MapCustom(int device, DS4State cState, DS4State MappedState, DS4StateExposed eState)
@ -506,18 +510,18 @@ namespace DS4Control
if (keys[0] == 271 && !MappedState.PS) MappedState.PS = getBoolMapping(customKey.Key, cState, eState); if (keys[0] == 271 && !MappedState.PS) MappedState.PS = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 272 && !MappedState.L1) MappedState.L1 = getBoolMapping(customKey.Key, cState, eState); if (keys[0] == 272 && !MappedState.L1) MappedState.L1 = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 273 && !MappedState.R1) MappedState.R1 = getBoolMapping(customKey.Key, cState, eState); if (keys[0] == 273 && !MappedState.R1) MappedState.R1 = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 274 && MappedState.L2 == 0) MappedState.L2 = getByteMapping(customKey.Key, cState, eState); if (keys[0] == 274 && MappedState.L2 == 0) MappedState.L2 = getByteMapping(device, customKey.Key, cState, eState);
if (keys[0] == 275 && MappedState.R2 == 0) MappedState.R2 = getByteMapping(customKey.Key, cState, eState); if (keys[0] == 275 && MappedState.R2 == 0) MappedState.R2 = getByteMapping(device, customKey.Key, cState, eState);
if (keys[0] == 276 && !MappedState.L3) MappedState.L3 = getBoolMapping(customKey.Key, cState, eState); if (keys[0] == 276 && !MappedState.L3) MappedState.L3 = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 277 && !MappedState.R3) MappedState.R3 = getBoolMapping(customKey.Key, cState, eState); if (keys[0] == 277 && !MappedState.R3) MappedState.R3 = getBoolMapping(customKey.Key, cState, eState);
if (keys[0] == 278 && LYChanged) MappedState.LY = getXYAxisMapping(customKey.Key, cState, eState); if (keys[0] == 278 && LYChanged) MappedState.LY = getXYAxisMapping(device, customKey.Key, cState, eState);
if (keys[0] == 279 && LYChanged) MappedState.LY = getXYAxisMapping(customKey.Key, cState, eState, true); if (keys[0] == 279 && LYChanged) MappedState.LY = getXYAxisMapping(device, customKey.Key, cState, eState, true);
if (keys[0] == 280 && LXChanged) MappedState.LX = getXYAxisMapping(customKey.Key, cState, eState); if (keys[0] == 280 && LXChanged) MappedState.LX = getXYAxisMapping(device, customKey.Key, cState, eState);
if (keys[0] == 281 && LXChanged) MappedState.LX = getXYAxisMapping(customKey.Key, cState, eState, true); if (keys[0] == 281 && LXChanged) MappedState.LX = getXYAxisMapping(device, customKey.Key, cState, eState, true);
if (keys[0] == 282 && RYChanged) MappedState.RY = getXYAxisMapping(customKey.Key, cState, eState); if (keys[0] == 282 && RYChanged) MappedState.RY = getXYAxisMapping(device, customKey.Key, cState, eState);
if (keys[0] == 283 && RYChanged) MappedState.RY = getXYAxisMapping(customKey.Key, cState, eState, true); if (keys[0] == 283 && RYChanged) MappedState.RY = getXYAxisMapping(device, customKey.Key, cState, eState, true);
if (keys[0] == 284 && RXChanged) MappedState.RX = getXYAxisMapping(customKey.Key, cState, eState); if (keys[0] == 284 && RXChanged) MappedState.RX = getXYAxisMapping(device, customKey.Key, cState, eState);
if (keys[0] == 285 && RXChanged) MappedState.RX = getXYAxisMapping(customKey.Key, cState, eState, true); if (keys[0] == 285 && RXChanged) MappedState.RX = getXYAxisMapping(device, customKey.Key, cState, eState, true);
} }
if (!macrodone[DS4ControltoInt(customKey.Key)]) if (!macrodone[DS4ControltoInt(customKey.Key)])
{ {
@ -599,8 +603,6 @@ namespace DS4Control
pressedonce[customKey.Value] = false; pressedonce[customKey.Value] = false;
} }
bool LX = false, LY = false, RX = false, RY = false;
MappedState.LX = 127; MappedState.LX = 127;
MappedState.LY = 127; MappedState.LY = 127;
MappedState.RX = 127; MappedState.RX = 127;
@ -713,70 +715,43 @@ namespace DS4Control
break; break;
case X360Controls.LXNeg: case X360Controls.LXNeg:
if (LXChanged) if (LXChanged)
{ MappedState.LX = getXYAxisMapping(device, customButton.Key, cState, eState);
MappedState.LX = getXYAxisMapping(customButton.Key, cState, eState);
LX = true;
}
break; break;
case X360Controls.LYNeg: case X360Controls.LYNeg:
if (LYChanged) if (LYChanged)
{ MappedState.LY = getXYAxisMapping(device, customButton.Key, cState, eState);
MappedState.LY = getXYAxisMapping(customButton.Key, cState, eState);
LY = true;
}
break; break;
case X360Controls.RXNeg: case X360Controls.RXNeg:
if (RXChanged) if (RXChanged)
{ MappedState.RX = getXYAxisMapping(device, customButton.Key, cState, eState);
MappedState.RX = getXYAxisMapping(customButton.Key, cState, eState);
if (MappedState.RX != 127)
RX = true;
}
break; break;
case X360Controls.RYNeg: case X360Controls.RYNeg:
if (RYChanged) if (RYChanged)
{ MappedState.RY = getXYAxisMapping(device, customButton.Key, cState, eState);
MappedState.RY = getXYAxisMapping(customButton.Key, cState, eState);
RY = true;
}
break; break;
case X360Controls.LXPos: case X360Controls.LXPos:
if (LXChanged) if (LXChanged)
{ MappedState.LX = getXYAxisMapping(device, customButton.Key, cState, eState, true);
MappedState.LX = getXYAxisMapping(customButton.Key, cState, eState, true);
//Console.WriteLine(MappedState.LX + "");
LX = true;
}
break; break;
case X360Controls.LYPos: case X360Controls.LYPos:
if (LYChanged) if (LYChanged)
{ MappedState.LY = getXYAxisMapping(device, customButton.Key, cState, eState, true);
MappedState.LY = getXYAxisMapping(customButton.Key, cState, eState, true);
//Console.WriteLine(MappedState.LY + "");
LY = true;
}
break; break;
case X360Controls.RXPos: case X360Controls.RXPos:
if (RXChanged) if (RXChanged)
{ MappedState.RX = getXYAxisMapping(device, customButton.Key, cState, eState, true);
MappedState.RX = getXYAxisMapping(customButton.Key, cState, eState, true);
RX = true;
}
break; break;
case X360Controls.RYPos: case X360Controls.RYPos:
if (RYChanged) if (RYChanged)
{ MappedState.RY = getXYAxisMapping(device, customButton.Key, cState, eState, true);
MappedState.RY = getXYAxisMapping(customButton.Key, cState, eState, true);
RY = true;
}
break; break;
case X360Controls.LT: case X360Controls.LT:
if (MappedState.L2 == 0) if (MappedState.L2 == 0)
MappedState.L2 = getByteMapping(customButton.Key, cState, eState); MappedState.L2 = getByteMapping(device, customButton.Key, cState, eState);
break; break;
case X360Controls.RT: case X360Controls.RT:
if (MappedState.R2 == 0) if (MappedState.R2 == 0)
MappedState.R2 = getByteMapping(customButton.Key, cState, eState); MappedState.R2 = getByteMapping(device, customButton.Key, cState, eState);
break; break;
case X360Controls.LeftMouse: case X360Controls.LeftMouse:
if (getBoolMapping(customButton.Key, cState, eState)) if (getBoolMapping(customButton.Key, cState, eState))
@ -850,9 +825,13 @@ namespace DS4Control
} }
public static DateTime[] mousenow = { DateTime.UtcNow, DateTime.UtcNow, DateTime.UtcNow, DateTime.UtcNow }; public static DateTime[] mousenow = { DateTime.UtcNow, DateTime.UtcNow, DateTime.UtcNow, DateTime.UtcNow };
public static double mvalue = 0; public static double mvalue = 0;
public static int[] mouseaccel = new int[34];
public static bool[] mousedoublecheck = new bool[34];
private static int getMouseMapping(int device, DS4Controls control, DS4State cState, DS4StateExposed eState, int mnum) private static int getMouseMapping(int device, DS4Controls control, DS4State cState, DS4StateExposed eState, int mnum)
{ {
int controlnum = DS4ControltoInt(control);
double SXD = Global.getSXDeadzone(device);
double SZD = Global.getSZDeadzone(device);
int deadzone = 10; int deadzone = 10;
double value = 0; double value = 0;
int speed = Global.getButtonMouseSensitivity(device); int speed = Global.getButtonMouseSensitivity(device);
@ -914,13 +893,13 @@ namespace DS4Control
if (eState != null) if (eState != null)
switch (control) switch (control)
{ {
case DS4Controls.GyroXPos: return (byte)(eState.GyroX > 1800 ? case DS4Controls.GyroXPos: return (byte)(eState.GyroX > SXD * 7500 ?
Math.Pow(root + speed / divide, eState.GyroX / 48) : 0); Math.Pow(root + speed / divide, eState.GyroX / 48) : 0);
case DS4Controls.GyroXNeg: return (byte)(eState.GyroX < -1800 ? case DS4Controls.GyroXNeg: return (byte)(eState.GyroX < -SXD * 7500 ?
Math.Pow(root + speed / divide, -eState.GyroX / 48) : 0); Math.Pow(root + speed / divide, -eState.GyroX / 48) : 0);
case DS4Controls.GyroZPos: return (byte)(eState.GyroZ > 1800 ? case DS4Controls.GyroZPos: return (byte)(eState.GyroZ > SZD * 7500 ?
Math.Pow(root + speed / divide, eState.GyroZ / 48) : 0); Math.Pow(root + speed / divide, eState.GyroZ / 48) : 0);
case DS4Controls.GyroZNeg: return (byte)(eState.GyroZ < -1800 ? case DS4Controls.GyroZNeg: return (byte)(eState.GyroZ < -SZD * 7500 ?
Math.Pow(root + speed / divide, -eState.GyroZ / 48) : 0); Math.Pow(root + speed / divide, -eState.GyroZ / 48) : 0);
} }
bool LXChanged = (Math.Abs(127 - cState.LX) < deadzone); bool LXChanged = (Math.Abs(127 - cState.LX) < deadzone);
@ -929,6 +908,16 @@ namespace DS4Control
bool RYChanged = (Math.Abs(127 - cState.RY) < deadzone); bool RYChanged = (Math.Abs(127 - cState.RY) < deadzone);
if (LXChanged || LYChanged || RXChanged || RYChanged) if (LXChanged || LYChanged || RXChanged || RYChanged)
now = DateTime.UtcNow; now = DateTime.UtcNow;
if (Global.getMouseAccel(device))
{
if (value > 0)
mouseaccel[controlnum]++;
else if (!mousedoublecheck[controlnum])
mouseaccel[controlnum] = 0;
mousedoublecheck[controlnum] = value != 0;
if (mouseaccel[controlnum] > 1000)
value *= (double)Math.Min(2000, (mouseaccel[controlnum])) / 1000d;
}
if (value <= 1) if (value <= 1)
{ {
if (now >= mousenow[mnum] + TimeSpan.FromMilliseconds((1 - value) * 500)) if (now >= mousenow[mnum] + TimeSpan.FromMilliseconds((1 - value) * 500))
@ -954,8 +943,10 @@ namespace DS4Control
static bool[] touchArea = { true, true, true, true }; static bool[] touchArea = { true, true, true, true };
public static byte getByteMapping(DS4Controls control, DS4State cState, DS4StateExposed eState) public static byte getByteMapping(int device, DS4Controls control, DS4State cState, DS4StateExposed eState)
{ {
double SXD = Global.getSXDeadzone(device);
double SZD = Global.getSZDeadzone(device);
if (!cState.TouchButton) if (!cState.TouchButton)
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
touchArea[i] = false; touchArea[i] = false;
@ -1001,10 +992,10 @@ namespace DS4Control
if (eState != null) if (eState != null)
switch (control) switch (control)
{ {
case DS4Controls.GyroXPos: return (byte)(eState.GyroX > 1800 ? Math.Min(255, eState.GyroX / 24) : 0); case DS4Controls.GyroXPos: return (byte)(eState.GyroX > SXD * 7500 ? Math.Min(255, eState.GyroX / 24) : 0);
case DS4Controls.GyroXNeg: return (byte)(eState.GyroX < -1800 ? Math.Min(255,-eState.GyroX / 24) : 0); case DS4Controls.GyroXNeg: return (byte)(eState.GyroX < -SXD * 7500 ? Math.Min(255, -eState.GyroX / 24) : 0);
case DS4Controls.GyroZPos: return (byte)(eState.GyroZ > 1800 ? Math.Min(255, eState.GyroZ / 24) : 0); case DS4Controls.GyroZPos: return (byte)(eState.GyroZ > SZD * 7500 ? Math.Min(255, eState.GyroZ / 24) : 0);
case DS4Controls.GyroZNeg: return (byte)(eState.GyroZ < -1800 ? Math.Min(255, -eState.GyroZ / 24) : 0); case DS4Controls.GyroZNeg: return (byte)(eState.GyroZ < -SZD * 7500 ? Math.Min(255, -eState.GyroZ / 24) : 0);
} }
if (cState.TouchButton) if (cState.TouchButton)
{ {
@ -1093,10 +1084,12 @@ namespace DS4Control
return false; return false;
} }
public static byte getXYAxisMapping(DS4Controls control, DS4State cState, DS4StateExposed eState, bool alt = false) public static byte getXYAxisMapping(int device, DS4Controls control, DS4State cState, DS4StateExposed eState, bool alt = false)
{ {
byte trueVal = 0; byte trueVal = 0;
byte falseVal = 127; byte falseVal = 127;
double SXD = Global.getSXDeadzone(device);
double SZD = Global.getSZDeadzone(device);
if (alt) if (alt)
trueVal = 255; trueVal = 255;
if (!cState.TouchButton) if (!cState.TouchButton)
@ -1137,16 +1130,16 @@ namespace DS4Control
{ {
switch (control) switch (control)
{ {
case DS4Controls.GyroXPos: if (eState.GyroX > 1800) case DS4Controls.GyroXPos: if (eState.GyroX > SXD * 7500)
if (alt) return (byte)Math.Min(255, 127 + eState.GyroX / 48); else return (byte)Math.Max(0, 127 - eState.GyroX / 48); if (alt) return (byte)Math.Min(255, 127 + eState.GyroX / 48); else return (byte)Math.Max(0, 127 - eState.GyroX / 48);
else return falseVal; else return falseVal;
case DS4Controls.GyroXNeg: if (eState.GyroX < -1800) case DS4Controls.GyroXNeg: if (eState.GyroX < -SXD * 7500)
if (alt) return (byte)Math.Min(255, 127 + -eState.GyroX / 48); else return (byte)Math.Max(0, 127 - -eState.GyroX / 48); if (alt) return (byte)Math.Min(255, 127 + -eState.GyroX / 48); else return (byte)Math.Max(0, 127 - -eState.GyroX / 48);
else return falseVal; else return falseVal;
case DS4Controls.GyroZPos: if (eState.GyroZ > 1800) case DS4Controls.GyroZPos: if (eState.GyroZ > SZD * 7500)
if (alt) return (byte)Math.Min(255, 127 + eState.GyroZ / 48); else return (byte)Math.Max(0, 127 - eState.GyroZ / 48); if (alt) return (byte)Math.Min(255, 127 + eState.GyroZ / 48); else return (byte)Math.Max(0, 127 - eState.GyroZ / 48);
else return falseVal; else return falseVal;
case DS4Controls.GyroZNeg: if (eState.GyroZ < -1800) case DS4Controls.GyroZNeg: if (eState.GyroZ < -SZD * 7500)
if (alt) return (byte)Math.Min(255, 127 + -eState.GyroZ / 48); else return (byte)Math.Max(0, 127 - -eState.GyroZ / 48); if (alt) return (byte)Math.Min(255, 127 + -eState.GyroZ / 48); else return (byte)Math.Max(0, 127 - -eState.GyroZ / 48);
else return falseVal; else return falseVal;
} }

View File

@ -416,6 +416,22 @@ namespace DS4Control
{ {
m_Config.m_RightTriggerMiddle[device] = value; m_Config.m_RightTriggerMiddle[device] = value;
} }
public static double getSXDeadzone(int device)
{
return m_Config.SXDeadzone[device];
}
public static void setSXDeadzone(int device, double value)
{
m_Config.SXDeadzone[device] = value;
}
public static double getSZDeadzone(int device)
{
return m_Config.SZDeadzone[device];
}
public static void setSZDeadzone(int device, double value)
{
m_Config.SZDeadzone[device] = value;
}
public static byte getLSDeadzone(int device) public static byte getLSDeadzone(int device)
{ {
return m_Config.LSDeadzone[device]; return m_Config.LSDeadzone[device];
@ -432,6 +448,14 @@ namespace DS4Control
{ {
m_Config.RSDeadzone[device] = value; m_Config.RSDeadzone[device] = value;
} }
public static bool getMouseAccel(int device)
{
return m_Config.mouseAccel[device];
}
public static void setMouseAccel(int device, bool value)
{
m_Config.mouseAccel[device] = value;
}
public static void setAProfile(int device, string filepath) public static void setAProfile(int device, string filepath)
{ {
m_Config.profilePath[device] = appdatapath + @"\Profiles\" + filepath + ".xml"; m_Config.profilePath[device] = appdatapath + @"\Profiles\" + filepath + ".xml";
@ -487,11 +511,11 @@ namespace DS4Control
} }
public static void LoadProfile(int device) public static void LoadProfile(int device)
{ {
m_Config.LoadProfile(device); m_Config.LoadProfile(device, null);
} }
public static void LoadTempProfile(int device, string name) public static void LoadTempProfile(int device, string name)
{ {
m_Config.LoadProfile(device, appdatapath + @"\Profiles\" + name + ".xml"); m_Config.LoadProfile(device, null, appdatapath + @"\Profiles\" + name + ".xml");
} }
public static bool Save() public static bool Save()
{ {
@ -592,12 +616,14 @@ namespace DS4Control
public String[] profilePath = { String.Empty, String.Empty, String.Empty, String.Empty, String.Empty }; public String[] profilePath = { String.Empty, String.Empty, String.Empty, String.Empty, String.Empty };
public Byte[] m_Rumble = { 100, 100, 100, 100, 100 }; public Byte[] m_Rumble = { 100, 100, 100, 100, 100 };
public Byte[] touchSensitivity = { 100, 100, 100, 100, 100 }; public Byte[] touchSensitivity = { 100, 100, 100, 100, 100 };
public Byte[] LSDeadzone = { 0, 0, 0, 0, 0 }, RSDeadzone = { 0, 0, 0, 0, 0}; public Byte[] LSDeadzone = { 0, 0, 0, 0, 0 }, RSDeadzone = { 0, 0, 0, 0, 0 };
public double[] SXDeadzone = { 0.25, 0.25, 0.25, 0.25, 0.25 }, SZDeadzone = { 0.25, 0.25, 0.25, 0.25, 0.25 };
public Byte[] tapSensitivity = { 0, 0, 0, 0, 0 }; public Byte[] tapSensitivity = { 0, 0, 0, 0, 0 };
public bool[] doubleTap = { false, false, false, false, false }; public bool[] doubleTap = { false, false, false, false, false };
public int[] scrollSensitivity = { 0, 0, 0, 0, 0 }; public int[] scrollSensitivity = { 0, 0, 0, 0, 0 };
public double[] rainbow = { 0, 0, 0, 0, 0 }; public double[] rainbow = { 0, 0, 0, 0, 0 };
public int[] flashAt = { 30, 30, 30, 30, 30 }; public int[] flashAt = { 30, 30, 30, 30, 30 };
public bool[] mouseAccel = { true, true, true, true, true };
public Byte[][] m_LowLeds = new Byte[][] public Byte[][] m_LowLeds = new Byte[][]
{ {
new Byte[] {0,0,0}, new Byte[] {0,0,0},
@ -704,20 +730,20 @@ namespace DS4Control
XmlNode xmlFlushHIDQueue = m_Xdoc.CreateNode(XmlNodeType.Element, "flushHIDQueue", null); xmlFlushHIDQueue.InnerText = flushHIDQueue[device].ToString(); Node.AppendChild(xmlFlushHIDQueue); XmlNode xmlFlushHIDQueue = m_Xdoc.CreateNode(XmlNodeType.Element, "flushHIDQueue", null); xmlFlushHIDQueue.InnerText = flushHIDQueue[device].ToString(); Node.AppendChild(xmlFlushHIDQueue);
XmlNode xmlIdleDisconnectTimeout = m_Xdoc.CreateNode(XmlNodeType.Element, "idleDisconnectTimeout", null); xmlIdleDisconnectTimeout.InnerText = idleDisconnectTimeout[device].ToString(); Node.AppendChild(xmlIdleDisconnectTimeout); XmlNode xmlIdleDisconnectTimeout = m_Xdoc.CreateNode(XmlNodeType.Element, "idleDisconnectTimeout", null); xmlIdleDisconnectTimeout.InnerText = idleDisconnectTimeout[device].ToString(); Node.AppendChild(xmlIdleDisconnectTimeout);
XmlNode xmlRed = m_Xdoc.CreateNode(XmlNodeType.Element, "Red", null); xmlRed.InnerText = m_Leds[device][0].ToString(); Node.AppendChild(xmlRed); XmlNode xmlColor = m_Xdoc.CreateNode(XmlNodeType.Element, "Color", null);
XmlNode xmlGreen = m_Xdoc.CreateNode(XmlNodeType.Element, "Green", null); xmlGreen.InnerText = m_Leds[device][1].ToString(); Node.AppendChild(xmlGreen); xmlColor.InnerText = m_Leds[device][0].ToString() + "," + m_Leds[device][1].ToString() + "," + m_Leds[device][2].ToString();
XmlNode xmlBlue = m_Xdoc.CreateNode(XmlNodeType.Element, "Blue", null); xmlBlue.InnerText = m_Leds[device][2].ToString(); Node.AppendChild(xmlBlue); Node.AppendChild(xmlColor);
XmlNode xmlRumbleBoost = m_Xdoc.CreateNode(XmlNodeType.Element, "RumbleBoost", null); xmlRumbleBoost.InnerText = m_Rumble[device].ToString(); Node.AppendChild(xmlRumbleBoost); XmlNode xmlRumbleBoost = m_Xdoc.CreateNode(XmlNodeType.Element, "RumbleBoost", null); xmlRumbleBoost.InnerText = m_Rumble[device].ToString(); Node.AppendChild(xmlRumbleBoost);
XmlNode xmlLedAsBatteryIndicator = m_Xdoc.CreateNode(XmlNodeType.Element, "ledAsBatteryIndicator", null); xmlLedAsBatteryIndicator.InnerText = ledAsBattery[device].ToString(); Node.AppendChild(xmlLedAsBatteryIndicator); XmlNode xmlLedAsBatteryIndicator = m_Xdoc.CreateNode(XmlNodeType.Element, "ledAsBatteryIndicator", null); xmlLedAsBatteryIndicator.InnerText = ledAsBattery[device].ToString(); Node.AppendChild(xmlLedAsBatteryIndicator);
XmlNode xmlLowBatteryFlash = m_Xdoc.CreateNode(XmlNodeType.Element, "lowBatteryFlash", null); xmlLowBatteryFlash.InnerText = flashLedLowBattery[device].ToString(); Node.AppendChild(xmlLowBatteryFlash); XmlNode xmlLowBatteryFlash = m_Xdoc.CreateNode(XmlNodeType.Element, "lowBatteryFlash", null); xmlLowBatteryFlash.InnerText = flashLedLowBattery[device].ToString(); Node.AppendChild(xmlLowBatteryFlash);
XmlNode xmlFlashBatterAt = m_Xdoc.CreateNode(XmlNodeType.Element, "flashBatteryAt", null); xmlFlashBatterAt.InnerText = flashAt[device].ToString(); Node.AppendChild(xmlFlashBatterAt); XmlNode xmlFlashBatterAt = m_Xdoc.CreateNode(XmlNodeType.Element, "flashBatteryAt", null); xmlFlashBatterAt.InnerText = flashAt[device].ToString(); Node.AppendChild(xmlFlashBatterAt);
XmlNode xmlTouchSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "touchSensitivity", null); xmlTouchSensitivity.InnerText = touchSensitivity[device].ToString(); Node.AppendChild(xmlTouchSensitivity); XmlNode xmlTouchSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "touchSensitivity", null); xmlTouchSensitivity.InnerText = touchSensitivity[device].ToString(); Node.AppendChild(xmlTouchSensitivity);
XmlNode xmlLowRed = m_Xdoc.CreateNode(XmlNodeType.Element, "LowRed", null); xmlLowRed.InnerText = m_LowLeds[device][0].ToString(); Node.AppendChild(xmlLowRed); XmlNode xmlLowColor = m_Xdoc.CreateNode(XmlNodeType.Element, "LowColor", null);
XmlNode xmlLowGreen = m_Xdoc.CreateNode(XmlNodeType.Element, "LowGreen", null); xmlLowGreen.InnerText = m_LowLeds[device][1].ToString(); Node.AppendChild(xmlLowGreen); xmlLowColor.InnerText = m_LowLeds[device][0].ToString() + "," + m_LowLeds[device][1].ToString() + "," + m_LowLeds[device][2].ToString();
XmlNode xmlLowBlue = m_Xdoc.CreateNode(XmlNodeType.Element, "LowBlue", null); xmlLowBlue.InnerText = m_LowLeds[device][2].ToString(); Node.AppendChild(xmlLowBlue); Node.AppendChild(xmlLowColor);
XmlNode xmlChargingRed = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingRed", null); xmlChargingRed.InnerText = m_ChargingLeds[device][0].ToString(); Node.AppendChild(xmlChargingRed); XmlNode xmlChargingColor = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingColor", null);
XmlNode xmlChargingGreen = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingGreen", null); xmlChargingGreen.InnerText = m_ChargingLeds[device][1].ToString(); Node.AppendChild(xmlChargingGreen); xmlChargingColor.InnerText = m_ChargingLeds[device][0].ToString() + "," + m_ChargingLeds[device][1].ToString() + "," + m_ChargingLeds[device][2].ToString();
XmlNode xmlChargingBlue = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingBlue", null); xmlChargingBlue.InnerText = m_ChargingLeds[device][2].ToString(); Node.AppendChild(xmlChargingBlue); Node.AppendChild(xmlChargingColor);
XmlNode xmlTouchpadJitterCompensation = m_Xdoc.CreateNode(XmlNodeType.Element, "touchpadJitterCompensation", null); xmlTouchpadJitterCompensation.InnerText = touchpadJitterCompensation[device].ToString(); Node.AppendChild(xmlTouchpadJitterCompensation); XmlNode xmlTouchpadJitterCompensation = m_Xdoc.CreateNode(XmlNodeType.Element, "touchpadJitterCompensation", null); xmlTouchpadJitterCompensation.InnerText = touchpadJitterCompensation[device].ToString(); Node.AppendChild(xmlTouchpadJitterCompensation);
XmlNode xmlLowerRCOn = m_Xdoc.CreateNode(XmlNodeType.Element, "lowerRCOn", null); xmlLowerRCOn.InnerText = lowerRCOn[device].ToString(); Node.AppendChild(xmlLowerRCOn); XmlNode xmlLowerRCOn = m_Xdoc.CreateNode(XmlNodeType.Element, "lowerRCOn", null); xmlLowerRCOn.InnerText = lowerRCOn[device].ToString(); Node.AppendChild(xmlLowerRCOn);
XmlNode xmlTapSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "tapSensitivity", null); xmlTapSensitivity.InnerText = tapSensitivity[device].ToString(); Node.AppendChild(xmlTapSensitivity); XmlNode xmlTapSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "tapSensitivity", null); xmlTapSensitivity.InnerText = tapSensitivity[device].ToString(); Node.AppendChild(xmlTapSensitivity);
@ -729,7 +755,10 @@ namespace DS4Control
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 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 xmlRSD = m_Xdoc.CreateNode(XmlNodeType.Element, "RSDeadZone", null); xmlRSD.InnerText = RSDeadzone[device].ToString(); Node.AppendChild(xmlRSD);
XmlNode xmlSXD = m_Xdoc.CreateNode(XmlNodeType.Element, "SXDeadZone", null); xmlSXD.InnerText = SXDeadzone[device].ToString(); Node.AppendChild(xmlSXD);
XmlNode xmlSZD = m_Xdoc.CreateNode(XmlNodeType.Element, "SZDeadZone", null); xmlSZD.InnerText = SZDeadzone[device].ToString(); Node.AppendChild(xmlSZD);
XmlNode xmlChargingType = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingType", null); xmlChargingType.InnerText = chargingType[device].ToString(); Node.AppendChild(xmlChargingType); XmlNode xmlChargingType = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingType", null); xmlChargingType.InnerText = chargingType[device].ToString(); Node.AppendChild(xmlChargingType);
XmlNode xmlMouseAccel = m_Xdoc.CreateNode(XmlNodeType.Element, "MouseAcceleration", null); xmlMouseAccel.InnerText = mouseAccel[device].ToString(); Node.AppendChild(xmlMouseAccel);
XmlNode NodeControl = m_Xdoc.CreateNode(XmlNodeType.Element, "Control", null); XmlNode NodeControl = m_Xdoc.CreateNode(XmlNodeType.Element, "Control", null);
XmlNode Key = m_Xdoc.CreateNode(XmlNodeType.Element, "Key", null); XmlNode Key = m_Xdoc.CreateNode(XmlNodeType.Element, "Key", null);
@ -738,7 +767,6 @@ namespace DS4Control
XmlNode Button = m_Xdoc.CreateNode(XmlNodeType.Element, "Button", null); XmlNode Button = m_Xdoc.CreateNode(XmlNodeType.Element, "Button", null);
foreach (var button in buttons) foreach (var button in buttons)
// try
{ {
// Save even if string (for xbox controller buttons) // Save even if string (for xbox controller buttons)
if (button.Tag != null) if (button.Tag != null)
@ -777,10 +805,6 @@ namespace DS4Control
else Button.AppendChild(buttonNode); else Button.AppendChild(buttonNode);
} }
} }
//catch
// {
// NodeControl.InnerText = "";
//}
Node.AppendChild(NodeControl); Node.AppendChild(NodeControl);
if (Button.HasChildNodes) if (Button.HasChildNodes)
NodeControl.AppendChild(Button); NodeControl.AppendChild(Button);
@ -892,192 +916,8 @@ namespace DS4Control
} }
return X360Controls.Unbound; return X360Controls.Unbound;
} }
public Boolean LoadProfile(int device, System.Windows.Forms.Control[] buttons)
{
Boolean Loaded = true;
Dictionary<DS4Controls, DS4KeyType> customMapKeyTypes = new Dictionary<DS4Controls, DS4KeyType>();
Dictionary<DS4Controls, UInt16> customMapKeys = new Dictionary<DS4Controls, UInt16>();
Dictionary<DS4Controls, X360Controls> customMapButtons = new Dictionary<DS4Controls, X360Controls>();
Dictionary<DS4Controls, String> customMapMacros = new Dictionary<DS4Controls, String>();
Boolean missingSetting = false;
try public Boolean LoadProfile(int device, System.Windows.Forms.Control[] buttons, string propath = "")
{
if (File.Exists(profilePath[device]))
{
XmlNode Item;
m_Xdoc.Load(profilePath[device]);
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/flushHIDQueue"); Boolean.TryParse(Item.InnerText, out flushHIDQueue[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/idleDisconnectTimeout"); Int32.TryParse(Item.InnerText, out idleDisconnectTimeout[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Red"); Byte.TryParse(Item.InnerText, out m_Leds[device][0]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Green"); Byte.TryParse(Item.InnerText, out m_Leds[device][1]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Blue"); Byte.TryParse(Item.InnerText, out m_Leds[device][2]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RumbleBoost"); Byte.TryParse(Item.InnerText, out m_Rumble[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ledAsBatteryIndicator"); Boolean.TryParse(Item.InnerText, out ledAsBattery[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/lowBatteryFlash"); Boolean.TryParse(Item.InnerText, out flashLedLowBattery[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/flashBatteryAt"); Int32.TryParse(Item.InnerText, out flashAt[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/touchSensitivity"); Byte.TryParse(Item.InnerText, out touchSensitivity[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowRed"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][0]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowGreen"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][1]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowBlue"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][2]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingRed"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][0]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingGreen"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][1]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingBlue"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][2]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/touchpadJitterCompensation"); Boolean.TryParse(Item.InnerText, out touchpadJitterCompensation[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/lowerRCOn"); Boolean.TryParse(Item.InnerText, out lowerRCOn[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/tapSensitivity"); Byte.TryParse(Item.InnerText, out tapSensitivity[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/doubleTap"); Boolean.TryParse(Item.InnerText, out doubleTap[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/scrollSensitivity"); Int32.TryParse(Item.InnerText, out scrollSensitivity[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LeftTriggerMiddle"); Byte.TryParse(Item.InnerText, out m_LeftTriggerMiddle[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RightTriggerMiddle"); Byte.TryParse(Item.InnerText, out m_RightTriggerMiddle[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ButtonMouseSensitivity"); Int32.TryParse(Item.InnerText, out buttonMouseSensitivity[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Rainbow"); Double.TryParse(Item.InnerText, out rainbow[device]); }
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; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingType"); Int32.TryParse(Item.InnerText, out chargingType[device]); }
catch { missingSetting = true; }
DS4KeyType keyType;
UInt16 wvk;
foreach (var button in buttons)
try
{
//bool foundBinding = false;
Item = m_Xdoc.SelectSingleNode(String.Format("/ScpControl/Control/KeyType/{0}", button.Name));
if (Item != null)
{
//foundBinding = true;
keyType = DS4KeyType.None;
if (Item.InnerText.Contains(DS4KeyType.Unbound.ToString()))
{
keyType = DS4KeyType.Unbound;
button.Tag = "Unbound";
button.Text = "Unbound";
}
else
{
bool SC = Item.InnerText.Contains(DS4KeyType.ScanCode.ToString());
bool TG = Item.InnerText.Contains(DS4KeyType.Toggle.ToString());
bool MC = Item.InnerText.Contains(DS4KeyType.Macro.ToString());
bool MR = Item.InnerText.Contains(DS4KeyType.HoldMacro.ToString());
button.Font = new Font(button.Font,
(SC ? FontStyle.Bold : FontStyle.Regular) | (TG ? FontStyle.Italic : FontStyle.Regular) |
(MC ? FontStyle.Underline : FontStyle.Regular) | (MR ? FontStyle.Strikeout : FontStyle.Regular));
if (Item.InnerText.Contains(DS4KeyType.ScanCode.ToString()))
keyType |= DS4KeyType.ScanCode;
if (Item.InnerText.Contains(DS4KeyType.Toggle.ToString()))
keyType |= DS4KeyType.Toggle;
if (Item.InnerText.Contains(DS4KeyType.Macro.ToString()))
keyType |= DS4KeyType.Macro;
}
if (keyType != DS4KeyType.None)
customMapKeyTypes.Add(getDS4ControlsByName(Item.Name), keyType);
}
Item = m_Xdoc.SelectSingleNode(String.Format("/ScpControl/Control/Macro/{0}", button.Name));
if (Item != null)
{
string[] splitter = Item.InnerText.Split('/');
int[] keys = new int[splitter.Length];
for (int i = 0; i < keys.Length; i++)
{
keys[i] = int.Parse(splitter[i]);
if (keys[i] < 255) splitter[i] = ((System.Windows.Forms.Keys)keys[i]).ToString();
else if (keys[i] == 256) splitter[i] = "Left Mouse Button";
else if (keys[i] == 257) splitter[i] = "Right Mouse Button";
else if (keys[i] == 258) splitter[i] = "Middle Mouse Button";
else if (keys[i] == 259) splitter[i] = "4th Mouse Button";
else if (keys[i] == 260) splitter[i] = "5th Mouse Button";
else if (keys[i] > 300) splitter[i] = "Wait " + (keys[i] - 300) + "ms";
}
button.Text = "Macro";
button.Tag = keys;
customMapMacros.Add(getDS4ControlsByName(button.Name), Item.InnerText);
}
else if (m_Xdoc.SelectSingleNode(String.Format("/ScpControl/Control/Key/{0}", button.Name)) != null)
{
Item = m_Xdoc.SelectSingleNode(String.Format("/ScpControl/Control/Key/{0}", button.Name));
if (UInt16.TryParse(Item.InnerText, out wvk))
{
//foundBinding = true;
customMapKeys.Add(getDS4ControlsByName(Item.Name), wvk);
button.Tag = wvk;
button.Text = ((System.Windows.Forms.Keys)wvk).ToString();
}
}
else
{
Item = m_Xdoc.SelectSingleNode(String.Format("/ScpControl/Control/Button/{0}", button.Name));
if (Item != null)
{
//foundBinding = true;
button.Tag = Item.InnerText;
button.Text = Item.InnerText;
customMapButtons.Add(getDS4ControlsByName(button.Name), getX360ControlsByName(Item.InnerText));
}
}
}
catch
{
}
}
}
catch { Loaded = false; }
if (Loaded)
{
this.customMapButtons[device] = customMapButtons;
this.customMapKeys[device] = customMapKeys;
this.customMapKeyTypes[device] = customMapKeyTypes;
this.customMapMacros[device] = customMapMacros;
}
// Only add missing settings if the actual load was graceful
if (missingSetting && Loaded)
SaveProfile(device, profilePath[device], buttons);
return Loaded;
}
public Boolean LoadProfile(int device, string propath = "")
{ {
Boolean Loaded = true; Boolean Loaded = true;
Dictionary<DS4Controls, DS4KeyType> customMapKeyTypes = new Dictionary<DS4Controls, DS4KeyType>(); Dictionary<DS4Controls, DS4KeyType> customMapKeyTypes = new Dictionary<DS4Controls, DS4KeyType>();
@ -1103,16 +943,31 @@ namespace DS4Control
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/idleDisconnectTimeout"); Int32.TryParse(Item.InnerText, out idleDisconnectTimeout[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/idleDisconnectTimeout"); Int32.TryParse(Item.InnerText, out idleDisconnectTimeout[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
//New method for saving color
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Red"); Byte.TryParse(Item.InnerText, out m_Leds[device][0]); } try
{
Item = m_Xdoc.SelectSingleNode("/ScpControl/Color");
string[] colors;
if (!string.IsNullOrEmpty(Item.InnerText))
colors = Item.InnerText.Split(',');
else
colors = new string[0];
for (int i = 0; i < colors.Length; i++)
m_Leds[device][i] = byte.Parse(colors[i]);
}
catch { missingSetting = true; } catch { missingSetting = true; }
if (string.IsNullOrEmpty(m_Xdoc.SelectSingleNode("/ScpControl/Color").InnerText))
{
//Old method of color saving
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Red"); Byte.TryParse(Item.InnerText, out m_Leds[device][0]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Green"); Byte.TryParse(Item.InnerText, out m_Leds[device][1]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Green"); Byte.TryParse(Item.InnerText, out m_Leds[device][1]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Blue"); Byte.TryParse(Item.InnerText, out m_Leds[device][2]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Blue"); Byte.TryParse(Item.InnerText, out m_Leds[device][2]); }
catch { missingSetting = true; }
}
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RumbleBoost"); Byte.TryParse(Item.InnerText, out m_Rumble[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RumbleBoost"); Byte.TryParse(Item.InnerText, out m_Rumble[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
@ -1127,19 +982,51 @@ namespace DS4Control
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/touchSensitivity"); Byte.TryParse(Item.InnerText, out touchSensitivity[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/touchSensitivity"); Byte.TryParse(Item.InnerText, out touchSensitivity[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
//New method for saving color
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowRed"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][0]); } try
{
Item = m_Xdoc.SelectSingleNode("/ScpControl/LowColor");
string[] colors;
if (!string.IsNullOrEmpty(Item.InnerText))
colors = Item.InnerText.Split(',');
else
colors = new string[0];
for (int i = 0; i < colors.Length; i++)
m_LowLeds[device][i] = byte.Parse(colors[i]);
}
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowGreen"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][1]); } if (string.IsNullOrEmpty(m_Xdoc.SelectSingleNode("/ScpControl/LowColor").InnerText))
catch { missingSetting = true; } {
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowBlue"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][2]); } //Old method of color saving
catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowRed"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][0]); }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingRed"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][0]); } catch { missingSetting = true; }
catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowGreen"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][1]); }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingGreen"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][1]); } catch { missingSetting = true; }
catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowBlue"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][2]); }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingBlue"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][2]); } catch { missingSetting = true; }
}
//New method for saving color
try
{
Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingColor");
string[] colors;
if (!string.IsNullOrEmpty(Item.InnerText))
colors = Item.InnerText.Split(',');
else
colors = new string[0];
for (int i = 0; i < colors.Length; i++)
m_ChargingLeds[device][i] = byte.Parse(colors[i]);
}
catch { missingSetting = true; } catch { missingSetting = true; }
if (string.IsNullOrEmpty(m_Xdoc.SelectSingleNode("/ScpControl/ChargingColor").InnerText))
{
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingRed"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][0]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingGreen"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][1]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingBlue"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][2]); }
catch { missingSetting = true; }
}
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/touchpadJitterCompensation"); Boolean.TryParse(Item.InnerText, out touchpadJitterCompensation[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/touchpadJitterCompensation"); Boolean.TryParse(Item.InnerText, out touchpadJitterCompensation[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/lowerRCOn"); Boolean.TryParse(Item.InnerText, out lowerRCOn[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/lowerRCOn"); Boolean.TryParse(Item.InnerText, out lowerRCOn[device]); }
@ -1162,43 +1049,137 @@ namespace DS4Control
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RSDeadZone"); Byte.TryParse(Item.InnerText, out RSDeadzone[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RSDeadZone"); Byte.TryParse(Item.InnerText, out RSDeadzone[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/SXDeadZone"); Double.TryParse(Item.InnerText, out SXDeadzone[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/SZDeadZone"); Double.TryParse(Item.InnerText, out SZDeadzone[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingType"); Int32.TryParse(Item.InnerText, out chargingType[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingType"); Int32.TryParse(Item.InnerText, out chargingType[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/MouseAcceleration"); Boolean.TryParse(Item.InnerText, out mouseAccel[device]); }
catch { missingSetting = true; }
DS4KeyType keyType; DS4KeyType keyType;
UInt16 wvk; UInt16 wvk;
XmlNode ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/Control/Button"); if (buttons == null)
if (ParentItem != null) {
foreach (XmlNode item in ParentItem.ChildNodes) XmlNode ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/Control/Button");
customMapButtons.Add(getDS4ControlsByName(item.Name), getX360ControlsByName(item.InnerText)); if (ParentItem != null)
ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/Control/Macro"); foreach (XmlNode item in ParentItem.ChildNodes)
if (ParentItem != null) customMapButtons.Add(getDS4ControlsByName(item.Name), getX360ControlsByName(item.InnerText));
foreach (XmlNode item in ParentItem.ChildNodes) ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/Control/Macro");
if (ParentItem != null)
foreach (XmlNode item in ParentItem.ChildNodes)
customMapMacros.Add(getDS4ControlsByName(item.Name), item.InnerText); customMapMacros.Add(getDS4ControlsByName(item.Name), item.InnerText);
ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/Control/Key"); ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/Control/Key");
if (ParentItem != null) if (ParentItem != null)
foreach (XmlNode item in ParentItem.ChildNodes) foreach (XmlNode item in ParentItem.ChildNodes)
if (UInt16.TryParse(item.InnerText, out wvk)) if (UInt16.TryParse(item.InnerText, out wvk))
customMapKeys.Add(getDS4ControlsByName(item.Name), wvk); customMapKeys.Add(getDS4ControlsByName(item.Name), wvk);
ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/Control/KeyType"); ParentItem = m_Xdoc.SelectSingleNode("/ScpControl/Control/KeyType");
if (ParentItem != null) if (ParentItem != null)
foreach (XmlNode item in ParentItem.ChildNodes) foreach (XmlNode item in ParentItem.ChildNodes)
if (item != null) if (item != null)
{
keyType = DS4KeyType.None;
if (item.InnerText.Contains(DS4KeyType.ScanCode.ToString()))
keyType |= DS4KeyType.ScanCode;
if (item.InnerText.Contains(DS4KeyType.Toggle.ToString()))
keyType |= DS4KeyType.Toggle;
if (item.InnerText.Contains(DS4KeyType.Macro.ToString()))
keyType |= DS4KeyType.Macro;
if (item.InnerText.Contains(DS4KeyType.HoldMacro.ToString()))
keyType |= DS4KeyType.HoldMacro;
if (item.InnerText.Contains(DS4KeyType.Unbound.ToString()))
keyType |= DS4KeyType.Unbound;
if (keyType != DS4KeyType.None)
customMapKeyTypes.Add(getDS4ControlsByName(item.Name), keyType);
}
}
else
{
foreach (var button in buttons)
try
{ {
keyType = DS4KeyType.None; //bool foundBinding = false;
if (item.InnerText.Contains(DS4KeyType.ScanCode.ToString())) Item = m_Xdoc.SelectSingleNode(String.Format("/ScpControl/Control/KeyType/{0}", button.Name));
keyType |= DS4KeyType.ScanCode; if (Item != null)
if (item.InnerText.Contains(DS4KeyType.Toggle.ToString())) {
keyType |= DS4KeyType.Toggle; //foundBinding = true;
if (item.InnerText.Contains(DS4KeyType.Macro.ToString())) keyType = DS4KeyType.None;
keyType |= DS4KeyType.Macro; if (Item.InnerText.Contains(DS4KeyType.Unbound.ToString()))
if (item.InnerText.Contains(DS4KeyType.HoldMacro.ToString())) {
keyType |= DS4KeyType.HoldMacro; keyType = DS4KeyType.Unbound;
if (item.InnerText.Contains(DS4KeyType.Unbound.ToString())) button.Tag = "Unbound";
keyType |= DS4KeyType.Unbound; button.Text = "Unbound";
if (keyType != DS4KeyType.None) }
customMapKeyTypes.Add(getDS4ControlsByName(item.Name), keyType); else
{
bool SC = Item.InnerText.Contains(DS4KeyType.ScanCode.ToString());
bool TG = Item.InnerText.Contains(DS4KeyType.Toggle.ToString());
bool MC = Item.InnerText.Contains(DS4KeyType.Macro.ToString());
bool MR = Item.InnerText.Contains(DS4KeyType.HoldMacro.ToString());
button.Font = new Font(button.Font,
(SC ? FontStyle.Bold : FontStyle.Regular) | (TG ? FontStyle.Italic : FontStyle.Regular) |
(MC ? FontStyle.Underline : FontStyle.Regular) | (MR ? FontStyle.Strikeout : FontStyle.Regular));
if (Item.InnerText.Contains(DS4KeyType.ScanCode.ToString()))
keyType |= DS4KeyType.ScanCode;
if (Item.InnerText.Contains(DS4KeyType.Toggle.ToString()))
keyType |= DS4KeyType.Toggle;
if (Item.InnerText.Contains(DS4KeyType.Macro.ToString()))
keyType |= DS4KeyType.Macro;
}
if (keyType != DS4KeyType.None)
customMapKeyTypes.Add(getDS4ControlsByName(Item.Name), keyType);
}
Item = m_Xdoc.SelectSingleNode(String.Format("/ScpControl/Control/Macro/{0}", button.Name));
if (Item != null)
{
string[] splitter = Item.InnerText.Split('/');
int[] keys = new int[splitter.Length];
for (int i = 0; i < keys.Length; i++)
{
keys[i] = int.Parse(splitter[i]);
if (keys[i] < 255) splitter[i] = ((System.Windows.Forms.Keys)keys[i]).ToString();
else if (keys[i] == 256) splitter[i] = "Left Mouse Button";
else if (keys[i] == 257) splitter[i] = "Right Mouse Button";
else if (keys[i] == 258) splitter[i] = "Middle Mouse Button";
else if (keys[i] == 259) splitter[i] = "4th Mouse Button";
else if (keys[i] == 260) splitter[i] = "5th Mouse Button";
else if (keys[i] > 300) splitter[i] = "Wait " + (keys[i] - 300) + "ms";
}
button.Text = "Macro";
button.Tag = keys;
customMapMacros.Add(getDS4ControlsByName(button.Name), Item.InnerText);
}
else if (m_Xdoc.SelectSingleNode(String.Format("/ScpControl/Control/Key/{0}", button.Name)) != null)
{
Item = m_Xdoc.SelectSingleNode(String.Format("/ScpControl/Control/Key/{0}", button.Name));
if (UInt16.TryParse(Item.InnerText, out wvk))
{
//foundBinding = true;
customMapKeys.Add(getDS4ControlsByName(Item.Name), wvk);
button.Tag = wvk;
button.Text = ((System.Windows.Forms.Keys)wvk).ToString();
}
}
else
{
Item = m_Xdoc.SelectSingleNode(String.Format("/ScpControl/Control/Button/{0}", button.Name));
if (Item != null)
{
//foundBinding = true;
button.Tag = Item.InnerText;
button.Text = Item.InnerText;
customMapButtons.Add(getDS4ControlsByName(button.Name), getX360ControlsByName(Item.InnerText));
}
}
} }
catch
{
}
}
} }
} }
catch { Loaded = false; } catch { Loaded = false; }

View File

@ -121,9 +121,6 @@
this.lowBatteryPanel = new System.Windows.Forms.Panel(); this.lowBatteryPanel = new System.Windows.Forms.Panel();
this.SixaxisPanel = new System.Windows.Forms.Panel(); this.SixaxisPanel = new System.Windows.Forms.Panel();
this.bnGyroZP = new System.Windows.Forms.Button(); this.bnGyroZP = new System.Windows.Forms.Button();
this.lBProfileTip = new System.Windows.Forms.Label();
this.tBProfile = new System.Windows.Forms.TextBox();
this.btnSaveProfile = new System.Windows.Forms.Button();
this.lbRS = new System.Windows.Forms.Label(); this.lbRS = new System.Windows.Forms.Label();
this.lbLS = new System.Windows.Forms.Label(); this.lbLS = new System.Windows.Forms.Label();
this.nUDRS = new System.Windows.Forms.NumericUpDown(); this.nUDRS = new System.Windows.Forms.NumericUpDown();
@ -147,12 +144,17 @@
this.nUDflashLED = new System.Windows.Forms.NumericUpDown(); this.nUDflashLED = new System.Windows.Forms.NumericUpDown();
this.gBRumble = new System.Windows.Forms.GroupBox(); this.gBRumble = new System.Windows.Forms.GroupBox();
this.gBDeadzone = new System.Windows.Forms.GroupBox(); this.gBDeadzone = new System.Windows.Forms.GroupBox();
this.btnCancel = new System.Windows.Forms.Button(); this.lbSixaxisX = new System.Windows.Forms.Label();
this.lbSixaxisZ = new System.Windows.Forms.Label();
this.nUDSZ = new System.Windows.Forms.NumericUpDown();
this.nUDSX = new System.Windows.Forms.NumericUpDown();
this.bnGyroXP = new System.Windows.Forms.Button(); this.bnGyroXP = new System.Windows.Forms.Button();
this.bnGyroXN = new System.Windows.Forms.Button(); this.bnGyroXN = new System.Windows.Forms.Button();
this.bnGyroZN = new System.Windows.Forms.Button(); this.bnGyroZN = new System.Windows.Forms.Button();
this.fLPTiltControls = new System.Windows.Forms.FlowLayoutPanel(); this.fLPTiltControls = new System.Windows.Forms.FlowLayoutPanel();
this.label2 = new System.Windows.Forms.Label();
this.advColorDialog = new ScpServer.AdvancedColorDialog(); this.advColorDialog = new ScpServer.AdvancedColorDialog();
this.cBMouseAccel = new System.Windows.Forms.CheckBox();
this.MainPanel.SuspendLayout(); this.MainPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pBController)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pBController)).BeginInit();
this.SticksPanel.SuspendLayout(); this.SticksPanel.SuspendLayout();
@ -193,6 +195,8 @@
((System.ComponentModel.ISupportInitialize)(this.nUDflashLED)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDflashLED)).BeginInit();
this.gBRumble.SuspendLayout(); this.gBRumble.SuspendLayout();
this.gBDeadzone.SuspendLayout(); this.gBDeadzone.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDSZ)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDSX)).BeginInit();
this.fLPTiltControls.SuspendLayout(); this.fLPTiltControls.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -899,7 +903,7 @@
// lBControlTip // lBControlTip
// //
this.lBControlTip.AutoSize = true; this.lBControlTip.AutoSize = true;
this.lBControlTip.Location = new System.Drawing.Point(25, 3); this.lBControlTip.Location = new System.Drawing.Point(25, 7);
this.lBControlTip.Name = "lBControlTip"; this.lBControlTip.Name = "lBControlTip";
this.lBControlTip.Size = new System.Drawing.Size(219, 26); this.lBControlTip.Size = new System.Drawing.Size(219, 26);
this.lBControlTip.TabIndex = 181; this.lBControlTip.TabIndex = 181;
@ -1086,7 +1090,7 @@
this.cBDoubleTap.AutoSize = true; this.cBDoubleTap.AutoSize = true;
this.cBDoubleTap.Checked = true; this.cBDoubleTap.Checked = true;
this.cBDoubleTap.CheckState = System.Windows.Forms.CheckState.Checked; this.cBDoubleTap.CheckState = System.Windows.Forms.CheckState.Checked;
this.cBDoubleTap.Location = new System.Drawing.Point(357, 17); this.cBDoubleTap.Location = new System.Drawing.Point(349, 16);
this.cBDoubleTap.Name = "cBDoubleTap"; this.cBDoubleTap.Name = "cBDoubleTap";
this.cBDoubleTap.RightToLeft = System.Windows.Forms.RightToLeft.No; this.cBDoubleTap.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cBDoubleTap.Size = new System.Drawing.Size(82, 17); this.cBDoubleTap.Size = new System.Drawing.Size(82, 17);
@ -1100,7 +1104,7 @@
this.cBTap.AutoSize = true; this.cBTap.AutoSize = true;
this.cBTap.Checked = true; this.cBTap.Checked = true;
this.cBTap.CheckState = System.Windows.Forms.CheckState.Checked; this.cBTap.CheckState = System.Windows.Forms.CheckState.Checked;
this.cBTap.Location = new System.Drawing.Point(326, 47); this.cBTap.Location = new System.Drawing.Point(318, 46);
this.cBTap.Name = "cBTap"; this.cBTap.Name = "cBTap";
this.cBTap.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.cBTap.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cBTap.Size = new System.Drawing.Size(45, 17); this.cBTap.Size = new System.Drawing.Size(45, 17);
@ -1111,7 +1115,7 @@
// //
// nUDTap // nUDTap
// //
this.nUDTap.Location = new System.Drawing.Point(377, 46); this.nUDTap.Location = new System.Drawing.Point(369, 45);
this.nUDTap.Maximum = new decimal(new int[] { this.nUDTap.Maximum = new decimal(new int[] {
200, 200,
0, 0,
@ -1132,7 +1136,7 @@
this.cBScroll.AutoSize = true; this.cBScroll.AutoSize = true;
this.cBScroll.Checked = true; this.cBScroll.Checked = true;
this.cBScroll.CheckState = System.Windows.Forms.CheckState.Checked; this.cBScroll.CheckState = System.Windows.Forms.CheckState.Checked;
this.cBScroll.Location = new System.Drawing.Point(180, 48); this.cBScroll.Location = new System.Drawing.Point(169, 47);
this.cBScroll.Name = "cBScroll"; this.cBScroll.Name = "cBScroll";
this.cBScroll.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.cBScroll.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cBScroll.Size = new System.Drawing.Size(52, 17); this.cBScroll.Size = new System.Drawing.Size(52, 17);
@ -1157,7 +1161,7 @@
// //
// nUDScroll // nUDScroll
// //
this.nUDScroll.Location = new System.Drawing.Point(234, 46); this.nUDScroll.Location = new System.Drawing.Point(227, 45);
this.nUDScroll.Maximum = new decimal(new int[] { this.nUDScroll.Maximum = new decimal(new int[] {
10, 10,
0, 0,
@ -1209,7 +1213,7 @@
// cBlowerRCOn // cBlowerRCOn
// //
this.cBlowerRCOn.AutoSize = true; this.cBlowerRCOn.AutoSize = true;
this.cBlowerRCOn.Location = new System.Drawing.Point(218, 10); this.cBlowerRCOn.Location = new System.Drawing.Point(182, 11);
this.cBlowerRCOn.Name = "cBlowerRCOn"; this.cBlowerRCOn.Name = "cBlowerRCOn";
this.cBlowerRCOn.RightToLeft = System.Windows.Forms.RightToLeft.No; this.cBlowerRCOn.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cBlowerRCOn.Size = new System.Drawing.Size(100, 30); this.cBlowerRCOn.Size = new System.Drawing.Size(100, 30);
@ -1223,7 +1227,7 @@
this.cBTouchpadJitterCompensation.AutoSize = true; this.cBTouchpadJitterCompensation.AutoSize = true;
this.cBTouchpadJitterCompensation.Checked = true; this.cBTouchpadJitterCompensation.Checked = true;
this.cBTouchpadJitterCompensation.CheckState = System.Windows.Forms.CheckState.Checked; this.cBTouchpadJitterCompensation.CheckState = System.Windows.Forms.CheckState.Checked;
this.cBTouchpadJitterCompensation.Location = new System.Drawing.Point(42, 17); this.cBTouchpadJitterCompensation.Location = new System.Drawing.Point(12, 18);
this.cBTouchpadJitterCompensation.Name = "cBTouchpadJitterCompensation"; this.cBTouchpadJitterCompensation.Name = "cBTouchpadJitterCompensation";
this.cBTouchpadJitterCompensation.RightToLeft = System.Windows.Forms.RightToLeft.No; this.cBTouchpadJitterCompensation.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cBTouchpadJitterCompensation.Size = new System.Drawing.Size(118, 17); this.cBTouchpadJitterCompensation.Size = new System.Drawing.Size(118, 17);
@ -1244,7 +1248,7 @@
// lBR2 // lBR2
// //
this.lBR2.AutoSize = true; this.lBR2.AutoSize = true;
this.lBR2.Location = new System.Drawing.Point(109, 17); this.lBR2.Location = new System.Drawing.Point(88, 17);
this.lBR2.Name = "lBR2"; this.lBR2.Name = "lBR2";
this.lBR2.Size = new System.Drawing.Size(21, 13); this.lBR2.Size = new System.Drawing.Size(21, 13);
this.lBR2.TabIndex = 197; this.lBR2.TabIndex = 197;
@ -1281,7 +1285,7 @@
0, 0,
0, 0,
65536}); 65536});
this.nUDR2.Location = new System.Drawing.Point(133, 15); this.nUDR2.Location = new System.Drawing.Point(111, 15);
this.nUDR2.Maximum = new decimal(new int[] { this.nUDR2.Maximum = new decimal(new int[] {
1, 1,
0, 0,
@ -1332,11 +1336,12 @@
// leftMotorLabel // leftMotorLabel
// //
this.leftMotorLabel.AutoSize = true; this.leftMotorLabel.AutoSize = true;
this.leftMotorLabel.Location = new System.Drawing.Point(8, 45); this.leftMotorLabel.Location = new System.Drawing.Point(763, 208);
this.leftMotorLabel.Name = "leftMotorLabel"; this.leftMotorLabel.Name = "leftMotorLabel";
this.leftMotorLabel.Size = new System.Drawing.Size(25, 13); this.leftMotorLabel.Size = new System.Drawing.Size(13, 13);
this.leftMotorLabel.TabIndex = 209; this.leftMotorLabel.TabIndex = 209;
this.leftMotorLabel.Text = "Left"; this.leftMotorLabel.Text = "L";
this.leftMotorLabel.Visible = false;
// //
// tBsixaxisAccelX // tBsixaxisAccelX
// //
@ -1353,11 +1358,12 @@
// rightMotorLabel // rightMotorLabel
// //
this.rightMotorLabel.AutoSize = true; this.rightMotorLabel.AutoSize = true;
this.rightMotorLabel.Location = new System.Drawing.Point(111, 45); this.rightMotorLabel.Location = new System.Drawing.Point(674, 207);
this.rightMotorLabel.Name = "rightMotorLabel"; this.rightMotorLabel.Name = "rightMotorLabel";
this.rightMotorLabel.Size = new System.Drawing.Size(32, 13); this.rightMotorLabel.Size = new System.Drawing.Size(15, 13);
this.rightMotorLabel.TabIndex = 208; this.rightMotorLabel.TabIndex = 208;
this.rightMotorLabel.Text = "Right"; this.rightMotorLabel.Text = "R";
this.rightMotorLabel.Visible = false;
// //
// tBsixaxisGyroZ // tBsixaxisGyroZ
// //
@ -1374,11 +1380,12 @@
// rumbleBoostLabel // rumbleBoostLabel
// //
this.rumbleBoostLabel.AutoSize = true; this.rumbleBoostLabel.AutoSize = true;
this.rumbleBoostLabel.Location = new System.Drawing.Point(8, 17); this.rumbleBoostLabel.Location = new System.Drawing.Point(842, 212);
this.rumbleBoostLabel.Name = "rumbleBoostLabel"; this.rumbleBoostLabel.Name = "rumbleBoostLabel";
this.rumbleBoostLabel.Size = new System.Drawing.Size(34, 13); this.rumbleBoostLabel.Size = new System.Drawing.Size(34, 13);
this.rumbleBoostLabel.TabIndex = 207; this.rumbleBoostLabel.TabIndex = 207;
this.rumbleBoostLabel.Text = "Boost"; this.rumbleBoostLabel.Text = "Boost";
this.rumbleBoostLabel.Visible = false;
// //
// tBsixaxisGyroY // tBsixaxisGyroY
// //
@ -1406,14 +1413,14 @@
// //
// nUDRumbleBoost // nUDRumbleBoost
// //
this.nUDRumbleBoost.Location = new System.Drawing.Point(46, 14); this.nUDRumbleBoost.Location = new System.Drawing.Point(14, 15);
this.nUDRumbleBoost.Maximum = new decimal(new int[] { this.nUDRumbleBoost.Maximum = new decimal(new int[] {
200, 150,
0, 0,
0, 0,
0}); 0});
this.nUDRumbleBoost.Name = "nUDRumbleBoost"; this.nUDRumbleBoost.Name = "nUDRumbleBoost";
this.nUDRumbleBoost.Size = new System.Drawing.Size(52, 20); this.nUDRumbleBoost.Size = new System.Drawing.Size(43, 20);
this.nUDRumbleBoost.TabIndex = 211; this.nUDRumbleBoost.TabIndex = 211;
this.nUDRumbleBoost.Value = new decimal(new int[] { this.nUDRumbleBoost.Value = new decimal(new int[] {
100, 100,
@ -1433,15 +1440,16 @@
// //
// nUDHeavyRumble // nUDHeavyRumble
// //
this.nUDHeavyRumble.Location = new System.Drawing.Point(149, 43); this.nUDHeavyRumble.Location = new System.Drawing.Point(695, 205);
this.nUDHeavyRumble.Maximum = new decimal(new int[] { this.nUDHeavyRumble.Maximum = new decimal(new int[] {
255, 255,
0, 0,
0, 0,
0}); 0});
this.nUDHeavyRumble.Name = "nUDHeavyRumble"; this.nUDHeavyRumble.Name = "nUDHeavyRumble";
this.nUDHeavyRumble.Size = new System.Drawing.Size(52, 20); this.nUDHeavyRumble.Size = new System.Drawing.Size(43, 20);
this.nUDHeavyRumble.TabIndex = 212; this.nUDHeavyRumble.TabIndex = 212;
this.nUDHeavyRumble.Visible = false;
this.nUDHeavyRumble.ValueChanged += new System.EventHandler(this.numUDHeavyRumble_ValueChanged); this.nUDHeavyRumble.ValueChanged += new System.EventHandler(this.numUDHeavyRumble_ValueChanged);
// //
// lB6Gryo // lB6Gryo
@ -1456,22 +1464,23 @@
// //
// nUDLightRumble // nUDLightRumble
// //
this.nUDLightRumble.Location = new System.Drawing.Point(46, 43); this.nUDLightRumble.Location = new System.Drawing.Point(782, 205);
this.nUDLightRumble.Maximum = new decimal(new int[] { this.nUDLightRumble.Maximum = new decimal(new int[] {
255, 255,
0, 0,
0, 0,
0}); 0});
this.nUDLightRumble.Name = "nUDLightRumble"; this.nUDLightRumble.Name = "nUDLightRumble";
this.nUDLightRumble.Size = new System.Drawing.Size(52, 20); this.nUDLightRumble.Size = new System.Drawing.Size(43, 20);
this.nUDLightRumble.TabIndex = 213; this.nUDLightRumble.TabIndex = 213;
this.nUDLightRumble.Visible = false;
this.nUDLightRumble.ValueChanged += new System.EventHandler(this.numUDLightRumble_ValueChanged); this.nUDLightRumble.ValueChanged += new System.EventHandler(this.numUDLightRumble_ValueChanged);
// //
// btnRumbleTest // btnRumbleTest
// //
this.btnRumbleTest.Location = new System.Drawing.Point(161, 11); this.btnRumbleTest.Location = new System.Drawing.Point(14, 39);
this.btnRumbleTest.Name = "btnRumbleTest"; this.btnRumbleTest.Name = "btnRumbleTest";
this.btnRumbleTest.Size = new System.Drawing.Size(41, 23); this.btnRumbleTest.Size = new System.Drawing.Size(64, 23);
this.btnRumbleTest.TabIndex = 214; this.btnRumbleTest.TabIndex = 214;
this.btnRumbleTest.Text = "Test"; this.btnRumbleTest.Text = "Test";
this.btnRumbleTest.UseVisualStyleBackColor = true; this.btnRumbleTest.UseVisualStyleBackColor = true;
@ -1624,44 +1633,10 @@
this.bnGyroZP.UseVisualStyleBackColor = true; this.bnGyroZP.UseVisualStyleBackColor = true;
this.bnGyroZP.Click += new System.EventHandler(this.Show_ControlsBn); this.bnGyroZP.Click += new System.EventHandler(this.Show_ControlsBn);
// //
// lBProfileTip
//
this.lBProfileTip.AutoSize = true;
this.lBProfileTip.Location = new System.Drawing.Point(13, 302);
this.lBProfileTip.Name = "lBProfileTip";
this.lBProfileTip.Size = new System.Drawing.Size(70, 13);
this.lBProfileTip.TabIndex = 239;
this.lBProfileTip.Text = "Profile Name:";
this.lBProfileTip.Visible = false;
//
// tBProfile
//
this.tBProfile.ForeColor = System.Drawing.SystemColors.GrayText;
this.tBProfile.Location = new System.Drawing.Point(85, 299);
this.tBProfile.Name = "tBProfile";
this.tBProfile.Size = new System.Drawing.Size(185, 20);
this.tBProfile.TabIndex = 238;
this.tBProfile.Text = "<type profile name here>";
this.tBProfile.Visible = false;
this.tBProfile.TextChanged += new System.EventHandler(this.tBProfile_TextChanged);
this.tBProfile.Enter += new System.EventHandler(this.tBProfile_Enter);
this.tBProfile.Leave += new System.EventHandler(this.tBProfile_Leave);
//
// btnSaveProfile
//
this.btnSaveProfile.Location = new System.Drawing.Point(276, 297);
this.btnSaveProfile.Name = "btnSaveProfile";
this.btnSaveProfile.Size = new System.Drawing.Size(78, 23);
this.btnSaveProfile.TabIndex = 237;
this.btnSaveProfile.Text = "Save Profile";
this.btnSaveProfile.UseVisualStyleBackColor = true;
this.btnSaveProfile.Visible = false;
this.btnSaveProfile.Click += new System.EventHandler(this.saveButton_Click);
//
// lbRS // lbRS
// //
this.lbRS.AutoSize = true; this.lbRS.AutoSize = true;
this.lbRS.Location = new System.Drawing.Point(110, 46); this.lbRS.Location = new System.Drawing.Point(88, 46);
this.lbRS.Name = "lbRS"; this.lbRS.Name = "lbRS";
this.lbRS.Size = new System.Drawing.Size(22, 13); this.lbRS.Size = new System.Drawing.Size(22, 13);
this.lbRS.TabIndex = 197; this.lbRS.TabIndex = 197;
@ -1684,7 +1659,7 @@
0, 0,
0, 0,
65536}); 65536});
this.nUDRS.Location = new System.Drawing.Point(133, 43); this.nUDRS.Location = new System.Drawing.Point(111, 43);
this.nUDRS.Maximum = new decimal(new int[] { this.nUDRS.Maximum = new decimal(new int[] {
1, 1,
0, 0,
@ -1767,13 +1742,14 @@
this.gBTouchpad.Controls.Add(this.cBScroll); this.gBTouchpad.Controls.Add(this.cBScroll);
this.gBTouchpad.Location = new System.Drawing.Point(440, 220); this.gBTouchpad.Location = new System.Drawing.Point(440, 220);
this.gBTouchpad.Name = "gBTouchpad"; this.gBTouchpad.Name = "gBTouchpad";
this.gBTouchpad.Size = new System.Drawing.Size(438, 70); this.gBTouchpad.Size = new System.Drawing.Size(437, 70);
this.gBTouchpad.TabIndex = 246; this.gBTouchpad.TabIndex = 246;
this.gBTouchpad.TabStop = false; this.gBTouchpad.TabStop = false;
this.gBTouchpad.Text = "Touchpad"; this.gBTouchpad.Text = "Touchpad";
// //
// gBOther // gBOther
// //
this.gBOther.Controls.Add(this.cBMouseAccel);
this.gBOther.Controls.Add(this.nUDSixaxis); this.gBOther.Controls.Add(this.nUDSixaxis);
this.gBOther.Controls.Add(this.cBControllerInput); this.gBOther.Controls.Add(this.cBControllerInput);
this.gBOther.Controls.Add(this.nUDIdleDisconnect); this.gBOther.Controls.Add(this.nUDIdleDisconnect);
@ -1963,16 +1939,12 @@
// //
// gBRumble // gBRumble
// //
this.gBRumble.Controls.Add(this.rumbleBoostLabel); this.gBRumble.Controls.Add(this.label2);
this.gBRumble.Controls.Add(this.nUDHeavyRumble);
this.gBRumble.Controls.Add(this.btnRumbleTest); this.gBRumble.Controls.Add(this.btnRumbleTest);
this.gBRumble.Controls.Add(this.leftMotorLabel);
this.gBRumble.Controls.Add(this.nUDLightRumble);
this.gBRumble.Controls.Add(this.rightMotorLabel);
this.gBRumble.Controls.Add(this.nUDRumbleBoost); this.gBRumble.Controls.Add(this.nUDRumbleBoost);
this.gBRumble.Location = new System.Drawing.Point(442, 3); this.gBRumble.Location = new System.Drawing.Point(442, 3);
this.gBRumble.Name = "gBRumble"; this.gBRumble.Name = "gBRumble";
this.gBRumble.Size = new System.Drawing.Size(213, 67); this.gBRumble.Size = new System.Drawing.Size(89, 67);
this.gBRumble.TabIndex = 247; this.gBRumble.TabIndex = 247;
this.gBRumble.TabStop = false; this.gBRumble.TabStop = false;
this.gBRumble.Text = "Rumble"; this.gBRumble.Text = "Rumble";
@ -1981,30 +1953,89 @@
// //
this.gBDeadzone.Controls.Add(this.lBL2); this.gBDeadzone.Controls.Add(this.lBL2);
this.gBDeadzone.Controls.Add(this.nUDL2); this.gBDeadzone.Controls.Add(this.nUDL2);
this.gBDeadzone.Controls.Add(this.lbSixaxisX);
this.gBDeadzone.Controls.Add(this.lbSixaxisZ);
this.gBDeadzone.Controls.Add(this.lBR2); this.gBDeadzone.Controls.Add(this.lBR2);
this.gBDeadzone.Controls.Add(this.lbRS); this.gBDeadzone.Controls.Add(this.lbRS);
this.gBDeadzone.Controls.Add(this.nUDSZ);
this.gBDeadzone.Controls.Add(this.lbLS); this.gBDeadzone.Controls.Add(this.lbLS);
this.gBDeadzone.Controls.Add(this.nUDSX);
this.gBDeadzone.Controls.Add(this.nUDRS); this.gBDeadzone.Controls.Add(this.nUDRS);
this.gBDeadzone.Controls.Add(this.nUDR2); this.gBDeadzone.Controls.Add(this.nUDR2);
this.gBDeadzone.Controls.Add(this.nUDLS); this.gBDeadzone.Controls.Add(this.nUDLS);
this.gBDeadzone.Location = new System.Drawing.Point(684, 3); this.gBDeadzone.Location = new System.Drawing.Point(598, 2);
this.gBDeadzone.Name = "gBDeadzone"; this.gBDeadzone.Name = "gBDeadzone";
this.gBDeadzone.Size = new System.Drawing.Size(194, 67); this.gBDeadzone.Size = new System.Drawing.Size(282, 67);
this.gBDeadzone.TabIndex = 248; this.gBDeadzone.TabIndex = 248;
this.gBDeadzone.TabStop = false; this.gBDeadzone.TabStop = false;
this.gBDeadzone.Text = "Deadzone"; this.gBDeadzone.Text = "Deadzone";
// //
// btnCancel // lbSixaxisX
// //
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.lbSixaxisX.AutoSize = true;
this.btnCancel.Location = new System.Drawing.Point(360, 297); this.lbSixaxisX.Location = new System.Drawing.Point(168, 16);
this.btnCancel.Name = "btnCancel"; this.lbSixaxisX.Name = "lbSixaxisX";
this.btnCancel.Size = new System.Drawing.Size(75, 23); this.lbSixaxisX.Size = new System.Drawing.Size(49, 13);
this.btnCancel.TabIndex = 249; this.lbSixaxisX.TabIndex = 197;
this.btnCancel.Text = "Cancel"; this.lbSixaxisX.Text = "Sixaxis X";
this.btnCancel.UseVisualStyleBackColor = true; //
this.btnCancel.Visible = false; // lbSixaxisZ
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); //
this.lbSixaxisZ.AutoSize = true;
this.lbSixaxisZ.Location = new System.Drawing.Point(168, 45);
this.lbSixaxisZ.Name = "lbSixaxisZ";
this.lbSixaxisZ.Size = new System.Drawing.Size(49, 13);
this.lbSixaxisZ.TabIndex = 197;
this.lbSixaxisZ.Text = "Sixaxis Z";
//
// nUDSZ
//
this.nUDSZ.DecimalPlaces = 2;
this.nUDSZ.Increment = new decimal(new int[] {
1,
0,
0,
65536});
this.nUDSZ.Location = new System.Drawing.Point(223, 43);
this.nUDSZ.Maximum = new decimal(new int[] {
1,
0,
0,
0});
this.nUDSZ.Name = "nUDSZ";
this.nUDSZ.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.nUDSZ.Size = new System.Drawing.Size(50, 20);
this.nUDSZ.TabIndex = 203;
this.nUDSZ.Value = new decimal(new int[] {
25,
0,
0,
131072});
this.nUDSZ.ValueChanged += new System.EventHandler(this.nUDSZ_ValueChanged);
//
// nUDSX
//
this.nUDSX.DecimalPlaces = 2;
this.nUDSX.Increment = new decimal(new int[] {
1,
0,
0,
65536});
this.nUDSX.Location = new System.Drawing.Point(223, 14);
this.nUDSX.Maximum = new decimal(new int[] {
1,
0,
0,
0});
this.nUDSX.Name = "nUDSX";
this.nUDSX.Size = new System.Drawing.Size(50, 20);
this.nUDSX.TabIndex = 202;
this.nUDSX.Value = new decimal(new int[] {
25,
0,
0,
131072});
this.nUDSX.ValueChanged += new System.EventHandler(this.nUDSX_ValueChanged);
// //
// bnGyroXP // bnGyroXP
// //
@ -2047,36 +2078,56 @@
this.fLPTiltControls.Size = new System.Drawing.Size(350, 31); this.fLPTiltControls.Size = new System.Drawing.Size(350, 31);
this.fLPTiltControls.TabIndex = 252; this.fLPTiltControls.TabIndex = 252;
// //
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(63, 17);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(15, 13);
this.label2.TabIndex = 207;
this.label2.Text = "%";
//
// advColorDialog // advColorDialog
// //
this.advColorDialog.AnyColor = true; this.advColorDialog.AnyColor = true;
this.advColorDialog.Color = System.Drawing.Color.Blue; this.advColorDialog.Color = System.Drawing.Color.Blue;
this.advColorDialog.FullOpen = true; this.advColorDialog.FullOpen = true;
// //
// cBMouseAccel
//
this.cBMouseAccel.AutoSize = true;
this.cBMouseAccel.Location = new System.Drawing.Point(161, 17);
this.cBMouseAccel.Name = "cBMouseAccel";
this.cBMouseAccel.Size = new System.Drawing.Size(85, 17);
this.cBMouseAccel.TabIndex = 251;
this.cBMouseAccel.Text = "Acceleration";
this.cBMouseAccel.UseVisualStyleBackColor = true;
this.cBMouseAccel.CheckedChanged += new System.EventHandler(this.cBMouseAccel_CheckedChanged);
//
// Options // Options
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.BackColor = System.Drawing.Color.White; this.BackColor = System.Drawing.Color.White;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(888, 295); this.ClientSize = new System.Drawing.Size(888, 295);
this.Controls.Add(this.btnCancel); this.Controls.Add(this.rumbleBoostLabel);
this.Controls.Add(this.nUDHeavyRumble);
this.Controls.Add(this.lB6Gryo); this.Controls.Add(this.lB6Gryo);
this.Controls.Add(this.gBDeadzone); this.Controls.Add(this.gBDeadzone);
this.Controls.Add(this.leftMotorLabel);
this.Controls.Add(this.gBRumble); this.Controls.Add(this.gBRumble);
this.Controls.Add(this.nUDLightRumble);
this.Controls.Add(this.rightMotorLabel);
this.Controls.Add(this.gBLightbar); this.Controls.Add(this.gBLightbar);
this.Controls.Add(this.gBTouchpad); this.Controls.Add(this.gBTouchpad);
this.Controls.Add(this.lBProfileTip);
this.Controls.Add(this.tBProfile);
this.Controls.Add(this.btnSaveProfile);
this.Controls.Add(this.lBControlTip); this.Controls.Add(this.lBControlTip);
this.Controls.Add(this.lBControls); this.Controls.Add(this.lBControls);
this.Controls.Add(this.MainPanel); this.Controls.Add(this.MainPanel);
this.Controls.Add(this.SticksPanel); this.Controls.Add(this.SticksPanel);
this.Controls.Add(this.gBOther); this.Controls.Add(this.gBOther);
this.Controls.Add(this.fLPTiltControls);
this.Controls.Add(this.SixaxisPanel); this.Controls.Add(this.SixaxisPanel);
this.Controls.Add(this.fLPTiltControls);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
@ -2132,6 +2183,8 @@
this.gBRumble.PerformLayout(); this.gBRumble.PerformLayout();
this.gBDeadzone.ResumeLayout(false); this.gBDeadzone.ResumeLayout(false);
this.gBDeadzone.PerformLayout(); this.gBDeadzone.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDSZ)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDSX)).EndInit();
this.fLPTiltControls.ResumeLayout(false); this.fLPTiltControls.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -2234,9 +2287,6 @@
private System.Windows.Forms.Panel lowBatteryPanel; private System.Windows.Forms.Panel lowBatteryPanel;
private System.Windows.Forms.Panel FullPanel; private System.Windows.Forms.Panel FullPanel;
private System.Windows.Forms.Panel SixaxisPanel; private System.Windows.Forms.Panel SixaxisPanel;
private System.Windows.Forms.Label lBProfileTip;
private System.Windows.Forms.TextBox tBProfile;
private System.Windows.Forms.Button btnSaveProfile;
private System.Windows.Forms.Label lBControlTip; private System.Windows.Forms.Label lBControlTip;
private System.Windows.Forms.Label lbRS; private System.Windows.Forms.Label lbRS;
private System.Windows.Forms.Label lbLS; private System.Windows.Forms.Label lbLS;
@ -2250,7 +2300,6 @@
private System.Windows.Forms.GroupBox gBRumble; private System.Windows.Forms.GroupBox gBRumble;
private System.Windows.Forms.GroupBox gBDeadzone; private System.Windows.Forms.GroupBox gBDeadzone;
private System.Windows.Forms.CheckBox cBControllerInput; private System.Windows.Forms.CheckBox cBControllerInput;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.NumericUpDown nUDSixaxis; private System.Windows.Forms.NumericUpDown nUDSixaxis;
private System.Windows.Forms.NumericUpDown nUDflashLED; private System.Windows.Forms.NumericUpDown nUDflashLED;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
@ -2267,6 +2316,12 @@
private System.Windows.Forms.Button bnGyroZP; private System.Windows.Forms.Button bnGyroZP;
private System.Windows.Forms.Button bnGyroZN; private System.Windows.Forms.Button bnGyroZN;
private System.Windows.Forms.FlowLayoutPanel fLPTiltControls; private System.Windows.Forms.FlowLayoutPanel fLPTiltControls;
private System.Windows.Forms.Label lbSixaxisX;
private System.Windows.Forms.Label lbSixaxisZ;
private System.Windows.Forms.NumericUpDown nUDSZ;
private System.Windows.Forms.NumericUpDown nUDSX;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox cBMouseAccel;
} }
} }
 

View File

@ -39,7 +39,6 @@ namespace ScpServer
{ {
Global.setAProfile(4, name); Global.setAProfile(4, name);
Global.LoadProfile(deviceNum); Global.LoadProfile(deviceNum);
tBProfile.Text = filename;
DS4Color color = Global.loadColor(device); DS4Color color = Global.loadColor(device);
redBar.Value = color.red; redBar.Value = color.red;
greenBar.Value = color.green; greenBar.Value = color.green;
@ -104,6 +103,8 @@ namespace ScpServer
} }
nUDLS.Value = Math.Round((decimal)(Global.getLSDeadzone(device) / 127d ), 3); nUDLS.Value = Math.Round((decimal)(Global.getLSDeadzone(device) / 127d ), 3);
nUDRS.Value = Math.Round((decimal)(Global.getRSDeadzone(device) / 127d ), 3); nUDRS.Value = Math.Round((decimal)(Global.getRSDeadzone(device) / 127d ), 3);
nUDSX.Value = (decimal)Global.getSXDeadzone(device);
nUDSZ.Value = (decimal)Global.getSZDeadzone(device);
} }
else else
Set(); Set();
@ -275,26 +276,13 @@ namespace ScpServer
Global.setLSDeadzone(device, (byte)Math.Round((nUDLS.Value * 127), 0)); Global.setLSDeadzone(device, (byte)Math.Round((nUDLS.Value * 127), 0));
Global.setButtonMouseSensitivity(device, (int)numUDMouseSens.Value); Global.setButtonMouseSensitivity(device, (int)numUDMouseSens.Value);
Global.setFlashAt(device, (int)nUDflashLED.Value); Global.setFlashAt(device, (int)nUDflashLED.Value);
Global.setSXDeadzone(device, (double)nUDSX.Value);
Global.setSZDeadzone(device, (double)nUDSZ.Value);
Global.setMouseAccel(device, cBMouseAccel.Checked);
if (nUDRainbow.Value == 0) pBRainbow.Image = greyscale; if (nUDRainbow.Value == 0) pBRainbow.Image = greyscale;
else pBRainbow.Image = colored; else pBRainbow.Image = colored;
} }
private void saveButton_Click(object sender, EventArgs e)
{
Set();
if (tBProfile.Text != null && tBProfile.Text != "" && !tBProfile.Text.Contains("\\") && !tBProfile.Text.Contains("/") && !tBProfile.Text.Contains(":") && !tBProfile.Text.Contains("*") && !tBProfile.Text.Contains("?") && !tBProfile.Text.Contains("\"") && !tBProfile.Text.Contains("<") && !tBProfile.Text.Contains(">") && !tBProfile.Text.Contains("|"))
{
System.IO.File.Delete(Global.appdatapath + @"\Profiles\" + filename + ".xml");
Global.setAProfile(device, tBProfile.Text);
Global.SaveProfile(device, tBProfile.Text, buttons.ToArray());
Global.Save();
this.Close();
}
else
MessageBox.Show("Please enter a valid name", "Not valid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
KBM360 kbm360 = null; KBM360 kbm360 = null;
private void Show_ControlsBn(object sender, EventArgs e) private void Show_ControlsBn(object sender, EventArgs e)
@ -556,7 +544,7 @@ namespace ScpServer
{ {
if (((Button)sender).Text == "Test") if (((Button)sender).Text == "Test")
{ {
scpDevice.setRumble((byte)nUDHeavyRumble.Value, (byte)nUDLightRumble.Value, (int)nUDSixaxis.Value - 1); scpDevice.setRumble(255, 255, (int)nUDSixaxis.Value - 1);
((Button)sender).Text = "Stop"; ((Button)sender).Text = "Stop";
} }
else else
@ -629,26 +617,6 @@ namespace ScpServer
sixaxisTimer.Stop(); sixaxisTimer.Stop();
} }
private void tBProfile_TextChanged(object sender, EventArgs e)
{
if (tBProfile.Text != null && tBProfile.Text != "" && !tBProfile.Text.Contains("\\") && !tBProfile.Text.Contains("/") && !tBProfile.Text.Contains(":") && !tBProfile.Text.Contains("*") && !tBProfile.Text.Contains("?") && !tBProfile.Text.Contains("\"") && !tBProfile.Text.Contains("<") && !tBProfile.Text.Contains(">") && !tBProfile.Text.Contains("|"))
tBProfile.ForeColor = System.Drawing.SystemColors.WindowText;
else
tBProfile.ForeColor = System.Drawing.SystemColors.GrayText;
}
private void tBProfile_Enter(object sender, EventArgs e)
{
if (tBProfile.Text == "<type profile name here>")
tBProfile.Text = "";
}
private void tBProfile_Leave(object sender, EventArgs e)
{
if (tBProfile.Text == "")
tBProfile.Text = "<type profile name here>";
}
private void cBSlide_CheckedChanged(object sender, EventArgs e) private void cBSlide_CheckedChanged(object sender, EventArgs e)
{ {
if (cBSlide.Checked) if (cBSlide.Checked)
@ -682,12 +650,6 @@ namespace ScpServer
Global.setDoubleTap(device, cBDoubleTap.Checked); Global.setDoubleTap(device, cBDoubleTap.Checked);
} }
private void tbProfile_EnterDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == 13)
saveButton_Click(sender, e);
}
public void UpdateLists() public void UpdateLists()
{ {
lBControls.Items[0] = "Cross : " + bnCross.Text; lBControls.Items[0] = "Cross : " + bnCross.Text;
@ -869,6 +831,16 @@ namespace ScpServer
Global.setRightTriggerMiddle(device, (byte)(nUDR2.Value * 255)); Global.setRightTriggerMiddle(device, (byte)(nUDR2.Value * 255));
} }
private void nUDSX_ValueChanged(object sender, EventArgs e)
{
Global.setSXDeadzone(device, (double)nUDSX.Value);
}
private void nUDSZ_ValueChanged(object sender, EventArgs e)
{
Global.setSZDeadzone(device, (double)nUDSZ.Value);
}
Image L = Properties.Resources.LeftTouch; Image L = Properties.Resources.LeftTouch;
Image R = Properties.Resources.RightTouch; Image R = Properties.Resources.RightTouch;
Image M = Properties.Resources.MultiTouch; Image M = Properties.Resources.MultiTouch;
@ -971,5 +943,10 @@ namespace ScpServer
else else
sixaxisTimer.Stop(); sixaxisTimer.Stop();
} }
private void cBMouseAccel_CheckedChanged(object sender, EventArgs e)
{
Global.setMouseAccel(device, cBMouseAccel.Checked);
}
} }
} }

View File

@ -320,9 +320,9 @@
// //
this.tabMain.Controls.Add(this.tabControllers); this.tabMain.Controls.Add(this.tabControllers);
this.tabMain.Controls.Add(this.tabProfiles); this.tabMain.Controls.Add(this.tabProfiles);
this.tabMain.Controls.Add(this.tabLog);
this.tabMain.Controls.Add(this.tabAutoProfiles); this.tabMain.Controls.Add(this.tabAutoProfiles);
this.tabMain.Controls.Add(this.tabSettings); this.tabMain.Controls.Add(this.tabSettings);
this.tabMain.Controls.Add(this.tabLog);
resources.ApplyResources(this.tabMain, "tabMain"); resources.ApplyResources(this.tabMain, "tabMain");
this.tabMain.Name = "tabMain"; this.tabMain.Name = "tabMain";
this.tabMain.SelectedIndex = 0; this.tabMain.SelectedIndex = 0;

View File

@ -13,11 +13,12 @@ using Microsoft.Win32;
using System.Diagnostics; using System.Diagnostics;
using System.Xml; using System.Xml;
using System.Text; using System.Text;
using System.Globalization;
namespace ScpServer namespace ScpServer
{ {
public partial class ScpForm : Form public partial class ScpForm : Form
{ {
double version = 10.6; double version = 10.65;
private DS4Control.Control rootHub; private DS4Control.Control rootHub;
delegate void LogDebugDelegate(DateTime Time, String Data); delegate void LogDebugDelegate(DateTime Time, String Data);
@ -125,18 +126,18 @@ namespace ScpServer
protected void Form_Load(object sender, EventArgs e) protected void Form_Load(object sender, EventArgs e)
{ {
SetupArrays(); SetupArrays();
if (File.Exists(exepath + "\\Profiles.xml") if (File.Exists(exepath + "\\Auto Profiles.xml")
&& File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool\\Profiles.xml")) && File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool\\Auto Profiles.xml"))
new SaveWhere(true).ShowDialog(); new SaveWhere(true).ShowDialog();
else if (File.Exists(exepath + "\\Profiles.xml")) else if (File.Exists(exepath + "\\Auto Profiles.xml"))
Global.SaveWhere(exepath); Global.SaveWhere(exepath);
else if (File.Exists(appdatapath + "\\Profiles.xml")) else if (File.Exists(appdatapath + "\\Auto Profiles.xml"))
Global.SaveWhere(appdatapath); Global.SaveWhere(appdatapath);
else if (!File.Exists(exepath + "\\Profiles.xml") else if (!File.Exists(exepath + "\\Auto Profiles.xml")
&& !File.Exists(appdatapath + "\\Profiles.xml")) && !File.Exists(appdatapath + "\\Auto Profiles.xml"))
{ {
new WelcomeDialog().ShowDialog();
new SaveWhere(false).ShowDialog(); new SaveWhere(false).ShowDialog();
MessageBox.Show("If you haven't installed the Virtual Bus driver, go to Settings and \"Controller Setup\"", "Welcome to DS4Windows");
} }
@ -257,7 +258,7 @@ namespace ScpServer
private void test_Tick(object sender, EventArgs e) private void test_Tick(object sender, EventArgs e)
{ {
lBTest.Visible = true; lBTest.Visible = true;
lBTest.Text = rootHub.getDS4StateMapped(0).LY.ToString(); lBTest.Text = Mapping.mouseaccel[18]+"";
} }
void Hotkeys(object sender, EventArgs e) void Hotkeys(object sender, EventArgs e)
{ {
@ -394,7 +395,7 @@ namespace ScpServer
double newversion; double newversion;
try try
{ {
if (double.TryParse(File.ReadAllText(Global.appdatapath + "\\version.txt"), out newversion)) if (double.TryParse(File.ReadAllText(Global.appdatapath + "\\version.txt"), NumberStyles.Any, CultureInfo.InvariantCulture, out newversion))
if (newversion > version) if (newversion > version)
if (MessageBox.Show("Download Version " + newversion + " now?", "DS4Windows Update Available!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) if (MessageBox.Show("Download Version " + newversion + " now?", "DS4Windows Update Available!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{ {
@ -571,11 +572,6 @@ namespace ScpServer
this.Show(); this.Show();
this.ShowInTaskbar = true; this.ShowInTaskbar = true;
} }
//Added last message alternative
/*if (this.Height > 220)
lbLastMessage.Visible = tabMain.SelectedIndex != 2;
else lbLastMessage.Visible = true;*/
} }
protected void btnStartStop_Click(object sender, EventArgs e) protected void btnStartStop_Click(object sender, EventArgs e)
@ -1029,7 +1025,7 @@ namespace ScpServer
private void tabMain_SelectedIndexChanged(object sender, EventArgs e) private void tabMain_SelectedIndexChanged(object sender, EventArgs e)
{ {
lbLastMessage.Visible = tabMain.SelectedIndex != 2; lbLastMessage.Visible = tabMain.SelectedIndex != 4;
if (opt != null) if (opt != null)
if (tabMain.SelectedIndex != 1) if (tabMain.SelectedIndex != 1)
opt.inputtimer.Stop(); opt.inputtimer.Stop();
@ -1217,7 +1213,7 @@ namespace ScpServer
double newversion; double newversion;
try try
{ {
if (double.TryParse(File.ReadAllText(Global.appdatapath + "\\version.txt"), out newversion)) if (double.TryParse(File.ReadAllText(Global.appdatapath + "\\version.txt"), NumberStyles.Any, CultureInfo.InvariantCulture, out newversion))
if (newversion > Global.getVersion()) if (newversion > Global.getVersion())
if (MessageBox.Show("Download Version " + newversion + " now?", "DS4Windows Update Available!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) if (MessageBox.Show("Download Version " + newversion + " now?", "DS4Windows Update Available!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{ {

File diff suppressed because it is too large Load Diff