Option to start a program when loading a (auto-)profile/connecting a controller

Reworked mouse movement with analog sticks, still needs more fine tuning
Option to add a different color for when in shift modifier mode
Added default to regular controller mapping, which goes back to it's original 360 mapped action if any
Big fixes: such as controller being disconnected when hiding the DS4 with D/C when stopping is on
Spelling fixes
This commit is contained in:
jays2kings 2014-07-25 19:17:45 -04:00
parent 46e529f7be
commit a53869f2a4
12 changed files with 1598 additions and 863 deletions

View File

@ -5,6 +5,7 @@ using System.Text;
using DS4Library; using DS4Library;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Diagnostics;
namespace DS4Control namespace DS4Control
{ {
public class Control public class Control
@ -78,16 +79,13 @@ namespace DS4Control
device.Removal -= DS4Devices.On_Removal; device.Removal -= DS4Devices.On_Removal;
device.Removal += this.On_DS4Removal; device.Removal += this.On_DS4Removal;
device.Removal += DS4Devices.On_Removal; device.Removal += DS4Devices.On_Removal;
//TPadModeSwitcher m_switcher = new TPadModeSwitcher(device, ind);
//m_switcher.Debug += OnDebug;
//modeSwitcher[ind] = m_switcher;
touchPad[ind] = new Mouse(ind, device); touchPad[ind] = new Mouse(ind, device);
DS4Color color = Global.loadColor(ind); DS4Color color = Global.loadColor(ind);
device.LightBarColor = color; device.LightBarColor = color;
x360Bus.Plugin(ind); x360Bus.Plugin(ind);
device.Report += this.On_Report; device.Report += this.On_Report;
//m_switcher.setMode(Global.getInitialMode(ind));
TouchPadOn(ind, device); TouchPadOn(ind, device);
LaunchProgram(ind);
string filename = Path.GetFileName(Global.getAProfile(ind)); string filename = Path.GetFileName(Global.getAProfile(ind));
ind++; ind++;
if (showlog) if (showlog)
@ -133,7 +131,7 @@ namespace DS4Control
else else
{ {
DS4LightBar.defualtLight = true; DS4LightBar.defualtLight = true;
DS4LightBar.updateLightBar(DS4Controllers[i], i); DS4LightBar.updateLightBar(DS4Controllers[i], i, CurrentState[i], ExposedState[i]);
System.Threading.Thread.Sleep(50); System.Threading.Thread.Sleep(50);
} }
CurrentState[i].Battery = PreviousState[i].Battery = 0; // Reset for the next connection's initial status change. CurrentState[i].Battery = PreviousState[i].Battery = 0; // Reset for the next connection's initial status change.
@ -188,6 +186,7 @@ namespace DS4Control
device.Report += this.On_Report; device.Report += this.On_Report;
x360Bus.Plugin(Index); x360Bus.Plugin(Index);
TouchPadOn(Index, device); TouchPadOn(Index, device);
LaunchProgram(Index);
string filename = Path.GetFileName(Global.getAProfile(Index)); string filename = Path.GetFileName(Global.getAProfile(Index));
if (System.IO.File.Exists(Global.appdatapath + "\\Profiles\\" + filename)) if (System.IO.File.Exists(Global.appdatapath + "\\Profiles\\" + filename))
{ {
@ -207,6 +206,13 @@ namespace DS4Control
return true; return true;
} }
public void LaunchProgram(int ind)
{
if (Global.getLaunchProgram(ind) != string.Empty)
{
Process.Start(Global.getLaunchProgram(ind));
}
}
public void TouchPadOn(int ind, DS4Device device) public void TouchPadOn(int ind, DS4Device device)
{ {
ITouchpadBehaviour tPad = touchPad[ind]; ITouchpadBehaviour tPad = touchPad[ind];
@ -218,7 +224,7 @@ namespace DS4Control
device.Touchpad.TouchUnchanged += tPad.touchUnchanged; device.Touchpad.TouchUnchanged += tPad.touchUnchanged;
//LogDebug("Touchpad mode for " + device.MacAddress + " is now " + tmode.ToString()); //LogDebug("Touchpad mode for " + device.MacAddress + " is now " + tmode.ToString());
//Log.LogToTray("Touchpad mode for " + device.MacAddress + " is now " + tmode.ToString()); //Log.LogToTray("Touchpad mode for " + device.MacAddress + " is now " + tmode.ToString());
Global.ControllerStatusChanged(this); //Global.ControllerStatusChanged(this);
} }
public void TimeoutConnection(DS4Device d) public void TimeoutConnection(DS4Device d)
@ -379,7 +385,6 @@ namespace DS4Control
Log.LogToTray("Controller " + device.MacAddress + " was removed or lost connection"); Log.LogToTray("Controller " + device.MacAddress + " was removed or lost connection");
System.Threading.Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME); System.Threading.Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME);
DS4Controllers[ind] = null; DS4Controllers[ind] = null;
//modeSwitcher[ind] = null;
touchPad[ind] = null; touchPad[ind] = null;
Global.ControllerStatusChanged(this); Global.ControllerStatusChanged(this);
} }
@ -414,8 +419,7 @@ namespace DS4Control
} }
// Update the GUI/whatever. // Update the GUI/whatever.
DS4LightBar.updateLightBar(device, ind); DS4LightBar.updateLightBar(device, ind, cState, ExposedState[ind]);
//DS4LightBar.defualtLight(device, ind);
x360Bus.Parse(cState, processingData[ind].Report, ind); x360Bus.Parse(cState, processingData[ind].Report, ind);
// We push the translated Xinput state, and simultaneously we // We push the translated Xinput state, and simultaneously we

View File

@ -24,92 +24,99 @@ namespace DS4Control
public static double[] fadetimer = new double[4] { 0, 0, 0, 0 }; public static double[] fadetimer = new double[4] { 0, 0, 0, 0 };
static bool[] fadedirection = new bool[4] { false, false, false, false }; static bool[] fadedirection = new bool[4] { false, false, false, false };
static DateTime oldnow = DateTime.UtcNow; static DateTime oldnow = DateTime.UtcNow;
public static void updateLightBar(DS4Device device, int deviceNum) public static void updateLightBar(DS4Device device, int deviceNum, DS4State cState, DS4StateExposed eState)
{ {
DS4Color color; DS4Color color;
if (!defualtLight) if (!defualtLight)
{ {
if (Global.getRainbow(deviceNum) > 0) if (Global.getShiftColorOn(deviceNum) && Global.getShiftModifier(deviceNum) > 0 && shiftMod(device, deviceNum, cState, eState))
{// Display rainbow
DateTime now = DateTime.UtcNow;
if (now >= oldnow + TimeSpan.FromMilliseconds(10)) //update by the millisecond that way it's a smooth transtion
{
oldnow = now;
if (device.Charging)
counters[deviceNum] -= 1.5 * 3 / Global.getRainbow(deviceNum);
else
counters[deviceNum] += 1.5 * 3 / Global.getRainbow(deviceNum);
}
if (counters[deviceNum] < 0)
counters[deviceNum] = 180000;
if (Global.getLedAsBatteryIndicator(deviceNum))
color = HuetoRGB((float)counters[deviceNum] % 360, (byte)(2.55 * device.Battery));
else
color = HuetoRGB((float)counters[deviceNum] % 360, 255);
}
else if (Global.getLedAsBatteryIndicator(deviceNum))
{ {
//if (device.Charging == false || device.Battery >= 100) // when charged, don't show the charging animation color = Global.loadShiftColor(deviceNum);
{
DS4Color fullColor = new DS4Color
{
red = Global.loadColor(deviceNum).red,
green = Global.loadColor(deviceNum).green,
blue = Global.loadColor(deviceNum).blue
};
color = Global.loadLowColor(deviceNum);
DS4Color lowColor = new DS4Color
{
red = color.red,
green = color.green,
blue = color.blue
};
color = Global.getTransitionedColor(lowColor, fullColor, (uint)device.Battery);
}
} }
else else
{ {
color = Global.loadColor(deviceNum); if (Global.getRainbow(deviceNum) > 0)
} {// Display rainbow
DateTime now = DateTime.UtcNow;
if (Global.getIdleDisconnectTimeout(deviceNum) > 0 && Global.getLedAsBatteryIndicator(deviceNum) && (!device.Charging || device.Battery >= 100)) if (now >= oldnow + TimeSpan.FromMilliseconds(10)) //update by the millisecond that way it's a smooth transtion
{//Fade lightbar by idle time {
TimeSpan timeratio = new TimeSpan(DateTime.UtcNow.Ticks - device.lastActive.Ticks); oldnow = now;
double botratio = timeratio.TotalMilliseconds; if (device.Charging)
double topratio = TimeSpan.FromSeconds(Global.getIdleDisconnectTimeout(deviceNum)).TotalMilliseconds; counters[deviceNum] -= 1.5 * 3 / Global.getRainbow(deviceNum);
double ratio = ((botratio / topratio) * 100);
if (ratio >= 50 && ratio <= 100)
color = Global.getTransitionedColor(color, new DS4Color { red = 0, green = 0, blue = 0 }, (uint)((ratio - 50) * 2));
else if (ratio >= 100)
color = Global.getTransitionedColor(color, new DS4Color { red = 0, green = 0, blue = 0 }, 100);
}
if (device.Charging && device.Battery < 100)
switch (Global.getChargingType(deviceNum))
{
case 1:
if (fadetimer[deviceNum] <= 0)
fadedirection[deviceNum] = true;
else if (fadetimer[deviceNum] >= 105)
fadedirection[deviceNum] = false;
if (fadedirection[deviceNum])
fadetimer[deviceNum]+= .1;
else else
fadetimer[deviceNum] -= .1; counters[deviceNum] += 1.5 * 3 / Global.getRainbow(deviceNum);
color = Global.getTransitionedColor(color, new DS4Color { red = 0, green = 0, blue = 0 }, fadetimer[deviceNum]); }
break; if (counters[deviceNum] < 0)
case 2: counters[deviceNum] = 180000;
counters[deviceNum] += .167; if (Global.getLedAsBatteryIndicator(deviceNum))
color = HuetoRGB((float)counters[deviceNum] % 360, (byte)(2.55 * device.Battery));
else
color = HuetoRGB((float)counters[deviceNum] % 360, 255); color = HuetoRGB((float)counters[deviceNum] % 360, 255);
break;
case 3:
color = Global.loadChargingColor(deviceNum);
break;
default:
break;
} }
else if (Global.getLedAsBatteryIndicator(deviceNum))
{
//if (device.Charging == false || device.Battery >= 100) // when charged, don't show the charging animation
{
DS4Color fullColor = new DS4Color
{
red = Global.loadColor(deviceNum).red,
green = Global.loadColor(deviceNum).green,
blue = Global.loadColor(deviceNum).blue
};
color = Global.loadLowColor(deviceNum);
DS4Color lowColor = new DS4Color
{
red = color.red,
green = color.green,
blue = color.blue
};
color = Global.getTransitionedColor(lowColor, fullColor, (uint)device.Battery);
}
}
else
{
color = Global.loadColor(deviceNum);
}
if (Global.getIdleDisconnectTimeout(deviceNum) > 0 && Global.getLedAsBatteryIndicator(deviceNum) && (!device.Charging || device.Battery >= 100))
{//Fade lightbar by idle time
TimeSpan timeratio = new TimeSpan(DateTime.UtcNow.Ticks - device.lastActive.Ticks);
double botratio = timeratio.TotalMilliseconds;
double topratio = TimeSpan.FromSeconds(Global.getIdleDisconnectTimeout(deviceNum)).TotalMilliseconds;
double ratio = ((botratio / topratio) * 100);
if (ratio >= 50 && ratio <= 100)
color = Global.getTransitionedColor(color, new DS4Color { red = 0, green = 0, blue = 0 }, (uint)((ratio - 50) * 2));
else if (ratio >= 100)
color = Global.getTransitionedColor(color, new DS4Color { red = 0, green = 0, blue = 0 }, 100);
}
if (device.Charging && device.Battery < 100)
switch (Global.getChargingType(deviceNum))
{
case 1:
if (fadetimer[deviceNum] <= 0)
fadedirection[deviceNum] = true;
else if (fadetimer[deviceNum] >= 105)
fadedirection[deviceNum] = false;
if (fadedirection[deviceNum])
fadetimer[deviceNum] += .1;
else
fadetimer[deviceNum] -= .1;
color = Global.getTransitionedColor(color, new DS4Color { red = 0, green = 0, blue = 0 }, fadetimer[deviceNum]);
break;
case 2:
counters[deviceNum] += .167;
color = HuetoRGB((float)counters[deviceNum] % 360, 255);
break;
case 3:
color = Global.loadChargingColor(deviceNum);
break;
default:
break;
}
}
} }
else if (shuttingdown) else if (shuttingdown)
color = new DS4Color { red = 0, green = 0, blue = 0}; color = new DS4Color { red = 0, green = 0, blue = 0};
@ -144,6 +151,41 @@ namespace DS4Control
} }
public static bool defualtLight = false, shuttingdown = false; public static bool defualtLight = false, shuttingdown = false;
public static bool shiftMod(DS4Device device, int deviceNum, DS4State cState, DS4StateExposed eState)
{
bool shift;;
switch (Global.getShiftModifier(deviceNum))
{
case 1: shift = Mapping.getBoolMapping(DS4Controls.Cross, cState, eState); break;
case 2: shift = Mapping.getBoolMapping(DS4Controls.Circle, cState, eState); break;
case 3: shift = Mapping.getBoolMapping(DS4Controls.Square, cState, eState); break;
case 4: shift = Mapping.getBoolMapping(DS4Controls.Triangle, cState, eState); break;
case 5: shift = Mapping.getBoolMapping(DS4Controls.Options, cState, eState); break;
case 6: shift = Mapping.getBoolMapping(DS4Controls.Share, cState, eState); break;
case 7: shift = Mapping.getBoolMapping(DS4Controls.DpadUp, cState, eState); break;
case 8: shift = Mapping.getBoolMapping(DS4Controls.DpadDown, cState, eState); break;
case 9: shift = Mapping.getBoolMapping(DS4Controls.DpadLeft, cState, eState); break;
case 10: shift = Mapping.getBoolMapping(DS4Controls.DpadRight, cState, eState); break;
case 11: shift = Mapping.getBoolMapping(DS4Controls.PS, cState, eState); break;
case 12: shift = Mapping.getBoolMapping(DS4Controls.L1, cState, eState); break;
case 13: shift = Mapping.getBoolMapping(DS4Controls.R1, cState, eState); break;
case 14: shift = Mapping.getBoolMapping(DS4Controls.L2, cState, eState); break;
case 15: shift = Mapping.getBoolMapping(DS4Controls.R2, cState, eState); break;
case 16: shift = Mapping.getBoolMapping(DS4Controls.L3, cState, eState); break;
case 17: shift = Mapping.getBoolMapping(DS4Controls.R3, cState, eState); break;
case 18: shift = Mapping.getBoolMapping(DS4Controls.TouchLeft, cState, eState); break;
case 19: shift = Mapping.getBoolMapping(DS4Controls.TouchUpper, cState, eState); break;
case 20: shift = Mapping.getBoolMapping(DS4Controls.TouchMulti, cState, eState); break;
case 21: shift = Mapping.getBoolMapping(DS4Controls.TouchRight, cState, eState); break;
case 22: shift = Mapping.getBoolMapping(DS4Controls.GyroZNeg, cState, eState); break;
case 23: shift = Mapping.getBoolMapping(DS4Controls.GyroZPos, cState, eState); break;
case 24: shift = Mapping.getBoolMapping(DS4Controls.GyroXPos, cState, eState); break;
case 25: shift = Mapping.getBoolMapping(DS4Controls.GyroXNeg, cState, eState); break;
case 26: shift = device.getCurrentState().Touch1; break;
default: shift = false; break;
}
return shift;
}
public static DS4Color HuetoRGB(float hue, byte sat) public static DS4Color HuetoRGB(float hue, byte sat)
{ {
byte C = sat; byte C = sat;

View File

@ -1246,13 +1246,47 @@ namespace DS4Control
double SZD = Global.getSZDeadzone(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)+15;
double root = 1.002; double root = 1.002;
double divide = 10000d; double divide = 10000d;
DateTime now = mousenow[mnum]; DateTime now = mousenow[mnum];
bool leftsitcklive = ((cState.LX < 127 - deadzone || 127 + deadzone < cState.LX) || (cState.LY < 127 - deadzone || 127 + deadzone < cState.LY));
bool rightsitcklive = ((cState.RX < 127 - deadzone || 127 + deadzone < cState.RX) || (cState.RY < 127 - deadzone || 127 + deadzone < cState.RY));
switch (control) switch (control)
{ {
case DS4Controls.LXNeg: case DS4Controls.LXNeg:
if (leftsitcklive)
value = -(cState.LX - 127) / 2550d * speed;
break;
case DS4Controls.LXPos:
if (leftsitcklive)
value = (cState.LX - 127) / 2550d * speed;
break;
case DS4Controls.RXNeg:
if (rightsitcklive)
value = -(cState.RX - 127) / 2550d * speed;
break;
case DS4Controls.RXPos:
if (rightsitcklive)
value = (cState.RX - 127) / 2550d * speed;
break;
case DS4Controls.LYNeg:
if (leftsitcklive)
value = -(cState.LY - 127) / 2550d * speed;
break;
case DS4Controls.LYPos:
if (leftsitcklive)
value = (cState.LY - 127) / 2550d * speed;
break;
case DS4Controls.RYNeg:
if (rightsitcklive)
value = -(cState.RY - 127) / 2550d * speed;
break;
case DS4Controls.RYPos:
if (rightsitcklive)
value = (cState.RY - 127) / 2550d * speed;
break;
/*case DS4Controls.LXNeg:
if (cState.LX < 127 - deadzone) if (cState.LX < 127 - deadzone)
value = Math.Pow(root + speed / divide, -(cState.LX - 127)) - 1; value = Math.Pow(root + speed / divide, -(cState.LX - 127)) - 1;
break; break;
@ -1283,7 +1317,7 @@ namespace DS4Control
case DS4Controls.RYPos: case DS4Controls.RYPos:
if (cState.RY > 127 + deadzone) if (cState.RY > 127 + deadzone)
value = Math.Pow(root + speed / divide, (cState.RY - 127)) - 1; value = Math.Pow(root + speed / divide, (cState.RY - 127)) - 1;
break; break;*/
case DS4Controls.Share: value = (cState.Share ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; case DS4Controls.Share: value = (cState.Share ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
case DS4Controls.Options: value = (cState.Options ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; case DS4Controls.Options: value = (cState.Options ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
case DS4Controls.L1: value = (cState.L1 ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; case DS4Controls.L1: value = (cState.L1 ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;

View File

@ -318,6 +318,28 @@ namespace DS4Control
color.blue = m_Config.m_ChargingLeds[device][2]; color.blue = m_Config.m_ChargingLeds[device][2];
return color; return color;
} }
public static void saveShiftColor(int device, byte red, byte green, byte blue)
{
m_Config.m_ShiftLeds[device][0] = red;
m_Config.m_ShiftLeds[device][1] = green;
m_Config.m_ShiftLeds[device][2] = blue;
}
public static DS4Color loadShiftColor(int device)
{
DS4Color color = new DS4Color();
color.red = m_Config.m_ShiftLeds[device][0];
color.green = m_Config.m_ShiftLeds[device][1];
color.blue = m_Config.m_ShiftLeds[device][2];
return color;
}
public static void setShiftColorOn(int device, bool on)
{
m_Config.shiftColorOn[device] = on;
}
public static bool getShiftColorOn(int device)
{
return m_Config.shiftColorOn[device];
}
public static void setTapSensitivity(int device, byte sen) public static void setTapSensitivity(int device, byte sen)
{ {
m_Config.tapSensitivity[device] = sen; m_Config.tapSensitivity[device] = sen;
@ -454,6 +476,14 @@ namespace DS4Control
{ {
m_Config.shiftModifier[device] = value; m_Config.shiftModifier[device] = value;
} }
public static string getLaunchProgram(int device)
{
return m_Config.launchProgram[device];
}
public static void setLaunchProgram(int device, string value)
{
m_Config.launchProgram[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";
@ -685,9 +715,19 @@ namespace DS4Control
new Byte[] {0,0,0}, new Byte[] {0,0,0},
new Byte[] {0,0,0} new Byte[] {0,0,0}
}; };
public Byte[][] m_ShiftLeds = new Byte[][]
{
new Byte[] {0,0,0},
new Byte[] {0,0,0},
new Byte[] {0,0,0},
new Byte[] {0,0,0},
new Byte[] {0,0,0}
};
public bool[] shiftColorOn = { false, false, false, false, false };
public int[] chargingType = { 0, 0, 0, 0, 0 }; public int[] chargingType = { 0, 0, 0, 0, 0 };
public bool[] flushHIDQueue = { true, true, true, true, true }; public bool[] flushHIDQueue = { true, true, true, true, true };
public int[] idleDisconnectTimeout = { 0, 0, 0, 0, 0 }; public int[] idleDisconnectTimeout = { 0, 0, 0, 0, 0 };
public string[] launchProgram = { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
public Boolean useExclusiveMode = false; public Boolean useExclusiveMode = false;
public Int32 formWidth = 782; public Int32 formWidth = 782;
@ -820,6 +860,10 @@ namespace DS4Control
XmlNode xmlChargingColor = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingColor", null); XmlNode xmlChargingColor = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingColor", null);
xmlChargingColor.InnerText = m_ChargingLeds[device][0].ToString() + "," + m_ChargingLeds[device][1].ToString() + "," + m_ChargingLeds[device][2].ToString(); xmlChargingColor.InnerText = m_ChargingLeds[device][0].ToString() + "," + m_ChargingLeds[device][1].ToString() + "," + m_ChargingLeds[device][2].ToString();
Node.AppendChild(xmlChargingColor); Node.AppendChild(xmlChargingColor);
XmlNode xmlShiftColor = m_Xdoc.CreateNode(XmlNodeType.Element, "ShiftColor", null);
xmlShiftColor.InnerText = m_ShiftLeds[device][0].ToString() + "," + m_ShiftLeds[device][1].ToString() + "," + m_ShiftLeds[device][2].ToString();
Node.AppendChild(xmlShiftColor);
XmlNode xmlShiftColorOn = m_Xdoc.CreateNode(XmlNodeType.Element, "ShiftColorOn", null); xmlShiftColorOn.InnerText = shiftColorOn[device].ToString(); Node.AppendChild(xmlShiftColorOn);
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);
@ -835,7 +879,8 @@ namespace DS4Control
XmlNode xmlSZD = m_Xdoc.CreateNode(XmlNodeType.Element, "SZDeadZone", null); xmlSZD.InnerText = SZDeadzone[device].ToString(); Node.AppendChild(xmlSZD); 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 xmlMouseAccel = m_Xdoc.CreateNode(XmlNodeType.Element, "MouseAcceleration", null); xmlMouseAccel.InnerText = mouseAccel[device].ToString(); Node.AppendChild(xmlMouseAccel);
XmlNode xmlShiftMod = m_Xdoc.CreateNode(XmlNodeType.Element, "ShiftModifier", null); xmlShiftMod.InnerText = shiftModifier[device].ToString(); Node.AppendChild(xmlShiftMod); XmlNode xmlShiftMod = m_Xdoc.CreateNode(XmlNodeType.Element, "ShiftModifier", null); xmlShiftMod.InnerText = shiftModifier[device].ToString(); Node.AppendChild(xmlShiftMod);
XmlNode xmlLaunchProgram = m_Xdoc.CreateNode(XmlNodeType.Element, "LaunchProgram", null); xmlLaunchProgram.InnerText = launchProgram[device].ToString(); Node.AppendChild(xmlLaunchProgram);
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);
@ -1210,6 +1255,20 @@ namespace DS4Control
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingBlue"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][2]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingBlue"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][2]); }
catch { missingSetting = true; } catch { missingSetting = true; }
} }
try
{
Item = m_Xdoc.SelectSingleNode("/ScpControl/ShiftColor");
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_ShiftLeds[device][i] = byte.Parse(colors[i]);
}
catch { m_ShiftLeds[device] = m_Leds[device]; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ShiftColorOn"); Boolean.TryParse(Item.InnerText, out shiftColorOn[device]); }
catch { shiftColorOn[device] = false; 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]); }
@ -1242,6 +1301,8 @@ namespace DS4Control
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ShiftModifier"); Int32.TryParse(Item.InnerText, out shiftModifier[device]); } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ShiftModifier"); Int32.TryParse(Item.InnerText, out shiftModifier[device]); }
catch { shiftModifier[device] = 0; missingSetting = true; } catch { shiftModifier[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LaunchProgram"); launchProgram[device] = Item.InnerText; }
catch { launchProgram[device] = string.Empty; missingSetting = true; }
DS4KeyType keyType; DS4KeyType keyType;
UInt16 wvk; UInt16 wvk;
if (buttons == null) if (buttons == null)

View File

@ -1694,7 +1694,7 @@
// //
// btnUNBOUND2 // btnUNBOUND2
// //
this.btnUNBOUND2.Location = new System.Drawing.Point(396, 379); this.btnUNBOUND2.Location = new System.Drawing.Point(440, 379);
this.btnUNBOUND2.Name = "btnUNBOUND2"; this.btnUNBOUND2.Name = "btnUNBOUND2";
this.btnUNBOUND2.Size = new System.Drawing.Size(75, 23); this.btnUNBOUND2.Size = new System.Drawing.Size(75, 23);
this.btnUNBOUND2.TabIndex = 317; this.btnUNBOUND2.TabIndex = 317;
@ -2034,9 +2034,8 @@
this.btnFallBack.Size = new System.Drawing.Size(75, 23); this.btnFallBack.Size = new System.Drawing.Size(75, 23);
this.btnFallBack.TabIndex = 323; this.btnFallBack.TabIndex = 323;
this.btnFallBack.TabStop = false; this.btnFallBack.TabStop = false;
this.btnFallBack.Text = "Fall Back"; this.btnFallBack.Text = "Default";
this.btnFallBack.UseVisualStyleBackColor = true; this.btnFallBack.UseVisualStyleBackColor = true;
this.btnFallBack.Visible = false;
// //
// KBM360 // KBM360
// //

View File

@ -34,8 +34,7 @@ namespace ScpServer
else if (button.Name.StartsWith("sbn")) else if (button.Name.StartsWith("sbn"))
{ {
Text = "Select an action for " + button.Name.Substring(3); Text = "Select an action for " + button.Name.Substring(3);
btnFallBack.Visible = true; btnFallBack.Text = "Fall Back";
btnUNBOUND2.Location = new Point(btnUNBOUND2.Location.X + 35, btnUNBOUND2.Location.Y);
} }
foreach (System.Windows.Forms.Control control in this.Controls) foreach (System.Windows.Forms.Control control in this.Controls)
if (control is Button) if (control is Button)
@ -72,7 +71,7 @@ namespace ScpServer
keyname = "How did you get here?"; keyname = "How did you get here?";
} }
else if (((Button)sender).Tag == null) else if (((Button)sender).Tag == null)
keyname = "Fall back"; keyname = ((Button)sender).Text;
else if (((Button)sender).Tag.ToString().Contains("X360")) else if (((Button)sender).Tag.ToString().Contains("X360"))
keyname = ((Button)sender).Tag.ToString().Substring(4); keyname = ((Button)sender).Tag.ToString().Substring(4);
else else

File diff suppressed because it is too large Load Diff

View File

@ -62,9 +62,7 @@ namespace ScpServer
if (filename != "") if (filename != "")
{ {
if (device == 4) if (device == 4)
{
Global.setAProfile(4, name); Global.setAProfile(4, name);
}
Global.LoadProfile(device, buttons.ToArray(), subbuttons.ToArray()); Global.LoadProfile(device, buttons.ToArray(), subbuttons.ToArray());
DS4Color color = Global.loadColor(device); DS4Color color = Global.loadColor(device);
redBar.Value = color.red; redBar.Value = color.red;
@ -82,6 +80,12 @@ namespace ScpServer
lowGreenBar.Value = lowColor.green; lowGreenBar.Value = lowColor.green;
lowBlueBar.Value = lowColor.blue; lowBlueBar.Value = lowColor.blue;
DS4Color shiftColor = Global.loadShiftColor(device);
shiftRedBar.Value = shiftColor.red;
shiftGreenBar.Value = shiftColor.green;
shiftBlueBar.Value = shiftColor.blue;
cBShiftLight.Checked = Global.getShiftColorOn(device);
DS4Color cColor = Global.loadChargingColor(device); DS4Color cColor = Global.loadChargingColor(device);
btnChargingColor.BackColor = Color.FromArgb(cColor.red, cColor.green, cColor.blue); btnChargingColor.BackColor = Color.FromArgb(cColor.red, cColor.green, cColor.blue);
nUDRumbleBoost.Value = Global.loadRumbleBoost(device); nUDRumbleBoost.Value = Global.loadRumbleBoost(device);
@ -133,6 +137,12 @@ namespace ScpServer
nUDSX.Value = (decimal)Global.getSXDeadzone(device); nUDSX.Value = (decimal)Global.getSXDeadzone(device);
nUDSZ.Value = (decimal)Global.getSZDeadzone(device); nUDSZ.Value = (decimal)Global.getSZDeadzone(device);
cBShiftControl.SelectedIndex = Global.getShiftModifier(device); cBShiftControl.SelectedIndex = Global.getShiftModifier(device);
if (Global.getLaunchProgram(device) != string.Empty)
{
cBLaunchProgram.Checked = true;
pBProgram.Image = Icon.ExtractAssociatedIcon(Global.getLaunchProgram(device)).ToBitmap();
btnBrowse.Text = Path.GetFileNameWithoutExtension(Global.getLaunchProgram(device));
}
} }
else else
Set(); Set();
@ -143,20 +153,21 @@ namespace ScpServer
tp.SetToolTip(cBlowerRCOn, "Best used with right side as a mouse function"); tp.SetToolTip(cBlowerRCOn, "Best used with right side as a mouse function");
tp.SetToolTip(cBDoubleTap, "Tap and hold to drag, slight delay with single taps"); tp.SetToolTip(cBDoubleTap, "Tap and hold to drag, slight delay with single taps");
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(cBTouchpadJitterCompensation, "Use Sixaxis to help calculate touchpad movement"); tp.SetToolTip(cBTouchpadJitterCompensation, "Use Sixaxis to help calculate touchpad movement");
tp.SetToolTip(pBRainbow, "Always on Rainbow Mode"); tp.SetToolTip(pBRainbow, "Always on Rainbow Mode");
tp.SetToolTip(cBFlushHIDQueue, "Flush HID Queue after each reading"); tp.SetToolTip(cBFlushHIDQueue, "Flush HID Queue after each reading");
tp.SetToolTip(cBLightbyBattery, "Also dim light by idle timeout if on"); tp.SetToolTip(cBLightbyBattery, "Also dim light by idle timeout if on");
tp.SetToolTip(lBGryo, "Click to see readout of Sixaxis Gyro"); tp.SetToolTip(lbGryo, "Click to see readout of Sixaxis Gyro");
tp.SetToolTip(tBsixaxisGyroX, "GyroX, Left and Right Tilt"); tp.SetToolTip(tBsixaxisGyroX, "GyroX, Left and Right Tilt");
tp.SetToolTip(tBsixaxisGyroY, "GyroY, Forward and Back Tilt"); tp.SetToolTip(tBsixaxisGyroY, "GyroY, Forward and Back Tilt");
tp.SetToolTip(tBsixaxisGyroZ, "GyroZ, Up and Down Tilt"); tp.SetToolTip(tBsixaxisGyroZ, "GyroZ, Up and Down Tilt");
tp.SetToolTip(tBsixaxisAccelX, "AccelX"); tp.SetToolTip(tBsixaxisAccelX, "AccelX");
tp.SetToolTip(tBsixaxisAccelY, "AccelY"); tp.SetToolTip(tBsixaxisAccelY, "AccelY");
tp.SetToolTip(tBsixaxisAccelZ, "AccelZ"); tp.SetToolTip(tBsixaxisAccelZ, "AccelZ");
tp.SetToolTip(lBEmpty, "Click to copy the full color"); tp.SetToolTip(lbEmpty, "Click to copy the full color");
tp.SetToolTip(lBSATip, "Click for advanced Sixaxis reading"); tp.SetToolTip(lbShift, "Click to copy the full color");
tp.SetToolTip(lbSATip, "Click for advanced Sixaxis reading");
advColorDialog.OnUpdateColor += advColorDialog_OnUpdateColor; advColorDialog.OnUpdateColor += advColorDialog_OnUpdateColor;
btnLeftStick.Enter += btnSticks_Enter; btnLeftStick.Enter += btnSticks_Enter;
btnRightStick.Enter += btnSticks_Enter; btnRightStick.Enter += btnSticks_Enter;
@ -178,7 +189,7 @@ namespace ScpServer
if (scpDevice.DS4Controllers[(int)nUDSixaxis.Value - 1] == null) if (scpDevice.DS4Controllers[(int)nUDSixaxis.Value - 1] == null)
{ {
tPController.Enabled = false; tPController.Enabled = false;
lBInputDelay.Text = "Input Delay: N/Ams"; lbInputDelay.Text = "Input Delay: N/Ams";
pBDelayTracker.BackColor = Color.Transparent; pBDelayTracker.BackColor = Color.Transparent;
} }
else else
@ -192,31 +203,31 @@ namespace ScpServer
SetDynamicTrackBarValue(tBsixaxisAccelZ, (scpDevice.ExposedState[(int)nUDSixaxis.Value - 1].AccelZ + tBsixaxisAccelZ.Value * 2) / 3); SetDynamicTrackBarValue(tBsixaxisAccelZ, (scpDevice.ExposedState[(int)nUDSixaxis.Value - 1].AccelZ + tBsixaxisAccelZ.Value * 2) / 3);
int x = scpDevice.getDS4State((int)nUDSixaxis.Value - 1).LX; int x = scpDevice.getDS4State((int)nUDSixaxis.Value - 1).LX;
int y = scpDevice.getDS4State((int)nUDSixaxis.Value - 1).LY; int y = scpDevice.getDS4State((int)nUDSixaxis.Value - 1).LY;
btnLSTrack.Location = new Point((int)(x / 2.09 + lBLSTrack.Location.X), (int)(y / 2.09 + lBLSTrack.Location.Y)); btnLSTrack.Location = new Point((int)(x / 2.09 + lbLSTrack.Location.X), (int)(y / 2.09 + lbLSTrack.Location.Y));
x = scpDevice.getDS4State((int)nUDSixaxis.Value - 1).RX; x = scpDevice.getDS4State((int)nUDSixaxis.Value - 1).RX;
y = scpDevice.getDS4State((int)nUDSixaxis.Value - 1).RY; y = scpDevice.getDS4State((int)nUDSixaxis.Value - 1).RY;
btnRSTrack.Location = new Point((int)(x / 2.09 + lBRSTrack.Location.X), (int)(y / 2.09 + lBRSTrack.Location.Y)); btnRSTrack.Location = new Point((int)(x / 2.09 + lbRSTrack.Location.X), (int)(y / 2.09 + lbRSTrack.Location.Y));
x = -scpDevice.ExposedState[(int)nUDSixaxis.Value - 1].GyroX / 62 + 127; x = -scpDevice.ExposedState[(int)nUDSixaxis.Value - 1].GyroX / 62 + 127;
y = scpDevice.ExposedState[(int)nUDSixaxis.Value - 1].GyroZ / 62 + 127; y = scpDevice.ExposedState[(int)nUDSixaxis.Value - 1].GyroZ / 62 + 127;
btnSATrack.Location = new Point((int)(x / 2.09 + lBSATrack.Location.X), (int)(y / 2.09 + lBSATrack.Location.Y)); btnSATrack.Location = new Point((int)(x / 2.09 + lbSATrack.Location.X), (int)(y / 2.09 + lbSATrack.Location.Y));
tBL2.Value = scpDevice.getDS4State((int)nUDSixaxis.Value - 1).L2; tBL2.Value = scpDevice.getDS4State((int)nUDSixaxis.Value - 1).L2;
lBL2Track.Location = new Point(tBL2.Location.X - 15, (int)(24 - tBL2.Value / 10.625) + 10); lbL2Track.Location = new Point(tBL2.Location.X - 15, (int)(24 - tBL2.Value / 10.625) + 10);
if (tBL2.Value == 255) if (tBL2.Value == 255)
lBL2Track.ForeColor = Color.Green; lbL2Track.ForeColor = Color.Green;
else if (tBL2.Value < (double)nUDL2.Value * 255) else if (tBL2.Value < (double)nUDL2.Value * 255)
lBL2Track.ForeColor = Color.Red; lbL2Track.ForeColor = Color.Red;
else else
lBL2Track.ForeColor = Color.Black; lbL2Track.ForeColor = Color.Black;
tBR2.Value = scpDevice.getDS4State((int)nUDSixaxis.Value - 1).R2; tBR2.Value = scpDevice.getDS4State((int)nUDSixaxis.Value - 1).R2;
lBR2Track.Location = new Point(tBR2.Location.X + 20, (int)(24 - tBR2.Value / 10.625) + 10); lbR2Track.Location = new Point(tBR2.Location.X + 20, (int)(24 - tBR2.Value / 10.625) + 10);
if (tBR2.Value == 255) if (tBR2.Value == 255)
lBR2Track.ForeColor = Color.Green; lbR2Track.ForeColor = Color.Green;
else if (tBR2.Value < (double)nUDR2.Value * 255) else if (tBR2.Value < (double)nUDR2.Value * 255)
lBR2Track.ForeColor = Color.Red; lbR2Track.ForeColor = Color.Red;
else else
lBR2Track.ForeColor = Color.Black; lbR2Track.ForeColor = Color.Black;
double latency = scpDevice.DS4Controllers[(int)nUDSixaxis.Value - 1].Latency; double latency = scpDevice.DS4Controllers[(int)nUDSixaxis.Value - 1].Latency;
lBInputDelay.Text = "Input Delay: " + latency + "ms"; lbInputDelay.Text = "Input Delay: " + latency + "ms";
if (latency > 10) if (latency > 10)
pBDelayTracker.BackColor = Color.Red; pBDelayTracker.BackColor = Color.Red;
else if (latency > 5) else if (latency > 5)
@ -359,6 +370,7 @@ namespace ScpServer
FullPanel.Location = (cBLightbyBattery.Checked ? new Point(FullPanel.Location.X, 42) : new Point(FullPanel.Location.X, 48)); FullPanel.Location = (cBLightbyBattery.Checked ? new Point(FullPanel.Location.X, 42) : new Point(FullPanel.Location.X, 48));
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.saveShiftColor(device, (byte)shiftRedBar.Value, (byte)shiftGreenBar.Value, (byte)shiftBlueBar.Value);
Global.setLeftTriggerMiddle(device, (byte)Math.Round((nUDL2.Value * 255), 0)); Global.setLeftTriggerMiddle(device, (byte)Math.Round((nUDL2.Value * 255), 0));
Global.setRightTriggerMiddle(device, (byte)Math.Round((nUDR2.Value * 255), 0)); Global.setRightTriggerMiddle(device, (byte)Math.Round((nUDR2.Value * 255), 0));
Global.saveRumbleBoost(device, (byte)nUDRumbleBoost.Value); Global.saveRumbleBoost(device, (byte)nUDRumbleBoost.Value);
@ -618,6 +630,57 @@ namespace ScpServer
tp.Show(((TrackBar)sender).Value.ToString(), ((TrackBar)sender), 100, 0, 2000); tp.Show(((TrackBar)sender).Value.ToString(), ((TrackBar)sender), 100, 0, 2000);
} }
private void shiftRedBar_ValueChanged(object sender, EventArgs e)
{
int value = ((TrackBar)sender).Value;
int sat = bgc - (value < bgc ? value : bgc);
int som = bgc + 11 * (int)(value * 0.0039215);
((TrackBar)sender).BackColor = Color.FromArgb(som, sat, sat);
alphacolor = Math.Max(shiftRedBar.Value, Math.Max(shiftGreenBar.Value, shiftBlueBar.Value));
reg = Color.FromArgb(shiftRedBar.Value, shiftGreenBar.Value, shiftBlueBar.Value);
full = HuetoRGB(reg.GetHue(), reg.GetBrightness(), reg);
spBController.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
Global.saveShiftColor(device, (byte)shiftRedBar.Value, (byte)shiftGreenBar.Value, (byte)shiftBlueBar.Value);
if (g.DpiX == 120)
tp.Show(((TrackBar)sender).Value.ToString(), ((TrackBar)sender), 125, 0, 2000);
else
tp.Show(((TrackBar)sender).Value.ToString(), ((TrackBar)sender), 100, 0, 2000);
}
private void shiftGreenBar_ValueChanged(object sender, EventArgs e)
{
int value = ((TrackBar)sender).Value;
int sat = bgc - (value < bgc ? value : bgc);
int som = bgc + 11 * (int)(value * 0.0039215);
((TrackBar)sender).BackColor = Color.FromArgb(sat, som, sat);
alphacolor = Math.Max(shiftRedBar.Value, Math.Max(shiftGreenBar.Value, shiftBlueBar.Value));
reg = Color.FromArgb(shiftRedBar.Value, shiftGreenBar.Value, shiftBlueBar.Value);
full = HuetoRGB(reg.GetHue(), reg.GetBrightness(), reg);
spBController.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
Global.saveShiftColor(device, (byte)shiftRedBar.Value, (byte)shiftGreenBar.Value, (byte)shiftBlueBar.Value);
if (g.DpiX == 120)
tp.Show(((TrackBar)sender).Value.ToString(), ((TrackBar)sender), 125, 0, 2000);
else
tp.Show(((TrackBar)sender).Value.ToString(), ((TrackBar)sender), 100, 0, 2000);
}
private void shiftBlueBar_ValueChanged(object sender, EventArgs e)
{
int value = ((TrackBar)sender).Value;
int sat = bgc - (value < bgc ? value : bgc);
int som = bgc + 11 * (int)(value * 0.0039215);
((TrackBar)sender).BackColor = Color.FromArgb(sat, sat, som);
alphacolor = Math.Max(shiftRedBar.Value, Math.Max(shiftGreenBar.Value, shiftBlueBar.Value));
reg = Color.FromArgb(shiftRedBar.Value, shiftGreenBar.Value, shiftBlueBar.Value);
full = HuetoRGB(reg.GetHue(), reg.GetBrightness(), reg);
spBController.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
Global.saveShiftColor(device, (byte)shiftRedBar.Value, (byte)shiftGreenBar.Value, (byte)shiftBlueBar.Value);
if (g.DpiX == 120)
tp.Show(((TrackBar)sender).Value.ToString(), ((TrackBar)sender), 125, 0, 2000);
else
tp.Show(((TrackBar)sender).Value.ToString(), ((TrackBar)sender), 100, 0, 2000);
}
public Color HuetoRGB(float hue, float light, Color rgb) public Color HuetoRGB(float hue, float light, Color rgb)
{ {
float L = (float)Math.Max(.5, light); float L = (float)Math.Max(.5, light);
@ -754,7 +817,7 @@ namespace ScpServer
{ {
lBControls.Items[0] = "Cross : " + bnCross.Text; lBControls.Items[0] = "Cross : " + bnCross.Text;
lBControls.Items[1] = "Circle : " + bnCircle.Text; lBControls.Items[1] = "Circle : " + bnCircle.Text;
lBControls.Items[2] = "Sqaure : " + bnSquare.Text; lBControls.Items[2] = "Square : " + bnSquare.Text;
lBControls.Items[3] = "Triangle : " + bnTriangle.Text; lBControls.Items[3] = "Triangle : " + bnTriangle.Text;
lBControls.Items[4] = "Options : " + bnOptions.Text; lBControls.Items[4] = "Options : " + bnOptions.Text;
lBControls.Items[5] = "Share : " + bnShare.Text; lBControls.Items[5] = "Share : " + bnShare.Text;
@ -795,7 +858,7 @@ namespace ScpServer
b.Text = "Fall Back to " + buttons[subbuttons.IndexOf(b)].Text; b.Text = "Fall Back to " + buttons[subbuttons.IndexOf(b)].Text;
lBShiftControls.Items[0] = "Cross : " + sbnCross.Text; lBShiftControls.Items[0] = "Cross : " + sbnCross.Text;
lBShiftControls.Items[1] = "Circle : " + sbnCircle.Text; lBShiftControls.Items[1] = "Circle : " + sbnCircle.Text;
lBShiftControls.Items[2] = "Sqaure : " + sbnSquare.Text; lBShiftControls.Items[2] = "Square : " + sbnSquare.Text;
lBShiftControls.Items[3] = "Triangle : " + sbnTriangle.Text; lBShiftControls.Items[3] = "Triangle : " + sbnTriangle.Text;
lBShiftControls.Items[4] = "Options : " + sbnOptions.Text; lBShiftControls.Items[4] = "Options : " + sbnOptions.Text;
lBShiftControls.Items[5] = "Share : " + sbnShare.Text; lBShiftControls.Items[5] = "Share : " + sbnShare.Text;
@ -989,7 +1052,7 @@ namespace ScpServer
pBController.BackgroundImage = null; pBController.BackgroundImage = null;
cBLightbyBattery.Text = "Color by Battery %"; cBLightbyBattery.Text = "Color by Battery %";
} }
lBspc.Enabled = on; lbspc.Enabled = on;
lowBatteryPanel.Enabled = !on; lowBatteryPanel.Enabled = !on;
FullPanel.Enabled = !on; FullPanel.Enabled = !on;
} }
@ -1031,7 +1094,7 @@ namespace ScpServer
{ {
pBSADeadzone.Visible = true; pBSADeadzone.Visible = true;
pBSADeadzone.Size = new Size((int)(nUDSX.Value * 125), (int)(nUDSZ.Value * 125)); pBSADeadzone.Size = new Size((int)(nUDSX.Value * 125), (int)(nUDSZ.Value * 125));
pBSADeadzone.Location = new Point(lBSATrack.Location.X + 63 - pBSADeadzone.Size.Width / 2, lBSATrack.Location.Y + 63 - pBSADeadzone.Size.Height / 2); pBSADeadzone.Location = new Point(lbSATrack.Location.X + 63 - pBSADeadzone.Size.Width / 2, lbSATrack.Location.Y + 63 - pBSADeadzone.Size.Height / 2);
} }
} }
@ -1044,7 +1107,7 @@ namespace ScpServer
{ {
pBSADeadzone.Visible = true; pBSADeadzone.Visible = true;
pBSADeadzone.Size = new Size((int)(nUDSX.Value * 125), (int)(nUDSZ.Value * 125)); pBSADeadzone.Size = new Size((int)(nUDSX.Value * 125), (int)(nUDSZ.Value * 125));
pBSADeadzone.Location = new Point(lBSATrack.Location.X + 63 - pBSADeadzone.Size.Width / 2, lBSATrack.Location.Y + 63 - pBSADeadzone.Size.Height / 2); pBSADeadzone.Location = new Point(lbSATrack.Location.X + 63 - pBSADeadzone.Size.Width / 2, lbSATrack.Location.Y + 63 - pBSADeadzone.Size.Height / 2);
} }
} }
@ -1086,7 +1149,7 @@ namespace ScpServer
{ {
pBRSDeadzone.Visible = true; pBRSDeadzone.Visible = true;
pBRSDeadzone.Size = new Size((int)(nUDRS.Value * 125), (int)(nUDRS.Value * 125)); pBRSDeadzone.Size = new Size((int)(nUDRS.Value * 125), (int)(nUDRS.Value * 125));
pBRSDeadzone.Location = new Point(lBRSTrack.Location.X + 63 - pBRSDeadzone.Size.Width / 2, lBRSTrack.Location.Y + 63 - pBRSDeadzone.Size.Width / 2); pBRSDeadzone.Location = new Point(lbRSTrack.Location.X + 63 - pBRSDeadzone.Size.Width / 2, lbRSTrack.Location.Y + 63 - pBRSDeadzone.Size.Width / 2);
} }
} }
@ -1099,7 +1162,7 @@ namespace ScpServer
{ {
pBLSDeadzone.Visible = true; pBLSDeadzone.Visible = true;
pBLSDeadzone.Size = new Size((int)(nUDLS.Value*125), (int)(nUDLS.Value*125)); pBLSDeadzone.Size = new Size((int)(nUDLS.Value*125), (int)(nUDLS.Value*125));
pBLSDeadzone.Location = new Point(lBLSTrack.Location.X + 63 - pBLSDeadzone.Size.Width / 2, lBLSTrack.Location.Y + 63 - pBLSDeadzone.Size.Width / 2); pBLSDeadzone.Location = new Point(lbLSTrack.Location.X + 63 - pBLSDeadzone.Size.Width / 2, lbLSTrack.Location.Y + 63 - pBLSDeadzone.Size.Width / 2);
} }
} }
@ -1165,16 +1228,8 @@ namespace ScpServer
private void cBShiftControl_SelectedIndexChanged(object sender, EventArgs e) private void cBShiftControl_SelectedIndexChanged(object sender, EventArgs e)
{ {
Global.setShiftModifier(device, cBShiftControl.SelectedIndex); Global.setShiftModifier(device, cBShiftControl.SelectedIndex);
} if (cBShiftControl.SelectedIndex < 1)
cBShiftLight.Checked = false;
private void pBController_BackColorChanged(object sender, EventArgs e)
{
spBController.BackColor = pBController.BackColor;
}
private void pBController_BackgroundImageChanged(object sender, EventArgs e)
{
spBController.BackgroundImage = pBController.BackgroundImage;
} }
private void tabControls_SelectedIndexChanged(object sender, EventArgs e) private void tabControls_SelectedIndexChanged(object sender, EventArgs e)
@ -1183,6 +1238,10 @@ namespace ScpServer
sixaxisTimer.Start(); sixaxisTimer.Start();
else else
sixaxisTimer.Stop(); sixaxisTimer.Stop();
if (tabControls.SelectedIndex == 1)
ShiftPanel.Visible = true;
else
ShiftPanel.Visible = false;
} }
private void DrawCircle(object sender, PaintEventArgs e) private void DrawCircle(object sender, PaintEventArgs e)
@ -1197,14 +1256,21 @@ namespace ScpServer
e.Graphics.DrawEllipse(blackPen, rect); e.Graphics.DrawEllipse(blackPen, rect);
} }
private void lBEmpty_Click(object sender, EventArgs e) private void lbEmpty_Click(object sender, EventArgs e)
{ {
lowRedBar.Value = redBar.Value; lowRedBar.Value = redBar.Value;
lowGreenBar.Value = greenBar.Value; lowGreenBar.Value = greenBar.Value;
lowBlueBar.Value = blueBar.Value; lowBlueBar.Value = blueBar.Value;
} }
private void lBSATip_Click(object sender, EventArgs e) private void lbShift_Click(object sender, EventArgs e)
{
shiftRedBar.Value = redBar.Value;
shiftGreenBar.Value = greenBar.Value;
shiftBlueBar.Value = blueBar.Value;
}
private void lbSATip_Click(object sender, EventArgs e)
{ {
SixaxisPanel.Visible = !SixaxisPanel.Visible; SixaxisPanel.Visible = !SixaxisPanel.Visible;
pBSADeadzone.Visible = !pBSADeadzone.Visible; pBSADeadzone.Visible = !pBSADeadzone.Visible;
@ -1213,12 +1279,59 @@ namespace ScpServer
private void SixaxisPanel_Click(object sender, EventArgs e) private void SixaxisPanel_Click(object sender, EventArgs e)
{ {
lBSATip_Click(sender, e); lbSATip_Click(sender, e);
} }
private void lBSATrack_Click(object sender, EventArgs e) private void lbSATrack_Click(object sender, EventArgs e)
{ {
lBSATip_Click(sender, e); lbSATip_Click(sender, e);
}
private void cBShiftLight_CheckedChanged(object sender, EventArgs e)
{
if (Global.getShiftModifier(device) < 1)
cBShiftLight.Checked = false;
if (!cBShiftLight.Checked)
{
spBController.BackColor = pBController.BackColor;
spBController.BackgroundImage = pBController.BackgroundImage;
}
else
{
alphacolor = Math.Max(shiftRedBar.Value, Math.Max(shiftGreenBar.Value, shiftBlueBar.Value));
reg = Color.FromArgb(shiftRedBar.Value, shiftGreenBar.Value, shiftBlueBar.Value);
full = HuetoRGB(reg.GetHue(), reg.GetBrightness(), reg);
spBController.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
}
Global.setShiftColorOn(device, cBShiftLight.Checked);
lbShift.Enabled = cBShiftLight.Checked;
lbShiftRed.Enabled = cBShiftLight.Checked;
lbShiftGreen.Enabled = cBShiftLight.Checked;
lbShiftBlue.Enabled = cBShiftLight.Checked;
shiftRedBar.Enabled = cBShiftLight.Checked;
shiftGreenBar.Enabled = cBShiftLight.Checked;
shiftBlueBar.Enabled = cBShiftLight.Checked;
}
private void btnBrowse_Click(object sender, EventArgs e)
{
if( openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
cBLaunchProgram.Checked = true;
Global.setLaunchProgram(device, openFileDialog1.FileName);
pBProgram.Image = Icon.ExtractAssociatedIcon(openFileDialog1.FileName).ToBitmap();
btnBrowse.Text = Path.GetFileNameWithoutExtension(openFileDialog1.FileName);
}
}
private void cBLaunchProgram_CheckedChanged(object sender, EventArgs e)
{
if (!cBLaunchProgram.Checked)
{
Global.setLaunchProgram(device, string.Empty);
pBProgram.Image = null;
btnBrowse.Text = "Browse...";
}
} }
} }
} }

View File

@ -382,6 +382,9 @@
AElFTkSuQmCC AElFTkSuQmCC
</value> </value>
</data> </data>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>153, 17</value>
</metadata>
<metadata name="advColorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="advColorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>

View File

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

View File

@ -212,10 +212,12 @@ namespace ScpServer
Form_Resize(sender, e); Form_Resize(sender, e);
RefreshProfiles(); RefreshProfiles();
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{
Global.LoadProfile(i); Global.LoadProfile(i);
}
LoadP(); LoadP();
Global.ControllerStatusChange += ControllerStatusChange; Global.ControllerStatusChange += ControllerStatusChange;
ControllerStatusChanged(); ControllerStatusChanged(false);
if (btnStartStop.Enabled) if (btnStartStop.Enabled)
btnStartStop_Clicked(); btnStartStop_Clicked();
cBNotifications.Checked = Global.getNotifications(); cBNotifications.Checked = Global.getNotifications();
@ -290,7 +292,10 @@ namespace ScpServer
{ {
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
if (proprofiles[j][i] != "(none)") if (proprofiles[j][i] != "(none)")
{
Global.LoadTempProfile(j, proprofiles[j][i]); //j is controller index, i is filename Global.LoadTempProfile(j, proprofiles[j][i]); //j is controller index, i is filename
if (Global.getLaunchProgram(j) != string.Empty) Process.Start(Global.getLaunchProgram(j));
}
tempprofile = name; tempprofile = name;
} }
} }
@ -554,18 +559,18 @@ namespace ScpServer
{ {
btnStartStop_Clicked(); btnStartStop_Clicked();
} }
protected void btnStartStop_Clicked() protected void btnStartStop_Clicked(bool log = true)
{ {
if (btnStartStop.Text == Properties.Resources.StartText) if (btnStartStop.Text == Properties.Resources.StartText)
{ {
rootHub.Start(); rootHub.Start(log);
hotkeystimer.Start(); hotkeystimer.Start();
btnStartStop.Text = Properties.Resources.StopText; btnStartStop.Text = Properties.Resources.StopText;
} }
else if (btnStartStop.Text == Properties.Resources.StopText) else if (btnStartStop.Text == Properties.Resources.StopText)
{ {
rootHub.Stop(); rootHub.Stop(log);
hotkeystimer.Stop(); hotkeystimer.Stop();
btnStartStop.Text = Properties.Resources.StartText; btnStartStop.Text = Properties.Resources.StartText;
} }
@ -608,7 +613,7 @@ namespace ScpServer
else else
ControllerStatusChanged(); ControllerStatusChanged();
} }
protected void ControllerStatusChanged() protected void ControllerStatusChanged(bool program = true)
{ {
String tooltip = "DS4Windows v" + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion; String tooltip = "DS4Windows v" + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;
for (Int32 Index = 0; Index < Pads.Length; Index++) for (Int32 Index = 0; Index < Pads.Length; Index++)
@ -627,6 +632,8 @@ namespace ScpServer
if (Pads[Index].Text != "Connecting...") if (Pads[Index].Text != "Connecting...")
{ {
Enable_Controls(Index, true); Enable_Controls(Index, true);
//Console.WriteLine(opt == null);
//if (program && Global.getLaunchProgram(Index) != string.Empty) Process.Start(Global.getLaunchProgram(Index));
if (opt != null) if (opt != null)
opt.inputtimer.Start(); opt.inputtimer.Start();
//MinimumSize = new Size(MinimumSize.Width, 137 + 29 * Index); //MinimumSize = new Size(MinimumSize.Width, 137 + 29 * Index);
@ -882,8 +889,8 @@ namespace ScpServer
module.Dispose(); module.Dispose();
Global.setUseExclusiveMode(hideDS4CheckBox.Checked); Global.setUseExclusiveMode(hideDS4CheckBox.Checked);
btnStartStop_Clicked(); btnStartStop_Clicked(false);
btnStartStop_Clicked(); btnStartStop_Clicked(false);
Global.Save(); Global.Save();
} }
@ -915,6 +922,7 @@ namespace ScpServer
Global.setAProfile(tdevice, cb.Items[cb.SelectedIndex].ToString()); Global.setAProfile(tdevice, cb.Items[cb.SelectedIndex].ToString());
Global.Save(); Global.Save();
Global.LoadProfile(tdevice); Global.LoadProfile(tdevice);
if (Global.getLaunchProgram(tdevice) != string.Empty) Process.Start(Global.getLaunchProgram(tdevice));
} }
else if (cb.SelectedIndex == cb.Items.Count - 1 && cb.Items.Count > 1) //if +New Profile selected else if (cb.SelectedIndex == cb.Items.Count - 1 && cb.Items.Count > 1) //if +New Profile selected
ShowOptions(tdevice, ""); ShowOptions(tdevice, "");
@ -923,7 +931,7 @@ namespace ScpServer
else else
ebns[tdevice].Text = "Edit"; ebns[tdevice].Text = "Edit";
} }
ControllerStatusChanged(); //to update profile name in notify icon ControllerStatusChanged(false); //to update profile name in notify icon
} }
private void Profile_Changed_Menu(object sender, ToolStripItemClickedEventArgs e) private void Profile_Changed_Menu(object sender, ToolStripItemClickedEventArgs e)

File diff suppressed because it is too large Load Diff