mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-12 16:29:05 +01:00
Merged latest DS4Windows, added Button Mode to custom mapping
Includes highlights and shows current mode when you click the touchpad
This commit is contained in:
parent
8cbd1da322
commit
0c49776fde
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -79,5 +79,10 @@ namespace DS4Control
|
||||
{
|
||||
return modes.ElementAt(currentTypeInd);
|
||||
}
|
||||
|
||||
public int getCurrentModeInt()
|
||||
{
|
||||
return currentTypeInd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
30
DS4Tool/CustomMapping.Designer.cs
generated
30
DS4Tool/CustomMapping.Designer.cs
generated
@ -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;
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@ namespace ScpServer
|
||||
private bool ReapTipShown = false;
|
||||
private List<ComboBox> comboBoxes = new List<ComboBox>();
|
||||
private List<Button> buttons = new List<Button>();
|
||||
private string currentMode;
|
||||
private Dictionary<string, string> defaults = new Dictionary<string, string>();
|
||||
private ComboBox lastSelected;
|
||||
private Button lastSelectedBn;
|
||||
@ -30,6 +31,7 @@ namespace ScpServer
|
||||
public CustomMapping(DS4Control.Control rootHub, int deviceNum)
|
||||
{
|
||||
InitializeComponent();
|
||||
currentMode = rootHub.getDS4ControllerMode(deviceNum);
|
||||
this.rootHub = rootHub;
|
||||
device = deviceNum;
|
||||
DS4Color color = Global.loadColor(device);
|
||||
@ -51,8 +53,36 @@ namespace ScpServer
|
||||
((Button)control).KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.KeyPressCommand);
|
||||
((Button)control).PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.PreviewKeyDownCommand);
|
||||
lbControls.SelectedIndexChanged += new System.EventHandler(this.SelectedIndexChangedCommand);
|
||||
|
||||
}
|
||||
}
|
||||
if (currentMode == "Button Mode")
|
||||
{
|
||||
bnTouchpad.Location = new System.Drawing.Point(151, 135);
|
||||
bnTouchpad.Size = new System.Drawing.Size(64, 52);
|
||||
bnTouchMulti.Location = new System.Drawing.Point(215, 135);
|
||||
bnTouchMulti.Size = new System.Drawing.Size(64, 52);
|
||||
TouchTip.Text = "Touchpad (" + currentMode + "):\n Top: Upper Pad \n Left: Left Side \n Right: Right Side";
|
||||
lbMode.Text = ("Touchpad is in " + currentMode);
|
||||
}
|
||||
else if (currentMode == "Disabled" || currentMode == "Cursor Mode")
|
||||
{
|
||||
bnTouchpad.Location = new System.Drawing.Point(151, 161);
|
||||
bnTouchpad.Size = new System.Drawing.Size(128, 26);
|
||||
bnTouchMulti.Location = new System.Drawing.Point(151, 135);
|
||||
bnTouchMulti.Size = new System.Drawing.Size(128, 26);
|
||||
TouchTip.Text = "Touchpad (" + currentMode + "):\n Controls are saved, \n but change modes \n to use touchpad";
|
||||
lbMode.Text = ("Touchpad is currently disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
bnTouchpad.Location = new System.Drawing.Point(151, 161);
|
||||
bnTouchpad.Size = new System.Drawing.Size(128, 26);
|
||||
bnTouchMulti.Location = new System.Drawing.Point(151, 135);
|
||||
bnTouchMulti.Size = new System.Drawing.Size(128, 26);
|
||||
TouchTip.Text = "Touchpad (" + currentMode + "):\n Top: Upper Pad \n Middle: Multi-Touch \n Bottom: Single Touch";
|
||||
lbMode.Text = ("Touchpad is in " + currentMode);
|
||||
}
|
||||
availableButtons.Sort();
|
||||
foreach (string s in availableButtons)
|
||||
lbControls.Items.Add(s);
|
||||
@ -124,11 +154,23 @@ namespace ScpServer
|
||||
break;
|
||||
case "bnShare": pictureBox.Image = Properties.Resources._17;
|
||||
break;
|
||||
case "bnTouchpad": pictureBox.Image = Properties.Resources._18;
|
||||
case "bnTouchpad":
|
||||
if (currentMode == "Button Mode")
|
||||
{
|
||||
pictureBox.Image = Properties.Resources._30;
|
||||
}
|
||||
else
|
||||
pictureBox.Image = Properties.Resources._18;
|
||||
break;
|
||||
case "bnTouchUpper": pictureBox.Image = Properties.Resources._20;
|
||||
break;
|
||||
case "bnTouchMulti": pictureBox.Image = Properties.Resources._21;
|
||||
case "bnTouchMulti":
|
||||
if (currentMode == "Button Mode")
|
||||
{
|
||||
pictureBox.Image = Properties.Resources._31;
|
||||
}
|
||||
else
|
||||
pictureBox.Image = Properties.Resources._21;
|
||||
break;
|
||||
case "bnPS": pictureBox.Image = Properties.Resources._19;
|
||||
break;
|
||||
|
@ -169,6 +169,8 @@
|
||||
<None Include="Resources\28.png" />
|
||||
<None Include="Resources\29.png" />
|
||||
<Content Include="Resources\3.png" />
|
||||
<None Include="Resources\30.png" />
|
||||
<None Include="Resources\31.png" />
|
||||
<Content Include="Resources\4.png" />
|
||||
<Content Include="Resources\5.png" />
|
||||
<Content Include="Resources\6.png" />
|
||||
|
20
DS4Tool/Properties/Resources.Designer.cs
generated
20
DS4Tool/Properties/Resources.Designer.cs
generated
@ -290,6 +290,26 @@ namespace ScpServer.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap _30 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("_30", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap _31 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("_31", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
@ -198,6 +198,12 @@
|
||||
<data name="_3" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="_30" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\30.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="_31" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\31.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="_4" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
BIN
DS4Tool/Resources/30.png
Normal file
BIN
DS4Tool/Resources/30.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
BIN
DS4Tool/Resources/31.png
Normal file
BIN
DS4Tool/Resources/31.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
2
DS4Tool/ScpForm.Designer.cs
generated
2
DS4Tool/ScpForm.Designer.cs
generated
@ -327,7 +327,7 @@
|
||||
this.Controls.Add(this.pnlStatus);
|
||||
this.MinimumSize = new System.Drawing.Size(750, 192);
|
||||
this.Name = "ScpForm";
|
||||
this.Text = "DS4Windows 1.0 Alpha (2014-03-28.1)";
|
||||
this.Text = "DS4Windows 1.0 (2014-03-27.0)";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Close);
|
||||
this.Load += new System.EventHandler(this.Form_Load);
|
||||
this.Resize += new System.EventHandler(this.Form_Resize);
|
||||
|
@ -266,7 +266,6 @@ namespace ScpServer
|
||||
{
|
||||
MessageBox.Show(((ListView)sender).FocusedItem.SubItems[1].Text,"Log");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ThemeUtil
|
||||
|
Loading…
x
Reference in New Issue
Block a user