diff --git a/DS4Control/Control.cs b/DS4Control/Control.cs
index 2e695bb..6251e48 100644
--- a/DS4Control/Control.cs
+++ b/DS4Control/Control.cs
@@ -399,6 +399,10 @@ namespace DS4Control
{
if (Global.getFlushHIDQueue(ind))
device.FlushHID();
+ if (!string.IsNullOrEmpty(device.error))
+ {
+ LogDebug(device.error);
+ }
device.getExposedState(ExposedState[ind], CurrentState[ind]);
DS4State cState = CurrentState[ind];
device.getPreviousState(PreviousState[ind]);
diff --git a/DS4Control/DS4Control.csproj b/DS4Control/DS4Control.csproj
index 1cf5058..2f0a093 100644
--- a/DS4Control/DS4Control.csproj
+++ b/DS4Control/DS4Control.csproj
@@ -22,6 +22,7 @@
prompt
4
false
+ AnyCPU
pdbonly
diff --git a/DS4Control/InputMethods.cs b/DS4Control/InputMethods.cs
index 4eb28a6..271ea32 100644
--- a/DS4Control/InputMethods.cs
+++ b/DS4Control/InputMethods.cs
@@ -181,6 +181,7 @@ namespace DS4Control
public static void performSCKeyRelease(ushort key)
{
+ Console.WriteLine((System.Windows.Forms.Keys)key);
lock (lockob)
{
sendInputs[0].Type = INPUT_KEYBOARD;
@@ -188,7 +189,7 @@ namespace DS4Control
sendInputs[0].Data.Keyboard.Flags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP;
sendInputs[0].Data.Keyboard.Scan = MapVirtualKey(key, MAPVK_VK_TO_VSC);
sendInputs[0].Data.Keyboard.Time = 0;
- sendInputs[0].Data.Keyboard.Vk = key;
+ //sendInputs[0].Data.Keyboard.Vk = MapVirtualKey(key, MAPVK_VK_TO_VSC);
uint result = SendInput(1, sendInputs, Marshal.SizeOf(sendInputs[0]));
}
}
diff --git a/DS4Control/Mapping.cs b/DS4Control/Mapping.cs
index bfe7aa6..2e9aa9f 100644
--- a/DS4Control/Mapping.cs
+++ b/DS4Control/Mapping.cs
@@ -173,7 +173,6 @@ namespace DS4Control
gkp.current = kvp.Value.current;
globalState.keyPresses[kvp.Key] = gkp;
}
-
if (gkp.current.toggleCount != 0 && gkp.previous.toggleCount == 0 && gkp.current.toggle)
{
if (gkp.current.scanCodeCount != 0)
@@ -236,7 +235,7 @@ namespace DS4Control
}
}
}
- else if ((gkp.current.toggleCount == 0 && gkp.previous.toggleCount == 0) && gkp.current.vkCount + gkp.current.scanCodeCount == 0 && gkp.previous.vkCount + gkp.previous.scanCodeCount != 0)
+ if ((gkp.current.toggleCount == 0 && gkp.previous.toggleCount == 0) && gkp.current.vkCount + gkp.current.scanCodeCount == 0 && gkp.previous.vkCount + gkp.previous.scanCodeCount != 0)
{
if (gkp.previous.scanCodeCount != 0) // use the last type of VK/SC
{
@@ -421,7 +420,9 @@ namespace DS4Control
public static bool[] pressedonce = new bool[261], macrodone = new bool[34];
public static int test = 0;
static bool[] macroControl = new bool[25];
- /** 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, Mouse tp, Control ctrl)
{
bool shift;
@@ -1491,6 +1492,7 @@ namespace DS4Control
{
if (!actionDone[device,index])
{
+ DS4KeyType keyType = action.keyType;
actionDone[device,index] = true;
foreach (DS4Controls dc in action.trigger)
resetToDefaultValue(dc, MappedState);
@@ -1532,8 +1534,8 @@ namespace DS4Control
else if (i == 283) macroControl[22] = true;
else if (i == 284) macroControl[23] = true;
else if (i == 285) macroControl[24] = true;
- //else if (keyType.HasFlag(DS4KeyType.ScanCode))
- //InputMethods.performSCKeyPress((ushort)i);
+ else if (keyType.HasFlag(DS4KeyType.ScanCode))
+ InputMethods.performSCKeyPress((ushort)i);
else
InputMethods.performKeyPress((ushort)i);
keydown[i] = true;
@@ -1570,8 +1572,8 @@ namespace DS4Control
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((ushort)i);
+ else if (keyType.HasFlag(DS4KeyType.ScanCode))
+ InputMethods.performSCKeyRelease((ushort)i);
else
InputMethods.performKeyRelease((ushort)i);
keydown[i] = false;
@@ -1610,15 +1612,15 @@ namespace DS4Control
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 if (keyType.HasFlag(DS4KeyType.ScanCode))
+ InputMethods.performSCKeyRelease(i);
else
InputMethods.performKeyRelease(i);
}
/*if (keyType.HasFlag(DS4KeyType.HoldMacro))
{
await Task.Delay(50);
- macrodoneA[index] = false;
+ actionDone[device,index] = false;
}*/
}
}
@@ -1839,8 +1841,6 @@ namespace DS4Control
public static bool getBoolMapping(DS4Controls control, DS4State cState, DS4StateExposed eState, Mouse tp)
{
- //if (control == DS4Controls.Up)
- //Cons
switch (control)
{
case DS4Controls.Share: return cState.Share;
diff --git a/DS4Control/ScpUtil.cs b/DS4Control/ScpUtil.cs
index d4e6af8..15d517b 100644
--- a/DS4Control/ScpUtil.cs
+++ b/DS4Control/ScpUtil.cs
@@ -1255,7 +1255,7 @@ namespace DS4Control
hasvalue = true;
break;
}
- if (hasvalue)
+ if (hasvalue && !string.IsNullOrEmpty(String.Join(",", extras)))
{
XmlNode extraNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
extraNode.InnerText = String.Join(",", extras);
@@ -1701,9 +1701,12 @@ namespace DS4Control
if (UInt16.TryParse(item.InnerText, out wvk))
customMapKeys.Add(getDS4ControlsByName(item.Name), wvk);
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/Extras");
- if (ParentItem != null)
+ if (ParentItem != null)
foreach (XmlNode item in ParentItem.ChildNodes)
- customMapExtras.Add(getDS4ControlsByName(item.Name), item.InnerText);
+ if (item.InnerText != string.Empty)
+ customMapExtras.Add(getDS4ControlsByName(item.Name), item.InnerText);
+ else
+ ParentItem.RemoveChild(item);
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/KeyType");
if (ParentItem != null)
foreach (XmlNode item in ParentItem.ChildNodes)
@@ -1840,8 +1843,16 @@ namespace DS4Control
Item = m_Xdoc.SelectSingleNode(String.Format("/" + rootname + "/" + control + "/Extras/{0}", button.Name));
if (Item != null)
{
- extras = Item.InnerText;
- customMapExtras.Add(getDS4ControlsByName(button.Name), Item.InnerText);
+ if (Item.InnerText != string.Empty)
+ {
+ extras = Item.InnerText;
+ customMapExtras.Add(getDS4ControlsByName(button.Name), Item.InnerText);
+ }
+ else
+ {
+ m_Xdoc.RemoveChild(Item);
+ extras = "0,0,0,0,0,0,0,0";
+ }
}
else
extras = "0,0,0,0,0,0,0,0";
@@ -2015,7 +2026,7 @@ namespace DS4Control
m_Xdoc.Save(m_Actions);
}
- public bool SaveAction(string name, string controls, int mode, string details, bool edit, string ucontrols = "")
+ public bool SaveAction(string name, string controls, int mode, string details, bool edit, string extras = "")
{
bool saved = true;
if (!File.Exists(m_Actions))
@@ -2036,6 +2047,8 @@ namespace DS4Control
case 1:
el.AppendChild(m_Xdoc.CreateElement("Type")).InnerText = "Macro";
el.AppendChild(m_Xdoc.CreateElement("Details")).InnerText = details;
+ if (extras != string.Empty)
+ el.AppendChild(m_Xdoc.CreateElement("Extras")).InnerText = extras;
break;
case 2:
el.AppendChild(m_Xdoc.CreateElement("Type")).InnerText = "Program";
@@ -2044,7 +2057,7 @@ namespace DS4Control
case 3:
el.AppendChild(m_Xdoc.CreateElement("Type")).InnerText = "Profile";
el.AppendChild(m_Xdoc.CreateElement("Details")).InnerText = details;
- el.AppendChild(m_Xdoc.CreateElement("UnloadTrigger")).InnerText = ucontrols;
+ el.AppendChild(m_Xdoc.CreateElement("UnloadTrigger")).InnerText = extras;
break;
}
if (edit)
@@ -2083,7 +2096,7 @@ namespace DS4Control
XmlDocument doc = new XmlDocument();
doc.Load(Global.appdatapath + "\\Actions.xml");
XmlNodeList actionslist = doc.SelectNodes("Actions/Action");
- string name, controls, type, details, ucontrols;
+ string name, controls, type, details, extras;
foreach (XmlNode x in actionslist)
{
name = x.Attributes["Name"].Value;
@@ -2092,11 +2105,15 @@ namespace DS4Control
details = x.ChildNodes[2].InnerText;
if (type == "Profile")
{
- ucontrols = x.ChildNodes[3].InnerText;
- actions.Add(new SpecialAction(name, controls, type, details, ucontrols));
+ extras = x.ChildNodes[3].InnerText;
+ actions.Add(new SpecialAction(name, controls, type, details, 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));
}
- else
- actions.Add(new SpecialAction(name, controls, type, details));
}
}
catch { saved = false; }
@@ -2114,7 +2131,8 @@ namespace DS4Control
public string details;
public List uTrigger = new List();
public string ucontrols;
- public SpecialAction(string name, string controls, string type, string details, string ucontrols = "")
+ public DS4KeyType keyType;
+ public SpecialAction(string name, string controls, string type, string details, string extras = "")
{
this.name = name;
this.type = type;
@@ -2131,13 +2149,15 @@ namespace DS4Control
if (int.TryParse(s, out v))
macro.Add(v);
}
+ if (extras.Contains("Scan Code"))
+ keyType |= DS4KeyType.ScanCode;
}
else
this.details = details;
- if (!string.IsNullOrEmpty(ucontrols))
+ if (!string.IsNullOrEmpty(extras))
{
- this.ucontrols = ucontrols;
- string[] uctrls = ucontrols.Split('/');
+ this.ucontrols = extras;
+ string[] uctrls = extras.Split('/');
foreach (string s in uctrls)
uTrigger.Add(getDS4ControlsByName(s));
}
diff --git a/DS4Library/DS4Device.cs b/DS4Library/DS4Device.cs
index 3bac5ec..373f217 100644
--- a/DS4Library/DS4Device.cs
+++ b/DS4Library/DS4Device.cs
@@ -280,6 +280,7 @@ namespace DS4Library
private byte priorInputReport30 = 0xff;
public double Latency = 0;
bool warn;
+ public string error;
private void performDs4Input()
{
System.Timers.Timer readTimeout = new System.Timers.Timer(); // Await 30 seconds for the initial packet, then 3 seconds thereafter.
@@ -290,6 +291,7 @@ namespace DS4Library
sw.Start();
while (true)
{
+ string currerror = string.Empty;
Latency.Add(sw.ElapsedMilliseconds - oldtime);
oldtime = sw.ElapsedMilliseconds;
@@ -408,28 +410,36 @@ namespace DS4Library
Array.Copy(inputReport, 14, accel, 0, 6);
Array.Copy(inputReport, 20, gyro, 0, 6);
+
+ try
+ {
charging = (inputReport[30] & 0x10) != 0;
battery = (inputReport[30] & 0x0f) * 10;
cState.Battery = (byte)battery;
- if (inputReport[30] != priorInputReport30)
- {
- priorInputReport30 = inputReport[30];
- Console.WriteLine(MacAddress.ToString() + " " + System.DateTime.UtcNow.ToString("o") + "> power subsystem octet: 0x" + inputReport[30].ToString("x02"));
+ if (inputReport[30] != priorInputReport30)
+ {
+ priorInputReport30 = inputReport[30];
+ Console.WriteLine(MacAddress.ToString() + " " + System.DateTime.UtcNow.ToString("o") + "> power subsystem octet: 0x" + inputReport[30].ToString("x02"));
+ }
}
-
+ catch { currerror = "Index out ofr bounds: battery"; }
// XXX DS4State mapping needs fixup, turn touches into an array[4] of structs. And include the touchpad details there instead.
- for (int touches = inputReport[-1 + DS4Touchpad.TOUCHPAD_DATA_OFFSET - 1], touchOffset = 0; touches > 0; touches--, touchOffset += 9)
+ try
{
- cState.TouchPacketCounter = inputReport[-1 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset];
- cState.Touch1 = (inputReport[0 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] >> 7) != 0 ? false : true; // >= 1 touch detected
- cState.Touch1Identifier = (byte)(inputReport[0 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] & 0x7f);
- cState.Touch2 = (inputReport[4 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] >> 7) != 0 ? false : true; // 2 touches detected
- cState.Touch2Identifier = (byte)(inputReport[4 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] & 0x7f);
- cState.TouchLeft = (inputReport[1 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] + ((inputReport[2 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] & 0xF) * 255) >= 1920 * 2 / 5) ? false : true;
- cState.TouchRight = (inputReport[1 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] + ((inputReport[2 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] & 0xF) * 255) < 1920 * 2 / 5) ? false : true;
+ for (int touches = inputReport[-1 + DS4Touchpad.TOUCHPAD_DATA_OFFSET - 1], touchOffset = 0; touches > 0; touches--, touchOffset += 9)
+ {
+ cState.TouchPacketCounter = inputReport[-1 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset];
+ cState.Touch1 = (inputReport[0 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] >> 7) != 0 ? false : true; // >= 1 touch detected
+ cState.Touch1Identifier = (byte)(inputReport[0 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] & 0x7f);
+ cState.Touch2 = (inputReport[4 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] >> 7) != 0 ? false : true; // 2 touches detected
+ cState.Touch2Identifier = (byte)(inputReport[4 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] & 0x7f);
+ cState.TouchLeft = (inputReport[1 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] + ((inputReport[2 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] & 0xF) * 255) >= 1920 * 2 / 5) ? false : true;
+ cState.TouchRight = (inputReport[1 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] + ((inputReport[2 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] & 0xF) * 255) < 1920 * 2 / 5) ? false : true;
// Even when idling there is still a touch packet indicating no touch 1 or 2
- touchpad.handleTouchpad(inputReport, cState, touchOffset);
+ touchpad.handleTouchpad(inputReport, cState, touchOffset);
+ }
}
+ catch { currerror = "Index out ofr bounds: touchpad"; }
/* Debug output of incoming HID data:
if (cState.L2 == 0xff && cState.R2 == 0xff)
@@ -444,12 +454,6 @@ namespace DS4Library
if (conType == ConnectionType.BT)
{
bool shouldDisconnect = false;
- /*if ((!pState.PS || !pState.Options) && cState.PS && cState.Options)
- {
- shouldDisconnect = true;
- for (int i = 0; i < 255; i++)
- ReleaseKeys(i);
- }*/
if (IdleTimeout > 0)
{
if (isNonSixaxisIdle())
@@ -466,7 +470,10 @@ namespace DS4Library
if (Report != null)
Report(this, EventArgs.Empty);
sendOutputReport(false);
-
+ if (!string.IsNullOrEmpty(error))
+ error = string.Empty;
+ if (!string.IsNullOrEmpty(currerror))
+ error = currerror;
cState.CopyTo(pState);
}
}
diff --git a/DS4Service/DS4Service.cs b/DS4Service/DS4Service.cs
index db24dde..f3ccf68 100644
--- a/DS4Service/DS4Service.cs
+++ b/DS4Service/DS4Service.cs
@@ -20,6 +20,14 @@ namespace DS4Service
logWriter = File.AppendText(logFile);
}
+ public DS4Service(Control scpdevice)
+ {
+ InitializeComponent();
+ rootHub = scpdevice;
+ rootHub.Debug += On_Debug;
+ logWriter = File.AppendText(logFile);
+ }
+
protected override void OnStart(string[] args)
{
rootHub.Start();
diff --git a/DS4Tool/DS4Form.cs b/DS4Tool/DS4Form.cs
index 016587d..0701285 100644
--- a/DS4Tool/DS4Form.cs
+++ b/DS4Tool/DS4Form.cs
@@ -15,6 +15,7 @@ using System.Xml;
using System.Text;
using System.Globalization;
using System.Threading.Tasks;
+using System.ServiceProcess;
namespace DS4Windows
{
public partial class DS4Form : Form
@@ -51,7 +52,9 @@ namespace DS4Windows
protected XmlDocument m_Xdoc = new XmlDocument();
public bool mAllowVisible;
bool contextclose;
-
+ string logFile = Global.appdatapath + @"\DS4Service.log";
+ StreamWriter logWriter;
+ //bool outputlog = false;
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
@@ -80,7 +83,6 @@ namespace DS4Windows
cbs = new ComboBox[4] { cBController1, cBController2, cBController3, cBController4 };
ebns = new Button[4] { bnEditC1, bnEditC2, bnEditC3, bnEditC4 };
statPB = new PictureBox[4] { pBStatus1, pBStatus2, pBStatus3, pBStatus4 };
-
shortcuts = new ToolStripMenuItem[4] { (ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[0],
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[1],
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[2],
@@ -148,7 +150,10 @@ namespace DS4Windows
Icon = Properties.Resources.DS4W;
notifyIcon1.Icon = Properties.Resources.DS4W;
Program.rootHub.Debug += On_Debug;
+
Log.GuiLog += On_Debug;
+ logFile = Global.appdatapath + "\\DS4Windows.log";
+ //logWriter = File.AppendText(logFile);
Log.TrayIconLog += ShowNotification;
// tmrUpdate.Enabled = true; TODO remove tmrUpdate and leave tick()
@@ -760,6 +765,8 @@ namespace DS4Windows
protected void On_Debug(object sender, DS4Control.DebugEventArgs e)
{
+ //logWriter.WriteLine(e.Time + ":\t" + e.Data);
+ //logWriter.Flush();
LogDebug(e.Time, e.Data);
}
diff --git a/DS4Tool/DS4Windows.csproj b/DS4Tool/DS4Windows.csproj
index 2a38668..9e947ee 100644
--- a/DS4Tool/DS4Windows.csproj
+++ b/DS4Tool/DS4Windows.csproj
@@ -88,6 +88,7 @@
+
diff --git a/DS4Tool/KBM360.Designer.cs b/DS4Tool/KBM360.Designer.cs
index 6dd36ba..d30845a 100644
--- a/DS4Tool/KBM360.Designer.cs
+++ b/DS4Tool/KBM360.Designer.cs
@@ -29,8 +29,8 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(KBM360));
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- this.pictureBox2 = new System.Windows.Forms.PictureBox();
+ this.pBX360 = new System.Windows.Forms.PictureBox();
+ this.pBMouse = new System.Windows.Forms.PictureBox();
this.btnF6 = new System.Windows.Forms.Button();
this.btnF5 = new System.Windows.Forms.Button();
this.btnF7 = new System.Windows.Forms.Button();
@@ -138,7 +138,7 @@
this.bnColor = new System.Windows.Forms.Button();
this.btnNUMDOT = new System.Windows.Forms.Button();
this.btnG = new System.Windows.Forms.Button();
- this.cbScanCode = new System.Windows.Forms.CheckBox();
+ this.cBScanCode = new System.Windows.Forms.CheckBox();
this.btnF = new System.Windows.Forms.Button();
this.lBTip = new System.Windows.Forms.Label();
this.btnD = new System.Windows.Forms.Button();
@@ -198,7 +198,7 @@
this.btnQ = new System.Windows.Forms.Button();
this.btnLSU = new System.Windows.Forms.Button();
this.btnLS = new System.Windows.Forms.Button();
- this.cbToggle = new System.Windows.Forms.CheckBox();
+ this.cBToggle = new System.Windows.Forms.CheckBox();
this.btnFallBack = new System.Windows.Forms.Button();
this.btnUNBOUND2 = new System.Windows.Forms.Button();
this.btnESC = new System.Windows.Forms.Button();
@@ -209,8 +209,8 @@
this.lbGreenV = new System.Windows.Forms.Label();
this.lbRedV = new System.Windows.Forms.Label();
this.advColorDialog = new DS4Windows.AdvancedColorDialog();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pBX360)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pBMouse)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDHeavy)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDLight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDLightFlash)).BeginInit();
@@ -221,18 +221,18 @@
this.gBExtras.SuspendLayout();
this.SuspendLayout();
//
- // pictureBox1
+ // pBX360
//
- resources.ApplyResources(this.pictureBox1, "pictureBox1");
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.TabStop = false;
+ resources.ApplyResources(this.pBX360, "pBX360");
+ this.pBX360.Name = "pBX360";
+ this.pBX360.TabStop = false;
//
- // pictureBox2
+ // pBMouse
//
- this.pictureBox2.Image = global::DS4Windows.Properties.Resources.mouse;
- resources.ApplyResources(this.pictureBox2, "pictureBox2");
- this.pictureBox2.Name = "pictureBox2";
- this.pictureBox2.TabStop = false;
+ this.pBMouse.Image = global::DS4Windows.Properties.Resources.mouse;
+ resources.ApplyResources(this.pBMouse, "pBMouse");
+ this.pBMouse.Name = "pBMouse";
+ this.pBMouse.TabStop = false;
//
// btnF6
//
@@ -1092,12 +1092,12 @@
this.btnG.Tag = "71";
this.btnG.UseVisualStyleBackColor = true;
//
- // cbScanCode
+ // cBScanCode
//
- resources.ApplyResources(this.cbScanCode, "cbScanCode");
- this.cbScanCode.Name = "cbScanCode";
- this.cbScanCode.TabStop = false;
- this.cbScanCode.UseVisualStyleBackColor = true;
+ resources.ApplyResources(this.cBScanCode, "cBScanCode");
+ this.cBScanCode.Name = "cBScanCode";
+ this.cBScanCode.TabStop = false;
+ this.cBScanCode.UseVisualStyleBackColor = true;
//
// btnF
//
@@ -1584,13 +1584,13 @@
this.btnLS.Tag = "X360Left Stick";
this.btnLS.UseVisualStyleBackColor = true;
//
- // cbToggle
+ // cBToggle
//
- resources.ApplyResources(this.cbToggle, "cbToggle");
- this.cbToggle.Name = "cbToggle";
- this.cbToggle.TabStop = false;
- this.cbToggle.UseVisualStyleBackColor = true;
- this.cbToggle.CheckedChanged += new System.EventHandler(this.cbToggle_CheckedChanged);
+ resources.ApplyResources(this.cBToggle, "cBToggle");
+ this.cBToggle.Name = "cBToggle";
+ this.cBToggle.TabStop = false;
+ this.cBToggle.UseVisualStyleBackColor = true;
+ this.cBToggle.CheckedChanged += new System.EventHandler(this.cbToggle_CheckedChanged);
//
// btnFallBack
//
@@ -1685,7 +1685,7 @@
this.Controls.Add(this.btnUNBOUND2);
this.Controls.Add(this.lBMacroOn);
this.Controls.Add(this.btnFallBack);
- this.Controls.Add(this.cbToggle);
+ this.Controls.Add(this.cBToggle);
this.Controls.Add(this.btnLS);
this.Controls.Add(this.btnF6);
this.Controls.Add(this.btnLSU);
@@ -1803,7 +1803,7 @@
this.Controls.Add(this.btnNUMSTAR);
this.Controls.Add(this.btnF);
this.Controls.Add(this.btnX);
- this.Controls.Add(this.cbScanCode);
+ this.Controls.Add(this.cBScanCode);
this.Controls.Add(this.btnNUM9);
this.Controls.Add(this.btnG);
this.Controls.Add(this.btnZ);
@@ -1836,8 +1836,8 @@
this.Controls.Add(this.btnRETURN);
this.Controls.Add(this.btnCAPS);
this.Controls.Add(this.btnNUM0);
- this.Controls.Add(this.pictureBox2);
- this.Controls.Add(this.pictureBox1);
+ this.Controls.Add(this.pBMouse);
+ this.Controls.Add(this.pBX360);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.KeyPreview = true;
this.MaximizeBox = false;
@@ -1845,8 +1845,8 @@
this.Name = "KBM360";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.finalMeasure);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Key_Down_Action);
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pBX360)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pBMouse)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDHeavy)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDLight)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDLightFlash)).EndInit();
@@ -1863,8 +1863,8 @@
#endregion
- private System.Windows.Forms.PictureBox pictureBox1;
- private System.Windows.Forms.PictureBox pictureBox2;
+ private System.Windows.Forms.PictureBox pBX360;
+ private System.Windows.Forms.PictureBox pBMouse;
private System.Windows.Forms.Button btnF6;
private System.Windows.Forms.Button btnF5;
private System.Windows.Forms.Button btnF7;
@@ -1972,7 +1972,7 @@
private System.Windows.Forms.Button bnColor;
private System.Windows.Forms.Button btnNUMDOT;
private System.Windows.Forms.Button btnG;
- private System.Windows.Forms.CheckBox cbScanCode;
+ private System.Windows.Forms.CheckBox cBScanCode;
private System.Windows.Forms.Button btnF;
private System.Windows.Forms.Label lBTip;
private System.Windows.Forms.Button btnD;
@@ -2032,7 +2032,7 @@
private System.Windows.Forms.Button btnQ;
private System.Windows.Forms.Button btnLSU;
private System.Windows.Forms.Button btnLS;
- private System.Windows.Forms.CheckBox cbToggle;
+ private System.Windows.Forms.CheckBox cBToggle;
private System.Windows.Forms.Button btnFallBack;
private System.Windows.Forms.Button btnUNBOUND2;
private System.Windows.Forms.Button btnESC;
diff --git a/DS4Tool/KBM360.cs b/DS4Tool/KBM360.cs
index ab7ffa7..42550b4 100644
--- a/DS4Tool/KBM360.cs
+++ b/DS4Tool/KBM360.cs
@@ -19,14 +19,17 @@ namespace DS4Windows
public bool macrorepeat, newaction;
RecordBox rb;
object oldtag;
+ bool scanavail, toggleavil;
+ string keyname;
+ object keytag;
public KBM360(int deviceNum, Options ooo, Button buton)
{
InitializeComponent();
device = deviceNum;
ops = ooo;
button = buton;
- cbToggle.Checked = button.Font.Italic;
- cbScanCode.Checked = button.Font.Bold;
+ cBToggle.Checked = button.Font.Italic;
+ cBScanCode.Checked = button.Font.Bold;
if (button.Tag != null)
{
string[] extras;
@@ -34,12 +37,14 @@ namespace DS4Windows
{
KeyValuePair tag = (KeyValuePair)button.Tag;
oldtag = tag.Key;
+ keytag = tag.Key;
extras = tag.Value.Split(',');
}
else if (button.Tag is KeyValuePair)
{
KeyValuePair tag = (KeyValuePair)button.Tag;
oldtag = tag.Key;
+ keytag = tag.Key;
if (button.Font.Underline)
{
lBMacroOn.Visible = true;
@@ -54,6 +59,7 @@ namespace DS4Windows
{
KeyValuePair tag = (KeyValuePair)button.Tag;
oldtag = tag.Key;
+ keytag = tag.Key;
extras = tag.Value.Split(',');
}
else
@@ -115,7 +121,7 @@ namespace DS4Windows
if (rb == null && sender is Button && ((Button)sender).Name != "bnMacro" && ((Button)sender).Name != "bnTest")
{
Button bn = ((Button)sender);
- string keyname;
+ macrostag.Clear();
if (((Button)sender).Text.Contains('↑') || ((Button)sender).Text.Contains('↓') || ((Button)sender).Text.Contains('→') || ((Button)sender).Text.Contains('←') || ((Button)sender).Text.Contains('Ø'))
keyname = ((Button)sender).Text.Substring(1);
else if (((Button)sender).Font.Name == "Webdings")
@@ -134,15 +140,17 @@ namespace DS4Windows
else if (((Button)sender).Tag == null)
keyname = ((Button)sender).Text;
else if (((Button)sender).Tag.ToString().Contains("X360"))
+ {
keyname = ((Button)sender).Tag.ToString().Substring(4);
+ }
else
keyname = ((Button)sender).Text;
- object keytag;
if (((Button)sender).Tag != null && ((Button)sender).Tag.ToString().Contains("X360"))
keytag = ((Button)sender).Tag.ToString().Substring(4);
else
keytag = ((Button)sender).Tag;
+
lBMacroOn.Visible = false;
string extras = GetExtras();
KeyValuePair