Skip to content
This repository has been archived by the owner on Oct 24, 2021. It is now read-only.

Commit

Permalink
Version 1.4.245
Browse files Browse the repository at this point in the history
Fix settings tab text being blank after clicking controller/driver setup
Check if .Net 4.5 or higher is installed at the start.
Fix crash with certain macro
Option to disable flashing light when controller latency is over 10ms
Special Action Program: Added Arguments/Command Line and hold trigger
for x seconds to launch program
Bug fixes
  • Loading branch information
Jays2Kings committed Mar 15, 2015
1 parent e5a26ee commit 3da12e5
Show file tree
Hide file tree
Showing 16 changed files with 9,679 additions and 2,737 deletions.
6 changes: 6 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
13 changes: 8 additions & 5 deletions DS4Control/ControlSerivce.cs
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,13 @@ public void LagFlashWarning(int ind, bool on)
{
lag[ind] = true;
LogDebug(Properties.Resources.LatencyOverTen.Replace("*number*", (ind + 1).ToString()), true);
DS4Color color = new DS4Color { red = 50, green = 0, blue = 0 };
DS4LightBar.forcedColor[ind] = color;
DS4LightBar.forcedFlash[ind] = 2;
DS4LightBar.forcelight[ind] = true;
if (Global.FlashWhenLate)
{
DS4Color color = new DS4Color { red = 50, green = 0, blue = 0 };
DS4LightBar.forcedColor[ind] = color;
DS4LightBar.forcedFlash[ind] = 2;
DS4LightBar.forcelight[ind] = true;
}
}
else
{
Expand Down Expand Up @@ -767,7 +770,7 @@ protected virtual void CheckForHotkeys(int deviceID, DS4State cState, DS4State p

public virtual void StartTPOff(int deviceID)
{
if (deviceID > 4)
if (deviceID < 4)
{
oldtouchvalue[deviceID] = Global.TouchSensitivity[deviceID];
oldscrollvalue[deviceID] = Global.ScrollSensitivity[deviceID];
Expand Down
28 changes: 14 additions & 14 deletions DS4Control/Mapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ public static async void MapCustomAction(int device, DS4State cState, DS4State M
if (!(action.name == "null" || index < 0))
{
bool triggeractivated = true;
if ((action.type == "DisconnectBT" && double.Parse(action.details) > 0) || (action.type == "BatteryCheck" && double.Parse(action.details.Split(',')[0]) > 0))
if (action.delayTime > 0)
{
triggeractivated = false;
bool subtriggeractivated = true;
Expand All @@ -1214,10 +1214,7 @@ public static async void MapCustomAction(int device, DS4State cState, DS4State M
}
if (subtriggeractivated)
{
if (action.type == "DisconnectBT")
time = double.Parse(action.details);
else
time = double.Parse(action.details.Split(',')[0]);
time = action.delayTime;
nowAction[device] = DateTime.UtcNow;
if (nowAction[device] >= oldnowAction[device] + TimeSpan.FromSeconds(time))
triggeractivated = true;
Expand Down Expand Up @@ -1293,7 +1290,10 @@ public static async void MapCustomAction(int device, DS4State cState, DS4State M
if (!actionDone[device, index])
{
actionDone[device, index] = true;
Process.Start(action.details);
if (!string.IsNullOrEmpty(action.extra))
Process.Start(action.details, action.extra);
else
Process.Start(action.details);
}
}
else if (triggeractivated && action.type == "Profile")
Expand Down Expand Up @@ -1620,14 +1620,14 @@ private static async void PlayMacro(int device, bool[] macrocontrol, string macr
else if (i == 275) macroControl[14] = false;
else if (i == 276) macroControl[15] = false;
else if (i == 277) macroControl[16] = false;
else if (keys[i] == 278) macroControl[17] = false;
else if (keys[i] == 279) macroControl[18] = false;
else if (keys[i] == 280) macroControl[19] = false;
else if (keys[i] == 281) macroControl[20] = false;
else if (keys[i] == 282) macroControl[21] = false;
else if (keys[i] == 283) macroControl[22] = false;
else if (keys[i] == 284) macroControl[23] = false;
else if (keys[i] == 285) macroControl[24] = false;
else if (i == 278) macroControl[17] = false;
else if (i == 279) macroControl[18] = false;
else if (i == 280) macroControl[19] = false;
else if (i == 281) macroControl[20] = false;
else if (i == 282) macroControl[21] = false;
else if (i == 283) macroControl[22] = false;
else if (i == 284) macroControl[23] = false;
else if (i == 285) macroControl[24] = false;
else if (keyType.HasFlag(DS4KeyType.ScanCode))
InputMethods.performSCKeyRelease(i);
else
Expand Down
78 changes: 67 additions & 11 deletions DS4Control/ScpUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ public static bool DownloadLang
set { m_Config.downloadLang = value; }
get { return m_Config.downloadLang; }
}
public static bool FlashWhenLate
{
set { m_Config.flashWhenLate = value; }
get { return m_Config.flashWhenLate; }
}

//controller/profile specfic values
public static int[] ButtonMouseSensitivity
Expand Down Expand Up @@ -354,12 +359,12 @@ public static string[] ProfilePath
}
public static List<String>[] ProfileActions
{
get{ return m_Config.profileActions;}
get { return m_Config.profileActions; }
}

public static void SaveAction(string name, string controls, int mode, string details, bool edit, string ucontrols = "")
public static void SaveAction(string name, string controls, int mode, string details, bool edit, string extras = "")
{
m_Config.SaveAction(name, controls, mode, details, edit, ucontrols);
m_Config.SaveAction(name, controls, mode, details, edit, extras);
}

public static void RemoveAction(string name)
Expand Down Expand Up @@ -694,6 +699,7 @@ public class BackingStore
public Dictionary<DS4Controls, String>[] shiftCustomMapExtras = { null, null, null, null, null };
public List<String>[] profileActions = { null, null, null, null, null };
public bool downloadLang = true;
public bool flashWhenLate = true;
public BackingStore()
{
for (int i = 0; i < 5; i++)
Expand Down Expand Up @@ -1261,6 +1267,11 @@ public Boolean LoadProfile(int device, System.Windows.Forms.Control[] buttons, S
rootname = "ScpControl";
missingSetting = true;
}
if (device < 4)
{
DS4LightBar.forcelight[device] = false;
DS4LightBar.forcedFlash[device] = 0;
}
try { Item = m_Xdoc.SelectSingleNode("/"+ rootname + "/flushHIDQueue"); Boolean.TryParse(Item.InnerText, out flushHIDQueue[device]); }
catch { missingSetting = true; }//rootname = }

Expand Down Expand Up @@ -1724,6 +1735,8 @@ public bool Load()
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/Profile/DownloadLang"); Boolean.TryParse(Item.InnerText, out downloadLang); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/Profile/FlashWhenLate"); Boolean.TryParse(Item.InnerText, out flashWhenLate); }
catch { missingSetting = true; }
}
}
catch { }
Expand Down Expand Up @@ -1770,7 +1783,9 @@ public bool Save()
XmlNode xmlQuickCharge = m_Xdoc.CreateNode(XmlNodeType.Element, "QuickCharge", null); xmlQuickCharge.InnerText = quickCharge.ToString(); Node.AppendChild(xmlQuickCharge);
XmlNode xmlFirstXinputPort = m_Xdoc.CreateNode(XmlNodeType.Element, "FirstXinputPort", null); xmlFirstXinputPort.InnerText = firstXinputPort.ToString(); Node.AppendChild(xmlFirstXinputPort);
XmlNode xmlCloseMini = m_Xdoc.CreateNode(XmlNodeType.Element, "CloseMinimizes", null); xmlCloseMini.InnerText = closeMini.ToString(); Node.AppendChild(xmlCloseMini);
XmlNode xmlDownloadLang = m_Xdoc.CreateNode(XmlNodeType.Element, "DownloadLang", null); xmlDownloadLang.InnerText = downloadLang.ToString(); Node.AppendChild(xmlDownloadLang);
XmlNode xmlDownloadLang = m_Xdoc.CreateNode(XmlNodeType.Element, "DownloadLang", null); xmlDownloadLang.InnerText = downloadLang.ToString(); Node.AppendChild(xmlDownloadLang);
XmlNode xmlFlashWhenLate = m_Xdoc.CreateNode(XmlNodeType.Element, "FlashWhenLate", null); xmlFlashWhenLate.InnerText = flashWhenLate.ToString(); Node.AppendChild(xmlFlashWhenLate);

m_Xdoc.AppendChild(Node);

try { m_Xdoc.Save(m_Profile); }
Expand Down Expand Up @@ -1825,7 +1840,9 @@ public bool SaveAction(string name, string controls, int mode, string details, b
break;
case 2:
el.AppendChild(m_Xdoc.CreateElement("Type")).InnerText = "Program";
el.AppendChild(m_Xdoc.CreateElement("Details")).InnerText = details;
el.AppendChild(m_Xdoc.CreateElement("Details")).InnerText = details.Split('?')[0];
el.AppendChild(m_Xdoc.CreateElement("Arguements")).InnerText = extras;
el.AppendChild(m_Xdoc.CreateElement("Delay")).InnerText = details.Split('?')[1];
break;
case 3:
el.AppendChild(m_Xdoc.CreateElement("Type")).InnerText = "Profile";
Expand Down Expand Up @@ -1900,13 +1917,13 @@ public bool LoadActions()
if (type == "Profile")
{
extras = x.ChildNodes[3].InnerText;
actions.Add(new SpecialAction(name, controls, type, details, extras));
actions.Add(new SpecialAction(name, controls, type, details, 0, extras));
}
else if (type == "Macro")
{
if (x.ChildNodes[3] != null) extras = x.ChildNodes[3].InnerText;
else extras = string.Empty;
actions.Add(new SpecialAction(name, controls, type, details, extras));
actions.Add(new SpecialAction(name, controls, type, details, 0, extras));
}
else if (type == "Key")
{
Expand All @@ -1921,12 +1938,42 @@ public bool LoadActions()
extras2 = string.Empty;
}
if (!string.IsNullOrEmpty(extras))
actions.Add(new SpecialAction(name, controls, type, details, extras2 + '\n' + extras));
actions.Add(new SpecialAction(name, controls, type, details, 0, extras2 + '\n' + extras));
else
actions.Add(new SpecialAction(name, controls, type, details));
}
else
actions.Add(new SpecialAction(name, controls, type, details));
else if (type == "DisconnectBT")
{
double doub;
if (double.TryParse(details, out doub))
actions.Add(new SpecialAction(name, controls, type, "", doub));
else
actions.Add(new SpecialAction(name, controls, type, ""));
}
else if (type == "BatteryCheck")
{
double doub;
if (double.TryParse(details.Split(',')[0], out doub))
actions.Add(new SpecialAction(name, controls, type, details, doub));
else
actions.Add(new SpecialAction(name, controls, type, details));
}
else if (type == "Program")
{
double doub;
if (x.ChildNodes[3] != null)
{
extras = x.ChildNodes[3].InnerText;
if (double.TryParse(x.ChildNodes[4].InnerText, out doub))
actions.Add(new SpecialAction(name, controls, type, details, doub, extras));
else
actions.Add(new SpecialAction(name, controls, type, details, 0, extras));
}
else
{
actions.Add(new SpecialAction(name, controls, type, details));
}
}
}
}
catch { saved = false; }
Expand All @@ -1944,13 +1991,16 @@ public class SpecialAction
public string details;
public List<DS4Controls> uTrigger = new List<DS4Controls>();
public string ucontrols;
public double delayTime = 0;
public string extra;
public bool pressRelease = false;
public DS4KeyType keyType;
public SpecialAction(string name, string controls, string type, string details, string extras = "")
public SpecialAction(string name, string controls, string type, string details, double delay = 0, string extras = "")
{
this.name = name;
this.type = type;
this.controls = controls;
delayTime = delay;
string[] ctrls = controls.Split('/');
foreach (string s in ctrls)
trigger.Add(getDS4ControlsByName(s));
Expand Down Expand Up @@ -1981,6 +2031,12 @@ public SpecialAction(string name, string controls, string type, string details,
if (details.Contains("Scan Code"))
keyType |= DS4KeyType.ScanCode;
}
else if (type == "Program")
{
this.details = details;
if (extras != string.Empty)
extra = extras;
}
else
this.details = details;

Expand Down
3 changes: 3 additions & 0 deletions DS4Windows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@
<EmbeddedResource Include="DS4Windows\WinProgs.ru-RU.resx">
<DependentUpon>WinProgs.cs</DependentUpon>
</EmbeddedResource>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="DS4Windows\app.config" />
<None Include="DS4Windows\DS4Tool_TemporaryKey.pfx" />
<None Include="Properties\Settings.settings">
Expand Down
Loading

0 comments on commit 3da12e5

Please sign in to comment.