From 0c49776fde0d398c0737ae2d0fbe91519361b3d2 Mon Sep 17 00:00:00 2001 From: jays2kings Date: Mon, 31 Mar 2014 02:43:21 -0400 Subject: [PATCH] Merged latest DS4Windows, added Button Mode to custom mapping Includes highlights and shows current mode when you click the touchpad --- DS4Control/ButtonMouse.cs | 18 +++------ DS4Control/Control.cs | 13 +++++++ DS4Control/TPadModeSwitcher.cs | 5 +++ DS4Tool/CustomMapping.Designer.cs | 30 +++++++++++---- DS4Tool/CustomMapping.cs | 46 ++++++++++++++++++++++- DS4Tool/DS4Tool.csproj | 2 + DS4Tool/Properties/Resources.Designer.cs | 20 ++++++++++ DS4Tool/Properties/Resources.resx | 6 +++ DS4Tool/Resources/30.png | Bin 0 -> 52398 bytes DS4Tool/Resources/31.png | Bin 0 -> 52462 bytes DS4Tool/ScpForm.Designer.cs | 2 +- DS4Tool/ScpForm.cs | 1 - 12 files changed, 120 insertions(+), 23 deletions(-) create mode 100644 DS4Tool/Resources/30.png create mode 100644 DS4Tool/Resources/31.png diff --git a/DS4Control/ButtonMouse.cs b/DS4Control/ButtonMouse.cs index 482b3a0..1028c1f 100644 --- a/DS4Control/ButtonMouse.cs +++ b/DS4Control/ButtonMouse.cs @@ -97,20 +97,17 @@ namespace DS4Control { if (upperDown) { - if (!mapTouchPad(DS4Controls.TouchUpper, true)) - InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_MIDDLEUP); + mapTouchPad(DS4Controls.TouchUpper, true); upperDown = false; } if (leftDown) { - if (!mapTouchPad(DS4Controls.TouchButton, true)) - InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_LEFTUP); + mapTouchPad(DS4Controls.TouchButton, true); leftDown = false; } if (rightDown) { - if (!mapTouchPad(DS4Controls.TouchMulti, true)) - InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_RIGHTUP); + mapTouchPad(DS4Controls.TouchMulti, true); rightDown = false; } dev.setRumble(0, 0); @@ -121,8 +118,7 @@ namespace DS4Control byte leftRumble, rightRumble; if (arg.touches == null) //No touches, finger on upper portion of touchpad { - if (!mapTouchPad(DS4Controls.TouchUpper, false)) - InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_MIDDLEDOWN); + mapTouchPad(DS4Controls.TouchUpper, false); upperDown = true; leftRumble = rightRumble = 127; } @@ -130,16 +126,14 @@ namespace DS4Control { if (isLeft(arg.touches[0])) { - if (!mapTouchPad(DS4Controls.TouchButton, false)) - InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_LEFTDOWN); + mapTouchPad(DS4Controls.TouchButton, false); leftDown = true; leftRumble = 63; rightRumble = 0; } else if (isRight(arg.touches[0])) { - if (!mapTouchPad(DS4Controls.TouchMulti, false)) - InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_RIGHTDOWN); + mapTouchPad(DS4Controls.TouchMulti, false); rightDown = true; leftRumble = 0; rightRumble = 63; diff --git a/DS4Control/Control.cs b/DS4Control/Control.cs index 1508bf1..706b2fa 100644 --- a/DS4Control/Control.cs +++ b/DS4Control/Control.cs @@ -192,6 +192,19 @@ namespace DS4Control return null; } + public string getDS4ControllerMode(int index) + { + if (DS4Controllers[index] != null) + { + DS4Device d = DS4Controllers[index]; + if (!d.IsAlive()) + return null; // awaiting the first battery charge indication + return modeSwitcher[index].ToString(); + } + else + return "couldn't find"; + } + //Called when DS4 is disconnected or timed out protected virtual void On_DS4Removal(object sender, EventArgs e) { diff --git a/DS4Control/TPadModeSwitcher.cs b/DS4Control/TPadModeSwitcher.cs index 697e7be..6a0d6f0 100644 --- a/DS4Control/TPadModeSwitcher.cs +++ b/DS4Control/TPadModeSwitcher.cs @@ -79,5 +79,10 @@ namespace DS4Control { return modes.ElementAt(currentTypeInd); } + + public int getCurrentModeInt() + { + return currentTypeInd; + } } } diff --git a/DS4Tool/CustomMapping.Designer.cs b/DS4Tool/CustomMapping.Designer.cs index c331b63..764acc7 100644 --- a/DS4Tool/CustomMapping.Designer.cs +++ b/DS4Tool/CustomMapping.Designer.cs @@ -64,6 +64,7 @@ this.bnR3 = new System.Windows.Forms.Button(); this.TouchTip = new System.Windows.Forms.Label(); this.ReapTip = new System.Windows.Forms.Label(); + this.lbMode = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); this.SuspendLayout(); // @@ -390,9 +391,9 @@ this.bnTouchpad.FlatAppearance.MouseOverBackColor = System.Drawing.SystemColors.Control; this.bnTouchpad.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.bnTouchpad.ForeColor = System.Drawing.SystemColors.WindowText; - this.bnTouchpad.Location = new System.Drawing.Point(151, 161); + this.bnTouchpad.Location = new System.Drawing.Point(151, 135); this.bnTouchpad.Name = "bnTouchpad"; - this.bnTouchpad.Size = new System.Drawing.Size(128, 26); + this.bnTouchpad.Size = new System.Drawing.Size(64, 52); this.bnTouchpad.TabIndex = 53; this.bnTouchpad.Text = "Click"; this.bnTouchpad.UseVisualStyleBackColor = false; @@ -444,9 +445,9 @@ this.bnTouchMulti.FlatAppearance.MouseOverBackColor = System.Drawing.SystemColors.Control; this.bnTouchMulti.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.bnTouchMulti.ForeColor = System.Drawing.SystemColors.WindowText; - this.bnTouchMulti.Location = new System.Drawing.Point(151, 135); + this.bnTouchMulti.Location = new System.Drawing.Point(215, 135); this.bnTouchMulti.Name = "bnTouchMulti"; - this.bnTouchMulti.Size = new System.Drawing.Size(128, 26); + this.bnTouchMulti.Size = new System.Drawing.Size(64, 52); this.bnTouchMulti.TabIndex = 53; this.bnTouchMulti.Text = "Right Click"; this.bnTouchMulti.UseVisualStyleBackColor = false; @@ -644,11 +645,14 @@ // TouchTip // this.TouchTip.AutoSize = true; - this.TouchTip.Location = new System.Drawing.Point(164, 34); + this.TouchTip.Location = new System.Drawing.Point(141, 34); + this.TouchTip.MaximumSize = new System.Drawing.Size(151, 52); + this.TouchTip.MinimumSize = new System.Drawing.Size(151, 52); this.TouchTip.Name = "TouchTip"; - this.TouchTip.Size = new System.Drawing.Size(109, 52); + this.TouchTip.Size = new System.Drawing.Size(151, 52); this.TouchTip.TabIndex = 55; - this.TouchTip.Text = "Touchpad:\r\nTop: Upper Pad \r\nMiddle: Multi-Touch \r\nBottom: Single Touch"; + this.TouchTip.Text = "Touchpad (Standard Mode):\r\nTop: Upper Pad \r\nMiddle: Multi-Touch \r\nBottom: Single " + + "Touch"; this.TouchTip.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.TouchTip.Visible = false; // @@ -663,6 +667,16 @@ this.ReapTip.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.ReapTip.Visible = false; // + // lbMode + // + this.lbMode.AutoSize = true; + this.lbMode.Location = new System.Drawing.Point(418, 51); + this.lbMode.Name = "lbMode"; + this.lbMode.Size = new System.Drawing.Size(51, 13); + this.lbMode.TabIndex = 56; + this.lbMode.Text = "Controller"; + this.lbMode.Visible = false; + // // CustomMapping // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -672,6 +686,7 @@ this.Controls.Add(this.ReapTip); this.Controls.Add(this.TouchTip); this.Controls.Add(this.pictureBox); + this.Controls.Add(this.lbMode); this.Controls.Add(this.lbControls); this.Controls.Add(this.cbScanCode); this.Controls.Add(this.cbRepeat); @@ -755,5 +770,6 @@ private System.Windows.Forms.Button bnR3; private System.Windows.Forms.Label TouchTip; private System.Windows.Forms.Label ReapTip; + private System.Windows.Forms.Label lbMode; } } \ No newline at end of file diff --git a/DS4Tool/CustomMapping.cs b/DS4Tool/CustomMapping.cs index 149b53e..ec85bc0 100644 --- a/DS4Tool/CustomMapping.cs +++ b/DS4Tool/CustomMapping.cs @@ -19,6 +19,7 @@ namespace ScpServer private bool ReapTipShown = false; private List comboBoxes = new List(); private List