Added Mouse movement to custom mapping

Works with both the sticks and the buttons (Sens. setting in options)

Signed-off-by: jays2kings <jays2kings@gmail.com>
This commit is contained in:
jays2kings 2014-04-29 17:56:58 -04:00
parent fca9dc9dac
commit 794cefe2e6
9 changed files with 281 additions and 62 deletions

View File

@ -295,7 +295,7 @@ namespace DS4Control
if (Global.getHasCustomKeysorButtons(ind))
{
Mapping.MapCustom(ind, cState, MappedState[ind]);
Mapping.MapCustom(ind, cState, MappedState[ind], pState);
cState = MappedState[ind];
}

View File

@ -304,7 +304,7 @@ namespace DS4Control
}
/** Map DS4 Buttons/Axes to other DS4 Buttons/Axes (largely the same as Xinput ones) and to keyboard and mouse buttons. */
public static void MapCustom(int device, DS4State cState, DS4State MappedState)
public static void MapCustom(int device, DS4State cState, DS4State MappedState, DS4State pState = null)
{
cState.CopyTo(MappedState);
SyntheticState deviceState = Mapping.deviceState[device];
@ -331,6 +331,8 @@ namespace DS4Control
MappedState.LY = 127;
MappedState.RX = 127;
MappedState.RY = 127;
int MouseDeltaX = 0;
int MouseDeltaY = 0;
Dictionary<DS4Controls, X360Controls> customButtons = Global.getCustomButtons(device);
foreach (KeyValuePair<DS4Controls, X360Controls> customButton in customButtons)
@ -349,19 +351,19 @@ namespace DS4Control
break;
case X360Controls.B:
if (!MappedState.Circle)
MappedState.Circle = getBoolMapping(customButton.Key, cState);
MappedState.Circle = getBoolMapping(customButton.Key, cState);
break;
case X360Controls.X:
if (!MappedState.Square)
MappedState.Square = getBoolMapping(customButton.Key, cState);
MappedState.Square = getBoolMapping(customButton.Key, cState);
break;
case X360Controls.Y:
if (!MappedState.Triangle)
MappedState.Triangle = getBoolMapping(customButton.Key, cState);
MappedState.Triangle = getBoolMapping(customButton.Key, cState);
break;
case X360Controls.LB:
if (!MappedState.L1)
MappedState.L1 = getBoolMapping(customButton.Key, cState);
MappedState.L1 = getBoolMapping(customButton.Key, cState);
break;
case X360Controls.LS:
if (!MappedState.L3)
@ -477,7 +479,7 @@ namespace DS4Control
if (getBoolMapping(customButton.Key, cState))
deviceState.currentClicks.middleCount++;
break;
case X360Controls.FourthMouse:
case X360Controls.FourthMouse:
if (getBoolMapping(customButton.Key, cState))
deviceState.currentClicks.fourthCount++;
break;
@ -487,13 +489,48 @@ namespace DS4Control
break;
case X360Controls.WUP:
if (getBoolMapping(customButton.Key, cState))
deviceState.currentClicks.wUpCount++;
deviceState.currentClicks.wUpCount++;
break;
case X360Controls.WDOWN:
if (getBoolMapping(customButton.Key, cState))
deviceState.currentClicks.wDownCount++;
deviceState.currentClicks.wDownCount++;
break;
}
if (pState != null)
{
switch (customButton.Value)
{
case X360Controls.MouseUp:
if (MouseDeltaY == 0)
{
MouseDeltaY = calculateRelativeMouseDelta(device, customButton.Key, cState, pState);
MouseDeltaY = -Math.Abs(MouseDeltaY);
}
break;
case X360Controls.MouseDown:
if (MouseDeltaY == 0)
{
MouseDeltaY = calculateRelativeMouseDelta(device, customButton.Key, cState, pState);
MouseDeltaY = Math.Abs(MouseDeltaY);
}
break;
case X360Controls.MouseLeft:
if (MouseDeltaX == 0)
{
MouseDeltaX = calculateRelativeMouseDelta(device, customButton.Key, cState, pState);
MouseDeltaX = -Math.Abs(MouseDeltaX);
}
break;
case X360Controls.MouseRight:
if (MouseDeltaX == 0)
{
MouseDeltaX = calculateRelativeMouseDelta(device, customButton.Key, cState, pState);
MouseDeltaX = Math.Abs(MouseDeltaX);
}
break;
}
}
}
if (!LX)
@ -504,12 +541,73 @@ namespace DS4Control
MappedState.RX = cState.RX;
if (!RY)
MappedState.RY = cState.RY;
InputMethods.MoveCursorBy(MouseDeltaX, MouseDeltaY);
}
static Mouse[] mouses;
public static void GetMouses(ref Mouse[] mouss)
private static int calculateRelativeMouseDelta(int device, DS4Controls control, DS4State cState, DS4State pState)
{
mouses = mouss;
int axisVal = -1;
int DEAD_ZONE = 10;
float SPEED_MULTIPLIER = 0.000004f;
bool positive = false;
float deltaTime = cState.ReportTimeStamp.Ticks - pState.ReportTimeStamp.Ticks;
switch (control)
{
case DS4Controls.LXNeg:
axisVal = cState.LX;
break;
case DS4Controls.LXPos:
positive = true;
axisVal = cState.LX;
break;
case DS4Controls.RXNeg:
axisVal = cState.RX;
break;
case DS4Controls.RXPos:
positive = true;
axisVal = cState.RX;
break;
case DS4Controls.LYNeg:
axisVal = cState.LY;
break;
case DS4Controls.LYPos:
positive = true;
axisVal = cState.LY;
break;
case DS4Controls.RYNeg:
axisVal = cState.RY;
break;
case DS4Controls.RYPos:
positive = true;
axisVal = cState.RY;
break;
case DS4Controls.Share: axisVal = (byte)(cState.Share ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.Options: axisVal = (byte)(cState.Options ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.L1: axisVal = (byte)(cState.L1 ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.R1: axisVal = (byte)(cState.R1 ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.L3: axisVal = (byte)(cState.L3 ? 117 - Global.getButtonMouseSensitivity(device) : -1); break;
case DS4Controls.R3: axisVal = (byte)(cState.R3 ? 117 - Global.getButtonMouseSensitivity(device) : -1); break;
case DS4Controls.DpadUp: axisVal = (byte)(cState.DpadUp ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.DpadDown: axisVal = (byte)(cState.DpadDown ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.DpadLeft: axisVal = (byte)(cState.DpadLeft ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.DpadRight: axisVal = (byte)(cState.DpadRight ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.PS: axisVal = (byte)(cState.PS ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.Cross: axisVal = (byte)(cState.Cross ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.Square: axisVal = (byte)(cState.Square ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.Triangle: axisVal = (byte)(cState.Triangle ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.Circle: axisVal = (byte)(cState.Circle ? -Global.getButtonMouseSensitivity(device) + 117 : -1); break;
case DS4Controls.L2: positive = true; axisVal = cState.L2; break;
case DS4Controls.R2: positive = true; axisVal = cState.R2; break;
}
axisVal = axisVal - 127;
int delta = 0;
if ((!positive && axisVal < -DEAD_ZONE) || (positive && axisVal > DEAD_ZONE))
{
delta = (int)(float)(axisVal * SPEED_MULTIPLIER * deltaTime);
}
return delta;
}
public static bool compare(byte b1, byte b2)
{
if (Math.Abs(b1 - b2) > 10)

View File

@ -12,7 +12,7 @@ namespace DS4Control
public enum DS4KeyType : byte { None = 0, ScanCode = 1, Repeat = 2, Unbound = 4 }; //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, Unbound };
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 };
public class DebugEventArgs : EventArgs
{
@ -87,7 +87,14 @@ namespace DS4Control
if (ControllerStatusChange != null)
ControllerStatusChange(sender, EventArgs.Empty);
}
public static void setButtonMouseSensitivity(int device, int data)
{
m_Config.buttonMouseSensitivity[device] = data;
}
public static int getButtonMouseSensitivity(int device)
{
return m_Config.buttonMouseSensitivity[device];
}
public static DS4Color loadColor(int device)
{
DS4Color color = new DS4Color();
@ -370,6 +377,8 @@ namespace DS4Control
protected String m_Profile = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles.xml";
protected XmlDocument m_Xdoc = new XmlDocument();
public int[] buttonMouseSensitivity = { 50, 50, 50, 50 };
public Boolean[] touchpadJitterCompensation = {true, true, true, true};
public Boolean[] lowerRCOn = { false, false, false, false };
public Boolean[] ledAsBattery = { false, false, false, false };
@ -483,6 +492,7 @@ namespace DS4Control
XmlNode xmlScrollSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "scrollSensitivity", null); xmlScrollSensitivity.InnerText = scrollSensitivity[device].ToString(); Node.AppendChild(xmlScrollSensitivity);
XmlNode xmlLeftTriggerMiddle = m_Xdoc.CreateNode(XmlNodeType.Element, "LeftTriggerMiddle", null); xmlLeftTriggerMiddle.InnerText = m_LeftTriggerMiddle[device].ToString(); Node.AppendChild(xmlLeftTriggerMiddle);
XmlNode xmlRightTriggerMiddle = m_Xdoc.CreateNode(XmlNodeType.Element, "RightTriggerMiddle", null); xmlRightTriggerMiddle.InnerText = m_RightTriggerMiddle[device].ToString(); Node.AppendChild(xmlRightTriggerMiddle);
XmlNode xmlButtonMouseSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "ButtonMouseSensitivity", null); xmlButtonMouseSensitivity.InnerText = buttonMouseSensitivity[device].ToString(); Node.AppendChild(xmlButtonMouseSensitivity);
XmlNode NodeControl = m_Xdoc.CreateNode(XmlNodeType.Element, "Control", null);
@ -621,6 +631,10 @@ namespace DS4Control
case "5th Mouse Button": return X360Controls.FifthMouse;
case "Mouse Wheel Up": return X360Controls.WUP;
case "Mouse Wheel Down": return X360Controls.WDOWN;
case "Mouse Up": return X360Controls.MouseUp;
case "Mouse Down": return X360Controls.MouseDown;
case "Mouse Left": return X360Controls.MouseLeft;
case "Mouse Right": return X360Controls.MouseRight;
case "Unbound": return X360Controls.Unbound;
}
@ -692,6 +706,8 @@ namespace DS4Control
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RightTriggerMiddle"); Double.TryParse(Item.InnerText, out m_RightTriggerMiddle[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ButtonMouseSensitivity"); Int32.TryParse(Item.InnerText, out buttonMouseSensitivity[device]); }
catch { missingSetting = true; }
DS4KeyType keyType;
UInt16 wvk;
@ -836,6 +852,8 @@ namespace DS4Control
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RightTriggerMiddle"); Double.TryParse(Item.InnerText, out m_RightTriggerMiddle[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ButtonMouseSensitivity"); Int32.TryParse(Item.InnerText, out buttonMouseSensitivity[device]); }
catch { missingSetting = true; }
DS4KeyType keyType;
UInt16 wvk;

View File

@ -33,7 +33,6 @@
this.label2 = new System.Windows.Forms.Label();
this.cbScanCode = new System.Windows.Forms.CheckBox();
this.cbRepeat = new System.Windows.Forms.CheckBox();
this.bnUnbound = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
@ -61,6 +60,7 @@
this.btnF10 = new System.Windows.Forms.Button();
this.btnF12 = new System.Windows.Forms.Button();
this.btnBREAK = new System.Windows.Forms.Button();
this.button35 = new System.Windows.Forms.Button();
this.button39 = new System.Windows.Forms.Button();
this.button38 = new System.Windows.Forms.Button();
this.bnPREVTRACK = new System.Windows.Forms.Button();
@ -147,6 +147,10 @@
this.btnW = new System.Windows.Forms.Button();
this.button33 = new System.Windows.Forms.Button();
this.button30 = new System.Windows.Forms.Button();
this.bnMOUSERIGHT = new System.Windows.Forms.Button();
this.bnMOUSELEFT = new System.Windows.Forms.Button();
this.bnMOUSEDOWN = new System.Windows.Forms.Button();
this.bnMOUSEUP = new System.Windows.Forms.Button();
this.btnLEFTMOUSE = new System.Windows.Forms.Button();
this.btnQ = new System.Windows.Forms.Button();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
@ -178,7 +182,6 @@
this.button21 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.button35 = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabKBM.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
@ -202,7 +205,6 @@
this.tabKBM.Controls.Add(this.label2);
this.tabKBM.Controls.Add(this.cbScanCode);
this.tabKBM.Controls.Add(this.cbRepeat);
this.tabKBM.Controls.Add(this.bnUnbound);
this.tabKBM.Controls.Add(this.button7);
this.tabKBM.Controls.Add(this.button5);
this.tabKBM.Controls.Add(this.button4);
@ -317,6 +319,10 @@
this.tabKBM.Controls.Add(this.btnW);
this.tabKBM.Controls.Add(this.button33);
this.tabKBM.Controls.Add(this.button30);
this.tabKBM.Controls.Add(this.bnMOUSERIGHT);
this.tabKBM.Controls.Add(this.bnMOUSELEFT);
this.tabKBM.Controls.Add(this.bnMOUSEDOWN);
this.tabKBM.Controls.Add(this.bnMOUSEUP);
this.tabKBM.Controls.Add(this.btnLEFTMOUSE);
this.tabKBM.Controls.Add(this.btnQ);
this.tabKBM.Controls.Add(this.pictureBox2);
@ -361,17 +367,6 @@
this.cbRepeat.Text = "Repeat";
this.cbRepeat.UseVisualStyleBackColor = true;
//
// bnUnbound
//
this.bnUnbound.Location = new System.Drawing.Point(749, 122);
this.bnUnbound.Name = "bnUnbound";
this.bnUnbound.Size = new System.Drawing.Size(71, 23);
this.bnUnbound.TabIndex = 162;
this.bnUnbound.Tag = "Unbound";
this.bnUnbound.Text = "(Unbound)";
this.bnUnbound.UseVisualStyleBackColor = true;
this.bnUnbound.Visible = false;
//
// button7
//
this.button7.Location = new System.Drawing.Point(494, 123);
@ -642,6 +637,16 @@
this.btnBREAK.Text = "bk";
this.btnBREAK.UseVisualStyleBackColor = true;
//
// button35
//
this.button35.Location = new System.Drawing.Point(697, 62);
this.button35.Name = "button35";
this.button35.Size = new System.Drawing.Size(40, 24);
this.button35.TabIndex = 122;
this.button35.Tag = "173";
this.button35.Text = "ØVolume Mute";
this.button35.UseVisualStyleBackColor = true;
//
// button39
//
this.button39.Location = new System.Drawing.Point(697, 32);
@ -1427,7 +1432,7 @@
//
// bTNRIGHTMOUSE
//
this.bTNRIGHTMOUSE.Location = new System.Drawing.Point(809, 42);
this.bTNRIGHTMOUSE.Location = new System.Drawing.Point(809, 49);
this.bTNRIGHTMOUSE.Name = "bTNRIGHTMOUSE";
this.bTNRIGHTMOUSE.Size = new System.Drawing.Size(24, 24);
this.bTNRIGHTMOUSE.TabIndex = 61;
@ -1447,7 +1452,7 @@
//
// button32
//
this.button32.Location = new System.Drawing.Point(779, 67);
this.button32.Location = new System.Drawing.Point(779, 74);
this.button32.Name = "button32";
this.button32.Size = new System.Drawing.Size(24, 21);
this.button32.TabIndex = 59;
@ -1457,7 +1462,7 @@
//
// button31
//
this.button31.Location = new System.Drawing.Point(779, 19);
this.button31.Location = new System.Drawing.Point(779, 26);
this.button31.Name = "button31";
this.button31.Size = new System.Drawing.Size(24, 22);
this.button31.TabIndex = 59;
@ -1467,7 +1472,7 @@
//
// btnMIDDLEMOUSE
//
this.btnMIDDLEMOUSE.Location = new System.Drawing.Point(779, 42);
this.btnMIDDLEMOUSE.Location = new System.Drawing.Point(779, 49);
this.btnMIDDLEMOUSE.Name = "btnMIDDLEMOUSE";
this.btnMIDDLEMOUSE.Size = new System.Drawing.Size(24, 24);
this.btnMIDDLEMOUSE.TabIndex = 59;
@ -1487,7 +1492,7 @@
//
// button33
//
this.button33.Location = new System.Drawing.Point(814, 92);
this.button33.Location = new System.Drawing.Point(814, 114);
this.button33.Name = "button33";
this.button33.Size = new System.Drawing.Size(19, 24);
this.button33.TabIndex = 58;
@ -1497,7 +1502,7 @@
//
// button30
//
this.button30.Location = new System.Drawing.Point(749, 92);
this.button30.Location = new System.Drawing.Point(749, 113);
this.button30.Name = "button30";
this.button30.Size = new System.Drawing.Size(19, 24);
this.button30.TabIndex = 58;
@ -1505,9 +1510,49 @@
this.button30.Text = "4th Mouse Button";
this.button30.UseVisualStyleBackColor = true;
//
// bnMOUSERIGHT
//
this.bnMOUSERIGHT.Location = new System.Drawing.Point(823, 87);
this.bnMOUSERIGHT.Name = "bnMOUSERIGHT";
this.bnMOUSERIGHT.Size = new System.Drawing.Size(24, 24);
this.bnMOUSERIGHT.TabIndex = 58;
this.bnMOUSERIGHT.Tag = "Mouse Right";
this.bnMOUSERIGHT.Text = "→Mouse Right";
this.bnMOUSERIGHT.UseVisualStyleBackColor = true;
//
// bnMOUSELEFT
//
this.bnMOUSELEFT.Location = new System.Drawing.Point(732, 87);
this.bnMOUSELEFT.Name = "bnMOUSELEFT";
this.bnMOUSELEFT.Size = new System.Drawing.Size(24, 24);
this.bnMOUSELEFT.TabIndex = 58;
this.bnMOUSELEFT.Tag = "Mouse Left";
this.bnMOUSELEFT.Text = "←Mouse Left";
this.bnMOUSELEFT.UseVisualStyleBackColor = true;
//
// bnMOUSEDOWN
//
this.bnMOUSEDOWN.Location = new System.Drawing.Point(779, 129);
this.bnMOUSEDOWN.Name = "bnMOUSEDOWN";
this.bnMOUSEDOWN.Size = new System.Drawing.Size(24, 24);
this.bnMOUSEDOWN.TabIndex = 58;
this.bnMOUSEDOWN.Tag = "Mouse Down";
this.bnMOUSEDOWN.Text = "↓Mouse Down";
this.bnMOUSEDOWN.UseVisualStyleBackColor = true;
//
// bnMOUSEUP
//
this.bnMOUSEUP.Location = new System.Drawing.Point(779, 0);
this.bnMOUSEUP.Name = "bnMOUSEUP";
this.bnMOUSEUP.Size = new System.Drawing.Size(24, 24);
this.bnMOUSEUP.TabIndex = 58;
this.bnMOUSEUP.Tag = "Mouse Up";
this.bnMOUSEUP.Text = "↑Mouse Up";
this.bnMOUSEUP.UseVisualStyleBackColor = true;
//
// btnLEFTMOUSE
//
this.btnLEFTMOUSE.Location = new System.Drawing.Point(749, 42);
this.btnLEFTMOUSE.Location = new System.Drawing.Point(749, 49);
this.btnLEFTMOUSE.Name = "btnLEFTMOUSE";
this.btnLEFTMOUSE.Size = new System.Drawing.Size(24, 24);
this.btnLEFTMOUSE.TabIndex = 58;
@ -1528,7 +1573,7 @@
// pictureBox2
//
this.pictureBox2.Image = global::ScpServer.Properties.Resources.mouse;
this.pictureBox2.Location = new System.Drawing.Point(743, 1);
this.pictureBox2.Location = new System.Drawing.Point(743, 8);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(97, 140);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@ -1843,16 +1888,6 @@
this.pictureBox1.TabIndex = 107;
this.pictureBox1.TabStop = false;
//
// button35
//
this.button35.Location = new System.Drawing.Point(697, 62);
this.button35.Name = "button35";
this.button35.Size = new System.Drawing.Size(40, 24);
this.button35.TabIndex = 122;
this.button35.Tag = "173";
this.button35.Text = "ØVolume Mute";
this.button35.UseVisualStyleBackColor = true;
//
// KBM360
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -2010,7 +2045,6 @@
private System.Windows.Forms.Button button22;
private System.Windows.Forms.Button button21;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button bnUnbound;
private System.Windows.Forms.Button btnWINDOWS;
private System.Windows.Forms.Button btnUNBOUND2;
private System.Windows.Forms.CheckBox cbScanCode;
@ -2029,5 +2063,9 @@
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.Button button34;
private System.Windows.Forms.Button button35;
private System.Windows.Forms.Button bnMOUSERIGHT;
private System.Windows.Forms.Button bnMOUSELEFT;
private System.Windows.Forms.Button bnMOUSEDOWN;
private System.Windows.Forms.Button bnMOUSEUP;
}
}

View File

@ -33,6 +33,13 @@ namespace ScpServer
foreach (System.Windows.Forms.Control control in tab360.Controls)
if (control is Button)
((Button)control).Click += new System.EventHandler(anybtn_Click360);
if (button.Name.Contains("Touch"))
{
bnMOUSEDOWN.Visible = false;
bnMOUSELEFT.Visible = false;
bnMOUSERIGHT.Visible = false;
bnMOUSEUP.Visible = false;
}
if (tabStart < 2)
tabControl1.SelectedIndex = tabStart;
else
@ -45,7 +52,7 @@ namespace ScpServer
if (sender is Button)
{
string keyname;
if (((Button)sender).Text.Contains('↑') || ((Button)sender).Text.Contains('↓') || ((Button)sender).Text.Contains('→') || ((Button)sender).Text.Contains('') || ((Button)sender).Text.Contains('Ø'))
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")
{

View File

@ -116,6 +116,7 @@
this.numUDTap = new System.Windows.Forms.NumericUpDown();
this.numUDScroll = new System.Windows.Forms.NumericUpDown();
this.numUDTouch = new System.Windows.Forms.NumericUpDown();
this.cBDoubleTap = new System.Windows.Forms.CheckBox();
this.bnTouchUpper = new System.Windows.Forms.Button();
this.bnTouchMulti = new System.Windows.Forms.Button();
this.bnTouchRight = new System.Windows.Forms.Button();
@ -129,8 +130,10 @@
this.label2 = new System.Windows.Forms.Label();
this.tBProfile = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.cBDoubleTap = new System.Windows.Forms.CheckBox();
this.tBMouseSens = new System.Windows.Forms.TrackBar();
this.lBMouseSens = new System.Windows.Forms.Label();
this.advColorDialog = new ScpServer.AdvancedColorDialog();
this.lBButtonMouseSens = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.blueBar)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.greenBar)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.redBar)).BeginInit();
@ -153,6 +156,7 @@
this.tabRumble.SuspendLayout();
this.tabOther.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.idleDisconnectTimeout)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tBMouseSens)).BeginInit();
this.SuspendLayout();
//
// BlueLabel
@ -1497,6 +1501,21 @@
0});
this.numUDTouch.ValueChanged += new System.EventHandler(this.numUDTouch_ValueChanged);
//
// cBDoubleTap
//
this.cBDoubleTap.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cBDoubleTap.AutoSize = true;
this.cBDoubleTap.Checked = true;
this.cBDoubleTap.CheckState = System.Windows.Forms.CheckState.Checked;
this.cBDoubleTap.Location = new System.Drawing.Point(344, 121);
this.cBDoubleTap.Name = "cBDoubleTap";
this.cBDoubleTap.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cBDoubleTap.Size = new System.Drawing.Size(82, 17);
this.cBDoubleTap.TabIndex = 39;
this.cBDoubleTap.Text = "Double Tap";
this.cBDoubleTap.UseVisualStyleBackColor = true;
this.cBDoubleTap.CheckedChanged += new System.EventHandler(this.cBDoubleTap_CheckedChanged);
//
// bnTouchUpper
//
this.bnTouchUpper.BackColor = System.Drawing.Color.Transparent;
@ -1635,6 +1654,8 @@
//
// tabOther
//
this.tabOther.Controls.Add(this.lBButtonMouseSens);
this.tabOther.Controls.Add(this.lBMouseSens);
this.tabOther.Controls.Add(this.idleDisconnectTimeout);
this.tabOther.Controls.Add(this.label3);
this.tabOther.Controls.Add(this.label2);
@ -1645,6 +1666,7 @@
this.tabOther.Controls.Add(this.label9);
this.tabOther.Controls.Add(this.rightTriggerMiddlePoint);
this.tabOther.Controls.Add(this.leftTriggerMiddlePoint);
this.tabOther.Controls.Add(this.tBMouseSens);
this.tabOther.Location = new System.Drawing.Point(4, 22);
this.tabOther.Name = "tabOther";
this.tabOther.Size = new System.Drawing.Size(425, 170);
@ -1705,20 +1727,26 @@
this.label4.TabIndex = 84;
this.label4.Text = "Profile Name:";
//
// cBDoubleTap
// tBMouseSens
//
this.cBDoubleTap.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cBDoubleTap.AutoSize = true;
this.cBDoubleTap.Checked = true;
this.cBDoubleTap.CheckState = System.Windows.Forms.CheckState.Checked;
this.cBDoubleTap.Location = new System.Drawing.Point(344, 121);
this.cBDoubleTap.Name = "cBDoubleTap";
this.cBDoubleTap.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cBDoubleTap.Size = new System.Drawing.Size(82, 17);
this.cBDoubleTap.TabIndex = 39;
this.cBDoubleTap.Text = "Double Tap";
this.cBDoubleTap.UseVisualStyleBackColor = true;
this.cBDoubleTap.CheckedChanged += new System.EventHandler(this.cBDoubleTap_CheckedChanged);
this.tBMouseSens.BackColor = System.Drawing.Color.White;
this.tBMouseSens.Location = new System.Drawing.Point(292, 8);
this.tBMouseSens.Maximum = 117;
this.tBMouseSens.Name = "tBMouseSens";
this.tBMouseSens.Size = new System.Drawing.Size(104, 45);
this.tBMouseSens.TabIndex = 85;
this.tBMouseSens.TickStyle = System.Windows.Forms.TickStyle.None;
this.tBMouseSens.Value = 50;
this.tBMouseSens.Scroll += new System.EventHandler(this.tBMouseSens_Scroll);
//
// lBMouseSens
//
this.lBMouseSens.Location = new System.Drawing.Point(392, 13);
this.lBMouseSens.Name = "lBMouseSens";
this.lBMouseSens.Size = new System.Drawing.Size(30, 13);
this.lBMouseSens.TabIndex = 86;
this.lBMouseSens.Text = "50";
this.lBMouseSens.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// advColorDialog
//
@ -1726,6 +1754,15 @@
this.advColorDialog.Color = System.Drawing.Color.Blue;
this.advColorDialog.FullOpen = true;
//
// lBButtonMouseSens
//
this.lBButtonMouseSens.AutoSize = true;
this.lBButtonMouseSens.Location = new System.Drawing.Point(158, 11);
this.lBButtonMouseSens.Name = "lBButtonMouseSens";
this.lBButtonMouseSens.Size = new System.Drawing.Size(134, 13);
this.lBButtonMouseSens.TabIndex = 87;
this.lBButtonMouseSens.Text = "Mouse Sensitivity (Buttons)";
//
// Options
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1772,6 +1809,7 @@
this.tabOther.ResumeLayout(false);
this.tabOther.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.idleDisconnectTimeout)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tBMouseSens)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -1884,6 +1922,9 @@
private System.Windows.Forms.NumericUpDown numUDTap;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.CheckBox cBDoubleTap;
private System.Windows.Forms.Label lBMouseSens;
private System.Windows.Forms.TrackBar tBMouseSens;
private System.Windows.Forms.Label lBButtonMouseSens;
}
}


View File

@ -55,6 +55,8 @@ namespace ScpServer
cBlowerRCOn.Checked = Global.getLowerRCOn(device);
flushHIDQueue.Checked = Global.getFlushHIDQueue(device);
idleDisconnectTimeout.Value = Global.getIdleDisconnectTimeout(device);
tBMouseSens.Value = Global.getButtonMouseSensitivity(device);
lBMouseSens.Text = tBMouseSens.Value.ToString();
// Force update of color choosers
alphacolor = Math.Max(redBar.Value, Math.Max(greenBar.Value, blueBar.Value));
reg = Color.FromArgb(color.red, color.green, color.blue);
@ -91,6 +93,7 @@ namespace ScpServer
Global.setDoubleTap(device, cBDoubleTap.Checked);
Global.setScrollSensitivity(device, (byte)numUDScroll.Value);
Global.setIdleDisconnectTimeout(device, (int)idleDisconnectTimeout.Value);
Global.setButtonMouseSensitivity(device, tBMouseSens.Value);
}
#region watch sixaxis data
// Control Positioning
@ -338,6 +341,7 @@ namespace ScpServer
if (int.TryParse(idleDisconnectTimeout.Text, out disconnectTimeout))
Global.setIdleDisconnectTimeout(device, disconnectTimeout);
Global.setDoubleTap(device, cBDoubleTap.Checked);
Global.setButtonMouseSensitivity(device, tBMouseSens.Value);
if (tBProfile.Text != null && tBProfile.Text != "" && !tBProfile.Text.Contains("\\") && !tBProfile.Text.Contains("/") && !tBProfile.Text.Contains(":") && !tBProfile.Text.Contains("*") && !tBProfile.Text.Contains("?") && !tBProfile.Text.Contains("\"") && !tBProfile.Text.Contains("<") && !tBProfile.Text.Contains(">") && !tBProfile.Text.Contains("|"))
{
@ -816,5 +820,11 @@ namespace ScpServer
if (e.KeyValue == 13)
Show_ControlsList(sender, e);
}
private void tBMouseSens_Scroll(object sender, EventArgs e)
{
Global.setButtonMouseSensitivity(device, tBMouseSens.Value);
lBMouseSens.Text = tBMouseSens.Value.ToString();
}
}
}

View File

@ -604,6 +604,7 @@
this.Text = "DS4Windows 1.0 Beta J2K Build";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Close);
this.Load += new System.EventHandler(this.Form_Load);
this.Move += new System.EventHandler(this.ScpForm_Move);
this.Resize += new System.EventHandler(this.Form_Resize);
this.pnlButton.ResumeLayout(false);
this.pnlButton.PerformLayout();

View File

@ -483,6 +483,12 @@ namespace ScpServer
this.Show();
WindowState = FormWindowState.Normal;
}
private void ScpForm_Move(object sender, EventArgs e)
{
}
}
public class ThemeUtil