diff --git a/DS4Control/Mapping.cs b/DS4Control/Mapping.cs
index 6a2c6e7..fb3dc5e 100644
--- a/DS4Control/Mapping.cs
+++ b/DS4Control/Mapping.cs
@@ -240,6 +240,7 @@ namespace DS4Control
if (gkp.previous.scanCodeCount != 0) // use the last type of VK/SC
{
InputMethods.performSCKeyRelease(kvp.Key);
+ InputMethods.performKeyRelease(kvp.Key);
pressagain = false;
}
else
@@ -289,26 +290,6 @@ namespace DS4Control
string macro = Global.getCustomMacro(device, what);
if (macro != "0")
{
- /*DS4KeyType keyType = Global.getCustomKeyType(device, what);
- SyntheticState.KeyPresses kp;
- string[] skeys = macro.Split('/');
- ushort[] keys = new ushort[skeys.Length];
- for (int i = 0; i < keys.Length; i++)
- {
- keys[i] = ushort.Parse(skeys[i]);
- if (keys[i] == 256) deviceState.currentClicks.leftCount++; //anything above 255 is not a keyvalue
- if (keys[i] == 257) deviceState.currentClicks.rightCount++;
- if (keys[i] == 258) deviceState.currentClicks.middleCount++;
- if (keys[i] == 259) deviceState.currentClicks.fourthCount++;
- if (keys[i] == 260) deviceState.currentClicks.fifthCount++;
- if (!deviceState.keyPresses.TryGetValue(keys[i], out kp))
- deviceState.keyPresses[keys[i]] = kp = new SyntheticState.KeyPresses();
- if (keyType.HasFlag(DS4KeyType.ScanCode))
- kp.current.scanCodeCount++;
- else
- kp.current.vkCount++;
- kp.current.repeatCount++;
- }*/
}
else if (Global.getCustomKey(device, what) != 0)
{
@@ -492,79 +473,67 @@ namespace DS4Control
{
resetToDefaultValue(customKey.Key, MappedState);
- string[] skeys = customKey.Value.Split('/');
- ushort[] keys = new ushort[skeys.Length];
+ string[] skeys;
+ int[] keys;
+ if (!string.IsNullOrEmpty(customKey.Value))
+ {
+ skeys = customKey.Value.Split('/');
+ keys = new int[skeys.Length];
+ }
+ else
+ {
+ skeys = new string[0];
+ keys = new int[0];
+ }
for (int i = 0; i < keys.Length; i++)
keys[i] = ushort.Parse(skeys[i]);
- bool timedmacro = false;
- for (int i = 0; i < keys.Length; i++)
- if (keys[i] > 300)
- {
- timedmacro = true;
- break;
- }
- if (timedmacro && !macrodone[DS4ControltoInt(customKey.Key)])
+ bool[] keydown = new bool[261];
+ if (!macrodone[DS4ControltoInt(customKey.Key)])
{
macrodone[DS4ControltoInt(customKey.Key)] = true;
for (int i = 0; i < keys.Length; i++)
{
- if (keys[i] > 300) //ints over 300 used to delay
+ if (keys[i] >= 300) //ints over 300 used to delay
await Task.Delay(keys[i] - 300);
- else if (keys[i] == 256) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_LEFTDOWN); //anything above 255 is not a keyvalue
- else if (keys[i] == 257) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_RIGHTDOWN);
- else if (keys[i] == 258) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_MIDDLEDOWN);
- else if (keys[i] == 259) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONDOWN, 1);
- else if (keys[i] == 260) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONDOWN, 2);
+ else if (!keydown[keys[i]])
+ {
+ if (keys[i] == 256) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_LEFTDOWN); //anything above 255 is not a keyvalue
+ else if (keys[i] == 257) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_RIGHTDOWN);
+ else if (keys[i] == 258) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_MIDDLEDOWN);
+ else if (keys[i] == 259) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONDOWN, 1);
+ else if (keys[i] == 260) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONDOWN, 2);
+ else if (keyType.HasFlag(DS4KeyType.ScanCode))
+ InputMethods.performSCKeyPress((ushort)keys[i]);
+ else
+ InputMethods.performKeyPress((ushort)keys[i]);
+ keydown[keys[i]] = true;
+ }
else
- InputMethods.performKeyPress(keys[i]);
- }
- for (int i = keys.Length - 1; i >= 0; i--)
- {
- if (keys[i] == 256) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_LEFTUP); //anything above 255 is not a keyvalue
- else if (keys[i] == 257) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_RIGHTUP);
- else if (keys[i] == 258) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_MIDDLEUP);
- else if (keys[i] == 259) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONUP, 1);
- else if (keys[i] == 260) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONUP, 2);
- else if (keys[i] < 300)
- InputMethods.performKeyRelease(keys[i]);
- }
- }
- else if (!timedmacro)
- {
- for (int i = 0; i < keys.Length; i++)
- {
- if (i > 0 && keys[i - 1] > 300)
{
- if (keys[i] == 256) deviceState.currentClicks.leftCount++; //anything above 255 is not a keyvalue
- if (keys[i] == 257) deviceState.currentClicks.rightCount++;
- if (keys[i] == 258) deviceState.currentClicks.middleCount++;
- if (keys[i] == 259) deviceState.currentClicks.fourthCount++;
- if (keys[i] == 260) deviceState.currentClicks.fifthCount++;
- SyntheticState.KeyPresses kp;
- if (!deviceState.keyPresses.TryGetValue(keys[i], out kp))
- deviceState.keyPresses[keys[i]] = kp = new SyntheticState.KeyPresses();
- if (keyType.HasFlag(DS4KeyType.ScanCode))
- kp.current.scanCodeCount++;
+ if (keys[i] == 256) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_LEFTUP); //anything above 255 is not a keyvalue
+ else if (keys[i] == 257) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_RIGHTUP);
+ else if (keys[i] == 258) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_MIDDLEUP);
+ else if (keys[i] == 259) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONUP, 1);
+ else if (keys[i] == 260) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONUP, 2);
+ else if (keyType.HasFlag(DS4KeyType.ScanCode))
+ InputMethods.performSCKeyRelease((ushort)keys[i]);
else
- kp.current.vkCount++;
- kp.current.repeatCount++;
+ InputMethods.performKeyRelease((ushort)keys[i]);
+ keydown[keys[i]] = false;
}
- else if (keys[i] < 261)
- {
- if (keys[i] == 256) deviceState.currentClicks.leftCount++; //anything above 255 is not a keyvalue
- if (keys[i] == 257) deviceState.currentClicks.rightCount++;
- if (keys[i] == 258) deviceState.currentClicks.middleCount++;
- if (keys[i] == 259) deviceState.currentClicks.fourthCount++;
- if (keys[i] == 260) deviceState.currentClicks.fifthCount++;
- SyntheticState.KeyPresses kp;
- if (!deviceState.keyPresses.TryGetValue(keys[i], out kp))
- deviceState.keyPresses[keys[i]] = kp = new SyntheticState.KeyPresses();
+ }
+ for (ushort i = 0; i < keydown.Length; i++)
+ {
+ if (keydown[i])
if (keyType.HasFlag(DS4KeyType.ScanCode))
- kp.current.scanCodeCount++;
+ InputMethods.performSCKeyRelease(i);
else
- kp.current.vkCount++;
- kp.current.repeatCount++;
- }
+ InputMethods.performKeyRelease(i);
+ }
+ if (keyType.HasFlag(DS4KeyType.HoldMacro))
+ {
+ await Task.Delay(50);
+ macrodone[DS4ControltoInt(customKey.Key)] = false;
}
}
}
@@ -600,7 +569,7 @@ namespace DS4Control
}
- bool LX = false, LY = false, RX = false, RY = false, L2 = false, R2 = false;
+ bool LX = false, LY = false, RX = false, RY = false;
MappedState.LX = 127;
MappedState.LY = 127;
MappedState.RX = 127;
@@ -853,58 +822,60 @@ namespace DS4Control
int deadzone = 10;
double value = 0;
int speed = Global.getButtonMouseSensitivity(device);
+ double root = 1.002;
+ double divide = 10000d;
DateTime now = mousenow[mnum];
switch (control)
{
case DS4Controls.LXNeg:
if (cState.LX < 127 - deadzone)
- value = Math.Pow(1.01 + speed / 10000d, -(cState.LX - 127)) - 1;
+ value = Math.Pow(root + speed / divide, -(cState.LX - 127)) - 1;
break;
case DS4Controls.LXPos:
if (cState.LX > 127 + deadzone)
- value = Math.Pow(1.01 + speed / 10000d, (cState.LX - 127)) -1;
+ value = Math.Pow(root + speed / divide, (cState.LX - 127)) -1;
break;
case DS4Controls.RXNeg:
if (cState.RX < 127 - deadzone)
- value = Math.Pow(1.01 + speed / 10000d, -(cState.RX - 127)) - 1;
+ value = Math.Pow(root + speed / divide, -(cState.RX - 127)) - 1;
break;
case DS4Controls.RXPos:
if (cState.RX > 127 + deadzone)
- value = Math.Pow(1.01 + speed / 10000d, (cState.RX - 127)) - 1;
+ value = Math.Pow(root + speed / divide, (cState.RX - 127)) - 1;
break;
case DS4Controls.LYNeg:
if (cState.LY < 127 - deadzone)
- value = Math.Pow(1.01 + speed / 10000d, -(cState.LY - 127)) - 1;
+ value = Math.Pow(root + speed / divide, -(cState.LY - 127)) - 1;
break;
case DS4Controls.LYPos:
if (cState.LY > 127 + deadzone)
- value = Math.Pow(1.01 + speed / 10000d,(cState.LY - 127)) - 1;
+ value = Math.Pow(root + speed / divide,(cState.LY - 127)) - 1;
break;
case DS4Controls.RYNeg:
if (cState.RY < 127 - deadzone)
- value = Math.Pow(1.01 + speed / 10000d,-(cState.RY - 127)) - 1;
+ value = Math.Pow(root + speed / divide,-(cState.RY - 127)) - 1;
break;
case DS4Controls.RYPos:
if (cState.RY > 127 + deadzone)
- value = Math.Pow(1.01 + speed / 10000d, (cState.RY - 127)) - 1;
+ value = Math.Pow(root + speed / divide, (cState.RY - 127)) - 1;
break;
- case DS4Controls.Share: value = (cState.Share ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.Options: value = (cState.Options ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.L1: value = (cState.L1 ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.R1: value = (cState.R1 ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.L3: value = (cState.L3 ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.R3: value = (cState.R3 ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.DpadUp: value = (cState.DpadUp ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.DpadDown: value = (cState.DpadDown ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.DpadLeft: value = (cState.DpadLeft ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.DpadRight: value = (cState.DpadRight ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.PS: value = (cState.PS ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.Cross: value = (cState.Cross ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.Square: value = (cState.Square ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.Triangle: value = (cState.Triangle ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.Circle: value = (cState.Circle ? Math.Pow(1.01 + speed / 10000d, 100) - 1 : 0); break;
- case DS4Controls.L2: value = Math.Pow(1.01 + speed / 10000d, cState.L2 / 2d) - 1; break;
- case DS4Controls.R2: value = Math.Pow(1.01 + speed / 10000d, cState.R2 / 2d) - 1; 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.L1: value = (cState.L1 ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
+ case DS4Controls.R1: value = (cState.R1 ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
+ case DS4Controls.L3: value = (cState.L3 ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
+ case DS4Controls.R3: value = (cState.R3 ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
+ case DS4Controls.DpadUp: value = (cState.DpadUp ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
+ case DS4Controls.DpadDown: value = (cState.DpadDown ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
+ case DS4Controls.DpadLeft: value = (cState.DpadLeft ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
+ case DS4Controls.DpadRight: value = (cState.DpadRight ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
+ case DS4Controls.PS: value = (cState.PS ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
+ case DS4Controls.Cross: value = (cState.Cross ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
+ case DS4Controls.Square: value = (cState.Square ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
+ case DS4Controls.Triangle: value = (cState.Triangle ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
+ case DS4Controls.Circle: value = (cState.Circle ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
+ case DS4Controls.L2: value = Math.Pow(root + speed / divide, cState.L2 / 2d) - 1; break;
+ case DS4Controls.R2: value = Math.Pow(root + speed / divide, cState.R2 / 2d) - 1; break;
}
//if (value != 0)
//mvalue = value;
@@ -917,7 +888,7 @@ namespace DS4Control
now = DateTime.UtcNow;
if (value <= 1)
{
- if (now >= mousenow[mnum] + TimeSpan.FromMilliseconds((1 - value) * 250))
+ if (now >= mousenow[mnum] + TimeSpan.FromMilliseconds((1 - value) * 500))
{
mousenow[mnum] = now;
return 1;
@@ -926,7 +897,7 @@ namespace DS4Control
return 0;
}
else
- return (int)Math.Round(value, 0);
+ return (int)value;
}
public static bool compare(byte b1, byte b2)
diff --git a/DS4Control/ScpUtil.cs b/DS4Control/ScpUtil.cs
index 7439aba..3881d4f 100644
--- a/DS4Control/ScpUtil.cs
+++ b/DS4Control/ScpUtil.cs
@@ -11,7 +11,7 @@ using System.Security.Principal;
namespace DS4Control
{
[Flags]
- public enum DS4KeyType : byte { None = 0, ScanCode = 1, Toggle = 2, Unbound = 4, Macro = 8 }; //Increment by exponents of 2*, starting at 2^0
+ public enum DS4KeyType : byte { None = 0, ScanCode = 1, Toggle = 2, Unbound = 4, Macro = 8, HoldMacro = 16, RepeatMacro = 32 }; //Increment by exponents of 2*, starting at 2^0
public enum Ds3PadId : byte { None = 0xFF, One = 0x00, Two = 0x01, Three = 0x02, Four = 0x03, All = 0x04 };
public enum DS4Controls : byte { None, LXNeg, LXPos, LYNeg, LYPos, RXNeg, RXPos, RYNeg, RYPos, L1, L2, L3, R1, R2, R3, Square, Triangle, Circle, Cross, DpadUp, DpadRight, DpadDown, DpadLeft, PS, TouchLeft, TouchUpper, TouchMulti, TouchRight, Share, Options };
public enum X360Controls : byte { None, LXNeg, LXPos, LYNeg, LYPos, RXNeg, RXPos, RYNeg, RYPos, LB, LT, LS, RB, RT, RS, X, Y, B, A, DpadUp, DpadRight, DpadDown, DpadLeft, Guide, Back, Start, LeftMouse, RightMouse, MiddleMouse, FourthMouse, FifthMouse, WUP, WDOWN, MouseUp, MouseDown, MouseLeft, MouseRight, Unbound };
@@ -728,6 +728,8 @@ namespace DS4Control
keyType += DS4KeyType.Unbound;
}
{
+ if (button.Font.Strikeout)
+ keyType += DS4KeyType.HoldMacro;
if (button.Font.Underline)
keyType += DS4KeyType.Macro;
if (button.Font.Italic)
@@ -970,8 +972,10 @@ namespace DS4Control
bool SC = Item.InnerText.Contains(DS4KeyType.ScanCode.ToString());
bool TG = Item.InnerText.Contains(DS4KeyType.Toggle.ToString());
bool MC = Item.InnerText.Contains(DS4KeyType.Macro.ToString());
- button.Font = new Font(button.Font, (SC ? FontStyle.Bold : FontStyle.Regular) |
- (TG ? FontStyle.Italic : FontStyle.Regular) | (MC ? FontStyle.Underline : FontStyle.Regular));
+ bool MR = Item.InnerText.Contains(DS4KeyType.HoldMacro.ToString());
+ button.Font = new Font(button.Font,
+ (SC ? FontStyle.Bold : FontStyle.Regular) | (TG ? FontStyle.Italic : FontStyle.Regular) |
+ (MC ? FontStyle.Underline : FontStyle.Regular) | (MR ? FontStyle.Strikeout : FontStyle.Regular));
if (Item.InnerText.Contains(DS4KeyType.ScanCode.ToString()))
keyType |= DS4KeyType.ScanCode;
if (Item.InnerText.Contains(DS4KeyType.Toggle.ToString()))
@@ -999,7 +1003,7 @@ namespace DS4Control
else if (keys[i] == 260) splitter[i] = "5th Mouse Button";
else if (keys[i] > 300) splitter[i] = "Wait " + (keys[i] - 300) + "ms";
}
- button.Text = string.Join(", ", splitter);
+ button.Text = "Macro";
button.Tag = keys;
customMapMacros.Add(getDS4ControlsByName(button.Name), Item.InnerText);
}
@@ -1162,6 +1166,8 @@ namespace DS4Control
keyType |= DS4KeyType.Toggle;
if (item.InnerText.Contains(DS4KeyType.Macro.ToString()))
keyType |= DS4KeyType.Macro;
+ if (item.InnerText.Contains(DS4KeyType.HoldMacro.ToString()))
+ keyType |= DS4KeyType.HoldMacro;
if (item.InnerText.Contains(DS4KeyType.Unbound.ToString()))
keyType |= DS4KeyType.Unbound;
if (keyType != DS4KeyType.None)
diff --git a/DS4Tool/DS4Tool.csproj b/DS4Tool/DS4Tool.csproj
index 83d46d2..b5a6195 100644
--- a/DS4Tool/DS4Tool.csproj
+++ b/DS4Tool/DS4Tool.csproj
@@ -127,6 +127,12 @@
True
Resources.resx
+
+ Form
+
+
+ RecordBox.cs
+
True
True
@@ -177,6 +183,9 @@
Designer
Resources1.Designer.cs
+
+ RecordBox.cs
+
ResXFileCodeGenerator
Resource.es.Designer.cs
@@ -231,6 +240,7 @@
+
diff --git a/DS4Tool/KBM360.Designer.cs b/DS4Tool/KBM360.Designer.cs
index d4043a3..1359eb3 100644
--- a/DS4Tool/KBM360.Designer.cs
+++ b/DS4Tool/KBM360.Designer.cs
@@ -182,16 +182,10 @@
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.X360Label = new System.Windows.Forms.Label();
this.KBMlabel = new System.Windows.Forms.Label();
- this.cBMacro = new System.Windows.Forms.CheckBox();
- this.lBMacroOrder = new System.Windows.Forms.Label();
- this.pnLDelay = new System.Windows.Forms.Panel();
- this.nUDDelay = new System.Windows.Forms.NumericUpDown();
- this.lBms = new System.Windows.Forms.Label();
- this.lBDelay = new System.Windows.Forms.Label();
+ this.lBMacroOn = new System.Windows.Forms.Label();
+ this.btnMacro = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- this.pnLDelay.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.nUDDelay)).BeginInit();
this.SuspendLayout();
//
// lBTip
@@ -208,7 +202,7 @@
// cbScanCode
//
this.cbScanCode.AutoSize = true;
- this.cbScanCode.Location = new System.Drawing.Point(706, 5);
+ this.cbScanCode.Location = new System.Drawing.Point(677, 5);
this.cbScanCode.Name = "cbScanCode";
this.cbScanCode.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cbScanCode.Size = new System.Drawing.Size(79, 17);
@@ -965,6 +959,7 @@
this.btnSLASH.Size = new System.Drawing.Size(24, 24);
this.btnSLASH.TabIndex = 219;
this.btnSLASH.TabStop = false;
+ this.btnSLASH.Tag = "191";
this.btnSLASH.Text = "/";
this.btnSLASH.UseVisualStyleBackColor = true;
//
@@ -1399,7 +1394,7 @@
//
// bTNRIGHTMOUSE
//
- this.bTNRIGHTMOUSE.Location = new System.Drawing.Point(813, 82);
+ this.bTNRIGHTMOUSE.Location = new System.Drawing.Point(824, 82);
this.bTNRIGHTMOUSE.Name = "bTNRIGHTMOUSE";
this.bTNRIGHTMOUSE.Size = new System.Drawing.Size(24, 24);
this.bTNRIGHTMOUSE.TabIndex = 178;
@@ -1421,7 +1416,7 @@
//
// bnWHEELDOWN
//
- this.bnWHEELDOWN.Location = new System.Drawing.Point(783, 107);
+ this.bnWHEELDOWN.Location = new System.Drawing.Point(794, 107);
this.bnWHEELDOWN.Name = "bnWHEELDOWN";
this.bnWHEELDOWN.Size = new System.Drawing.Size(24, 21);
this.bnWHEELDOWN.TabIndex = 175;
@@ -1432,7 +1427,7 @@
//
// bnWHEELUP
//
- this.bnWHEELUP.Location = new System.Drawing.Point(783, 59);
+ this.bnWHEELUP.Location = new System.Drawing.Point(794, 59);
this.bnWHEELUP.Name = "bnWHEELUP";
this.bnWHEELUP.Size = new System.Drawing.Size(24, 22);
this.bnWHEELUP.TabIndex = 174;
@@ -1443,7 +1438,7 @@
//
// btnMIDDLEMOUSE
//
- this.btnMIDDLEMOUSE.Location = new System.Drawing.Point(783, 82);
+ this.btnMIDDLEMOUSE.Location = new System.Drawing.Point(794, 82);
this.btnMIDDLEMOUSE.Name = "btnMIDDLEMOUSE";
this.btnMIDDLEMOUSE.Size = new System.Drawing.Size(24, 24);
this.btnMIDDLEMOUSE.TabIndex = 176;
@@ -1465,7 +1460,7 @@
//
// button33
//
- this.button33.Location = new System.Drawing.Point(818, 147);
+ this.button33.Location = new System.Drawing.Point(829, 147);
this.button33.Name = "button33";
this.button33.Size = new System.Drawing.Size(19, 24);
this.button33.TabIndex = 169;
@@ -1476,7 +1471,7 @@
//
// button30
//
- this.button30.Location = new System.Drawing.Point(753, 146);
+ this.button30.Location = new System.Drawing.Point(764, 146);
this.button30.Name = "button30";
this.button30.Size = new System.Drawing.Size(19, 24);
this.button30.TabIndex = 173;
@@ -1487,7 +1482,7 @@
//
// bnMOUSERIGHT
//
- this.bnMOUSERIGHT.Location = new System.Drawing.Point(827, 117);
+ this.bnMOUSERIGHT.Location = new System.Drawing.Point(841, 117);
this.bnMOUSERIGHT.Name = "bnMOUSERIGHT";
this.bnMOUSERIGHT.Size = new System.Drawing.Size(24, 24);
this.bnMOUSERIGHT.TabIndex = 171;
@@ -1498,7 +1493,7 @@
//
// bnMOUSELEFT
//
- this.bnMOUSELEFT.Location = new System.Drawing.Point(736, 118);
+ this.bnMOUSELEFT.Location = new System.Drawing.Point(743, 118);
this.bnMOUSELEFT.Name = "bnMOUSELEFT";
this.bnMOUSELEFT.Size = new System.Drawing.Size(24, 24);
this.bnMOUSELEFT.TabIndex = 172;
@@ -1509,7 +1504,7 @@
//
// bnMOUSEDOWN
//
- this.bnMOUSEDOWN.Location = new System.Drawing.Point(783, 167);
+ this.bnMOUSEDOWN.Location = new System.Drawing.Point(794, 167);
this.bnMOUSEDOWN.Name = "bnMOUSEDOWN";
this.bnMOUSEDOWN.Size = new System.Drawing.Size(24, 24);
this.bnMOUSEDOWN.TabIndex = 170;
@@ -1520,7 +1515,7 @@
//
// bnMOUSEUP
//
- this.bnMOUSEUP.Location = new System.Drawing.Point(783, 25);
+ this.bnMOUSEUP.Location = new System.Drawing.Point(794, 25);
this.bnMOUSEUP.Name = "bnMOUSEUP";
this.bnMOUSEUP.Size = new System.Drawing.Size(24, 24);
this.bnMOUSEUP.TabIndex = 167;
@@ -1531,7 +1526,7 @@
//
// btnLEFTMOUSE
//
- this.btnLEFTMOUSE.Location = new System.Drawing.Point(753, 82);
+ this.btnLEFTMOUSE.Location = new System.Drawing.Point(764, 82);
this.btnLEFTMOUSE.Name = "btnLEFTMOUSE";
this.btnLEFTMOUSE.Size = new System.Drawing.Size(24, 24);
this.btnLEFTMOUSE.TabIndex = 168;
@@ -1555,7 +1550,7 @@
// pictureBox2
//
this.pictureBox2.Image = global::ScpServer.Properties.Resources.mouse;
- this.pictureBox2.Location = new System.Drawing.Point(747, 41);
+ this.pictureBox2.Location = new System.Drawing.Point(758, 41);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(97, 140);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -1565,7 +1560,7 @@
// cbToggle
//
this.cbToggle.AutoSize = true;
- this.cbToggle.Location = new System.Drawing.Point(641, 5);
+ this.cbToggle.Location = new System.Drawing.Point(604, 5);
this.cbToggle.Name = "cbToggle";
this.cbToggle.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.cbToggle.Size = new System.Drawing.Size(59, 17);
@@ -1875,7 +1870,7 @@
// X360Label
//
this.X360Label.AutoSize = true;
- this.X360Label.Location = new System.Drawing.Point(393, 202);
+ this.X360Label.Location = new System.Drawing.Point(393, 210);
this.X360Label.Name = "X360Label";
this.X360Label.Size = new System.Drawing.Size(73, 13);
this.X360Label.TabIndex = 318;
@@ -1890,79 +1885,34 @@
this.KBMlabel.TabIndex = 318;
this.KBMlabel.Text = "Keyboard and Mouse";
//
- // cBMacro
+ // lBMacroOn
//
- this.cBMacro.AutoSize = true;
- this.cBMacro.Location = new System.Drawing.Point(791, 5);
- this.cBMacro.Name = "cBMacro";
- this.cBMacro.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
- this.cBMacro.Size = new System.Drawing.Size(56, 17);
- this.cBMacro.TabIndex = 287;
- this.cBMacro.TabStop = false;
- this.cBMacro.Text = "Macro";
- this.cBMacro.UseVisualStyleBackColor = true;
- this.cBMacro.CheckedChanged += new System.EventHandler(this.cBMacro_CheckedChanged);
+ this.lBMacroOn.AutoSize = true;
+ this.lBMacroOn.Location = new System.Drawing.Point(10, 6);
+ this.lBMacroOn.Name = "lBMacroOn";
+ this.lBMacroOn.Size = new System.Drawing.Size(173, 13);
+ this.lBMacroOn.TabIndex = 319;
+ this.lBMacroOn.Text = "Macro On, Choose a key to disable";
+ this.lBMacroOn.Visible = false;
//
- // lBMacroOrder
+ // btnMacro
//
- this.lBMacroOrder.AutoSize = true;
- this.lBMacroOrder.Location = new System.Drawing.Point(12, 6);
- this.lBMacroOrder.Name = "lBMacroOrder";
- this.lBMacroOrder.Size = new System.Drawing.Size(72, 13);
- this.lBMacroOrder.TabIndex = 319;
- this.lBMacroOrder.Text = "Macro Order: ";
- this.lBMacroOrder.Visible = false;
- //
- // pnLDelay
- //
- this.pnLDelay.Controls.Add(this.nUDDelay);
- this.pnLDelay.Controls.Add(this.lBms);
- this.pnLDelay.Controls.Add(this.lBDelay);
- this.pnLDelay.Location = new System.Drawing.Point(12, 200);
- this.pnLDelay.Name = "pnLDelay";
- this.pnLDelay.Size = new System.Drawing.Size(183, 23);
- this.pnLDelay.TabIndex = 320;
- this.pnLDelay.Visible = false;
- //
- // nUDDelay
- //
- this.nUDDelay.Location = new System.Drawing.Point(65, 0);
- this.nUDDelay.Maximum = new decimal(new int[] {
- 60000,
- 0,
- 0,
- 0});
- this.nUDDelay.Name = "nUDDelay";
- this.nUDDelay.Size = new System.Drawing.Size(77, 20);
- this.nUDDelay.TabIndex = 1;
- this.nUDDelay.TabStop = false;
- this.nUDDelay.ValueChanged += new System.EventHandler(this.nUDDelay_ValueChanged);
- //
- // lBms
- //
- this.lBms.AutoSize = true;
- this.lBms.Location = new System.Drawing.Point(148, 2);
- this.lBms.Name = "lBms";
- this.lBms.Size = new System.Drawing.Size(20, 13);
- this.lBms.TabIndex = 0;
- this.lBms.Text = "ms";
- //
- // lBDelay
- //
- this.lBDelay.AutoSize = true;
- this.lBDelay.Location = new System.Drawing.Point(3, 2);
- this.lBDelay.Name = "lBDelay";
- this.lBDelay.Size = new System.Drawing.Size(56, 13);
- this.lBDelay.TabIndex = 0;
- this.lBDelay.Text = "Add Delay";
+ this.btnMacro.Location = new System.Drawing.Point(761, 1);
+ this.btnMacro.Name = "btnMacro";
+ this.btnMacro.Size = new System.Drawing.Size(104, 23);
+ this.btnMacro.TabIndex = 321;
+ this.btnMacro.TabStop = false;
+ this.btnMacro.Text = "Record a Macro";
+ this.btnMacro.UseVisualStyleBackColor = true;
+ this.btnMacro.Click += new System.EventHandler(this.btnMacro_Click);
//
// KBM360
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
- this.ClientSize = new System.Drawing.Size(854, 403);
- this.Controls.Add(this.pnLDelay);
- this.Controls.Add(this.lBMacroOrder);
+ this.ClientSize = new System.Drawing.Size(868, 403);
+ this.Controls.Add(this.btnMacro);
+ this.Controls.Add(this.lBMacroOn);
this.Controls.Add(this.KBMlabel);
this.Controls.Add(this.X360Label);
this.Controls.Add(this.btnUNBOUND2);
@@ -2116,7 +2066,6 @@
this.Controls.Add(this.btnLEFTMOUSE);
this.Controls.Add(this.btnQ);
this.Controls.Add(this.pictureBox2);
- this.Controls.Add(this.cBMacro);
this.Controls.Add(this.cbToggle);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.KeyPreview = true;
@@ -2126,11 +2075,9 @@
this.Text = "Keybaord";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.finalMeasure);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Key_Down_Action);
+ this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Key_Up_Action);
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- this.pnLDelay.ResumeLayout(false);
- this.pnLDelay.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.nUDDelay)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -2292,12 +2239,8 @@
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label X360Label;
private System.Windows.Forms.Label KBMlabel;
- private System.Windows.Forms.CheckBox cBMacro;
- private System.Windows.Forms.Label lBMacroOrder;
- private System.Windows.Forms.Panel pnLDelay;
- private System.Windows.Forms.NumericUpDown nUDDelay;
- private System.Windows.Forms.Label lBms;
- private System.Windows.Forms.Label lBDelay;
+ private System.Windows.Forms.Button btnMacro;
+ public System.Windows.Forms.Label lBMacroOn;
}
}
\ No newline at end of file
diff --git a/DS4Tool/KBM360.cs b/DS4Tool/KBM360.cs
index de9e40d..c3d588b 100644
--- a/DS4Tool/KBM360.cs
+++ b/DS4Tool/KBM360.cs
@@ -15,6 +15,9 @@ namespace ScpServer
private int device;
private Button button;
private Options ops;
+ public List macros = new List();
+ public List macrostag = new List();
+ public bool macrorepeat;
public KBM360(DS4Control.Control bus_device, int deviceNum, Options ooo, Button buton)
{
InitializeComponent();
@@ -24,13 +27,12 @@ namespace ScpServer
button = buton;
cbToggle.Checked = button.Font.Italic;
cbScanCode.Checked = button.Font.Bold;
- cBMacro.Checked = button.Font.Underline;
- if (cBMacro.Checked)
- lBMacroOrder.Text += button.Text;
+ //cBMacro.Checked = button.Font.Underline;
+ lBMacroOn.Visible = button.Font.Underline;
Text = "Select an action for " + button.Name.Substring(2);
foreach (System.Windows.Forms.Control control in this.Controls)
if (control is Button)
- ((Button)control).Click += new System.EventHandler(anybtn_Click);
+ ((Button)control).Click += anybtn_Click;
if (button.Name.Contains("Touch"))
{
bnMOUSEDOWN.Visible = false;
@@ -38,14 +40,12 @@ namespace ScpServer
bnMOUSERIGHT.Visible = false;
bnMOUSEUP.Visible = false;
}
- ToolTip tp = new ToolTip();
- tp.SetToolTip(cBMacro, "Max 5 actions");
+ ActiveControl = null;
}
- List macros = new List();
- List macrostag = new List();
+
public void anybtn_Click(object sender, EventArgs e)
{
- if (sender is Button)
+ if (sender is Button && ((Button)sender).Name != "btnMacro")
{
Button bn = ((Button)sender);
string keyname;
@@ -67,111 +67,95 @@ namespace ScpServer
else
keyname = ((Button)sender).Text;
- if (!cBMacro.Checked)
- {
- object keytag;
- if (((Button)sender).Tag.ToString() == "X360")
- keytag = ((Button)sender).Text;
- else
- keytag = ((Button)sender).Tag;
- ops.ChangeButtonText(keyname, keytag);
- this.Close();
- }
+ object keytag;
+ if (((Button)sender).Tag.ToString() == "X360")
+ keytag = ((Button)sender).Text;
else
- {
- if (!bn.Font.Bold && bn.Tag.ToString() != "X360" && macrostag.Count < 5 && (bn.Text.Contains("Mouse") ^ !bn.Text.Contains("Button"))) //end is xor to remove mouse movement and wheel from macro
- {
- bn.Font = new Font(bn.Font, FontStyle.Bold);
- if (nUDDelay.Value >= 1)
- {
- macros.Add("Wait " + (int)nUDDelay.Value + "ms");
- macrostag.Add(300 + (int)nUDDelay.Value);
- }
- macros.Add(keyname);
- int value;
- if (int.TryParse(bn.Tag.ToString(), out value))
- macrostag.Add(value);
- else
- {
- if (bn.Text == "Left Mouse Button") macrostag.Add(256);
- if (bn.Text == "Right Mouse Button") macrostag.Add(257);
- if (bn.Text == "Middle Mouse Button") macrostag.Add(258);
- if (bn.Text == "4th Mouse Button") macrostag.Add(259);
- if (bn.Text == "5th Mouse Button") macrostag.Add(260);
- }
- }
- else if (bn.Tag.ToString() != "X360")
- {
- bn.Font = new Font(bn.Font, FontStyle.Regular);
- int value;
- if (int.TryParse(bn.Tag.ToString(), out value))
- {
- int previ = macrostag.IndexOf(value) - 1;
- if (previ > -1 && macrostag[previ] > 300)
- {
- macros.RemoveAt(previ);
- macrostag.RemoveAt(previ);
- }
- macrostag.Remove(value);
- macros.Remove(keyname);
- }
- else
- {
- if (bn.Text == "Left Mouse Button") macrostag.Remove(256);
- if (bn.Text == "Right Mouse Button") macrostag.Remove(257);
- if (bn.Text == "Middle Mouse Button") macrostag.Remove(258);
- if (bn.Text == "4th Mouse Button") macrostag.Remove(259);
- if (bn.Text == "5th Mouse Button") macrostag.Remove(260);
- }
- }
- nUDDelay.Value = 0;
- if (macrostag.Count >= 4)
- pnLDelay.Enabled = false;
- else
- pnLDelay.Enabled = true;
- string macro = string.Join(", ", macros.ToArray());
- lBMacroOrder.Text = "Macro Order: " + macro;
- }
+ keytag = ((Button)sender).Tag;
+ lBMacroOn.Visible = false;
+ ops.ChangeButtonText(keyname, keytag);
+ this.Close();
}
}
private void finalMeasure(object sender, FormClosedEventArgs e)
{
- if (cBMacro.Checked && macrostag.Count > 0)
- {
- ops.ChangeButtonText(string.Join(", ", macros), macrostag.ToArray());
- }
- ops.Toggle_Bn(cbScanCode.Checked, cbToggle.Checked, cBMacro.Checked);
+ if (lBMacroOn.Visible)
+ ops.ChangeButtonText("Macro", macrostag.ToArray());
+ ops.Toggle_Bn(cbScanCode.Checked, cbToggle.Checked, lBMacroOn.Visible, macrorepeat);
ops.UpdateLists();
}
private void Key_Down_Action(object sender, KeyEventArgs e)
{
- if (!cBMacro.Checked)
- {
- ops.ChangeButtonText(e.KeyCode.ToString(), e.KeyValue);
- this.Close();
- }
+ lBMacroOn.Visible = false;
+ ops.ChangeButtonText(e.KeyCode.ToString(), e.KeyValue);
+ this.Close();
}
- private void cBMacro_CheckedChanged(object sender, EventArgs e)
+ private void Key_Up_Action(object sender, KeyEventArgs e)
{
- lBMacroOrder.Visible = cBMacro.Checked;
- pnLDelay.Visible = cBMacro.Checked;
- if (cBMacro.Checked)
- cbToggle.Checked = false;
+ lBMacroOn.Visible = false;
+ ops.ChangeButtonText(e.KeyCode.ToString(), e.KeyValue);
+ this.Close();
+ }
+
+ private void Key_Press_Action(object sender, KeyEventArgs e)
+ {
+ lBMacroOn.Visible = false;
+ ops.ChangeButtonText(e.KeyCode.ToString(), e.KeyValue);
+ this.Close();
}
private void cbToggle_CheckedChanged(object sender, EventArgs e)
{
if (cbToggle.Checked)
- cBMacro.Checked = false;
+ lBMacroOn.Visible = false;
}
- private void nUDDelay_ValueChanged(object sender, EventArgs e)
+ private void btnMacro_Click(object sender, EventArgs e)
+ {
+ RecordBox rb = new RecordBox(this);
+ rb.StartPosition = FormStartPosition.Manual;
+ rb.Location = new Point(this.Location.X + 580, this.Location.Y+ 55);
+ rb.ShowDialog();
+ }
+
+ protected override bool IsInputKey(Keys keyData)
{
-
+ switch (keyData)
+ {
+ case Keys.Right:
+ case Keys.Left:
+ case Keys.Up:
+ case Keys.Down:
+ return true;
+ case Keys.Shift | Keys.Right:
+ case Keys.Shift | Keys.Left:
+ case Keys.Shift | Keys.Up:
+ case Keys.Shift | Keys.Down:
+ return true;
+ }
+ return base.IsInputKey(keyData);
}
+ protected override void OnKeyDown(KeyEventArgs e)
+ {
+ base.OnKeyDown(e);
+ switch (e.KeyCode)
+ {
+ case Keys.Left:
+ case Keys.Right:
+ case Keys.Up:
+ case Keys.Down:
+ if (e.Shift)
+ {
+ }
+ else
+ {
+ }
+ break;
+ }
+ }
}
}
diff --git a/DS4Tool/Options.cs b/DS4Tool/Options.cs
index a5c7a33..9383027 100644
--- a/DS4Tool/Options.cs
+++ b/DS4Tool/Options.cs
@@ -304,11 +304,12 @@ namespace ScpServer
lastSelected.Text = controlname;
lastSelected.Tag = controlname;
}
- public void Toggle_Bn(bool SC, bool TG, bool MC)
+ public void Toggle_Bn(bool SC, bool TG, bool MC, bool MR)
{
if (lastSelected.Tag is int || lastSelected.Tag is UInt16 || lastSelected.Tag is int[])
- lastSelected.Font = new Font(lastSelected.Font, (SC ? FontStyle.Bold : FontStyle.Regular) |
- (TG ? FontStyle.Italic : FontStyle.Regular) | (MC ? FontStyle.Underline : FontStyle.Regular));
+ lastSelected.Font = new Font(lastSelected.Font,
+ (SC ? FontStyle.Bold : FontStyle.Regular) | (TG ? FontStyle.Italic : FontStyle.Regular) |
+ (MC ? FontStyle.Underline : FontStyle.Regular) | (MR ? FontStyle.Strikeout : FontStyle.Regular));
else if (lastSelected.Tag is string)
if (lastSelected.Tag.ToString().Contains("Mouse Button"))
lastSelected.Font = new Font(lastSelected.Font, TG ? FontStyle.Italic : FontStyle.Regular);
diff --git a/DS4Tool/RecordBox.Designer.cs b/DS4Tool/RecordBox.Designer.cs
new file mode 100644
index 0000000..64bca0e
--- /dev/null
+++ b/DS4Tool/RecordBox.Designer.cs
@@ -0,0 +1,179 @@
+namespace ScpServer
+{
+ partial class RecordBox
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RecordBox));
+ this.btnRecord = new System.Windows.Forms.Button();
+ this.cBRecordDelays = new System.Windows.Forms.CheckBox();
+ this.lVMacros = new System.Windows.Forms.ListView();
+ this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.iLKeys = new System.Windows.Forms.ImageList(this.components);
+ this.cBStyle = new System.Windows.Forms.ComboBox();
+ this.btnSave = new System.Windows.Forms.Button();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // btnRecord
+ //
+ this.btnRecord.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnRecord.Location = new System.Drawing.Point(13, 2);
+ this.btnRecord.Name = "btnRecord";
+ this.btnRecord.Size = new System.Drawing.Size(258, 23);
+ this.btnRecord.TabIndex = 322;
+ this.btnRecord.TabStop = false;
+ this.btnRecord.Text = "Record";
+ this.btnRecord.UseVisualStyleBackColor = true;
+ this.btnRecord.Click += new System.EventHandler(this.btnRecord_Click);
+ this.btnRecord.KeyDown += new System.Windows.Forms.KeyEventHandler(this.anyKeyDown);
+ this.btnRecord.KeyUp += new System.Windows.Forms.KeyEventHandler(this.anyKeyUp);
+ //
+ // cBRecordDelays
+ //
+ this.cBRecordDelays.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.cBRecordDelays.AutoSize = true;
+ this.cBRecordDelays.Location = new System.Drawing.Point(12, 219);
+ this.cBRecordDelays.Name = "cBRecordDelays";
+ this.cBRecordDelays.Size = new System.Drawing.Size(96, 17);
+ this.cBRecordDelays.TabIndex = 324;
+ this.cBRecordDelays.TabStop = false;
+ this.cBRecordDelays.Text = "Record Delays";
+ this.cBRecordDelays.UseVisualStyleBackColor = true;
+ this.cBRecordDelays.KeyDown += new System.Windows.Forms.KeyEventHandler(this.anyKeyDown);
+ this.cBRecordDelays.KeyUp += new System.Windows.Forms.KeyEventHandler(this.anyKeyUp);
+ this.cBRecordDelays.MouseDown += new System.Windows.Forms.MouseEventHandler(this.anyMouseDown);
+ this.cBRecordDelays.MouseUp += new System.Windows.Forms.MouseEventHandler(this.anyMouseUp);
+ //
+ // lVMacros
+ //
+ this.lVMacros.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.lVMacros.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnHeader1});
+ this.lVMacros.LargeImageList = this.iLKeys;
+ this.lVMacros.Location = new System.Drawing.Point(13, 29);
+ this.lVMacros.Name = "lVMacros";
+ this.lVMacros.Size = new System.Drawing.Size(258, 182);
+ this.lVMacros.SmallImageList = this.iLKeys;
+ this.lVMacros.TabIndex = 326;
+ this.lVMacros.UseCompatibleStateImageBehavior = false;
+ this.lVMacros.View = System.Windows.Forms.View.Details;
+ this.lVMacros.KeyDown += new System.Windows.Forms.KeyEventHandler(this.anyKeyDown);
+ this.lVMacros.KeyUp += new System.Windows.Forms.KeyEventHandler(this.anyKeyUp);
+ this.lVMacros.MouseDown += new System.Windows.Forms.MouseEventHandler(this.anyMouseDown);
+ this.lVMacros.MouseUp += new System.Windows.Forms.MouseEventHandler(this.anyMouseUp);
+ //
+ // columnHeader1
+ //
+ this.columnHeader1.Text = "Macro Order";
+ this.columnHeader1.Width = 150;
+ //
+ // iLKeys
+ //
+ this.iLKeys.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("iLKeys.ImageStream")));
+ this.iLKeys.TransparentColor = System.Drawing.Color.Transparent;
+ this.iLKeys.Images.SetKeyName(0, "keydown.png");
+ this.iLKeys.Images.SetKeyName(1, "keyup.png");
+ this.iLKeys.Images.SetKeyName(2, "Clock.png");
+ //
+ // cBStyle
+ //
+ this.cBStyle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.cBStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cBStyle.FormattingEnabled = true;
+ this.cBStyle.Items.AddRange(new object[] {
+ "Play once",
+ "Repeat while held"});
+ this.cBStyle.Location = new System.Drawing.Point(150, 217);
+ this.cBStyle.Name = "cBStyle";
+ this.cBStyle.Size = new System.Drawing.Size(121, 21);
+ this.cBStyle.TabIndex = 327;
+ //
+ // btnSave
+ //
+ this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.btnSave.Location = new System.Drawing.Point(12, 242);
+ this.btnSave.Name = "btnSave";
+ this.btnSave.Size = new System.Drawing.Size(75, 23);
+ this.btnSave.TabIndex = 328;
+ this.btnSave.Text = "Save";
+ this.btnSave.UseVisualStyleBackColor = true;
+ this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
+ //
+ // btnCancel
+ //
+ this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnCancel.Location = new System.Drawing.Point(196, 243);
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size(75, 23);
+ this.btnCancel.TabIndex = 328;
+ this.btnCancel.Text = "Cancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+ //
+ // RecordBox
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.SystemColors.ControlLightLight;
+ this.ClientSize = new System.Drawing.Size(276, 268);
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.btnSave);
+ this.Controls.Add(this.cBStyle);
+ this.Controls.Add(this.lVMacros);
+ this.Controls.Add(this.cBRecordDelays);
+ this.Controls.Add(this.btnRecord);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
+ this.Name = "RecordBox";
+ this.ShowInTaskbar = false;
+ this.Text = "Record a Macro";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RecordBox_FormClosing);
+ this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.anyKeyDown);
+ this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.anyKeyUp);
+ this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.anyMouseDown);
+ this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.anyMouseUp);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button btnRecord;
+ private System.Windows.Forms.CheckBox cBRecordDelays;
+ private System.Windows.Forms.ListView lVMacros;
+ private System.Windows.Forms.ImageList iLKeys;
+ private System.Windows.Forms.ColumnHeader columnHeader1;
+ private System.Windows.Forms.ComboBox cBStyle;
+ private System.Windows.Forms.Button btnSave;
+ private System.Windows.Forms.Button btnCancel;
+ }
+}
\ No newline at end of file
diff --git a/DS4Tool/RecordBox.cs b/DS4Tool/RecordBox.cs
new file mode 100644
index 0000000..a897b00
--- /dev/null
+++ b/DS4Tool/RecordBox.cs
@@ -0,0 +1,268 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Diagnostics;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ScpServer
+{
+ public partial class RecordBox : Form
+ {
+ Stopwatch sw = new Stopwatch();
+ public List macros = new List();
+ public List macronames = new List();
+ KBM360 kbm;
+ public RecordBox(KBM360 op)
+ {
+ kbm = op;
+ InitializeComponent();
+ if (kbm.macrorepeat)
+ cBStyle.SelectedIndex = 1;
+ else
+ cBStyle.SelectedIndex = 0;
+ }
+
+ private void btnRecord_Click(object sender, EventArgs e)
+ {
+ if (btnRecord.Text == "Record")
+ {
+ if (cBRecordDelays.Checked)
+ sw.Start();
+ macros.Clear();
+ lVMacros.Items.Clear();
+ btnRecord.Text = "Stop";
+ EnableControls(false);
+ ActiveControl = null;
+ lVMacros.Focus();
+ }
+ else
+ {
+ if (cBRecordDelays.Checked)
+ sw.Reset();
+ btnRecord.Text = "Record";
+ EnableControls(true);
+ }
+ }
+
+ private void EnableControls(bool on)
+ {
+ cBRecordDelays.Enabled = on;
+ lVMacros.Enabled = on;
+ cBStyle.Enabled = on;
+ btnCancel.Enabled = on;
+ btnSave.Enabled = on;
+ }
+
+ private void anyKeyDown(object sender, KeyEventArgs e)
+ {
+ if (btnRecord.Text == "Stop")
+ {
+ int count = 0;
+ foreach (int i in macros)
+ {
+ if (i == e.KeyValue)
+ count++;
+ }
+ if (macros.Count == 0)
+ {
+ macros.Add(e.KeyValue);
+ lVMacros.Items.Add(e.KeyCode.ToString(), 0);
+ if (cBRecordDelays.Checked)
+ {
+ sw.Reset();
+ sw.Start();
+ }
+ }
+ else if (count % 2 == 0)
+ {
+ if (cBRecordDelays.Checked)
+ {
+ macros.Add((int)sw.ElapsedMilliseconds + 300);
+ lVMacros.Items.Add("Wait " + sw.ElapsedMilliseconds + "ms", 2);
+ sw.Reset();
+ sw.Start();
+ }
+ macros.Add(e.KeyValue);
+ lVMacros.Items.Add(e.KeyCode.ToString(), 0);
+ }
+ }
+ else
+ {
+ if (e.KeyValue == 27)
+ Close();
+ }
+ }
+
+ private void anyKeyUp(object sender, KeyEventArgs e)
+ {
+ if (btnRecord.Text == "Stop" && macros.Count != 0 && !e.KeyCode.ToString().Contains("Media"))
+ {
+ if (cBRecordDelays.Checked)
+ {
+ macros.Add((int)sw.ElapsedMilliseconds + 300);
+ lVMacros.Items.Add("Wait " + sw.ElapsedMilliseconds + "ms", 2);
+ macros.Add(e.KeyValue);
+ sw.Reset();
+ sw.Start();
+ }
+ else
+ {
+ macros.Add(e.KeyValue);
+ }
+ lVMacros.Items.Add(e.KeyCode.ToString(), 1);
+ }
+ }
+
+ private void anyMouseDown(object sender, MouseEventArgs e)
+ {
+ if (btnRecord.Text == "Stop")
+ {
+ int value;
+ switch (e.Button)
+ {
+ case System.Windows.Forms.MouseButtons.Left: value = 256; break;
+ case System.Windows.Forms.MouseButtons.Right: value = 257; break;
+ case System.Windows.Forms.MouseButtons.Middle: value = 258; break;
+ case System.Windows.Forms.MouseButtons.XButton1: value = 259; break;
+ case System.Windows.Forms.MouseButtons.XButton2: value = 260; break;
+ default: value = 0; break;
+ }
+
+ if (macros.Count == 0)
+ {
+ macros.Add(value);
+ lVMacros.Items.Add(e.Button.ToString() + " Mouse Button", 0);
+ if (cBRecordDelays.Checked)
+ {
+ sw.Reset();
+ sw.Start();
+ }
+ }
+ else
+ {
+ if (cBRecordDelays.Checked)
+ {
+ macros.Add((int)sw.ElapsedMilliseconds + 300);
+ lVMacros.Items.Add("Wait " + sw.ElapsedMilliseconds + "ms", 2);
+ sw.Reset();
+ sw.Start();
+ }
+ macros.Add(value);
+ lVMacros.Items.Add(e.Button.ToString() + " Mouse Button", 0);
+ }
+ if (e.Button == System.Windows.Forms.MouseButtons.XButton1)
+ lVMacros.Items[lVMacros.Items.Count - 1].Text = "4th Mouse Button";
+ if (e.Button == System.Windows.Forms.MouseButtons.XButton2)
+ lVMacros.Items[lVMacros.Items.Count - 1].Text = "5th Mouse Button";
+ }
+ }
+
+ private void anyMouseUp(object sender, MouseEventArgs e)
+ {
+ if (btnRecord.Text == "Stop" && macros.Count != 0)
+ {
+ int value;
+ switch (e.Button)
+ {
+ case System.Windows.Forms.MouseButtons.Left: value = 256; break;
+ case System.Windows.Forms.MouseButtons.Right: value = 257; break;
+ case System.Windows.Forms.MouseButtons.Middle: value = 258; break;
+ case System.Windows.Forms.MouseButtons.XButton1: value = 259; break;
+ case System.Windows.Forms.MouseButtons.XButton2: value = 260; break;
+ default: value = 0; break;
+ }
+
+ if (cBRecordDelays.Checked)
+ {
+ macros.Add((int)sw.ElapsedMilliseconds + 300);
+ lVMacros.Items.Add("Wait " + sw.ElapsedMilliseconds + "ms", 2);
+ sw.Reset();
+ sw.Start();
+ }
+ macros.Add(value);
+ lVMacros.Items.Add(e.Button.ToString() + " Mouse Button", 1);
+ if (e.Button == System.Windows.Forms.MouseButtons.XButton1)
+ lVMacros.Items[lVMacros.Items.Count - 1].Text = "4th Mouse Button";
+ if (e.Button == System.Windows.Forms.MouseButtons.XButton2)
+ lVMacros.Items[lVMacros.Items.Count - 1].Text = "5th Mouse Button";
+ }
+ }
+ bool saved = false;
+ private void btnSave_Click(object sender, EventArgs e)
+ {
+ if (macros.Count > 0)
+ {
+ kbm.macrostag = macros;
+ foreach (ListViewItem lvi in lVMacros.Items)
+ {
+ macronames.Add(lvi.Text);
+ }
+ kbm.macros = macronames;
+ string macro = string.Join(", ", macronames.ToArray());
+ kbm.lBMacroOn.Visible = true;
+ if (cBStyle.SelectedIndex == 1)
+ kbm.macrorepeat = true;
+ saved = true;
+ Close();
+ }
+ else MessageBox.Show("No macro was recorded", "DS4Windows", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ }
+
+ private void btnCancel_Click(object sender, EventArgs e)
+ {
+ saved = true;
+ Close();
+ }
+
+
+
+ private void RecordBox_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ if (!saved && macros.Count > 0)
+ if (MessageBox.Show("Save Recorded Macro?", "DS4Windows", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
+ btnSave_Click(null, null);
+ }
+
+ protected override bool IsInputKey(Keys keyData)
+ {
+ switch (keyData)
+ {
+ case Keys.Right:
+ case Keys.Left:
+ case Keys.Up:
+ case Keys.Down:
+ return true;
+ case Keys.Shift | Keys.Right:
+ case Keys.Shift | Keys.Left:
+ case Keys.Shift | Keys.Up:
+ case Keys.Shift | Keys.Down:
+ return true;
+ }
+ return base.IsInputKey(keyData);
+ }
+ protected override void OnKeyDown(KeyEventArgs e)
+ {
+ base.OnKeyDown(e);
+ switch (e.KeyCode)
+ {
+ case Keys.Left:
+ case Keys.Right:
+ case Keys.Up:
+ case Keys.Down:
+ if (e.Shift)
+ {
+
+ }
+ else
+ {
+ }
+ break;
+ }
+ }
+ }
+}
diff --git a/DS4Tool/RecordBox.resx b/DS4Tool/RecordBox.resx
new file mode 100644
index 0000000..45a007c
--- /dev/null
+++ b/DS4Tool/RecordBox.resx
@@ -0,0 +1,174 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+
+ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
+ LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
+ ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAQ
+ CgAAAk1TRnQBSQFMAgEBAwEAATABAAEwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
+ AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
+ AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
+ AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
+ AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm
+ AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM
+ AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA
+ ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz
+ AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ
+ AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM
+ AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA
+ AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA
+ AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ
+ AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/
+ AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA
+ AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm
+ ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ
+ Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz
+ AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA
+ AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM
+ AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM
+ ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM
+ Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA
+ AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM
+ AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ
+ AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz
+ AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm
+ AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw
+ AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/yIAAf8B7wH3AfQGAAH/
+ Au8B/xgAAf8BBw4AAuwB/wcAAf8BBwHxAQcBvAGRAosBkQG8AQcB8QHvAf8XAAH/AuwBBw0AAuwB/wgA
+ AfQB8AEHBosCBwH0FwAB/wTsAQcMAALsAf8IAAHxAZEBiwe0AZEB8RYAAf8G7AEHCwAC7AH/BwAB9AG0
+ Aa0BtAG1AfEC/wHxAbUBtAGtAbQB9BUAAuwBBwLsAf8C7AH/CgAC7AH/BwABvAGzAbQBtQb/ArQBswG8
+ FQAB7AEHAQAC7AL/AewB/woAAuwB/wcAAbUBtAG1ARkC9AEHAfMB/wEZAQkCtAG1FQABBwIAAuwB/wEA
+ Av8HAAH/AgAC7AH/AgAB/wQAArQBtQP0AuwBvAH/ARkDtBgAAuwB/woAAewB/wEAAuwB/wEAAQcB/wQA
+ ArQBtQH0Av8B7AHvAewBBwEZA7QYAALsAf8KAALsAf8C7AH/AQcB7AH/BAABuwG0AbsBGQH/AfQBkgH0
+ Af8B7wEZAbUBtAG7GAAC7AH/CgABBwTsAQcC7AH/BAAB8AG0AbsBCQH/AfQB8gP/ArsBtAHwGAAC7AH/
+ CwABBwXsAf8EAAH0AVgBUgG7AgkB8wL0AfMBCQG7ARwBUgF5Af8XAALsAf8MAAEHA+wB/wUAARoBmgF6
+ AVIDCQK1AgkBuwFYARoBegH/FwAC7AH/DQABBwHsAf8GAAEaAXoBwwF6AVgB3AQJAbsBUgKaAXoB/xcA
+ A/8OAAH/BwAB/wEaAXoBwwF6AZkBCQLcAQkBmQF6AZoBegH2MgAB/wEaAVkBegH/BAAB/wFZAXoB9hIA
+ AUIBTQE+BwABPgMAASgDAAFAAwABEAMAAQEBAAEBBQABgBcAA/8BAAT/AYcB4QIAAf4BfwH+AT8BgAEB
+ AgAB/AE/Af4BPwHAAQMCAAH4AR8B/gE/AcABAwIAAfABDwH+AT8BgAEBAgAB8AEHAf4BPwGAAQECAAHy
+ AQcB/gE/AYABAQIAAfYBJwH2ATcBgAEBAgAB/gE/AfIBJwGAAQECAAH+AT8B8AEHAYABAQIAAf4BPwHw
+ AQcBgAEBAgAB/gE/AfgBDwQAAf4BPwH8AR8EAAH+AT8B/gE/BAAB/gE/Af8BfwEAAQECAAT/AYMBwwIA
+ Cw==
+
+
+
\ No newline at end of file
diff --git a/DS4Tool/Resources/Clock.png b/DS4Tool/Resources/Clock.png
new file mode 100644
index 0000000..bf09e33
Binary files /dev/null and b/DS4Tool/Resources/Clock.png differ
diff --git a/DS4Tool/SaveWhere.cs b/DS4Tool/SaveWhere.cs
index fb01edd..3e21b07 100644
--- a/DS4Tool/SaveWhere.cs
+++ b/DS4Tool/SaveWhere.cs
@@ -40,7 +40,7 @@ namespace ScpServer
catch { }
}
else if (!multisaves)
- Save(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + "Profiles.xml");
+ Save(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + "\\Profiles.xml");
Close();
}
diff --git a/DS4Tool/ScpForm.Designer.cs b/DS4Tool/ScpForm.Designer.cs
index ced3993..145785b 100644
--- a/DS4Tool/ScpForm.Designer.cs
+++ b/DS4Tool/ScpForm.Designer.cs
@@ -409,7 +409,7 @@
this.tLPControllers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 23.34039F));
this.tLPControllers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25.31077F));
this.tLPControllers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 117F));
- this.tLPControllers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F));
+ this.tLPControllers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 50F));
this.tLPControllers.Controls.Add(this.pBStatus1, 1, 1);
this.tLPControllers.Controls.Add(this.lbPad1, 0, 1);
this.tLPControllers.Controls.Add(this.lbPad2, 0, 2);
@@ -451,7 +451,7 @@
this.pBStatus1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pBStatus1.Image = ((System.Drawing.Image)(resources.GetObject("pBStatus1.Image")));
this.pBStatus1.InitialImage = global::ScpServer.Properties.Resources.BT;
- this.pBStatus1.Location = new System.Drawing.Point(370, 19);
+ this.pBStatus1.Location = new System.Drawing.Point(369, 19);
this.pBStatus1.Name = "pBStatus1";
this.pBStatus1.Size = new System.Drawing.Size(39, 20);
this.pBStatus1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -483,7 +483,7 @@
// bnEditC3
//
this.bnEditC3.Anchor = System.Windows.Forms.AnchorStyles.Left;
- this.bnEditC3.Location = new System.Drawing.Point(739, 76);
+ this.bnEditC3.Location = new System.Drawing.Point(737, 76);
this.bnEditC3.Name = "bnEditC3";
this.bnEditC3.Size = new System.Drawing.Size(40, 23);
this.bnEditC3.TabIndex = 43;
@@ -495,7 +495,7 @@
// bnEditC4
//
this.bnEditC4.Anchor = System.Windows.Forms.AnchorStyles.Left;
- this.bnEditC4.Location = new System.Drawing.Point(739, 105);
+ this.bnEditC4.Location = new System.Drawing.Point(737, 105);
this.bnEditC4.Name = "bnEditC4";
this.bnEditC4.Size = new System.Drawing.Size(40, 23);
this.bnEditC4.TabIndex = 43;
@@ -531,7 +531,7 @@
this.cBController1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.cBController1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBController1.FormattingEnabled = true;
- this.cBController1.Location = new System.Drawing.Point(622, 19);
+ this.cBController1.Location = new System.Drawing.Point(620, 19);
this.cBController1.Name = "cBController1";
this.cBController1.Size = new System.Drawing.Size(111, 21);
this.cBController1.TabIndex = 42;
@@ -541,7 +541,7 @@
// bnEditC2
//
this.bnEditC2.Anchor = System.Windows.Forms.AnchorStyles.Left;
- this.bnEditC2.Location = new System.Drawing.Point(739, 47);
+ this.bnEditC2.Location = new System.Drawing.Point(737, 47);
this.bnEditC2.Name = "bnEditC2";
this.bnEditC2.Size = new System.Drawing.Size(40, 23);
this.bnEditC2.TabIndex = 43;
@@ -555,7 +555,7 @@
this.cBController2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.cBController2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBController2.FormattingEnabled = true;
- this.cBController2.Location = new System.Drawing.Point(622, 48);
+ this.cBController2.Location = new System.Drawing.Point(620, 48);
this.cBController2.Name = "cBController2";
this.cBController2.Size = new System.Drawing.Size(111, 21);
this.cBController2.TabIndex = 42;
@@ -567,7 +567,7 @@
this.cBController3.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.cBController3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBController3.FormattingEnabled = true;
- this.cBController3.Location = new System.Drawing.Point(622, 77);
+ this.cBController3.Location = new System.Drawing.Point(620, 77);
this.cBController3.Name = "cBController3";
this.cBController3.Size = new System.Drawing.Size(111, 21);
this.cBController3.TabIndex = 42;
@@ -577,7 +577,7 @@
// bnEditC1
//
this.bnEditC1.Anchor = System.Windows.Forms.AnchorStyles.Left;
- this.bnEditC1.Location = new System.Drawing.Point(739, 18);
+ this.bnEditC1.Location = new System.Drawing.Point(737, 18);
this.bnEditC1.Name = "bnEditC1";
this.bnEditC1.Size = new System.Drawing.Size(40, 23);
this.bnEditC1.TabIndex = 43;
@@ -591,7 +591,7 @@
this.cBController4.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.cBController4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBController4.FormattingEnabled = true;
- this.cBController4.Location = new System.Drawing.Point(622, 106);
+ this.cBController4.Location = new System.Drawing.Point(620, 106);
this.cBController4.Name = "cBController4";
this.cBController4.Size = new System.Drawing.Size(111, 21);
this.cBController4.TabIndex = 42;
@@ -603,7 +603,7 @@
this.lBSelectedProfile.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lBSelectedProfile.AutoSize = true;
this.lBSelectedProfile.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lBSelectedProfile.Location = new System.Drawing.Point(623, 0);
+ this.lBSelectedProfile.Location = new System.Drawing.Point(621, 0);
this.lBSelectedProfile.Name = "lBSelectedProfile";
this.lBSelectedProfile.Size = new System.Drawing.Size(109, 15);
this.lBSelectedProfile.TabIndex = 45;
@@ -625,7 +625,7 @@
this.lBStatus.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lBStatus.AutoSize = true;
this.lBStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lBStatus.Location = new System.Drawing.Point(366, 0);
+ this.lBStatus.Location = new System.Drawing.Point(365, 0);
this.lBStatus.Name = "lBStatus";
this.lBStatus.Size = new System.Drawing.Size(47, 15);
this.lBStatus.TabIndex = 45;
@@ -636,7 +636,7 @@
this.lBBattery.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lBBattery.AutoSize = true;
this.lBBattery.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lBBattery.Location = new System.Drawing.Point(515, 0);
+ this.lBBattery.Location = new System.Drawing.Point(513, 0);
this.lBBattery.Name = "lBBattery";
this.lBBattery.Size = new System.Drawing.Size(51, 15);
this.lBBattery.TabIndex = 45;
@@ -647,7 +647,7 @@
this.lBBatt1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lBBatt1.AutoSize = true;
this.lBBatt1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lBBatt1.Location = new System.Drawing.Point(521, 22);
+ this.lBBatt1.Location = new System.Drawing.Point(519, 22);
this.lBBatt1.Name = "lBBatt1";
this.lBBatt1.Size = new System.Drawing.Size(39, 15);
this.lBBatt1.TabIndex = 44;
@@ -658,7 +658,7 @@
this.lBBatt2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lBBatt2.AutoSize = true;
this.lBBatt2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lBBatt2.Location = new System.Drawing.Point(521, 51);
+ this.lBBatt2.Location = new System.Drawing.Point(519, 51);
this.lBBatt2.Name = "lBBatt2";
this.lBBatt2.Size = new System.Drawing.Size(39, 15);
this.lBBatt2.TabIndex = 44;
@@ -669,7 +669,7 @@
this.lBBatt3.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lBBatt3.AutoSize = true;
this.lBBatt3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lBBatt3.Location = new System.Drawing.Point(521, 80);
+ this.lBBatt3.Location = new System.Drawing.Point(519, 80);
this.lBBatt3.Name = "lBBatt3";
this.lBBatt3.Size = new System.Drawing.Size(39, 15);
this.lBBatt3.TabIndex = 44;
@@ -680,7 +680,7 @@
this.lBBatt4.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lBBatt4.AutoSize = true;
this.lBBatt4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lBBatt4.Location = new System.Drawing.Point(521, 109);
+ this.lBBatt4.Location = new System.Drawing.Point(519, 109);
this.lBBatt4.Name = "lBBatt4";
this.lBBatt4.Size = new System.Drawing.Size(39, 15);
this.lBBatt4.TabIndex = 44;
@@ -691,7 +691,7 @@
this.pBStatus2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pBStatus2.Image = ((System.Drawing.Image)(resources.GetObject("pBStatus2.Image")));
this.pBStatus2.InitialImage = global::ScpServer.Properties.Resources.BT;
- this.pBStatus2.Location = new System.Drawing.Point(370, 48);
+ this.pBStatus2.Location = new System.Drawing.Point(369, 48);
this.pBStatus2.Name = "pBStatus2";
this.pBStatus2.Size = new System.Drawing.Size(39, 20);
this.pBStatus2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -703,7 +703,7 @@
this.pBStatus3.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pBStatus3.Image = ((System.Drawing.Image)(resources.GetObject("pBStatus3.Image")));
this.pBStatus3.InitialImage = global::ScpServer.Properties.Resources.BT;
- this.pBStatus3.Location = new System.Drawing.Point(370, 77);
+ this.pBStatus3.Location = new System.Drawing.Point(369, 77);
this.pBStatus3.Name = "pBStatus3";
this.pBStatus3.Size = new System.Drawing.Size(39, 20);
this.pBStatus3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -715,7 +715,7 @@
this.pBStatus4.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pBStatus4.Image = ((System.Drawing.Image)(resources.GetObject("pBStatus4.Image")));
this.pBStatus4.InitialImage = global::ScpServer.Properties.Resources.BT;
- this.pBStatus4.Location = new System.Drawing.Point(370, 106);
+ this.pBStatus4.Location = new System.Drawing.Point(369, 106);
this.pBStatus4.Name = "pBStatus4";
this.pBStatus4.Size = new System.Drawing.Size(39, 20);
this.pBStatus4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -1158,7 +1158,6 @@
this.MinimumSize = new System.Drawing.Size(420, 231);
this.Name = "ScpForm";
this.Text = "DS4Windows";
- this.Activated += new System.EventHandler(this.ScpForm_Activated);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScpForm_Closing);
this.Load += new System.EventHandler(this.Form_Load);
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.ScpForm_DragDrop);
diff --git a/DS4Tool/ScpForm.cs b/DS4Tool/ScpForm.cs
index 7308f70..d98e3da 100644
--- a/DS4Tool/ScpForm.cs
+++ b/DS4Tool/ScpForm.cs
@@ -17,7 +17,7 @@ namespace ScpServer
{
public partial class ScpForm : Form
{
- double version = 10.35;
+ double version = 10.4;
private DS4Control.Control rootHub;
delegate void LogDebugDelegate(DateTime Time, String Data);
@@ -85,7 +85,6 @@ namespace ScpServer
//CheckDrivers();
SystemEvents.PowerModeChanged += OnPowerChange;
tSOptions.Visible = false;
- LoadP();
ToolTip tt = new ToolTip();
if (File.Exists(appdatapath + "\\Profiles.xml"))
tt.SetToolTip(linkUninstall, "If removing DS4Windows, You can delete the settings following the profile folder link");
@@ -198,21 +197,20 @@ namespace ScpServer
t.DropDownItemClicked += Profile_Changed_Menu;
hideDS4CheckBox.CheckedChanged -= hideDS4CheckBox_CheckedChanged;
hideDS4CheckBox.Checked = Global.getUseExclusiveMode();
- hideDS4CheckBox.CheckedChanged += hideDS4CheckBox_CheckedChanged;
-
+ hideDS4CheckBox.CheckedChanged += hideDS4CheckBox_CheckedChanged;
// New settings
this.Width = Global.getFormWidth();
this.Height = Global.getFormHeight();
startMinimizedCheckBox.CheckedChanged -= startMinimizedCheckBox_CheckedChanged;
startMinimizedCheckBox.Checked = Global.getStartMinimized();
startMinimizedCheckBox.CheckedChanged += startMinimizedCheckBox_CheckedChanged;
- StartWindowsCheckBox.Checked = File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk");
if (startMinimizedCheckBox.Checked)
this.WindowState = FormWindowState.Minimized;
Form_Resize(sender, e);
RefreshProfiles();
for (int i = 0; i < 4; i++)
Global.LoadProfile(i);
+ LoadP();
Global.ControllerStatusChange += ControllerStatusChange;
ControllerStatusChanged();
if (btnStartStop.Enabled)
@@ -251,6 +249,7 @@ namespace ScpServer
test.Tick += test_Tick;
if (!System.IO.Directory.Exists(Global.appdatapath + "\\Virtual Bus Driver"))
linkUninstall.Visible = false;
+ StartWindowsCheckBox.Checked = File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk");
}
private void test_Tick(object sender, EventArgs e)
@@ -572,9 +571,9 @@ namespace ScpServer
}
//Added last message alternative
- if (this.Height > 220)
+ /*if (this.Height > 220)
lbLastMessage.Visible = tabMain.SelectedIndex != 2;
- else lbLastMessage.Visible = true;
+ else lbLastMessage.Visible = true;*/
}
protected void btnStartStop_Click(object sender, EventArgs e)
@@ -997,9 +996,9 @@ namespace ScpServer
private void StartWindowsCheckBox_CheckedChanged(object sender, EventArgs e)
{
RegistryKey KeyLoc = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
- if (StartWindowsCheckBox.Checked)
+ if (StartWindowsCheckBox.Checked && !File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk"))
appShortcutToStartup();
- else
+ else if (!StartWindowsCheckBox.Checked)
File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk");
KeyLoc.DeleteValue("DS4Tool", false);
}
@@ -1271,15 +1270,6 @@ namespace ScpServer
wd.ShowDialog();
}
- private void ScpForm_Activated(object sender, EventArgs e)
- {
- if (!this.ShowInTaskbar)
- {
- this.Show();
- this.ShowInTaskbar = true;
- }
- }
-
protected void ScpForm_Closing(object sender, FormClosingEventArgs e)
{
if (opt != null)
diff --git a/DS4Tool/ScpForm.resx b/DS4Tool/ScpForm.resx
index aefde06..e62a17a 100644
--- a/DS4Tool/ScpForm.resx
+++ b/DS4Tool/ScpForm.resx
@@ -6302,15 +6302,6 @@
449, 17
-
- 891, 17
-
-
- 568, 17
-
-
- 788, 17
-
iVBORw0KGgoAAAANSUhEUgAAACcAAAAUCAYAAAAOTSQ2AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
@@ -6535,6 +6526,12 @@
1WDefQHxFbbcLCQjmgAAAABJRU5ErkJggg==
+
+ 891, 17
+
+
+ 568, 17
+
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@@ -6570,6 +6567,9 @@
AABJRU5ErkJggg==
+
+ 788, 17
+
673, 17
diff --git a/DS4Tool/WinProgs.Designer.cs b/DS4Tool/WinProgs.Designer.cs
index b11d9b7..36c5b22 100644
--- a/DS4Tool/WinProgs.Designer.cs
+++ b/DS4Tool/WinProgs.Designer.cs
@@ -204,6 +204,7 @@
this.nameHeader,
this.PathHeader});
this.lVPrograms.FullRowSelect = true;
+ this.lVPrograms.HideSelection = false;
this.lVPrograms.LargeImageList = this.iLIcons;
this.lVPrograms.Location = new System.Drawing.Point(5, 28);
this.lVPrograms.MultiSelect = false;
diff --git a/DS4Tool/WinProgs.cs b/DS4Tool/WinProgs.cs
index 7ab30b2..ab992b9 100644
--- a/DS4Tool/WinProgs.cs
+++ b/DS4Tool/WinProgs.cs
@@ -99,15 +99,22 @@ namespace ScpServer
programpaths.Add(x.Attributes["path"].Value);
foreach (string st in programpaths)
{
- int index = programpaths.IndexOf(st);
- if (string.Empty != st)
+ if (File.Exists(st))
{
- iLIcons.Images.Add(Icon.ExtractAssociatedIcon(st));
- ListViewItem lvi = new ListViewItem(Path.GetFileNameWithoutExtension(st), index);
- lvi.SubItems.Add(st);
- lvi.Checked = true;
- lvi.ToolTipText = st;
- lVPrograms.Items.Add(lvi);
+ int index = programpaths.IndexOf(st);
+ if (string.Empty != st)
+ {
+ iLIcons.Images.Add(Icon.ExtractAssociatedIcon(st));
+ ListViewItem lvi = new ListViewItem(Path.GetFileNameWithoutExtension(st), index);
+ lvi.SubItems.Add(st);
+ lvi.Checked = true;
+ lvi.ToolTipText = st;
+ lVPrograms.Items.Add(lvi);
+ }
+ }
+ else
+ {
+ RemoveP(st, false, false);
}
}
}
@@ -230,7 +237,7 @@ namespace ScpServer
}
}
- public void RemoveP(string name, bool uncheck)
+ public void RemoveP(string name, bool uncheck, bool reload = true)
{
XmlDocument doc = new XmlDocument();
@@ -246,6 +253,7 @@ namespace ScpServer
for (int i = 0; i < 4; i++)
cbs[i].SelectedIndex = cbs[i].Items.Count - 1;
bnSave.Enabled = false;
+ if (reload)
form.LoadP();
}