From 2da3c285a92cdf2157bf64f57abb623326aa2cb4 Mon Sep 17 00:00:00 2001 From: jays2kings Date: Mon, 2 Jun 2014 13:29:38 -0400 Subject: [PATCH] Option to change what happens to the lightbar when charging: options are normal, fade in and out, rainbow, and it's own color Settings for saving,renaming, and cancelling the save of a profile while in profile settings moved into the toolbar Switch profiles now by a 2 finger swipe left or right on touchpad When shutting down, the controller light turns fully off --- DS4Control/Control.cs | 52 ++--- DS4Control/DS4LightBar.cs | 40 +++- DS4Control/Mouse.cs | 16 +- DS4Control/ScpUtil.cs | 69 +++++- DS4Tool/DS4Tool.csproj | 1 + DS4Tool/Hotkeys.Designer.cs | 8 +- DS4Tool/Options.Designer.cs | 248 ++++++++++++++-------- DS4Tool/Options.cs | 81 +++++-- DS4Tool/Properties/Resources.resx | 3 + DS4Tool/Properties/Resources1.Designer.cs | 10 + DS4Tool/Resources/saveprofile.png | Bin 0 -> 3755 bytes DS4Tool/ScpForm.Designer.cs | 106 +++++++-- DS4Tool/ScpForm.cs | 89 ++++++-- DS4Tool/ScpForm.resx | 3 + 14 files changed, 527 insertions(+), 199 deletions(-) create mode 100644 DS4Tool/Resources/saveprofile.png diff --git a/DS4Control/Control.cs b/DS4Control/Control.cs index 69afe6b..0f2098c 100644 --- a/DS4Control/Control.cs +++ b/DS4Control/Control.cs @@ -469,18 +469,11 @@ namespace DS4Control else return "nothing"; } - bool touchreleased = true, touchslid = false; + bool[] touchreleased = { true, true, true, true }, touchslid = { false, false, false, false }; byte[] oldtouchvalue = { 0, 0, 0, 0 }; protected virtual void CheckForHotkeys(int deviceID, DS4State cState, DS4State pState) { DS4Device d = DS4Controllers[deviceID]; - if (cState.Touch1 && !pState.Share && !pState.Options) - { - /*if (cState.Share) - Global.setTouchSensitivity(deviceID, 0); - else if (cState.Options) - Global.setTouchSensitivity(deviceID, 100); */ - } if ((!pState.PS || !pState.Options) && cState.PS && cState.Options) { if (!d.Charging) @@ -498,46 +491,47 @@ namespace DS4Control } if (cState.TouchButton && pState.PS) { - if (Global.getTouchSensitivity(deviceID) > 0 && touchreleased) + if (Global.getTouchSensitivity(deviceID) > 0 && touchreleased[deviceID]) { oldtouchvalue[deviceID] = Global.getTouchSensitivity(deviceID); Global.setTouchSensitivity(deviceID, 0); LogDebug("Touchpad Movement is now " + (Global.getTouchSensitivity(deviceID) > 0 ? "On" : "Off")); Log.LogToTray("Touchpad Movement is now " + (Global.getTouchSensitivity(deviceID) > 0 ? "On" : "Off")); - touchreleased = false; + touchreleased[deviceID] = false; } - else if (touchreleased) + else if (touchreleased[deviceID]) { Global.setTouchSensitivity(deviceID, oldtouchvalue[deviceID]); LogDebug("Touchpad Movement is now " + (Global.getTouchSensitivity(deviceID) > 0 ? "On" : "Off")); Log.LogToTray("Touchpad Movement is now " + (Global.getTouchSensitivity(deviceID) > 0 ? "On" : "Off")); - touchreleased = false; + touchreleased[deviceID] = false; } } else - touchreleased = true; + touchreleased[deviceID] = true; } public virtual string TouchpadSlide(int ind) { DS4State cState = CurrentState[ind]; string slidedir = "none"; - if (cState.L1 && cState.R1) - if (touchPad[ind].slideright && !touchslid) - { - slidedir = "right"; - touchslid = true; - } - else if (touchPad[ind].slideleft && !touchslid) - { - slidedir = "left"; - touchslid = true; - } - else if (!touchPad[ind].slideleft && !touchPad[ind].slideright) - { - slidedir = ""; - touchslid = false; - } + if (cState.Touch2) + if (DS4Controllers[ind] != null) + if (touchPad[ind].slideright && !touchslid[ind]) + { + slidedir = "right"; + touchslid[ind] = true; + } + else if (touchPad[ind].slideleft && !touchslid[ind]) + { + slidedir = "left"; + touchslid[ind] = true; + } + else if (!touchPad[ind].slideleft && !touchPad[ind].slideright) + { + slidedir = ""; + touchslid[ind] = false; + } return slidedir; } public virtual void LogDebug(String Data) diff --git a/DS4Control/DS4LightBar.cs b/DS4Control/DS4LightBar.cs index 808b140..b2c2b3c 100644 --- a/DS4Control/DS4LightBar.cs +++ b/DS4Control/DS4LightBar.cs @@ -20,8 +20,9 @@ namespace DS4Control { 224, 56}, // on 80% of the time at 80, etc. { 252, 28 } // on 90% of the time at 90 }; - static double[] counters = new double[4] {0,0,0,0}; - + static double[] counters = new double[4] { 0, 0, 0, 0 }; + public static double[] fadetimer = new double[4] { 0, 0, 0, 0 }; + static bool[] fadedirection = new bool[4] { false, false, false, false }; static DateTime oldnow = DateTime.UtcNow; public static void updateLightBar(DS4Device device, int deviceNum) { @@ -49,7 +50,7 @@ namespace DS4Control } else if (Global.getLedAsBatteryIndicator(deviceNum)) { - if (device.Charging == false || device.Battery >= 100) // when charged, don't show the charging animation + //if (device.Charging == false || device.Battery >= 100) // when charged, don't show the charging animation { DS4Color fullColor = new DS4Color { @@ -68,11 +69,6 @@ namespace DS4Control color = Global.getTransitionedColor(lowColor, fullColor, (uint)device.Battery); } - else // Display rainbow when charging. - { - counters[deviceNum] += .167; - color = HuetoRGB((float)counters[deviceNum] % 360, 255); - } } else { @@ -90,7 +86,33 @@ namespace DS4Control else if (ratio >= 100) color = Global.getTransitionedColor(color, new DS4Color { red = 0, green = 0, blue = 0 }, 100); } + if (device.Charging && device.Battery < 100) + switch (Global.getChargingType(deviceNum)) + { + case 1: + if (fadetimer[deviceNum] <= 0) + fadedirection[deviceNum] = true; + else if (fadetimer[deviceNum] >= 105) + fadedirection[deviceNum] = false; + if (fadedirection[deviceNum]) + fadetimer[deviceNum]+= .1; + else + fadetimer[deviceNum] -= .1; + color = Global.getTransitionedColor(color, new DS4Color { red = 0, green = 0, blue = 0 }, fadetimer[deviceNum]); + break; + case 2: + counters[deviceNum] += .167; + color = HuetoRGB((float)counters[deviceNum] % 360, 255); + break; + case 3: + color = Global.loadChargingColor(deviceNum); + break; + default: + break; + } } + else if (shuttingdown) + color = new DS4Color { red = 0, green = 0, blue = 0}; else color = new DS4Color { red = 32, green = 64, blue = 64 }; DS4HapticState haptics = new DS4HapticState @@ -120,7 +142,7 @@ namespace DS4Control device.pushHapticState(haptics); } - public static bool defualtLight = false; + public static bool defualtLight = false, shuttingdown = false; public static DS4Color HuetoRGB(float hue, byte sat) { diff --git a/DS4Control/Mouse.cs b/DS4Control/Mouse.cs index 496a69e..f3aa117 100644 --- a/DS4Control/Mouse.cs +++ b/DS4Control/Mouse.cs @@ -9,7 +9,7 @@ namespace DS4Control public class Mouse : ITouchpadBehaviour { protected DateTime pastTime, firstTap, TimeofEnd; - protected Touch firstTouch; + protected Touch firstTouch, secondTouch; private DS4State s = new DS4State(); protected int deviceNum; private DS4Device dev = null; @@ -33,12 +33,14 @@ namespace DS4Control public virtual void touchesMoved(object sender, TouchpadEventArgs arg) { cursor.touchesMoved(arg); - if (Math.Abs(firstTouch.hwX - arg.touches[0].hwX) > 5 && Math.Abs(firstTouch.hwY - arg.touches[0].hwY) > 5) - wheel.touchesMoved(arg); - if (arg.touches[0].hwX - firstTouch.hwX > 300 && !slideleft) - slideright = true; - else if (firstTouch.hwX - arg.touches[0].hwX > 300 && !slideright) - slideleft = true; + if (Math.Abs(firstTouch.hwY - arg.touches[0].hwY) > 5) + wheel.touchesMoved(arg); + if (Math.Abs(firstTouch.hwY - arg.touches[0].hwY) < 50) + if (arg.touches.Length == 2) + if (arg.touches[0].hwX - firstTouch.hwX > 200 && !slideleft) + slideright = true; + else if (firstTouch.hwX - arg.touches[0].hwX > 200 && !slideright) + slideleft = true; dev.getCurrentState(s); synthesizeMouseButtons(); //Console.WriteLine(arg.timeStamp.ToString("O") + " " + "moved to " + arg.touches[0].hwX + "," + arg.touches[0].hwY); diff --git a/DS4Control/ScpUtil.cs b/DS4Control/ScpUtil.cs index 5eb6a91..262dc6b 100644 --- a/DS4Control/ScpUtil.cs +++ b/DS4Control/ScpUtil.cs @@ -186,7 +186,18 @@ namespace DS4Control { return m_Config.ledAsBattery[device]; } - + + public static void setChargingType(int device, int type) + { + m_Config.chargingType[device] = type; + + } + public static int getChargingType(int device) + { + return m_Config.chargingType[device]; + + } + public static void setUseExclusiveMode(bool exclusive) { m_Config.useExclusiveMode = exclusive; @@ -230,6 +241,20 @@ namespace DS4Control color.blue = m_Config.m_LowLeds[device][2]; return color; } + public static void saveChargingColor(int device, byte red, byte green, byte blue) + { + m_Config.m_ChargingLeds[device][0] = red; + m_Config.m_ChargingLeds[device][1] = green; + m_Config.m_ChargingLeds[device][2] = blue; + } + public static DS4Color loadChargingColor(int device) + { + DS4Color color = new DS4Color(); + color.red = m_Config.m_ChargingLeds[device][0]; + color.green = m_Config.m_ChargingLeds[device][1]; + color.blue = m_Config.m_ChargingLeds[device][2]; + return color; + } public static void setTapSensitivity(int device, byte sen) { m_Config.tapSensitivity[device] = sen; @@ -401,19 +426,23 @@ namespace DS4Control m_Config.SaveProfile(device, propath, buttons); } - private static byte applyRatio(byte b1, byte b2, uint r) + private static byte applyRatio(byte b1, byte b2, double r) { - uint ratio = r; + if (r > 100) + r = 100; + else if (r < 0) + r = 0; + uint ratio = (uint)r; if (b1 > b2) { - ratio = 100 - r; + ratio = 100 - (uint)r; } byte bmax = Math.Max(b1, b2); byte bmin = Math.Min(b1, b2); byte bdif = (byte)(bmax - bmin); return (byte)(bmin + (bdif * ratio / 100)); } - public static DS4Color getTransitionedColor(DS4Color c1, DS4Color c2, uint ratio) + public static DS4Color getTransitionedColor(DS4Color c1, DS4Color c2, double ratio) {; Color cs = Color.FromArgb(c1.red, c1.green, c1.blue); c1.red = applyRatio(c1.red, c2.red, ratio); @@ -515,6 +544,15 @@ namespace DS4Control new Byte[] {255,0,255}, new Byte[] {255,255,255} }; + public Byte[][] m_ChargingLeds = new Byte[][] + { + new Byte[] {0,0,0}, + new Byte[] {0,0,0}, + new Byte[] {0,0,0}, + new Byte[] {0,0,0}, + new Byte[] {0,0,0} + }; + public int[] chargingType = { 0, 0, 0, 0, 0 }; public bool[] flushHIDQueue = { true, true, true, true, true }; public int[] idleDisconnectTimeout = { 0, 0, 0, 0, 0 }; @@ -599,6 +637,9 @@ namespace DS4Control XmlNode xmlLowRed = m_Xdoc.CreateNode(XmlNodeType.Element, "LowRed", null); xmlLowRed.InnerText = m_LowLeds[device][0].ToString(); Node.AppendChild(xmlLowRed); XmlNode xmlLowGreen = m_Xdoc.CreateNode(XmlNodeType.Element, "LowGreen", null); xmlLowGreen.InnerText = m_LowLeds[device][1].ToString(); Node.AppendChild(xmlLowGreen); XmlNode xmlLowBlue = m_Xdoc.CreateNode(XmlNodeType.Element, "LowBlue", null); xmlLowBlue.InnerText = m_LowLeds[device][2].ToString(); Node.AppendChild(xmlLowBlue); + XmlNode xmlChargingRed = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingRed", null); xmlChargingRed.InnerText = m_ChargingLeds[device][0].ToString(); Node.AppendChild(xmlChargingRed); + XmlNode xmlChargingGreen = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingGreen", null); xmlChargingGreen.InnerText = m_ChargingLeds[device][1].ToString(); Node.AppendChild(xmlChargingGreen); + XmlNode xmlChargingBlue = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingBlue", null); xmlChargingBlue.InnerText = m_ChargingLeds[device][2].ToString(); Node.AppendChild(xmlChargingBlue); XmlNode xmlTouchpadJitterCompensation = m_Xdoc.CreateNode(XmlNodeType.Element, "touchpadJitterCompensation", null); xmlTouchpadJitterCompensation.InnerText = touchpadJitterCompensation[device].ToString(); Node.AppendChild(xmlTouchpadJitterCompensation); XmlNode xmlLowerRCOn = m_Xdoc.CreateNode(XmlNodeType.Element, "lowerRCOn", null); xmlLowerRCOn.InnerText = lowerRCOn[device].ToString(); Node.AppendChild(xmlLowerRCOn); XmlNode xmlTapSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "tapSensitivity", null); xmlTapSensitivity.InnerText = tapSensitivity[device].ToString(); Node.AppendChild(xmlTapSensitivity); @@ -610,7 +651,7 @@ namespace DS4Control XmlNode xmlRainbow = m_Xdoc.CreateNode(XmlNodeType.Element, "Rainbow", null); xmlRainbow.InnerText = rainbow[device].ToString(); Node.AppendChild(xmlRainbow); XmlNode xmlLSD = m_Xdoc.CreateNode(XmlNodeType.Element, "LSDeadZone", null); xmlLSD.InnerText = LSDeadzone[device].ToString(); Node.AppendChild(xmlLSD); XmlNode xmlRSD = m_Xdoc.CreateNode(XmlNodeType.Element, "RSDeadZone", null); xmlRSD.InnerText = RSDeadzone[device].ToString(); Node.AppendChild(xmlRSD); - + XmlNode xmlChargingType = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingType", null); xmlChargingType.InnerText = chargingType[device].ToString(); Node.AppendChild(xmlChargingType); XmlNode NodeControl = m_Xdoc.CreateNode(XmlNodeType.Element, "Control", null); XmlNode Key = m_Xdoc.CreateNode(XmlNodeType.Element, "Key", null); @@ -820,6 +861,12 @@ namespace DS4Control catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowBlue"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][2]); } catch { missingSetting = true; } + try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingRed"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][0]); } + catch { missingSetting = true; } + try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingGreen"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][1]); } + catch { missingSetting = true; } + try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingBlue"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][2]); } + catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/touchpadJitterCompensation"); Boolean.TryParse(Item.InnerText, out touchpadJitterCompensation[device]); } catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/lowerRCOn"); Boolean.TryParse(Item.InnerText, out lowerRCOn[device]); } @@ -842,6 +889,8 @@ namespace DS4Control catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RSDeadZone"); Byte.TryParse(Item.InnerText, out RSDeadzone[device]); } catch { missingSetting = true; } + try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingType"); Int32.TryParse(Item.InnerText, out chargingType[device]); } + catch { missingSetting = true; } DS4KeyType keyType; UInt16 wvk; @@ -994,6 +1043,12 @@ namespace DS4Control catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowBlue"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][2]); } catch { missingSetting = true; } + try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingRed"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][0]); } + catch { missingSetting = true; } + try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingGreen"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][1]); } + catch { missingSetting = true; } + try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingBlue"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][2]); } + catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/touchpadJitterCompensation"); Boolean.TryParse(Item.InnerText, out touchpadJitterCompensation[device]); } catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/lowerRCOn"); Boolean.TryParse(Item.InnerText, out lowerRCOn[device]); } @@ -1016,6 +1071,8 @@ namespace DS4Control catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/ScpControl/RSDeadZone"); Byte.TryParse(Item.InnerText, out RSDeadzone[device]); } catch { missingSetting = true; } + try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingType"); Int32.TryParse(Item.InnerText, out chargingType[device]); } + catch { missingSetting = true; } DS4KeyType keyType; UInt16 wvk; diff --git a/DS4Tool/DS4Tool.csproj b/DS4Tool/DS4Tool.csproj index 6faa3c2..e44df50 100644 --- a/DS4Tool/DS4Tool.csproj +++ b/DS4Tool/DS4Tool.csproj @@ -225,6 +225,7 @@ + diff --git a/DS4Tool/Hotkeys.Designer.cs b/DS4Tool/Hotkeys.Designer.cs index 97c613c..575c1fa 100644 --- a/DS4Tool/Hotkeys.Designer.cs +++ b/DS4Tool/Hotkeys.Designer.cs @@ -156,12 +156,12 @@ // this.linkJhebbel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.linkJhebbel.AutoSize = true; - this.linkJhebbel.Location = new System.Drawing.Point(450, 361); + this.linkJhebbel.Location = new System.Drawing.Point(429, 361); this.linkJhebbel.Name = "linkJhebbel"; - this.linkJhebbel.Size = new System.Drawing.Size(41, 13); + this.linkJhebbel.Size = new System.Drawing.Size(87, 13); this.linkJhebbel.TabIndex = 18; this.linkJhebbel.TabStop = true; - this.linkJhebbel.Text = "jhebbel"; + this.linkJhebbel.Text = "jhebbel (DSDCS)"; this.linkJhebbel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkJhebbel_LinkClicked); // // linkUninstall @@ -435,7 +435,7 @@ this.label20.Name = "label20"; this.label20.Size = new System.Drawing.Size(172, 13); this.label20.TabIndex = 14; - this.label20.Text = "L1+R1+Touchpad Slide left or right"; + this.label20.Text = "2 finger touchpad swipe left or right"; // // label24 // diff --git a/DS4Tool/Options.Designer.cs b/DS4Tool/Options.Designer.cs index 9cc2ffd..0045944 100644 --- a/DS4Tool/Options.Designer.cs +++ b/DS4Tool/Options.Designer.cs @@ -70,7 +70,6 @@ this.lowColorChooserButton = new System.Windows.Forms.Button(); this.numUDRainbow = new System.Windows.Forms.NumericUpDown(); this.pBRainbow = new System.Windows.Forms.PictureBox(); - this.flashLed = new System.Windows.Forms.CheckBox(); this.blueBar = new System.Windows.Forms.TrackBar(); this.greenBar = new System.Windows.Forms.TrackBar(); this.redBar = new System.Windows.Forms.TrackBar(); @@ -125,7 +124,6 @@ this.lBProfileTip = new System.Windows.Forms.Label(); this.tBProfile = new System.Windows.Forms.TextBox(); this.btnSaveProfile = new System.Windows.Forms.Button(); - this.lBSeperator = new System.Windows.Forms.Label(); this.lbRS = new System.Windows.Forms.Label(); this.lbLS = new System.Windows.Forms.Label(); this.numUDRS = new System.Windows.Forms.NumericUpDown(); @@ -137,12 +135,18 @@ this.nUDSixaxis = new System.Windows.Forms.NumericUpDown(); this.cBControllerInput = new System.Windows.Forms.CheckBox(); this.gBLightbar = new System.Windows.Forms.GroupBox(); + this.btnChargingColor = new System.Windows.Forms.Button(); + this.rBColor = new System.Windows.Forms.RadioButton(); + this.rBFade = new System.Windows.Forms.RadioButton(); + this.rBNormal = new System.Windows.Forms.RadioButton(); + this.rBRainbow = new System.Windows.Forms.RadioButton(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.lBFlashAt = new System.Windows.Forms.Label(); + this.nUDflashLED = new System.Windows.Forms.NumericUpDown(); this.gBRumble = new System.Windows.Forms.GroupBox(); this.gBDeadzone = new System.Windows.Forms.GroupBox(); this.btnCancel = new System.Windows.Forms.Button(); - this.nUDflashLED = new System.Windows.Forms.NumericUpDown(); - this.lBFlashAt = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); this.advColorDialog = new ScpServer.AdvancedColorDialog(); this.MainPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pBController)).BeginInit(); @@ -181,9 +185,9 @@ this.gBOther.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nUDSixaxis)).BeginInit(); this.gBLightbar.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nUDflashLED)).BeginInit(); this.gBRumble.SuspendLayout(); this.gBDeadzone.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.nUDflashLED)).BeginInit(); this.SuspendLayout(); // // bnTouchUpper @@ -295,7 +299,7 @@ this.MainPanel.Controls.Add(this.bnOptions); this.MainPanel.Controls.Add(this.bnPS); this.MainPanel.Controls.Add(this.bnShare); - this.MainPanel.Location = new System.Drawing.Point(7, 77); + this.MainPanel.Location = new System.Drawing.Point(7, 44); this.MainPanel.Name = "MainPanel"; this.MainPanel.Size = new System.Drawing.Size(249, 137); this.MainPanel.TabIndex = 185; @@ -668,7 +672,7 @@ this.SticksPanel.Controls.Add(this.bnRSLeft); this.SticksPanel.Controls.Add(this.bnLSDown); this.SticksPanel.Controls.Add(this.bnR3); - this.SticksPanel.Location = new System.Drawing.Point(7, 77); + this.SticksPanel.Location = new System.Drawing.Point(7, 44); this.SticksPanel.Name = "SticksPanel"; this.SticksPanel.Size = new System.Drawing.Size(249, 142); this.SticksPanel.TabIndex = 187; @@ -888,7 +892,7 @@ // lBControlTip // this.lBControlTip.AutoSize = true; - this.lBControlTip.Location = new System.Drawing.Point(25, 42); + this.lBControlTip.Location = new System.Drawing.Point(25, 9); this.lBControlTip.Name = "lBControlTip"; this.lBControlTip.Size = new System.Drawing.Size(219, 26); this.lBControlTip.TabIndex = 181; @@ -929,7 +933,7 @@ "Right Stick Down :", "Right Stick Left :", "Right Stick Right :"}); - this.lBControls.Location = new System.Drawing.Point(258, 42); + this.lBControls.Location = new System.Drawing.Point(258, 9); this.lBControls.Name = "lBControls"; this.lBControls.Size = new System.Drawing.Size(169, 173); this.lBControls.TabIndex = 180; @@ -949,7 +953,7 @@ // // numUDRainbow // - this.numUDRainbow.Location = new System.Drawing.Point(180, 16); + this.numUDRainbow.Location = new System.Drawing.Point(181, 16); this.numUDRainbow.Maximum = new decimal(new int[] { 60, 0, @@ -963,7 +967,7 @@ // pBRainbow // this.pBRainbow.Image = global::ScpServer.Properties.Resources.rainbow; - this.pBRainbow.Location = new System.Drawing.Point(161, 18); + this.pBRainbow.Location = new System.Drawing.Point(159, 18); this.pBRainbow.Name = "pBRainbow"; this.pBRainbow.Size = new System.Drawing.Size(16, 16); this.pBRainbow.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -971,19 +975,6 @@ this.pBRainbow.TabStop = false; this.pBRainbow.Click += new System.EventHandler(this.pbRainbow_Click); // - // flashLed - // - this.flashLed.AutoSize = true; - this.flashLed.Location = new System.Drawing.Point(433, 103); - this.flashLed.Name = "flashLed"; - this.flashLed.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - this.flashLed.Size = new System.Drawing.Size(103, 17); - this.flashLed.TabIndex = 163; - this.flashLed.Text = "Flash when Low"; - this.flashLed.UseVisualStyleBackColor = true; - this.flashLed.Visible = false; - this.flashLed.CheckedChanged += new System.EventHandler(this.flashWhenLowBattery_CheckedChanged); - // // blueBar // this.blueBar.AutoSize = false; @@ -1035,11 +1026,11 @@ // batteryLed // this.batteryLed.AutoSize = true; - this.batteryLed.Location = new System.Drawing.Point(320, 17); + this.batteryLed.Location = new System.Drawing.Point(316, 17); this.batteryLed.Name = "batteryLed"; - this.batteryLed.Size = new System.Drawing.Size(115, 17); + this.batteryLed.Size = new System.Drawing.Size(111, 17); this.batteryLed.TabIndex = 162; - this.batteryLed.Text = "Battery Level Color"; + this.batteryLed.Text = "Color by Battery %"; this.batteryLed.UseVisualStyleBackColor = true; this.batteryLed.CheckedChanged += new System.EventHandler(this.ledAsBatteryIndicator_CheckedChanged); // @@ -1064,7 +1055,7 @@ // lBspc // this.lBspc.AutoSize = true; - this.lBspc.Location = new System.Drawing.Point(225, 18); + this.lBspc.Location = new System.Drawing.Point(223, 19); this.lBspc.Name = "lBspc"; this.lBspc.Size = new System.Drawing.Size(59, 13); this.lBspc.TabIndex = 157; @@ -1306,7 +1297,7 @@ this.tBsixaxisAccelZ.AutoSize = false; this.tBsixaxisAccelZ.BackColor = System.Drawing.Color.White; this.tBsixaxisAccelZ.Enabled = false; - this.tBsixaxisAccelZ.Location = new System.Drawing.Point(394, 6); + this.tBsixaxisAccelZ.Location = new System.Drawing.Point(382, 6); this.tBsixaxisAccelZ.Maximum = 32767; this.tBsixaxisAccelZ.Minimum = -32768; this.tBsixaxisAccelZ.Name = "tBsixaxisAccelZ"; @@ -1333,7 +1324,7 @@ this.tBsixaxisAccelY.AutoSize = false; this.tBsixaxisAccelY.BackColor = System.Drawing.Color.White; this.tBsixaxisAccelY.Enabled = false; - this.tBsixaxisAccelY.Location = new System.Drawing.Point(347, 6); + this.tBsixaxisAccelY.Location = new System.Drawing.Point(335, 6); this.tBsixaxisAccelY.Maximum = 32767; this.tBsixaxisAccelY.Minimum = -32768; this.tBsixaxisAccelY.Name = "tBsixaxisAccelY"; @@ -1355,7 +1346,7 @@ this.tBsixaxisAccelX.AutoSize = false; this.tBsixaxisAccelX.BackColor = System.Drawing.Color.White; this.tBsixaxisAccelX.Enabled = false; - this.tBsixaxisAccelX.Location = new System.Drawing.Point(301, 6); + this.tBsixaxisAccelX.Location = new System.Drawing.Point(289, 6); this.tBsixaxisAccelX.Maximum = 32767; this.tBsixaxisAccelX.Minimum = -32768; this.tBsixaxisAccelX.Name = "tBsixaxisAccelX"; @@ -1442,7 +1433,7 @@ // this.lB6Accel.AutoSize = true; this.lB6Accel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lB6Accel.Location = new System.Drawing.Point(232, 6); + this.lB6Accel.Location = new System.Drawing.Point(220, 6); this.lB6Accel.Name = "lB6Accel"; this.lB6Accel.Size = new System.Drawing.Size(72, 13); this.lB6Accel.TabIndex = 215; @@ -1628,53 +1619,45 @@ this.SixaxisPanel.Controls.Add(this.tBsixaxisGyroZ); this.SixaxisPanel.Controls.Add(this.tBsixaxisAccelY); this.SixaxisPanel.Controls.Add(this.tBsixaxisAccelZ); - this.SixaxisPanel.Location = new System.Drawing.Point(442, 6); + this.SixaxisPanel.Location = new System.Drawing.Point(1, 193); this.SixaxisPanel.Name = "SixaxisPanel"; - this.SixaxisPanel.Size = new System.Drawing.Size(441, 29); + this.SixaxisPanel.Size = new System.Drawing.Size(435, 27); this.SixaxisPanel.TabIndex = 236; // // lBProfileTip // this.lBProfileTip.AutoSize = true; - this.lBProfileTip.Location = new System.Drawing.Point(5, 12); + this.lBProfileTip.Location = new System.Drawing.Point(13, 302); this.lBProfileTip.Name = "lBProfileTip"; this.lBProfileTip.Size = new System.Drawing.Size(70, 13); this.lBProfileTip.TabIndex = 239; this.lBProfileTip.Text = "Profile Name:"; + this.lBProfileTip.Visible = false; // // tBProfile // this.tBProfile.ForeColor = System.Drawing.SystemColors.GrayText; - this.tBProfile.Location = new System.Drawing.Point(77, 9); + this.tBProfile.Location = new System.Drawing.Point(85, 299); this.tBProfile.Name = "tBProfile"; this.tBProfile.Size = new System.Drawing.Size(185, 20); this.tBProfile.TabIndex = 238; this.tBProfile.Text = ""; + this.tBProfile.Visible = false; this.tBProfile.TextChanged += new System.EventHandler(this.tBProfile_TextChanged); this.tBProfile.Enter += new System.EventHandler(this.tBProfile_Enter); this.tBProfile.Leave += new System.EventHandler(this.tBProfile_Leave); // // btnSaveProfile // - this.btnSaveProfile.Location = new System.Drawing.Point(268, 7); + this.btnSaveProfile.Location = new System.Drawing.Point(276, 297); this.btnSaveProfile.Name = "btnSaveProfile"; this.btnSaveProfile.Size = new System.Drawing.Size(78, 23); this.btnSaveProfile.TabIndex = 237; this.btnSaveProfile.Text = "Save Profile"; this.btnSaveProfile.UseVisualStyleBackColor = true; + this.btnSaveProfile.Visible = false; this.btnSaveProfile.Click += new System.EventHandler(this.saveButton_Click); // - // lBSeperator - // - this.lBSeperator.AutoSize = true; - this.lBSeperator.BackColor = System.Drawing.Color.Transparent; - this.lBSeperator.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(221)))), ((int)(((byte)(221)))), ((int)(((byte)(221))))); - this.lBSeperator.Location = new System.Drawing.Point(3, 23); - this.lBSeperator.Name = "lBSeperator"; - this.lBSeperator.Size = new System.Drawing.Size(433, 13); - this.lBSeperator.TabIndex = 240; - this.lBSeperator.Text = "_______________________________________________________________________"; - // // lbRS // this.lbRS.AutoSize = true; @@ -1782,7 +1765,7 @@ this.gBTouchpad.Controls.Add(this.numUDScroll); this.gBTouchpad.Controls.Add(this.numUDTap); this.gBTouchpad.Controls.Add(this.cBScroll); - this.gBTouchpad.Location = new System.Drawing.Point(442, 221); + this.gBTouchpad.Location = new System.Drawing.Point(440, 220); this.gBTouchpad.Name = "gBTouchpad"; this.gBTouchpad.Size = new System.Drawing.Size(438, 70); this.gBTouchpad.TabIndex = 246; @@ -1799,7 +1782,7 @@ this.gBOther.Controls.Add(this.flushHIDQueue); this.gBOther.Controls.Add(this.lBIdleMinutes); this.gBOther.Controls.Add(this.lBControllerOff); - this.gBOther.Location = new System.Drawing.Point(6, 221); + this.gBOther.Location = new System.Drawing.Point(7, 220); this.gBOther.Name = "gBOther"; this.gBOther.Size = new System.Drawing.Size(421, 70); this.gBOther.TabIndex = 247; @@ -1843,6 +1826,12 @@ // // gBLightbar // + this.gBLightbar.Controls.Add(this.btnChargingColor); + this.gBLightbar.Controls.Add(this.rBColor); + this.gBLightbar.Controls.Add(this.rBFade); + this.gBLightbar.Controls.Add(this.rBNormal); + this.gBLightbar.Controls.Add(this.rBRainbow); + this.gBLightbar.Controls.Add(this.label2); this.gBLightbar.Controls.Add(this.label1); this.gBLightbar.Controls.Add(this.lBFlashAt); this.gBLightbar.Controls.Add(this.pBRainbow); @@ -1852,13 +1841,112 @@ this.gBLightbar.Controls.Add(this.FullPanel); this.gBLightbar.Controls.Add(this.lBspc); this.gBLightbar.Controls.Add(this.batteryLed); - this.gBLightbar.Location = new System.Drawing.Point(442, 113); + this.gBLightbar.Location = new System.Drawing.Point(440, 76); this.gBLightbar.Name = "gBLightbar"; - this.gBLightbar.Size = new System.Drawing.Size(438, 102); + this.gBLightbar.Size = new System.Drawing.Size(438, 129); this.gBLightbar.TabIndex = 247; this.gBLightbar.TabStop = false; this.gBLightbar.Text = "Lightbar"; // + // btnChargingColor + // + this.btnChargingColor.BackColor = System.Drawing.Color.White; + this.btnChargingColor.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnChargingColor.Location = new System.Drawing.Point(391, 108); + this.btnChargingColor.Name = "btnChargingColor"; + this.btnChargingColor.Size = new System.Drawing.Size(13, 13); + this.btnChargingColor.TabIndex = 49; + this.btnChargingColor.UseVisualStyleBackColor = false; + this.btnChargingColor.Visible = false; + this.btnChargingColor.Click += new System.EventHandler(this.btnChargingColor_Click); + // + // rBColor + // + this.rBColor.AutoSize = true; + this.rBColor.Location = new System.Drawing.Point(336, 106); + this.rBColor.Name = "rBColor"; + this.rBColor.Size = new System.Drawing.Size(49, 17); + this.rBColor.TabIndex = 238; + this.rBColor.TabStop = true; + this.rBColor.Text = "Color"; + this.rBColor.UseVisualStyleBackColor = true; + this.rBColor.CheckedChanged += new System.EventHandler(this.rBColor_CheckedChanged); + // + // rBFade + // + this.rBFade.AutoSize = true; + this.rBFade.Location = new System.Drawing.Point(158, 106); + this.rBFade.Name = "rBFade"; + this.rBFade.Size = new System.Drawing.Size(99, 17); + this.rBFade.TabIndex = 237; + this.rBFade.Text = "Fade in and out"; + this.rBFade.UseVisualStyleBackColor = true; + this.rBFade.CheckedChanged += new System.EventHandler(this.rBFade_CheckedChanged); + // + // rBNormal + // + this.rBNormal.AutoSize = true; + this.rBNormal.Checked = true; + this.rBNormal.Location = new System.Drawing.Point(97, 106); + this.rBNormal.Name = "rBNormal"; + this.rBNormal.Size = new System.Drawing.Size(58, 17); + this.rBNormal.TabIndex = 237; + this.rBNormal.TabStop = true; + this.rBNormal.Text = "Normal"; + this.rBNormal.UseVisualStyleBackColor = true; + this.rBNormal.CheckedChanged += new System.EventHandler(this.rBNormal_CheckedChanged); + // + // rBRainbow + // + this.rBRainbow.AutoSize = true; + this.rBRainbow.Location = new System.Drawing.Point(263, 106); + this.rBRainbow.Name = "rBRainbow"; + this.rBRainbow.Size = new System.Drawing.Size(67, 17); + this.rBRainbow.TabIndex = 237; + this.rBRainbow.Text = "Rainbow"; + this.rBRainbow.UseVisualStyleBackColor = true; + this.rBRainbow.CheckedChanged += new System.EventHandler(this.rBRainbow_CheckedChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(9, 108); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(82, 13); + this.label2.TabIndex = 236; + this.label2.Text = "While Charging:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(98, 18); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(15, 13); + this.label1.TabIndex = 207; + this.label1.Text = "%"; + // + // lBFlashAt + // + this.lBFlashAt.AutoSize = true; + this.lBFlashAt.Location = new System.Drawing.Point(9, 18); + this.lBFlashAt.Name = "lBFlashAt"; + this.lBFlashAt.Size = new System.Drawing.Size(44, 13); + this.lBFlashAt.TabIndex = 207; + this.lBFlashAt.Text = "Flash at"; + // + // nUDflashLED + // + this.nUDflashLED.Increment = new decimal(new int[] { + 10, + 0, + 0, + 0}); + this.nUDflashLED.Location = new System.Drawing.Point(54, 16); + this.nUDflashLED.Name = "nUDflashLED"; + this.nUDflashLED.Size = new System.Drawing.Size(43, 20); + this.nUDflashLED.TabIndex = 167; + this.nUDflashLED.ValueChanged += new System.EventHandler(this.nUDflashLED_ValueChanged); + // // gBRumble // this.gBRumble.Controls.Add(this.rumbleBoostLabel); @@ -1868,7 +1956,7 @@ this.gBRumble.Controls.Add(this.numUDLightRumble); this.gBRumble.Controls.Add(this.rightMotorLabel); this.gBRumble.Controls.Add(this.rumbleBoostBar); - this.gBRumble.Location = new System.Drawing.Point(444, 40); + this.gBRumble.Location = new System.Drawing.Point(442, 3); this.gBRumble.Name = "gBRumble"; this.gBRumble.Size = new System.Drawing.Size(213, 67); this.gBRumble.TabIndex = 247; @@ -1885,7 +1973,7 @@ this.gBDeadzone.Controls.Add(this.numUDRS); this.gBDeadzone.Controls.Add(this.numUDR2); this.gBDeadzone.Controls.Add(this.numUDLS); - this.gBDeadzone.Location = new System.Drawing.Point(686, 40); + this.gBDeadzone.Location = new System.Drawing.Point(684, 3); this.gBDeadzone.Name = "gBDeadzone"; this.gBDeadzone.Size = new System.Drawing.Size(194, 67); this.gBDeadzone.TabIndex = 248; @@ -1895,45 +1983,15 @@ // btnCancel // this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(352, 7); + this.btnCancel.Location = new System.Drawing.Point(360, 297); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.TabIndex = 249; this.btnCancel.Text = "Cancel"; this.btnCancel.UseVisualStyleBackColor = true; + this.btnCancel.Visible = false; this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); // - // nUDflashLED - // - this.nUDflashLED.Increment = new decimal(new int[] { - 10, - 0, - 0, - 0}); - this.nUDflashLED.Location = new System.Drawing.Point(60, 16); - this.nUDflashLED.Name = "nUDflashLED"; - this.nUDflashLED.Size = new System.Drawing.Size(43, 20); - this.nUDflashLED.TabIndex = 167; - this.nUDflashLED.ValueChanged += new System.EventHandler(this.nUDflashLED_ValueChanged); - // - // lBFlashAt - // - this.lBFlashAt.AutoSize = true; - this.lBFlashAt.Location = new System.Drawing.Point(15, 18); - this.lBFlashAt.Name = "lBFlashAt"; - this.lBFlashAt.Size = new System.Drawing.Size(44, 13); - this.lBFlashAt.TabIndex = 207; - this.lBFlashAt.Text = "Flash at"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(104, 18); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(15, 13); - this.label1.TabIndex = 207; - this.label1.Text = "%"; - // // advColorDialog // this.advColorDialog.AnyColor = true; @@ -1946,13 +2004,11 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.CancelButton = this.btnCancel; - this.ClientSize = new System.Drawing.Size(888, 297); + this.ClientSize = new System.Drawing.Size(888, 295); this.Controls.Add(this.btnCancel); - this.Controls.Add(this.flashLed); this.Controls.Add(this.gBDeadzone); this.Controls.Add(this.gBRumble); this.Controls.Add(this.gBLightbar); - this.Controls.Add(this.gBOther); this.Controls.Add(this.gBTouchpad); this.Controls.Add(this.SixaxisPanel); this.Controls.Add(this.lBProfileTip); @@ -1962,7 +2018,7 @@ this.Controls.Add(this.lBControls); this.Controls.Add(this.MainPanel); this.Controls.Add(this.SticksPanel); - this.Controls.Add(this.lBSeperator); + this.Controls.Add(this.gBOther); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.MinimizeBox = false; @@ -2015,11 +2071,11 @@ ((System.ComponentModel.ISupportInitialize)(this.nUDSixaxis)).EndInit(); this.gBLightbar.ResumeLayout(false); this.gBLightbar.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nUDflashLED)).EndInit(); this.gBRumble.ResumeLayout(false); this.gBRumble.PerformLayout(); this.gBDeadzone.ResumeLayout(false); this.gBDeadzone.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.nUDflashLED)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -2071,7 +2127,6 @@ private System.Windows.Forms.NumericUpDown numUDRainbow; private System.Windows.Forms.PictureBox pBRainbow; private System.Windows.Forms.Button lowColorChooserButton; - private System.Windows.Forms.CheckBox flashLed; private System.Windows.Forms.TrackBar blueBar; private System.Windows.Forms.TrackBar greenBar; private System.Windows.Forms.TrackBar redBar; @@ -2126,7 +2181,6 @@ private System.Windows.Forms.Label lBProfileTip; private System.Windows.Forms.TextBox tBProfile; private System.Windows.Forms.Button btnSaveProfile; - private System.Windows.Forms.Label lBSeperator; private System.Windows.Forms.Label lBControlTip; private System.Windows.Forms.Label lbRS; private System.Windows.Forms.Label lbLS; @@ -2145,6 +2199,12 @@ private System.Windows.Forms.NumericUpDown nUDflashLED; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label lBFlashAt; + private System.Windows.Forms.RadioButton rBFade; + private System.Windows.Forms.RadioButton rBNormal; + private System.Windows.Forms.RadioButton rBRainbow; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button btnChargingColor; + private System.Windows.Forms.RadioButton rBColor; } }  \ No newline at end of file diff --git a/DS4Tool/Options.cs b/DS4Tool/Options.cs index a1ba52f..22a8175 100644 --- a/DS4Tool/Options.cs +++ b/DS4Tool/Options.cs @@ -12,10 +12,10 @@ namespace ScpServer { private DS4Control.Control scpDevice; public int device; - private string filename; - Byte[] oldLedColor, oldLowLedColor; + public string filename; + Byte[] oldLedColor, oldLowLedColor, oldChargingColor; Timer inputtimer = new Timer(), sixaxisTimer = new Timer(); - private List