Rename new hotkey option. Some optimizations for Options form.

This commit is contained in:
Travis Nickles 2017-04-26 14:51:15 -07:00
parent 4a159d4216
commit 508c2b2067
6 changed files with 2892 additions and 808 deletions

View File

@ -581,9 +581,9 @@ namespace DS4Windows
//ControllerStatusChanged(this);
}
if (getEnableHotkeys(ind))
if (getEnableTouchToggle(ind))
{
CheckForHotkeys(ind, cState, pState);
CheckForTouchToggle(ind, cState, pState);
}
// Temporarily disable easter time routine
@ -620,7 +620,7 @@ namespace DS4Windows
// Output any synthetic events.
Mapping.Commit(ind);
// Pull settings updates.
device.IdleTimeout = getIdleDisconnectTimeout(ind);
device.setIdleTimeout(getIdleDisconnectTimeout(ind));
}
}
@ -991,7 +991,7 @@ namespace DS4Windows
public byte[] oldtouchvalue = { 0, 0, 0, 0 };
public int[] oldscrollvalue = { 0, 0, 0, 0 };
protected virtual void CheckForHotkeys(int deviceID, DS4State cState, DS4State pState)
protected virtual void CheckForTouchToggle(int deviceID, DS4State cState, DS4State pState)
{
if (!getUseTPforControls(deviceID) && cState.Touch1 && pState.PS)
{

View File

@ -393,10 +393,10 @@ namespace DS4Windows
{
return m_Config.flushHIDQueue[index];
}
public static bool[] EnableHotkeys => m_Config.enableHotkeys;
public static bool getEnableHotkeys(int index)
public static bool[] EnableTouchToggle => m_Config.enableTouchToggle;
public static bool getEnableTouchToggle(int index)
{
return m_Config.enableHotkeys[index];
return m_Config.enableTouchToggle[index];
}
public static int[] IdleDisconnectTimeout => m_Config.idleDisconnectTimeout;
public static int getIdleDisconnectTimeout(int index)
@ -877,7 +877,7 @@ namespace DS4Windows
public int[] buttonMouseSensitivity = { 25, 25, 25, 25, 25 };
public bool[] flushHIDQueue = { false, false, false, false, false };
public bool[] enableHotkeys = { true, true, true, true, true };
public bool[] enableTouchToggle = { true, true, true, true, true };
public int[] idleDisconnectTimeout = { 0, 0, 0, 0, 0 };
public Boolean[] touchpadJitterCompensation = { true, true, true, true, true };
public Boolean[] lowerRCOn = { false, false, false, false, false };
@ -1113,7 +1113,7 @@ namespace DS4Windows
Node = m_Xdoc.CreateNode(XmlNodeType.Element, "DS4Windows", null);
XmlNode xmlFlushHIDQueue = m_Xdoc.CreateNode(XmlNodeType.Element, "flushHIDQueue", null); xmlFlushHIDQueue.InnerText = flushHIDQueue[device].ToString(); Node.AppendChild(xmlFlushHIDQueue);
XmlNode xmlEnableHotkeys = m_Xdoc.CreateNode(XmlNodeType.Element, "enableHotkeys", null); xmlEnableHotkeys.InnerText = enableHotkeys[device].ToString(); Node.AppendChild(xmlEnableHotkeys);
XmlNode xmlTouchToggle = m_Xdoc.CreateNode(XmlNodeType.Element, "touchToggle", null); xmlTouchToggle.InnerText = enableTouchToggle[device].ToString(); Node.AppendChild(xmlTouchToggle);
XmlNode xmlIdleDisconnectTimeout = m_Xdoc.CreateNode(XmlNodeType.Element, "idleDisconnectTimeout", null); xmlIdleDisconnectTimeout.InnerText = idleDisconnectTimeout[device].ToString(); Node.AppendChild(xmlIdleDisconnectTimeout);
XmlNode xmlColor = m_Xdoc.CreateNode(XmlNodeType.Element, "Color", null);
xmlColor.InnerText = m_Leds[device].red.ToString() + "," + m_Leds[device].green.ToString() + "," + m_Leds[device].blue.ToString();
@ -1712,7 +1712,7 @@ namespace DS4Windows
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/flushHIDQueue"); Boolean.TryParse(Item.InnerText, out flushHIDQueue[device]); }
catch { missingSetting = true; }//rootname = }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/enableHotkeys"); Boolean.TryParse(Item.InnerText, out enableHotkeys[device]); }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/touchToggle"); Boolean.TryParse(Item.InnerText, out enableTouchToggle[device]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/idleDisconnectTimeout"); Int32.TryParse(Item.InnerText, out idleDisconnectTimeout[device]); }

View File

@ -114,6 +114,7 @@
this.bnSwipeRight = new System.Windows.Forms.Button();
this.lbSwipeRight = new System.Windows.Forms.Label();
this.gBOther = new System.Windows.Forms.GroupBox();
this.enableTouchToggleCheckbox = new System.Windows.Forms.CheckBox();
this.cBDinput = new System.Windows.Forms.CheckBox();
this.pBProgram = new System.Windows.Forms.PictureBox();
this.cBLaunchProgram = new System.Windows.Forms.CheckBox();
@ -312,7 +313,6 @@
this.pSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.alwaysOnToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.advColorDialog = new DS4Windows.AdvancedColorDialog();
this.enableHotkeysCheckbox = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.nUDRainbow)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tBBlueBar)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tBGreenBar)).BeginInit();
@ -1148,7 +1148,7 @@
// gBOther
//
this.gBOther.BackColor = System.Drawing.Color.WhiteSmoke;
this.gBOther.Controls.Add(this.enableHotkeysCheckbox);
this.gBOther.Controls.Add(this.enableTouchToggleCheckbox);
this.gBOther.Controls.Add(this.cBDinput);
this.gBOther.Controls.Add(this.pBProgram);
this.gBOther.Controls.Add(this.cBLaunchProgram);
@ -1167,6 +1167,13 @@
this.gBOther.Name = "gBOther";
this.gBOther.TabStop = false;
//
// enableTouchToggleCheckbox
//
resources.ApplyResources(this.enableTouchToggleCheckbox, "enableTouchToggleCheckbox");
this.enableTouchToggleCheckbox.Name = "enableTouchToggleCheckbox";
this.enableTouchToggleCheckbox.UseVisualStyleBackColor = true;
this.enableTouchToggleCheckbox.CheckedChanged += new System.EventHandler(this.enableTouchToggleCheckbox_CheckedChanged);
//
// cBDinput
//
resources.ApplyResources(this.cBDinput, "cBDinput");
@ -3240,13 +3247,6 @@
resources.ApplyResources(this.alwaysOnToolStripMenuItem, "alwaysOnToolStripMenuItem");
this.alwaysOnToolStripMenuItem.CheckedChanged += new System.EventHandler(this.SATrigger_CheckedChanged);
//
// enableHotkeysCheckbox
//
resources.ApplyResources(this.enableHotkeysCheckbox, "enableHotkeysCheckbox");
this.enableHotkeysCheckbox.Name = "enableHotkeysCheckbox";
this.enableHotkeysCheckbox.UseVisualStyleBackColor = true;
this.enableHotkeysCheckbox.CheckedChanged += new System.EventHandler(this.enableHotkeysCheckbox_CheckedChanged);
//
// Options
//
resources.ApplyResources(this, "$this");
@ -3641,6 +3641,6 @@
private System.Windows.Forms.Label label3;
private System.Windows.Forms.NumericUpDown nUDL2AntiDead;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.CheckBox enableHotkeysCheckbox;
private System.Windows.Forms.CheckBox enableTouchToggleCheckbox;
}
}

View File

@ -30,6 +30,7 @@ namespace DS4Windows
public bool actionTabSeen = false;
public static Size mSize { get; private set; }
private Size settingsSize;
public Options(DS4Form rt)
{
InitializeComponent();
@ -152,10 +153,12 @@ namespace DS4Windows
root.lbLastMessage.Text = "Hover over items to see description or more about";
if (device < 4)
nUDSixaxis.Value = deviceNum + 1;
if (filename != "")
{
if (device == 4) //if temp device is called
ProfilePath[4] = name;
LoadProfile(device, false, Program.rootHub);
if (Rainbow[device] == 0)
@ -168,6 +171,7 @@ namespace DS4Windows
btnRainbow.Image = colored;
ToggleRainbow(true);
}
DS4Color color = MainColor[device];
tBRedBar.Value = color.red;
tBGreenBar.Value = color.green;
@ -195,14 +199,18 @@ namespace DS4Windows
cBFlashType.SelectedIndex = 0;
else
cBFlashType.SelectedIndex = FlashType[device];
DS4Color fColor = FlashColor[device];
if (fColor.Equals(new DS4Color { red = 0, green = 0, blue = 0 }))
{
if (Rainbow[device] == 0)
btnFlashColor.BackColor = main;
else
btnFlashColor.BackgroundImage = rainbowImg;
}
else
btnFlashColor.BackColor = Color.FromArgb(fColor.red, fColor.green, fColor.blue);
nUDRumbleBoost.Value = RumbleBoost[device];
nUDTouch.Value = TouchSensitivity[device];
cBSlide.Checked = TouchSensitivity[device] > 0;
@ -214,7 +222,7 @@ namespace DS4Windows
cBTouchpadJitterCompensation.Checked = TouchpadJitterCompensation[device];
cBlowerRCOn.Checked = LowerRCOn[device];
cBFlushHIDQueue.Checked = FlushHIDQueue[device];
enableHotkeysCheckbox.Checked = getEnableHotkeys(device);
enableTouchToggleCheckbox.Checked = getEnableTouchToggle(device);
nUDIdleDisconnect.Value = Math.Round((decimal)(IdleDisconnectTimeout[device] / 60d), 1);
cBIdleDisconnect.Checked = IdleDisconnectTimeout[device] > 0;
numUDMouseSens.Value = ButtonMouseSensitivity[device];
@ -230,6 +238,7 @@ namespace DS4Windows
cBWhileCharging.SelectedIndex = 0;
else
cBWhileCharging.SelectedIndex = ChargingType[device];
try
{
nUDL2.Value = Math.Round((decimal)L2Deadzone[device] / 255, 2);
@ -362,12 +371,14 @@ namespace DS4Windows
{
nUDSZS.Value = 1;
}
if (LaunchProgram[device] != string.Empty)
{
cBLaunchProgram.Checked = true;
pBProgram.Image = Icon.ExtractAssociatedIcon(LaunchProgram[device]).ToBitmap();
btnBrowse.Text = Path.GetFileNameWithoutExtension(LaunchProgram[device]);
}
cBDinput.Checked = DinputOnly[device];
olddinputcheck = cBDinput.Checked;
cbStartTouchpadOff.Checked = StartTouchpadOff[device];
@ -431,6 +442,7 @@ namespace DS4Windows
case 3: tBRedBar.Value = 255; tBGreenBar.Value = 0; tBBlueBar.Value = 255; break;
case 4: tBRedBar.Value = 255; tBGreenBar.Value = 255; tBBlueBar.Value = 255; break;
}
tBLowBlueBar.Value = 0; tBLowGreenBar.Value = 0; tBLowBlueBar.Value = 0;
cBLightbyBattery.Checked = false;
@ -449,7 +461,7 @@ namespace DS4Windows
cBTouchpadJitterCompensation.Checked = true;
cBlowerRCOn.Checked = false;
cBFlushHIDQueue.Checked = false;
enableHotkeysCheckbox.Checked = true;
enableTouchToggleCheckbox.Checked = true;
nUDIdleDisconnect.Value = 5;
cBIdleDisconnect.Checked = true;
numUDMouseSens.Value = 25;
@ -543,6 +555,7 @@ namespace DS4Windows
case DS4Controls.SwipeLeft: return "bnSwipeLeft";
case DS4Controls.SwipeRight: return "bnSwipeRight";
}
return "";
}
@ -574,18 +587,26 @@ namespace DS4Windows
lvi.SubItems.Add(Properties.Resources.MultiAction);
break;
}
if (newp)
{
if (action.type == "DisconnectBT")
lvi.Checked = true;
else
lvi.Checked = false;
}
else
{
foreach (string s in pactions)
{
if (s == action.name)
{
lvi.Checked = true;
break;
}
}
}
lVActions.Items.Add(lvi);
}
}
@ -599,6 +620,7 @@ namespace DS4Windows
else
return value;
}
void EnableReadings(bool on)
{
lbL2Track.Enabled = on;
@ -613,6 +635,7 @@ namespace DS4Windows
btnSATrack.Visible = on;
btnSATrackS.Visible = on;
}
void ControllerReadout_Tick(object sender, EventArgs e)
{
// MEMS gyro data is all calibrated to roughly -1G..1G for values -0x2000..0x1fff
@ -671,13 +694,18 @@ namespace DS4Windows
btnLSTrack.Location = new Point((int)(dpix * x / 2.09), (int)(dpiy * y / 2.09));
btnLSTrackS.Visible = nUDLSS.Value != 1;
}
if (nUDLSS.Value != 1)
{
btnLSTrackS.Location = new Point((int)((float)nUDLSS.Value * (btnLSTrack.Location.X - pnlLSTrack.Size.Width / 2f) + pnlLSTrack.Size.Width / 2f),
(int)((float)nUDLSS.Value * (btnLSTrack.Location.Y - pnlLSTrack.Size.Height / 2f) + pnlLSTrack.Size.Height / 2f));
}
x = Program.rootHub.getDS4State((int)nUDSixaxis.Value - 1).RX;
y = Program.rootHub.getDS4State((int)nUDSixaxis.Value - 1).RY;
btnRSTrackS.Visible = nUDRSS.Value != 1;
if (nUDRSCurve.Value > 0)
{
float max = x + y;
@ -710,6 +738,7 @@ namespace DS4Windows
btnRSTrack.Location = new Point((int)(dpix * x / 2.09), (int)(dpiy * y / 2.09));
btnRSTrackS.Visible = nUDRSS.Value != 1;
}
if (nUDRSS.Value != 1)
btnRSTrackS.Location = new Point((int)((float)nUDRSS.Value * (btnRSTrack.Location.X - pnlRSTrack.Size.Width / 2f) + pnlRSTrack.Size.Width / 2f),
(int)((float)nUDRSS.Value * (btnRSTrack.Location.Y - pnlRSTrack.Size.Height / 2f) + pnlRSTrack.Size.Height / 2f));
@ -726,6 +755,7 @@ namespace DS4Windows
lbL2Track.Location = new Point(tBL2.Location.X - (int)(dpix * 25),
Math.Max((int)(((tBL2.Location.Y + tBL2.Size.Height) - (tBL2.Value * (float)nUDL2S.Value) / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20),
(int)(1 * ((tBL2.Location.Y + tBL2.Size.Height) - 255 / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20)));
if (tBL2.Value * (float)nUDL2S.Value >= 255)
lbL2Track.ForeColor = Color.Green;
else if (tBL2.Value * (float)nUDL2S.Value < (double)nUDL2.Value * 255)
@ -737,6 +767,7 @@ namespace DS4Windows
lbR2Track.Location = new Point(tBR2.Location.X + (int)(dpix * 25),
Math.Max((int)(1 * ((tBR2.Location.Y + tBR2.Size.Height) - (tBR2.Value * (float)nUDR2S.Value) / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20),
(int)(1 * ((tBR2.Location.Y + tBR2.Size.Height) - 255 / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20)));
if (tBR2.Value * (float)nUDR2S.Value >= 255)
lbR2Track.ForeColor = Color.Green;
else if (tBR2.Value * (float)nUDR2S.Value < (double)nUDR2.Value * 255)
@ -771,9 +802,11 @@ namespace DS4Windows
percent /= 100f;
return value1 * percent + value2 * (1 - percent);
}
private void InputDS4(object sender, EventArgs e)
{
if (Form.ActiveForm == root && cBControllerInput.Checked && tCControls.SelectedIndex < 1)
{
switch (Program.rootHub.GetInputkeys((int)nUDSixaxis.Value - 1))
{
case ("Cross"): Show_ControlsBn(bnCross, e); break;
@ -810,9 +843,9 @@ namespace DS4Windows
case ("GyroZP"): Show_ControlsBn(bnGyroZP, e); break;
case ("GyroZN"): Show_ControlsBn(bnGyroZN, e); break;
}
}
}
private void button_MouseHoverB(object sender, EventArgs e)
{
Control[] b = Controls.Find(((Button)sender).Name.Remove(1, 1), true);
@ -898,7 +931,9 @@ namespace DS4Windows
case "bnGyroXN": lBControls.SelectedIndex = 32; break;
#endregion
}
if (swipesOn)
{
switch (name)
{
case "bnSwipeUp": if (swipesOn) lBControls.SelectedIndex = 33; break;
@ -906,7 +941,9 @@ namespace DS4Windows
case "bnSwipeLeft": if (swipesOn) lBControls.SelectedIndex = 35; break;
case "bnSwipeRight": if (swipesOn) lBControls.SelectedIndex = 36; break;
}
}
}
DS4ControlSettings dcs = getDS4CSetting(device, name);
if (lBControls.SelectedIndex >= 0)
{
@ -918,8 +955,10 @@ namespace DS4Windows
tipText += "\n Shift: ";
tipText += ShiftTrigger(GetDS4STrigger(device, name)) + " -> " + UpdateButtonList(((Button)sender), true);
}
lbControlName.Text = tipText;
}
switch (name)
{
#region
@ -1041,6 +1080,7 @@ namespace DS4Windows
break;
#endregion
}
if (pBHoveredButton.Image != null)
pBHoveredButton.Size = new Size((int)(pBHoveredButton.Image.Size.Width * (dpix / 1.25f)), (int)(pBHoveredButton.Image.Size.Height * (dpix / 1.25f)));
}
@ -1059,6 +1099,7 @@ namespace DS4Windows
trackBar.Maximum = value;
else if (trackBar.Minimum > value)
trackBar.Minimum = value;
trackBar.Value = value;
}
@ -1074,6 +1115,7 @@ namespace DS4Windows
FlashColor[device] = new DS4Color(btnFlashColor.BackColor);
else
FlashColor[device] = new DS4Color(Color.Black);
L2Deadzone[device] = (byte)Math.Round((nUDL2.Value * 255), 0);
R2Deadzone[device] = (byte)Math.Round((nUDR2.Value * 255), 0);
L2AntiDeadzone[device] = (int)(nUDL2AntiDead.Value * 100);
@ -1105,8 +1147,11 @@ namespace DS4Windows
RSCurve[device] = (int)Math.Round(nUDRSCurve.Value, 0);
List<string> pactions = new List<string>();
foreach (ListViewItem lvi in lVActions.Items)
{
if (lvi.Checked)
pactions.Add(lvi.Text);
}
ProfileActions[device] = pactions;
calculateProfileActionCount(device);
calculateProfileActionDicts(device);
@ -1119,17 +1164,24 @@ namespace DS4Windows
int invert = 0;
if (cBGyroInvertX.Checked)
invert += 2;
if (cBGyroInvertY.Checked)
invert += 1;
GyroInvert[device] = invert;
List<int> ints = new List<int>();
for (int i = 0; i < cMGyroTriggers.Items.Count - 1; i++)
{
if (((ToolStripMenuItem)cMGyroTriggers.Items[i]).Checked)
ints.Add(i);
}
if (ints.Count == 0)
ints.Add(-1);
SATriggers[device] = string.Join(",", ints);
if (nUDRainbow.Value == 0) btnRainbow.Image = greyscale;
else btnRainbow.Image = colored;
}
@ -1209,26 +1261,30 @@ namespace DS4Windows
btnLightbar.BackgroundImage = RecolorImage((Bitmap)btnLightbar.BackgroundImage, main);
if (FlashColor[device].Equals(new DS4Color { red = 0, green = 0, blue = 0 }))
btnFlashColor.BackColor = main;
btnFlashColor.BackgroundImage = nUDRainbow.Enabled ? rainbowImg : null;
tBRedBar.Value = advColorDialog.Color.R;
tBGreenBar.Value = advColorDialog.Color.G;
tBBlueBar.Value = advColorDialog.Color.B;
}
if (device < 4)
DS4LightBar.forcelight[device] = false;
}
private void lowColorChooserButton_Click(object sender, EventArgs e)
{
advColorDialog.Color = lowColorChooserButton.BackColor;
advColorDialog_OnUpdateColor(lowColorChooserButton.BackColor, e);
Color chooserBackColor = lowColorChooserButton.BackColor;
advColorDialog.Color = chooserBackColor;
advColorDialog_OnUpdateColor(chooserBackColor, e);
if (advColorDialog.ShowDialog() == DialogResult.OK)
{
lowColorChooserButton.BackColor = advColorDialog.Color;
lowColorChooserButton.BackColor = chooserBackColor = advColorDialog.Color;
tBLowRedBar.Value = advColorDialog.Color.R;
tBLowGreenBar.Value = advColorDialog.Color.G;
tBLowBlueBar.Value = advColorDialog.Color.B;
}
if (device < 4)
DS4LightBar.forcelight[device] = false;
}
@ -1236,16 +1292,20 @@ namespace DS4Windows
private void btnChargingColor_Click(object sender, EventArgs e)
{
advColorDialog.Color = btnChargingColor.BackColor;
advColorDialog_OnUpdateColor(btnChargingColor.BackColor, e);
Color chargingBackColor = btnChargingColor.BackColor;
advColorDialog.Color = chargingBackColor;
advColorDialog_OnUpdateColor(chargingBackColor, e);
if (advColorDialog.ShowDialog() == DialogResult.OK)
{
btnChargingColor.BackColor = advColorDialog.Color;
btnChargingColor.BackColor = chargingBackColor = advColorDialog.Color;
}
if (device < 4)
DS4LightBar.forcelight[device] = false;
ChargingColor[device] = new DS4Color(btnChargingColor.BackColor);
ChargingColor[device] = new DS4Color(chargingBackColor);
}
private void advColorDialog_OnUpdateColor(object sender, EventArgs e)
{
if (sender is Color && device < 4)
@ -1257,6 +1317,7 @@ namespace DS4Windows
DS4LightBar.forcelight[device] = true;
}
}
private void SetColorToolTip(TrackBar tb, int type)
{
if (tb != null)
@ -1266,7 +1327,8 @@ namespace DS4Windows
int som = bgc + 11 * (int)(value * 0.0039215);
tb.BackColor = Color.FromArgb(tb.Name.ToLower().Contains("red") ? som : sat, tb.Name.ToLower().Contains("green") ? som : sat, tb.Name.ToLower().Contains("blue") ? som : sat);
}
if (type == 0) //main
if (type == 0) // main
{
alphacolor = Math.Max(tBRedBar.Value, Math.Max(tBGreenBar.Value, tBBlueBar.Value));
reg = Color.FromArgb(tBRedBar.Value, tBGreenBar.Value, tBBlueBar.Value);
@ -1286,6 +1348,7 @@ namespace DS4Windows
lowColorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
LowColor[device] = new DS4Color((byte)tBLowRedBar.Value, (byte)tBLowGreenBar.Value, (byte)tBLowBlueBar.Value);
}
if (!saving && !loading && tb != null)
tp.Show(tb.Value.ToString(), tb, (int)(dpix * 100), 0, 2000);
}
@ -1308,6 +1371,7 @@ namespace DS4Windows
float X = (C * (1 - Math.Abs((hue / 60) % 2 - 1)));
float m = L - C / 2;
float R =0, G=0, B=0;
if (light == 1) return Color.White;
else if (rgb.R == rgb.G && rgb.G == rgb.B) return Color.White;
else if (0 <= hue && hue < 60) { R = C; G = X; }
@ -1332,6 +1396,7 @@ namespace DS4Windows
{
DS4Device d = Program.rootHub.DS4Controllers[(int)nUDSixaxis.Value - 1];
if (d != null)
{
if (((Button)sender).Text == Properties.Resources.TestHText)
{
Program.rootHub.setRumble((byte)Math.Min(255, (255 * nUDRumbleBoost.Value / 100)), d.RightLightFastRumble, (int)nUDSixaxis.Value - 1);
@ -1342,12 +1407,14 @@ namespace DS4Windows
Program.rootHub.setRumble(0, d.RightLightFastRumble, (int)nUDSixaxis.Value - 1);
((Button)sender).Text = Properties.Resources.TestHText;
}
}
}
private void btnRumbleLightTest_Click(object sender, EventArgs e)
{
DS4Device d = Program.rootHub.DS4Controllers[(int)nUDSixaxis.Value - 1];
if (d != null)
{
if (((Button)sender).Text == Properties.Resources.TestLText)
{
Program.rootHub.setRumble(d.LeftHeavySlowRumble, (byte)Math.Min(255, (255 * nUDRumbleBoost.Value / 100)), (int)nUDSixaxis.Value - 1);
@ -1358,6 +1425,7 @@ namespace DS4Windows
Program.rootHub.setRumble(d.LeftHeavySlowRumble, 0, (int)nUDSixaxis.Value - 1);
((Button)sender).Text = Properties.Resources.TestLText;
}
}
}
private void numUDTouch_ValueChanged(object sender, EventArgs e)
@ -1374,12 +1442,14 @@ namespace DS4Windows
{
ScrollSensitivity[device] = (int)nUDScroll.Value;
}
private void ledAsBatteryIndicator_CheckedChanged(object sender, EventArgs e)
{
LedAsBatteryIndicator[device] = cBLightbyBattery.Checked;
pnlLowBattery.Visible = cBLightbyBattery.Checked;
//pnlFull.Location = new Point(pnlFull.Location.X, (cBLightbyBattery.Checked ? (int)(dpix * 42) : (pnlFull.Location.Y + pnlLowBattery.Location.Y) / 2));
lbFull.Text = (cBLightbyBattery.Checked ? Properties.Resources.Full + ":" : Properties.Resources.Color + ":");
bool lightByBatteryChecked = cBLightbyBattery.Checked;
LedAsBatteryIndicator[device] = lightByBatteryChecked;
pnlLowBattery.Visible = lightByBatteryChecked;
//pnlFull.Location = new Point(pnlFull.Location.X, (lightByBatteryChecked ? (int)(dpix * 42) : (pnlFull.Location.Y + pnlLowBattery.Location.Y) / 2));
lbFull.Text = (lightByBatteryChecked ? Properties.Resources.Full + ":" : Properties.Resources.Color + ":");
}
private void lowerRCOffCheckBox_CheckedChanged(object sender, EventArgs e)
@ -1406,24 +1476,29 @@ namespace DS4Windows
private void cBIdleDisconnect_CheckedChanged(object sender, EventArgs e)
{
if (cBIdleDisconnect.Checked)
bool idleDisconnectChecked = cBIdleDisconnect.Checked;
if (idleDisconnectChecked)
nUDIdleDisconnect.Value = 5;
else
nUDIdleDisconnect.Value = 0;
nUDIdleDisconnect.Enabled = cBIdleDisconnect.Checked;
nUDIdleDisconnect.Enabled = idleDisconnectChecked;
}
private void Options_FormClosing(object sender, FormClosingEventArgs e)
{
for (int i = 0; i < 4; i++)
LoadProfile(i, false, Program.rootHub); //Refreshes all profiles in case other controllers are using the same profile
if (olddinputcheck != cBDinput.Checked)
{
root.btnStartStop_Clicked(false);
root.btnStartStop_Clicked(false);
}
if (btnRumbleHeavyTest.Text == Properties.Resources.StopText)
Program.rootHub.setRumble(0, 0, (int)nUDSixaxis.Value - 1);
inputtimer.Stop();
sixaxisTimer.Stop();
root.OptionsClosed();
@ -1449,30 +1524,36 @@ namespace DS4Windows
private void cBSlide_CheckedChanged(object sender, EventArgs e)
{
if (cBSlide.Checked)
bool slideChecked = cBSlide.Checked;
if (slideChecked)
nUDTouch.Value = 100;
else
nUDTouch.Value = 0;
nUDTouch.Enabled = cBSlide.Checked;
nUDTouch.Enabled = slideChecked;
}
private void cBScroll_CheckedChanged(object sender, EventArgs e)
{
if (cBScroll.Checked)
bool scrollChecked = cBScroll.Checked;
if (scrollChecked)
nUDScroll.Value = 5;
else
nUDScroll.Value = 0;
nUDScroll.Enabled = cBScroll.Checked;
nUDScroll.Enabled = scrollChecked;
}
private void cBTap_CheckedChanged(object sender, EventArgs e)
{
if (cBTap.Checked)
bool tapChecked = cBTap.Checked;
if (tapChecked)
nUDTap.Value = 100;
else
nUDTap.Value = 0;
nUDTap.Enabled = cBTap.Checked;
cBDoubleTap.Enabled = cBTap.Checked;
nUDTap.Enabled = tapChecked;
cBDoubleTap.Enabled = tapChecked;
}
private void cBDoubleTap_CheckedChanged(object sender, EventArgs e)
@ -1572,47 +1653,48 @@ namespace DS4Windows
}
private void Show_ControlsList(object sender, EventArgs e)
{
if (lBControls.SelectedIndex == 0) Show_ControlsBn(bnCross, e);
if (lBControls.SelectedIndex == 1) Show_ControlsBn(bnCircle, e);
if (lBControls.SelectedIndex == 2) Show_ControlsBn(bnSquare, e);
if (lBControls.SelectedIndex == 3) Show_ControlsBn(bnTriangle, e);
if (lBControls.SelectedIndex == 4) Show_ControlsBn(bnOptions, e);
if (lBControls.SelectedIndex == 5) Show_ControlsBn(bnShare, e);
if (lBControls.SelectedIndex == 6) Show_ControlsBn(bnUp, e);
if (lBControls.SelectedIndex == 7) Show_ControlsBn(bnDown, e);
if (lBControls.SelectedIndex == 8) Show_ControlsBn(bnLeft, e);
if (lBControls.SelectedIndex == 9) Show_ControlsBn(bnRight, e);
if (lBControls.SelectedIndex == 10) Show_ControlsBn(bnPS, e);
if (lBControls.SelectedIndex == 11) Show_ControlsBn(bnL1, e);
if (lBControls.SelectedIndex == 12) Show_ControlsBn(bnR1, e);
if (lBControls.SelectedIndex == 13) Show_ControlsBn(bnL2, e);
if (lBControls.SelectedIndex == 14) Show_ControlsBn(bnR2, e);
if (lBControls.SelectedIndex == 15) Show_ControlsBn(bnL3, e);
if (lBControls.SelectedIndex == 16) Show_ControlsBn(bnR3, e);
int controlSelectedIndex = lBControls.SelectedIndex;
if (controlSelectedIndex == 0) Show_ControlsBn(bnCross, e);
else if (controlSelectedIndex == 1) Show_ControlsBn(bnCircle, e);
else if (controlSelectedIndex == 2) Show_ControlsBn(bnSquare, e);
else if (controlSelectedIndex == 3) Show_ControlsBn(bnTriangle, e);
else if (controlSelectedIndex == 4) Show_ControlsBn(bnOptions, e);
else if (controlSelectedIndex == 5) Show_ControlsBn(bnShare, e);
else if (controlSelectedIndex == 6) Show_ControlsBn(bnUp, e);
else if (controlSelectedIndex == 7) Show_ControlsBn(bnDown, e);
else if (controlSelectedIndex == 8) Show_ControlsBn(bnLeft, e);
else if (controlSelectedIndex == 9) Show_ControlsBn(bnRight, e);
else if (controlSelectedIndex == 10) Show_ControlsBn(bnPS, e);
else if (controlSelectedIndex == 11) Show_ControlsBn(bnL1, e);
else if (controlSelectedIndex == 12) Show_ControlsBn(bnR1, e);
else if (controlSelectedIndex == 13) Show_ControlsBn(bnL2, e);
else if (controlSelectedIndex == 14) Show_ControlsBn(bnR2, e);
else if (controlSelectedIndex == 15) Show_ControlsBn(bnL3, e);
else if (controlSelectedIndex == 16) Show_ControlsBn(bnR3, e);
if (lBControls.SelectedIndex == 17) Show_ControlsBn(bnTouchLeft, e);
if (lBControls.SelectedIndex == 18) Show_ControlsBn(bnTouchRight, e);
if (lBControls.SelectedIndex == 19) Show_ControlsBn(bnTouchMulti, e);
if (lBControls.SelectedIndex == 20) Show_ControlsBn(bnTouchUpper, e);
else if (controlSelectedIndex == 17) Show_ControlsBn(bnTouchLeft, e);
else if (controlSelectedIndex == 18) Show_ControlsBn(bnTouchRight, e);
else if (controlSelectedIndex == 19) Show_ControlsBn(bnTouchMulti, e);
else if (controlSelectedIndex == 20) Show_ControlsBn(bnTouchUpper, e);
if (lBControls.SelectedIndex == 21) Show_ControlsBn(bnLSUp, e);
if (lBControls.SelectedIndex == 22) Show_ControlsBn(bnLSDown, e);
if (lBControls.SelectedIndex == 23) Show_ControlsBn(bnLSLeft, e);
if (lBControls.SelectedIndex == 24) Show_ControlsBn(bnLSRight, e);
if (lBControls.SelectedIndex == 25) Show_ControlsBn(bnRSUp, e);
if (lBControls.SelectedIndex == 26) Show_ControlsBn(bnRSDown, e);
if (lBControls.SelectedIndex == 27) Show_ControlsBn(bnRSLeft, e);
if (lBControls.SelectedIndex == 28) Show_ControlsBn(bnRSRight, e);
else if (controlSelectedIndex == 21) Show_ControlsBn(bnLSUp, e);
else if (controlSelectedIndex == 22) Show_ControlsBn(bnLSDown, e);
else if (controlSelectedIndex == 23) Show_ControlsBn(bnLSLeft, e);
else if (controlSelectedIndex == 24) Show_ControlsBn(bnLSRight, e);
else if (controlSelectedIndex == 25) Show_ControlsBn(bnRSUp, e);
else if (controlSelectedIndex == 26) Show_ControlsBn(bnRSDown, e);
else if (controlSelectedIndex == 27) Show_ControlsBn(bnRSLeft, e);
else if (controlSelectedIndex == 28) Show_ControlsBn(bnRSRight, e);
if (lBControls.SelectedIndex == 29) Show_ControlsBn(bnGyroZN, e);
if (lBControls.SelectedIndex == 30) Show_ControlsBn(bnGyroZP, e);
if (lBControls.SelectedIndex == 31) Show_ControlsBn(bnGyroXP, e);
if (lBControls.SelectedIndex == 32) Show_ControlsBn(bnGyroXN, e);
else if (controlSelectedIndex == 29) Show_ControlsBn(bnGyroZN, e);
else if (controlSelectedIndex == 30) Show_ControlsBn(bnGyroZP, e);
else if (controlSelectedIndex == 31) Show_ControlsBn(bnGyroXP, e);
else if (controlSelectedIndex == 32) Show_ControlsBn(bnGyroXN, e);
if (lBControls.SelectedIndex == 33) Show_ControlsBn(bnSwipeUp, e);
if (lBControls.SelectedIndex == 34) Show_ControlsBn(bnSwipeDown, e);
if (lBControls.SelectedIndex == 35) Show_ControlsBn(bnSwipeLeft, e);
if (lBControls.SelectedIndex == 36) Show_ControlsBn(bnSwipeRight, e);
else if (controlSelectedIndex == 33) Show_ControlsBn(bnSwipeUp, e);
else if (controlSelectedIndex == 34) Show_ControlsBn(bnSwipeDown, e);
else if (controlSelectedIndex == 35) Show_ControlsBn(bnSwipeLeft, e);
else if (controlSelectedIndex == 36) Show_ControlsBn(bnSwipeRight, e);
}
private void List_MouseDoubleClick(object sender, MouseEventArgs e)
@ -1667,8 +1749,10 @@ namespace DS4Windows
btnLightbar.BackgroundImage = RecolorImage((Bitmap)btnLightbar.BackgroundImage, main);
cBLightbyBattery.Text = Properties.Resources.ColorByBattery.Replace("*nl*", "\n");
}
if (FlashColor[device].Equals(new DS4Color { red = 0, green = 0, blue = 0 }))
btnFlashColor.BackColor = main;
btnFlashColor.BackgroundImage = nUDRainbow.Enabled ? rainbowImg : null;
lbspc.Enabled = on;
pnlLowBattery.Enabled = !on;
@ -1680,9 +1764,9 @@ namespace DS4Windows
Bitmap c = image;
Bitmap d = new Bitmap(c.Width, c.Height);
for (int i = 0; i < c.Width; i++)
for (int i = 0, bitwidth = c.Width; i < bitwidth; i++)
{
for (int x = 0; x < c.Height; x++)
for (int x = 0, bitheight = c.Height; x < bitheight; x++)
{
Color oc = c.GetPixel(i, x);
int grayScale = (int)((oc.R * 0.3) + (oc.G * 0.59) + (oc.B * 0.11));
@ -1690,6 +1774,7 @@ namespace DS4Windows
d.SetPixel(i, x, nc);
}
}
return d;
}
@ -1698,8 +1783,10 @@ namespace DS4Windows
Bitmap c = Properties.Resources.DS4_lightbar;
Bitmap d = new Bitmap(c.Width, c.Height);
for (int i = 0; i < c.Width; i++)
for (int x = 0; x < c.Height; x++)
for (int i = 0, bitwidth = c.Width; i < bitwidth; i++)
{
for (int x = 0, bitheight = c.Height; x < bitheight; x++)
{
if (!nUDRainbow.Enabled)
{
Color col = c.GetPixel(i, x);
@ -1711,6 +1798,9 @@ namespace DS4Windows
Color col = HuetoRGB((i / (float)c.Width) * 360, .5f, Color.Red);
d.SetPixel(i, x, Color.FromArgb(c.GetPixel(i, x).A, col));
}
}
}
return d;
}
@ -1829,6 +1919,7 @@ namespace DS4Windows
{
if (nUDflashLED.Value % 10 != 0)
nUDflashLED.Value = Math.Round(nUDflashLED.Value / 10, 0) * 10;
FlashAt[device] = (int)nUDflashLED.Value;
}
@ -1928,6 +2019,7 @@ namespace DS4Windows
string name = ((Control)sender).Name;
if (name.Contains("btn") && !name.Contains("Flash") && !name.Contains("Stick") && !name.Contains("Rainbow"))
name = name.Remove(1, 1);
switch (name)
{
case "cBlowerRCOn": root.lbLastMessage.Text = Properties.Resources.BestUsedRightSide; break;
@ -1975,8 +2067,10 @@ namespace DS4Windows
case "bnL3": root.lbLastMessage.Text = Properties.Resources.RightClickPresets; break;
case "bnR3": root.lbLastMessage.Text = Properties.Resources.RightClickPresets; break;
}
if (name.Contains("bnLS") || name.Contains("bnRS"))
root.lbLastMessage.Text = Properties.Resources.RightClickPresets;
if (root.lbLastMessage.Text != Properties.Resources.HoverOverItems)
root.lbLastMessage.ForeColor = Color.Black;
else
@ -2054,6 +2148,7 @@ namespace DS4Windows
string name = cMSPresets.SourceControl.Name;
if (name.Contains("btn") && !name.Contains("Stick"))
name = name.Remove(1, 1);
if (name == "bnUp" || name == "bnLeft" || name == "bnRight" || name == "bnDown")
controlToolStripMenuItem.Text = "Dpad";
else if (name == "btnLeftStick" || name.Contains("bnLS") || name.Contains("bnL3"))
@ -2068,6 +2163,7 @@ namespace DS4Windows
controlToolStripMenuItem.Text = "Touchpad Swipes";
else
controlToolStripMenuItem.Text = "Select another control";
MouseToolStripMenuItem.Visible = !(name == "lbTPSwipes" || name.StartsWith("bnSwipe"));
}
@ -2087,7 +2183,8 @@ namespace DS4Windows
KeyValuePair<object, string> tagL;
KeyValuePair<object, string> tagR;
KeyValuePair<object, string> tagD;
KeyValuePair<object, string> tagM = new KeyValuePair<object, string>(null, "0,0,0,0,0,0,0,0"); ;
KeyValuePair<object, string> tagM = new KeyValuePair<object, string>(null, "0,0,0,0,0,0,0,0");
string name = ((ToolStripMenuItem)sender).Name;
if (name.Contains("Dpad") || name.Contains("DPad"))
{
@ -2251,14 +2348,15 @@ namespace DS4Windows
}
Button button1, button2, button3, button4, button5 = null;
if (controlToolStripMenuItem.Text == "Dpad")
string toolStripMenuText = controlToolStripMenuItem.Text;
if (toolStripMenuText == "Dpad")
{
button1 = bnUp;
button2 = bnLeft;
button3 = bnRight;
button4 = bnDown;
}
else if (controlToolStripMenuItem.Text == "Left Stick")
else if (toolStripMenuText == "Left Stick")
{
button1 = bnLSUp;
button2 = bnLSLeft;
@ -2266,7 +2364,7 @@ namespace DS4Windows
button4 = bnLSDown;
button5 = bnL3;
}
else if (controlToolStripMenuItem.Text == "Right Stick")
else if (toolStripMenuText == "Right Stick")
{
button1 = bnRSUp;
button2 = bnRSLeft;
@ -2274,21 +2372,21 @@ namespace DS4Windows
button4 = bnRSDown;
button5 = bnR3;
}
else if (controlToolStripMenuItem.Text == "Face Buttons")
else if (toolStripMenuText == "Face Buttons")
{
button1 = bnTriangle;
button2 = bnSquare;
button3 = bnCircle;
button4 = bnCross;
}
else if (controlToolStripMenuItem.Text == "Sixaxis")
else if (toolStripMenuText == "Sixaxis")
{
button1 = bnGyroZN;
button2 = bnGyroXP;
button3 = bnGyroXN;
button4 = bnGyroZP;
}
else if (controlToolStripMenuItem.Text == "Touchpad Swipes")
else if (toolStripMenuText == "Touchpad Swipes")
{
button1 = bnSwipeUp;
button2 = bnSwipeLeft;
@ -2297,6 +2395,7 @@ namespace DS4Windows
}
else
button1 = button2 = button3 = button4 = null;
ChangeButtonText(tagU, button1, scancode);
ChangeButtonText(tagL, button2, scancode);
ChangeButtonText(tagR, button3, scancode);
@ -2321,6 +2420,7 @@ namespace DS4Windows
advColorDialog.Color = btnFlashColor.BackColor;
else
advColorDialog.Color = Color.Black;
advColorDialog_OnUpdateColor(lbPercentFlashBar.ForeColor, e);
if (advColorDialog.ShowDialog() == DialogResult.OK)
{
@ -2328,8 +2428,10 @@ namespace DS4Windows
btnFlashColor.BackColor = advColorDialog.Color;
else
btnFlashColor.BackColor = main;
FlashColor[device] = new DS4Color(advColorDialog.Color);
}
if (device < 4)
DS4LightBar.forcelight[device] = false;
}
@ -2357,16 +2459,20 @@ namespace DS4Windows
List <int> ints = new List<int>();
List<string> s = new List<string>();
for (int i = 0; i < cMGyroTriggers.Items.Count - 1; i++)
{
if (((ToolStripMenuItem)cMGyroTriggers.Items[i]).Checked)
{
ints.Add(i);
s.Add(cMGyroTriggers.Items[i].Text);
}
}
if (ints.Count == 0)
{
ints.Add(-1);
s.Add(cMGyroTriggers.Items[cMGyroTriggers.Items.Count - 1].Text);
}
SATriggers[device] = string.Join(",", ints);
if (s.Count > 0)
btnGyroTriggers.Text = string.Join(", ", s);
@ -2377,8 +2483,10 @@ namespace DS4Windows
int invert = 0;
if (cBGyroInvertX.Checked)
invert += 2;
if (cBGyroInvertY.Checked)
invert += 1;
GyroInvert[device] = invert;
}
@ -2435,9 +2543,9 @@ namespace DS4Windows
}
}
private void enableHotkeysCheckbox_CheckedChanged(object sender, EventArgs e)
private void enableTouchToggleCheckbox_CheckedChanged(object sender, EventArgs e)
{
EnableHotkeys[device] = enableHotkeysCheckbox.Checked;
EnableTouchToggle[device] = enableTouchToggleCheckbox.Checked;
}
private void Options_Resize(object sender, EventArgs e)
@ -2448,61 +2556,64 @@ namespace DS4Windows
private void lBControls_SelectedIndexChanged(object sender, EventArgs e)
{
int controlSelectedIndex = lBControls.SelectedIndex;
if (lBControls.SelectedItem != null)
{
//lbControlName.Text = lBControls.SelectedItem.ToString();
if (lBControls.SelectedIndex == 0)
if (controlSelectedIndex == 0)
lbControlName.ForeColor = Color.FromArgb(153, 205, 204);
else if (lBControls.SelectedIndex == 1)
else if (controlSelectedIndex == 1)
lbControlName.ForeColor = Color.FromArgb(247, 131, 150);
else if (lBControls.SelectedIndex == 2)
else if (controlSelectedIndex == 2)
lbControlName.ForeColor = Color.FromArgb(237, 170, 217);
else if (lBControls.SelectedIndex == 3)
else if (controlSelectedIndex == 3)
lbControlName.ForeColor = Color.FromArgb(75, 194, 202);
else
lbControlName.ForeColor = Color.White;
}
if (lBControls.SelectedIndex == 0) button_MouseHover(bnCross, null);
if (lBControls.SelectedIndex == 1) button_MouseHover(bnCircle, null);
if (lBControls.SelectedIndex == 2) button_MouseHover(bnSquare, null);
if (lBControls.SelectedIndex == 3) button_MouseHover(bnTriangle, null);
if (lBControls.SelectedIndex == 4) button_MouseHover(bnOptions, null);
if (lBControls.SelectedIndex == 5) button_MouseHover(bnShare, null);
if (lBControls.SelectedIndex == 6) button_MouseHover(bnUp, null);
if (lBControls.SelectedIndex == 7) button_MouseHover(bnDown, null);
if (lBControls.SelectedIndex == 8) button_MouseHover(bnLeft, null);
if (lBControls.SelectedIndex == 9) button_MouseHover(bnRight, null);
if (lBControls.SelectedIndex == 10) button_MouseHover(bnPS, null);
if (lBControls.SelectedIndex == 11) button_MouseHover(bnL1, null);
if (lBControls.SelectedIndex == 12) button_MouseHover(bnR1, null);
if (lBControls.SelectedIndex == 13) button_MouseHover(bnL2, null);
if (lBControls.SelectedIndex == 14) button_MouseHover(bnR2, null);
if (lBControls.SelectedIndex == 15) button_MouseHover(bnL3, null);
if (lBControls.SelectedIndex == 16) button_MouseHover(bnR3, null);
if (lBControls.SelectedIndex == 17) button_MouseHover(bnTouchLeft, null);
if (lBControls.SelectedIndex == 18) button_MouseHover(bnTouchRight, null);
if (lBControls.SelectedIndex == 19) button_MouseHover(bnTouchMulti, null);
if (lBControls.SelectedIndex == 20) button_MouseHover(bnTouchUpper, null);
if (controlSelectedIndex == 0) button_MouseHover(bnCross, null);
else if (controlSelectedIndex == 1) button_MouseHover(bnCircle, null);
else if (controlSelectedIndex == 2) button_MouseHover(bnSquare, null);
else if (controlSelectedIndex == 3) button_MouseHover(bnTriangle, null);
else if (controlSelectedIndex == 4) button_MouseHover(bnOptions, null);
else if (controlSelectedIndex == 5) button_MouseHover(bnShare, null);
else if (controlSelectedIndex == 6) button_MouseHover(bnUp, null);
else if (controlSelectedIndex == 7) button_MouseHover(bnDown, null);
else if (controlSelectedIndex == 8) button_MouseHover(bnLeft, null);
else if (controlSelectedIndex == 9) button_MouseHover(bnRight, null);
else if (controlSelectedIndex == 10) button_MouseHover(bnPS, null);
else if (controlSelectedIndex == 11) button_MouseHover(bnL1, null);
else if (controlSelectedIndex == 12) button_MouseHover(bnR1, null);
else if (controlSelectedIndex == 13) button_MouseHover(bnL2, null);
else if (controlSelectedIndex == 14) button_MouseHover(bnR2, null);
else if (controlSelectedIndex == 15) button_MouseHover(bnL3, null);
else if (controlSelectedIndex == 16) button_MouseHover(bnR3, null);
if (lBControls.SelectedIndex == 21) button_MouseHover(bnLSUp, null);
if (lBControls.SelectedIndex == 22) button_MouseHover(bnLSDown, null);
if (lBControls.SelectedIndex == 23) button_MouseHover(bnLSLeft, null);
if (lBControls.SelectedIndex == 24) button_MouseHover(bnLSRight, null);
if (lBControls.SelectedIndex == 25) button_MouseHover(bnRSUp, null);
if (lBControls.SelectedIndex == 26) button_MouseHover(bnRSDown, null);
if (lBControls.SelectedIndex == 27) button_MouseHover(bnRSLeft, null);
if (lBControls.SelectedIndex == 28) button_MouseHover(bnRSRight, null);
else if (controlSelectedIndex == 17) button_MouseHover(bnTouchLeft, null);
else if (controlSelectedIndex == 18) button_MouseHover(bnTouchRight, null);
else if (controlSelectedIndex == 19) button_MouseHover(bnTouchMulti, null);
else if (controlSelectedIndex == 20) button_MouseHover(bnTouchUpper, null);
if (lBControls.SelectedIndex == 29) button_MouseHover(bnGyroZN, null);
if (lBControls.SelectedIndex == 30) button_MouseHover(bnGyroZP, null);
if (lBControls.SelectedIndex == 31) button_MouseHover(bnGyroXP, null);
if (lBControls.SelectedIndex == 32) button_MouseHover(bnGyroXN, null);
else if (controlSelectedIndex == 21) button_MouseHover(bnLSUp, null);
else if (controlSelectedIndex == 22) button_MouseHover(bnLSDown, null);
else if (controlSelectedIndex == 23) button_MouseHover(bnLSLeft, null);
else if (controlSelectedIndex == 24) button_MouseHover(bnLSRight, null);
else if (controlSelectedIndex == 25) button_MouseHover(bnRSUp, null);
else if (controlSelectedIndex == 26) button_MouseHover(bnRSDown, null);
else if (controlSelectedIndex == 27) button_MouseHover(bnRSLeft, null);
else if (controlSelectedIndex == 28) button_MouseHover(bnRSRight, null);
if (lBControls.SelectedIndex == 33) button_MouseHover(bnSwipeUp, null);
if (lBControls.SelectedIndex == 34) button_MouseHover(bnSwipeDown, null);
if (lBControls.SelectedIndex == 35) button_MouseHover(bnSwipeLeft, null);
if (lBControls.SelectedIndex == 36) button_MouseHover(bnSwipeRight, null);
else if (controlSelectedIndex == 29) button_MouseHover(bnGyroZN, null);
else if (controlSelectedIndex == 30) button_MouseHover(bnGyroZP, null);
else if (controlSelectedIndex == 31) button_MouseHover(bnGyroXP, null);
else if (controlSelectedIndex == 32) button_MouseHover(bnGyroXN, null);
else if (controlSelectedIndex == 33) button_MouseHover(bnSwipeUp, null);
else if (controlSelectedIndex == 34) button_MouseHover(bnSwipeDown, null);
else if (controlSelectedIndex == 35) button_MouseHover(bnSwipeLeft, null);
else if (controlSelectedIndex == 36) button_MouseHover(bnSwipeRight, null);
}
private void nUDGyroSensitivity_ValueChanged(object sender, EventArgs e)
@ -2513,7 +2624,7 @@ namespace DS4Windows
private void cBFlashType_SelectedIndexChanged(object sender, EventArgs e)
{
FlashType[device]= (byte)cBFlashType.SelectedIndex;
FlashType[device] = (byte)cBFlashType.SelectedIndex;
}
private void nUDRainbowB_ValueChanged(object sender, EventArgs e)

File diff suppressed because it is too large Load Diff

View File

@ -221,7 +221,8 @@ namespace DS4Windows
// behavior only active when > 0
private int idleTimeout = 0;
public int IdleTimeout {
public int IdleTimeout
{
get { return idleTimeout; }
set
{
@ -229,6 +230,19 @@ namespace DS4Windows
}
}
public int getIdleTimeout()
{
return idleTimeout;
}
public void setIdleTimeout(int value)
{
if (idleTimeout != value)
{
idleTimeout = value;
}
}
public int Battery => battery;
public int getBattery()
{