mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-25 18:46:58 +01:00
Reworked Rainbow algorithm + added option for rainbow and speed
Also Revised popup on notification icon
This commit is contained in:
parent
b2aef9a984
commit
fda3c65dcd
@ -228,13 +228,13 @@ namespace DS4Control
|
||||
if (d.Battery >= 100)
|
||||
battery = "Full";
|
||||
else
|
||||
battery = ">" + d.Battery + '%';
|
||||
battery = d.Battery + "%+";
|
||||
}
|
||||
else
|
||||
{
|
||||
battery = d.Battery + "%";
|
||||
}
|
||||
return battery + ' ' + d.ConnectionType;
|
||||
return d.ConnectionType + " " + battery;
|
||||
}
|
||||
else
|
||||
return "None";
|
||||
|
@ -20,12 +20,26 @@ 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];
|
||||
static double[] counters = new double[4] {0,0,0,0};
|
||||
|
||||
static DateTime oldnow = DateTime.Now;
|
||||
public static void updateLightBar(DS4Device device, int deviceNum)
|
||||
{
|
||||
DS4Color color;
|
||||
if (Global.getLedAsBatteryIndicator(deviceNum))
|
||||
if (Global.getRainbow(deviceNum) > 0)
|
||||
{// Display rainbow
|
||||
DateTime now = DateTime.Now;
|
||||
if (now >= oldnow + TimeSpan.FromMilliseconds(10)) //update by the millisecond that way it's a smooth transtion
|
||||
{
|
||||
oldnow = now;
|
||||
counters[deviceNum] += 1.5*3 / Global.getRainbow(deviceNum);
|
||||
}
|
||||
if (Global.getLedAsBatteryIndicator(deviceNum) && (device.Charging == false || device.Battery >= 100))// when charged, don't show the charging animation
|
||||
color = HuetoRGB((float)counters[deviceNum] % 360, (byte)(2.55 * device.Battery));
|
||||
else
|
||||
color = HuetoRGB((float)counters[deviceNum] % 360, 255);
|
||||
}
|
||||
else if (Global.getLedAsBatteryIndicator(deviceNum))
|
||||
{
|
||||
if (device.Charging == false || device.Battery >= 100) // when charged, don't show the charging animation
|
||||
{
|
||||
@ -48,15 +62,8 @@ namespace DS4Control
|
||||
}
|
||||
else // Display rainbow when charging.
|
||||
{
|
||||
counters[deviceNum]++;
|
||||
double theta = Math.PI * 2.0 * counters[deviceNum] / 1800.0;
|
||||
const double brightness = Math.PI; // small brightness numbers (far from max 128.0) mean less light steps and slower output reports; also, the lower the brightness the faster you can charge
|
||||
color = new DS4Color
|
||||
{
|
||||
red = (byte)(brightness * Math.Sin(theta) + brightness - 0.5),
|
||||
green = (byte)(brightness * Math.Sin(theta + (Math.PI * 2.0) / 3.0) + brightness - 0.5),
|
||||
blue = (byte)(brightness * Math.Sin(theta + 2.0 * (Math.PI * 2.0) / 3.0) + brightness - 0.5)
|
||||
};
|
||||
counters[deviceNum]+= .167;
|
||||
color = HuetoRGB((float)counters[deviceNum] % 360, 255);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -90,5 +97,24 @@ namespace DS4Control
|
||||
device.pushHapticState(haptics);
|
||||
}
|
||||
|
||||
public static DS4Color HuetoRGB(float hue, byte sat)
|
||||
{
|
||||
byte C = sat;
|
||||
int X = (int)((C * (float)(1 - Math.Abs((hue / 60) % 2 - 1))));
|
||||
if (0 <= hue && hue < 60)
|
||||
return new DS4Color { red = C, green = (byte)X, blue = 0 };
|
||||
else if (60 <= hue && hue < 120)
|
||||
return new DS4Color { red = (byte)X, green = C, blue = 0 };
|
||||
else if (120 <= hue && hue < 180)
|
||||
return new DS4Color { red = 0, green = C, blue = (byte)X };
|
||||
else if (180 <= hue && hue < 240)
|
||||
return new DS4Color { red = 0, green = (byte)X, blue = C };
|
||||
else if (240 <= hue && hue < 300)
|
||||
return new DS4Color { red = (byte)X, green = 0, blue = C };
|
||||
else if (300 <= hue && hue < 360)
|
||||
return new DS4Color { red = C, green = 0, blue = (byte)X };
|
||||
else
|
||||
return new DS4Color { red = 255, green = 0, blue = 0 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,14 @@ namespace DS4Control
|
||||
{
|
||||
m_Config.rumbleSwap[device] = swap;
|
||||
}
|
||||
|
||||
public static double getRainbow(int device)
|
||||
{
|
||||
return m_Config.rainbow[device];
|
||||
}
|
||||
public static void setRainbow(int device, double speed)
|
||||
{
|
||||
m_Config.rainbow[device] = speed;
|
||||
}
|
||||
public static bool getFlushHIDQueue(int device)
|
||||
{
|
||||
return m_Config.flushHIDQueue[device];
|
||||
@ -391,6 +398,7 @@ namespace DS4Control
|
||||
public Byte[] tapSensitivity = {0, 0, 0, 0};
|
||||
public bool[] doubleTap = { false, false, false, false };
|
||||
public int[] scrollSensitivity = { 0, 0, 0, 0 };
|
||||
public double[] rainbow = { 0, 0, 0, 0 };
|
||||
public Byte[][] m_LowLeds = new Byte[][]
|
||||
{
|
||||
new Byte[] {0,0,0},
|
||||
@ -493,6 +501,7 @@ namespace DS4Control
|
||||
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 xmlRainbow = m_Xdoc.CreateNode(XmlNodeType.Element, "Rainbow", null); xmlRainbow.InnerText = rainbow[device].ToString(); Node.AppendChild(xmlRainbow);
|
||||
|
||||
XmlNode NodeControl = m_Xdoc.CreateNode(XmlNodeType.Element, "Control", null);
|
||||
|
||||
@ -708,6 +717,8 @@ namespace DS4Control
|
||||
catch { missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ButtonMouseSensitivity"); Int32.TryParse(Item.InnerText, out buttonMouseSensitivity[device]); }
|
||||
catch { missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Rainbow"); Double.TryParse(Item.InnerText, out rainbow[device]); }
|
||||
catch { missingSetting = true; }
|
||||
|
||||
DS4KeyType keyType;
|
||||
UInt16 wvk;
|
||||
@ -854,6 +865,8 @@ namespace DS4Control
|
||||
catch { missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ButtonMouseSensitivity"); Int32.TryParse(Item.InnerText, out buttonMouseSensitivity[device]); }
|
||||
catch { missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Rainbow"); Double.TryParse(Item.InnerText, out rainbow[device]); }
|
||||
catch { missingSetting = true; }
|
||||
|
||||
DS4KeyType keyType;
|
||||
UInt16 wvk;
|
||||
|
@ -152,6 +152,7 @@
|
||||
<None Include="Resources\DS4 Controller.png" />
|
||||
<Content Include="Resources\DS4.ico" />
|
||||
<None Include="Resources\mouse.png" />
|
||||
<None Include="Resources\rainbow.png" />
|
||||
<Content Include="Resources\Scp_All.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
257
DS4Tool/Options.Designer.cs
generated
257
DS4Tool/Options.Designer.cs
generated
@ -57,7 +57,6 @@
|
||||
this.lowBlueValLabel = new System.Windows.Forms.Label();
|
||||
this.fullColorLabel = new System.Windows.Forms.Label();
|
||||
this.lowColorLabel = new System.Windows.Forms.Label();
|
||||
this.lowLedCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.lowLedPanel = new System.Windows.Forms.Panel();
|
||||
this.lowColorChooserButton = new System.Windows.Forms.Button();
|
||||
this.fullLedPanel = new System.Windows.Forms.Panel();
|
||||
@ -122,18 +121,24 @@
|
||||
this.bnTouchRight = new System.Windows.Forms.Button();
|
||||
this.bnTouchLeft = new System.Windows.Forms.Button();
|
||||
this.tabLightBar = new System.Windows.Forms.TabPage();
|
||||
this.numUDRainbow = new System.Windows.Forms.NumericUpDown();
|
||||
this.pBRainbow = new System.Windows.Forms.PictureBox();
|
||||
this.lBspc = new System.Windows.Forms.Label();
|
||||
this.tabRumble = new System.Windows.Forms.TabPage();
|
||||
this.rumbleSwap = new System.Windows.Forms.CheckBox();
|
||||
this.tabOther = new System.Windows.Forms.TabPage();
|
||||
this.lBButtonMouseSens = new System.Windows.Forms.Label();
|
||||
this.lBMouseSens = new System.Windows.Forms.Label();
|
||||
this.idleDisconnectTimeout = new System.Windows.Forms.NumericUpDown();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.tBMouseSens = new System.Windows.Forms.TrackBar();
|
||||
this.tBProfile = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.tBMouseSens = new System.Windows.Forms.TrackBar();
|
||||
this.lBMouseSens = new System.Windows.Forms.Label();
|
||||
this.lowRedBar = new System.Windows.Forms.TrackBar();
|
||||
this.lowGreenBar = new System.Windows.Forms.TrackBar();
|
||||
this.lowBlueBar = new System.Windows.Forms.TrackBar();
|
||||
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,10 +158,15 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.numUDScroll)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numUDTouch)).BeginInit();
|
||||
this.tabLightBar.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numUDRainbow)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pBRainbow)).BeginInit();
|
||||
this.tabRumble.SuspendLayout();
|
||||
this.tabOther.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.idleDisconnectTimeout)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tBMouseSens)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.lowRedBar)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.lowGreenBar)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.lowBlueBar)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// BlueLabel
|
||||
@ -191,10 +201,10 @@
|
||||
this.blueBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.blueBar.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.blueBar.Location = new System.Drawing.Point(63, 100);
|
||||
this.blueBar.Location = new System.Drawing.Point(0, 95);
|
||||
this.blueBar.Maximum = 255;
|
||||
this.blueBar.Name = "blueBar";
|
||||
this.blueBar.Size = new System.Drawing.Size(288, 45);
|
||||
this.blueBar.Size = new System.Drawing.Size(321, 45);
|
||||
this.blueBar.TabIndex = 12;
|
||||
this.blueBar.TickFrequency = 25;
|
||||
this.blueBar.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||
@ -206,10 +216,10 @@
|
||||
this.greenBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.greenBar.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.greenBar.Location = new System.Drawing.Point(63, 70);
|
||||
this.greenBar.Location = new System.Drawing.Point(0, 65);
|
||||
this.greenBar.Maximum = 255;
|
||||
this.greenBar.Name = "greenBar";
|
||||
this.greenBar.Size = new System.Drawing.Size(288, 45);
|
||||
this.greenBar.Size = new System.Drawing.Size(321, 45);
|
||||
this.greenBar.TabIndex = 11;
|
||||
this.greenBar.TickFrequency = 25;
|
||||
this.greenBar.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||
@ -221,10 +231,10 @@
|
||||
this.redBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.redBar.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.redBar.Location = new System.Drawing.Point(63, 40);
|
||||
this.redBar.Location = new System.Drawing.Point(0, 35);
|
||||
this.redBar.Maximum = 255;
|
||||
this.redBar.Name = "redBar";
|
||||
this.redBar.Size = new System.Drawing.Size(288, 45);
|
||||
this.redBar.Size = new System.Drawing.Size(321, 45);
|
||||
this.redBar.TabIndex = 10;
|
||||
this.redBar.TickFrequency = 25;
|
||||
this.redBar.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||
@ -233,7 +243,8 @@
|
||||
//
|
||||
// blueValLabel
|
||||
//
|
||||
this.blueValLabel.Location = new System.Drawing.Point(2, 59);
|
||||
this.blueValLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.blueValLabel.Location = new System.Drawing.Point(321, 95);
|
||||
this.blueValLabel.Name = "blueValLabel";
|
||||
this.blueValLabel.Size = new System.Drawing.Size(30, 13);
|
||||
this.blueValLabel.TabIndex = 16;
|
||||
@ -242,7 +253,8 @@
|
||||
//
|
||||
// greenValLabel
|
||||
//
|
||||
this.greenValLabel.Location = new System.Drawing.Point(2, 30);
|
||||
this.greenValLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.greenValLabel.Location = new System.Drawing.Point(321, 66);
|
||||
this.greenValLabel.Name = "greenValLabel";
|
||||
this.greenValLabel.Size = new System.Drawing.Size(30, 13);
|
||||
this.greenValLabel.TabIndex = 17;
|
||||
@ -251,7 +263,8 @@
|
||||
//
|
||||
// redValLabel
|
||||
//
|
||||
this.redValLabel.Location = new System.Drawing.Point(2, 1);
|
||||
this.redValLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.redValLabel.Location = new System.Drawing.Point(321, 37);
|
||||
this.redValLabel.Name = "redValLabel";
|
||||
this.redValLabel.Size = new System.Drawing.Size(30, 13);
|
||||
this.redValLabel.TabIndex = 18;
|
||||
@ -372,7 +385,7 @@
|
||||
//
|
||||
this.colorLabel.AutoSize = true;
|
||||
this.colorLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.colorLabel.Location = new System.Drawing.Point(16, 20);
|
||||
this.colorLabel.Location = new System.Drawing.Point(16, 13);
|
||||
this.colorLabel.Name = "colorLabel";
|
||||
this.colorLabel.Size = new System.Drawing.Size(36, 13);
|
||||
this.colorLabel.TabIndex = 29;
|
||||
@ -393,7 +406,7 @@
|
||||
//
|
||||
this.batteryLed.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
|
||||
this.batteryLed.AutoSize = true;
|
||||
this.batteryLed.Location = new System.Drawing.Point(149, 136);
|
||||
this.batteryLed.Location = new System.Drawing.Point(307, 140);
|
||||
this.batteryLed.Name = "batteryLed";
|
||||
this.batteryLed.Size = new System.Drawing.Size(115, 17);
|
||||
this.batteryLed.TabIndex = 33;
|
||||
@ -405,8 +418,9 @@
|
||||
//
|
||||
this.flashLed.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.flashLed.AutoSize = true;
|
||||
this.flashLed.Location = new System.Drawing.Point(9, 136);
|
||||
this.flashLed.Location = new System.Drawing.Point(9, 139);
|
||||
this.flashLed.Name = "flashLed";
|
||||
this.flashLed.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.flashLed.Size = new System.Drawing.Size(116, 17);
|
||||
this.flashLed.TabIndex = 34;
|
||||
this.flashLed.Text = "Battery Level Flash";
|
||||
@ -429,7 +443,7 @@
|
||||
//
|
||||
// lowRedValLabel
|
||||
//
|
||||
this.lowRedValLabel.Location = new System.Drawing.Point(36, 43);
|
||||
this.lowRedValLabel.Location = new System.Drawing.Point(144, 39);
|
||||
this.lowRedValLabel.Name = "lowRedValLabel";
|
||||
this.lowRedValLabel.Size = new System.Drawing.Size(30, 13);
|
||||
this.lowRedValLabel.TabIndex = 40;
|
||||
@ -438,7 +452,7 @@
|
||||
//
|
||||
// lowGreenValLabel
|
||||
//
|
||||
this.lowGreenValLabel.Location = new System.Drawing.Point(36, 72);
|
||||
this.lowGreenValLabel.Location = new System.Drawing.Point(144, 68);
|
||||
this.lowGreenValLabel.Name = "lowGreenValLabel";
|
||||
this.lowGreenValLabel.Size = new System.Drawing.Size(30, 13);
|
||||
this.lowGreenValLabel.TabIndex = 41;
|
||||
@ -447,7 +461,7 @@
|
||||
//
|
||||
// lowBlueValLabel
|
||||
//
|
||||
this.lowBlueValLabel.Location = new System.Drawing.Point(36, 101);
|
||||
this.lowBlueValLabel.Location = new System.Drawing.Point(144, 97);
|
||||
this.lowBlueValLabel.Name = "lowBlueValLabel";
|
||||
this.lowBlueValLabel.Size = new System.Drawing.Size(30, 13);
|
||||
this.lowBlueValLabel.TabIndex = 42;
|
||||
@ -456,47 +470,39 @@
|
||||
//
|
||||
// fullColorLabel
|
||||
//
|
||||
this.fullColorLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.fullColorLabel.AutoSize = true;
|
||||
this.fullColorLabel.Location = new System.Drawing.Point(3, 20);
|
||||
this.fullColorLabel.Location = new System.Drawing.Point(216, 4);
|
||||
this.fullColorLabel.Name = "fullColorLabel";
|
||||
this.fullColorLabel.Size = new System.Drawing.Size(23, 13);
|
||||
this.fullColorLabel.Size = new System.Drawing.Size(55, 13);
|
||||
this.fullColorLabel.TabIndex = 43;
|
||||
this.fullColorLabel.Text = "Full";
|
||||
this.fullColorLabel.Text = "When Full";
|
||||
this.fullColorLabel.Visible = false;
|
||||
this.fullColorLabel.Click += new System.EventHandler(this.fullColorLabel_Click);
|
||||
//
|
||||
// lowColorLabel
|
||||
//
|
||||
this.lowColorLabel.AutoSize = true;
|
||||
this.lowColorLabel.Location = new System.Drawing.Point(36, 20);
|
||||
this.lowColorLabel.Location = new System.Drawing.Point(40, 4);
|
||||
this.lowColorLabel.Name = "lowColorLabel";
|
||||
this.lowColorLabel.Size = new System.Drawing.Size(27, 13);
|
||||
this.lowColorLabel.Size = new System.Drawing.Size(68, 13);
|
||||
this.lowColorLabel.TabIndex = 44;
|
||||
this.lowColorLabel.Text = "Low";
|
||||
//
|
||||
// lowLedCheckBox
|
||||
//
|
||||
this.lowLedCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lowLedCheckBox.AutoSize = true;
|
||||
this.lowLedCheckBox.Location = new System.Drawing.Point(284, 136);
|
||||
this.lowLedCheckBox.Name = "lowLedCheckBox";
|
||||
this.lowLedCheckBox.Size = new System.Drawing.Size(128, 17);
|
||||
this.lowLedCheckBox.TabIndex = 45;
|
||||
this.lowLedCheckBox.Text = "Set Low-Battery Color";
|
||||
this.lowLedCheckBox.UseVisualStyleBackColor = true;
|
||||
this.lowLedCheckBox.Visible = false;
|
||||
this.lowLedCheckBox.CheckedChanged += new System.EventHandler(this.lowBatteryLed_CheckedChanged);
|
||||
this.lowColorLabel.Text = "When Empty";
|
||||
//
|
||||
// lowLedPanel
|
||||
//
|
||||
this.lowLedPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lowLedPanel.Controls.Add(this.lowBlueBar);
|
||||
this.lowLedPanel.Controls.Add(this.lowColorChooserButton);
|
||||
this.lowLedPanel.Controls.Add(this.fullColorLabel);
|
||||
this.lowLedPanel.Controls.Add(this.lowRedValLabel);
|
||||
this.lowLedPanel.Controls.Add(this.lowColorLabel);
|
||||
this.lowLedPanel.Controls.Add(this.lowGreenValLabel);
|
||||
this.lowLedPanel.Controls.Add(this.lowBlueValLabel);
|
||||
this.lowLedPanel.Location = new System.Drawing.Point(356, 4);
|
||||
this.lowLedPanel.Controls.Add(this.lowGreenBar);
|
||||
this.lowLedPanel.Controls.Add(this.lowRedBar);
|
||||
this.lowLedPanel.Location = new System.Drawing.Point(240, 3);
|
||||
this.lowLedPanel.Name = "lowLedPanel";
|
||||
this.lowLedPanel.Size = new System.Drawing.Size(63, 129);
|
||||
this.lowLedPanel.Size = new System.Drawing.Size(174, 127);
|
||||
this.lowLedPanel.TabIndex = 46;
|
||||
this.lowLedPanel.Visible = false;
|
||||
//
|
||||
@ -504,7 +510,7 @@
|
||||
//
|
||||
this.lowColorChooserButton.BackColor = System.Drawing.Color.White;
|
||||
this.lowColorChooserButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.lowColorChooserButton.Location = new System.Drawing.Point(42, 3);
|
||||
this.lowColorChooserButton.Location = new System.Drawing.Point(150, 3);
|
||||
this.lowColorChooserButton.Name = "lowColorChooserButton";
|
||||
this.lowColorChooserButton.Size = new System.Drawing.Size(13, 13);
|
||||
this.lowColorChooserButton.TabIndex = 49;
|
||||
@ -515,11 +521,16 @@
|
||||
//
|
||||
this.fullLedPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.fullLedPanel.Controls.Add(this.redValLabel);
|
||||
this.fullLedPanel.Controls.Add(this.fullColorLabel);
|
||||
this.fullLedPanel.Controls.Add(this.blueValLabel);
|
||||
this.fullLedPanel.Controls.Add(this.greenValLabel);
|
||||
this.fullLedPanel.Location = new System.Drawing.Point(355, 46);
|
||||
this.fullLedPanel.Controls.Add(this.colorChooserButton);
|
||||
this.fullLedPanel.Controls.Add(this.blueBar);
|
||||
this.fullLedPanel.Controls.Add(this.greenBar);
|
||||
this.fullLedPanel.Controls.Add(this.redBar);
|
||||
this.fullLedPanel.Location = new System.Drawing.Point(63, 3);
|
||||
this.fullLedPanel.Name = "fullLedPanel";
|
||||
this.fullLedPanel.Size = new System.Drawing.Size(28, 83);
|
||||
this.fullLedPanel.Size = new System.Drawing.Size(351, 127);
|
||||
this.fullLedPanel.TabIndex = 47;
|
||||
//
|
||||
// colorChooserButton
|
||||
@ -527,7 +538,7 @@
|
||||
this.colorChooserButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.colorChooserButton.BackColor = System.Drawing.Color.White;
|
||||
this.colorChooserButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.colorChooserButton.Location = new System.Drawing.Point(364, 7);
|
||||
this.colorChooserButton.Location = new System.Drawing.Point(329, 4);
|
||||
this.colorChooserButton.Name = "colorChooserButton";
|
||||
this.colorChooserButton.Size = new System.Drawing.Size(13, 13);
|
||||
this.colorChooserButton.TabIndex = 48;
|
||||
@ -1598,18 +1609,16 @@
|
||||
//
|
||||
// tabLightBar
|
||||
//
|
||||
this.tabLightBar.Controls.Add(this.numUDRainbow);
|
||||
this.tabLightBar.Controls.Add(this.pBRainbow);
|
||||
this.tabLightBar.Controls.Add(this.flashLed);
|
||||
this.tabLightBar.Controls.Add(this.lowLedCheckBox);
|
||||
this.tabLightBar.Controls.Add(this.batteryLed);
|
||||
this.tabLightBar.Controls.Add(this.colorChooserButton);
|
||||
this.tabLightBar.Controls.Add(this.fullLedPanel);
|
||||
this.tabLightBar.Controls.Add(this.blueBar);
|
||||
this.tabLightBar.Controls.Add(this.greenBar);
|
||||
this.tabLightBar.Controls.Add(this.colorLabel);
|
||||
this.tabLightBar.Controls.Add(this.lBspc);
|
||||
this.tabLightBar.Controls.Add(this.RedLabel);
|
||||
this.tabLightBar.Controls.Add(this.redBar);
|
||||
this.tabLightBar.Controls.Add(this.GreenLabel);
|
||||
this.tabLightBar.Controls.Add(this.BlueLabel);
|
||||
this.tabLightBar.Controls.Add(this.fullLedPanel);
|
||||
this.tabLightBar.Controls.Add(this.lowLedPanel);
|
||||
this.tabLightBar.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabLightBar.Name = "tabLightBar";
|
||||
@ -1618,6 +1627,42 @@
|
||||
this.tabLightBar.TabIndex = 0;
|
||||
this.tabLightBar.Text = "Light Bar";
|
||||
this.tabLightBar.UseVisualStyleBackColor = true;
|
||||
this.tabLightBar.Click += new System.EventHandler(this.tabLightBar_Click);
|
||||
//
|
||||
// numUDRainbow
|
||||
//
|
||||
this.numUDRainbow.Location = new System.Drawing.Point(159, 137);
|
||||
this.numUDRainbow.Maximum = new decimal(new int[] {
|
||||
60,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numUDRainbow.Name = "numUDRainbow";
|
||||
this.numUDRainbow.Size = new System.Drawing.Size(51, 20);
|
||||
this.numUDRainbow.TabIndex = 50;
|
||||
this.numUDRainbow.Visible = false;
|
||||
this.numUDRainbow.ValueChanged += new System.EventHandler(this.numUDRainbow_ValueChanged);
|
||||
//
|
||||
// pBRainbow
|
||||
//
|
||||
this.pBRainbow.Image = global::ScpServer.Properties.Resources.rainbow;
|
||||
this.pBRainbow.Location = new System.Drawing.Point(215, 139);
|
||||
this.pBRainbow.Name = "pBRainbow";
|
||||
this.pBRainbow.Size = new System.Drawing.Size(16, 16);
|
||||
this.pBRainbow.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
this.pBRainbow.TabIndex = 49;
|
||||
this.pBRainbow.TabStop = false;
|
||||
this.pBRainbow.Click += new System.EventHandler(this.pictureBox2_Click);
|
||||
//
|
||||
// lBspc
|
||||
//
|
||||
this.lBspc.AutoSize = true;
|
||||
this.lBspc.Location = new System.Drawing.Point(212, 140);
|
||||
this.lBspc.Name = "lBspc";
|
||||
this.lBspc.Size = new System.Drawing.Size(93, 13);
|
||||
this.lBspc.TabIndex = 13;
|
||||
this.lBspc.Text = "seconds per cycle";
|
||||
this.lBspc.Visible = false;
|
||||
//
|
||||
// tabRumble
|
||||
//
|
||||
@ -1674,6 +1719,24 @@
|
||||
this.tabOther.Text = "Other";
|
||||
this.tabOther.UseVisualStyleBackColor = 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)";
|
||||
//
|
||||
// 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;
|
||||
//
|
||||
// idleDisconnectTimeout
|
||||
//
|
||||
this.idleDisconnectTimeout.Location = new System.Drawing.Point(6, 107);
|
||||
@ -1705,6 +1768,18 @@
|
||||
this.label2.TabIndex = 81;
|
||||
this.label2.Text = "Idle disconnection timeout";
|
||||
//
|
||||
// tBMouseSens
|
||||
//
|
||||
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);
|
||||
//
|
||||
// tBProfile
|
||||
//
|
||||
this.tBProfile.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||
@ -1727,26 +1802,50 @@
|
||||
this.label4.TabIndex = 84;
|
||||
this.label4.Text = "Profile Name:";
|
||||
//
|
||||
// tBMouseSens
|
||||
// lowRedBar
|
||||
//
|
||||
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);
|
||||
this.lowRedBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lowRedBar.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.lowRedBar.Location = new System.Drawing.Point(0, 34);
|
||||
this.lowRedBar.Maximum = 255;
|
||||
this.lowRedBar.Name = "lowRedBar";
|
||||
this.lowRedBar.Size = new System.Drawing.Size(144, 45);
|
||||
this.lowRedBar.TabIndex = 10;
|
||||
this.lowRedBar.TickFrequency = 25;
|
||||
this.lowRedBar.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||
this.lowRedBar.Value = 255;
|
||||
this.lowRedBar.ValueChanged += new System.EventHandler(this.lowRedBar_ValueChanged);
|
||||
//
|
||||
// lBMouseSens
|
||||
// lowGreenBar
|
||||
//
|
||||
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;
|
||||
this.lowGreenBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lowGreenBar.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.lowGreenBar.Location = new System.Drawing.Point(0, 64);
|
||||
this.lowGreenBar.Maximum = 255;
|
||||
this.lowGreenBar.Name = "lowGreenBar";
|
||||
this.lowGreenBar.Size = new System.Drawing.Size(144, 45);
|
||||
this.lowGreenBar.TabIndex = 11;
|
||||
this.lowGreenBar.TickFrequency = 25;
|
||||
this.lowGreenBar.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||
this.lowGreenBar.Value = 255;
|
||||
this.lowGreenBar.ValueChanged += new System.EventHandler(this.lowGreenBar_ValueChanged);
|
||||
//
|
||||
// lowBlueBar
|
||||
//
|
||||
this.lowBlueBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lowBlueBar.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.lowBlueBar.Location = new System.Drawing.Point(0, 94);
|
||||
this.lowBlueBar.Maximum = 255;
|
||||
this.lowBlueBar.Name = "lowBlueBar";
|
||||
this.lowBlueBar.Size = new System.Drawing.Size(144, 45);
|
||||
this.lowBlueBar.TabIndex = 12;
|
||||
this.lowBlueBar.TickFrequency = 25;
|
||||
this.lowBlueBar.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||
this.lowBlueBar.Value = 255;
|
||||
this.lowBlueBar.ValueChanged += new System.EventHandler(this.lowBlueBar_ValueChanged);
|
||||
//
|
||||
// advColorDialog
|
||||
//
|
||||
@ -1754,15 +1853,6 @@
|
||||
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);
|
||||
@ -1789,6 +1879,7 @@
|
||||
this.lowLedPanel.ResumeLayout(false);
|
||||
this.lowLedPanel.PerformLayout();
|
||||
this.fullLedPanel.ResumeLayout(false);
|
||||
this.fullLedPanel.PerformLayout();
|
||||
this.tabOptions.ResumeLayout(false);
|
||||
this.tabControls.ResumeLayout(false);
|
||||
this.tabControls.PerformLayout();
|
||||
@ -1804,12 +1895,17 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.numUDTouch)).EndInit();
|
||||
this.tabLightBar.ResumeLayout(false);
|
||||
this.tabLightBar.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numUDRainbow)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pBRainbow)).EndInit();
|
||||
this.tabRumble.ResumeLayout(false);
|
||||
this.tabRumble.PerformLayout();
|
||||
this.tabOther.ResumeLayout(false);
|
||||
this.tabOther.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.idleDisconnectTimeout)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tBMouseSens)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.lowRedBar)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.lowGreenBar)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.lowBlueBar)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@ -1847,7 +1943,6 @@
|
||||
private System.Windows.Forms.Label lowBlueValLabel;
|
||||
private System.Windows.Forms.Label fullColorLabel;
|
||||
private System.Windows.Forms.Label lowColorLabel;
|
||||
private System.Windows.Forms.CheckBox lowLedCheckBox;
|
||||
private System.Windows.Forms.Panel lowLedPanel;
|
||||
private System.Windows.Forms.Panel fullLedPanel;
|
||||
private System.Windows.Forms.Button colorChooserButton;
|
||||
@ -1925,6 +2020,12 @@
|
||||
private System.Windows.Forms.Label lBMouseSens;
|
||||
private System.Windows.Forms.TrackBar tBMouseSens;
|
||||
private System.Windows.Forms.Label lBButtonMouseSens;
|
||||
private System.Windows.Forms.NumericUpDown numUDRainbow;
|
||||
private System.Windows.Forms.PictureBox pBRainbow;
|
||||
private System.Windows.Forms.Label lBspc;
|
||||
private System.Windows.Forms.TrackBar lowBlueBar;
|
||||
private System.Windows.Forms.TrackBar lowGreenBar;
|
||||
private System.Windows.Forms.TrackBar lowRedBar;
|
||||
}
|
||||
}
|
||||
|
@ -21,9 +21,9 @@ namespace ScpServer
|
||||
private List<Button> buttons = new List<Button>();
|
||||
//private Dictionary<string, string> defaults = new Dictionary<string, string>();
|
||||
private Button lastSelected;
|
||||
int alphacolor;
|
||||
Color reg;
|
||||
Color full;
|
||||
private int alphacolor;
|
||||
private Color reg, full;
|
||||
private Image colored, greyscale;
|
||||
|
||||
public Options(DS4Control.Control bus_device, int deviceNum, string name, ScpForm mainWindow)
|
||||
{
|
||||
@ -32,16 +32,24 @@ namespace ScpServer
|
||||
scpDevice = bus_device;
|
||||
filename = name;
|
||||
mainWin = mainWindow;
|
||||
if (filename != "" && filename != "+New Profile")
|
||||
colored = pBRainbow.Image;
|
||||
greyscale = GreyscaleImage((Bitmap)pBRainbow.Image);
|
||||
if (filename != "")
|
||||
{
|
||||
tBProfile.Text = filename;
|
||||
DS4Color color = Global.loadColor(device);
|
||||
redBar.Value = color.red;
|
||||
greenBar.Value = color.green;
|
||||
blueBar.Value = color.blue;
|
||||
|
||||
batteryLed.Checked = DS4Control.Global.getLedAsBatteryIndicator(device);
|
||||
DS4Color lowColor = Global.loadLowColor(device);
|
||||
lowRedBar.Value = lowColor.red;
|
||||
lowGreenBar.Value = lowColor.green;
|
||||
lowBlueBar.Value = lowColor.blue;
|
||||
|
||||
rumbleBoostBar.Value = DS4Control.Global.loadRumbleBoost(device);
|
||||
rumbleSwap.Checked = Global.getRumbleSwap(device);
|
||||
batteryLed.Checked = DS4Control.Global.getLedAsBatteryIndicator(device);
|
||||
flashLed.Checked = DS4Control.Global.getFlashWhenLowBattery(device);
|
||||
numUDTouch.Value = Global.getTouchSensitivity(device);
|
||||
numUDScroll.Value = Global.getScrollSensitivity(device);
|
||||
@ -50,7 +58,6 @@ namespace ScpServer
|
||||
cBDoubleTap.Checked = Global.getDoubleTap(device);
|
||||
leftTriggerMiddlePoint.Text = Global.getLeftTriggerMiddle(device).ToString();
|
||||
rightTriggerMiddlePoint.Text = Global.getRightTriggerMiddle(device).ToString();
|
||||
DS4Color lowColor = Global.loadLowColor(device);
|
||||
touchpadJitterCompensation.Checked = Global.getTouchpadJitterCompensation(device);
|
||||
cBlowerRCOn.Checked = Global.getLowerRCOn(device);
|
||||
flushHIDQueue.Checked = Global.getFlushHIDQueue(device);
|
||||
@ -63,38 +70,29 @@ namespace ScpServer
|
||||
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
||||
colorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||
pBController.BackColor = colorChooserButton.BackColor;
|
||||
lowColorChooserButton.BackColor = Color.FromArgb(lowColor.red, lowColor.green, lowColor.blue);
|
||||
|
||||
alphacolor = Math.Max(lowRedBar.Value, Math.Max(greenBar.Value, blueBar.Value));
|
||||
reg = Color.FromArgb(lowColor.red, lowColor.green, lowColor.blue);
|
||||
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
||||
lowColorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||
lowRedValLabel.Text = lowColor.red.ToString();
|
||||
lowGreenValLabel.Text = lowColor.green.ToString();
|
||||
lowBlueValLabel.Text = lowColor.blue.ToString();
|
||||
numUDRainbow.Value = (decimal)Global.getRainbow(device);
|
||||
if (Global.getRainbow(device) == 0)
|
||||
{
|
||||
pBRainbow.Image = greyscale;
|
||||
ToggleRainbow(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
pBRainbow.Image = colored;
|
||||
ToggleRainbow(true);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.saveColor(device,
|
||||
(byte)redBar.Value,
|
||||
(byte)greenBar.Value,
|
||||
(byte)blueBar.Value);
|
||||
Global.saveLowColor(device,
|
||||
(byte)redBar.Value,
|
||||
(byte)greenBar.Value,
|
||||
(byte)blueBar.Value);
|
||||
double middle;
|
||||
if (Double.TryParse(leftTriggerMiddlePoint.Text, out middle))
|
||||
Global.setLeftTriggerMiddle(device, middle);
|
||||
if (Double.TryParse(rightTriggerMiddlePoint.Text, out middle))
|
||||
Global.setRightTriggerMiddle(device, middle);
|
||||
Global.saveRumbleBoost(device, (byte)rumbleBoostBar.Value);
|
||||
scpDevice.setRumble((byte)leftMotorBar.Value, (byte)rightMotorBar.Value, device);
|
||||
Global.setRumbleSwap(device, rumbleSwap.Checked);
|
||||
Global.setTouchSensitivity(device, (byte)numUDTouch.Value);
|
||||
Global.setTouchpadJitterCompensation(device, touchpadJitterCompensation.Checked);
|
||||
Global.setLowerRCOn(device, cBlowerRCOn.Checked);
|
||||
Global.setTapSensitivity(device, (byte)numUDTap.Value);
|
||||
Global.setDoubleTap(device, cBDoubleTap.Checked);
|
||||
Global.setScrollSensitivity(device, (byte)numUDScroll.Value);
|
||||
Global.setIdleDisconnectTimeout(device, (int)idleDisconnectTimeout.Value);
|
||||
Global.setButtonMouseSensitivity(device, tBMouseSens.Value);
|
||||
}
|
||||
Set();
|
||||
#region watch sixaxis data
|
||||
// Control Positioning
|
||||
int horizontalOffset = cbSixaxis.Location.X,
|
||||
@ -309,22 +307,13 @@ namespace ScpServer
|
||||
}
|
||||
private void btnLightbar_Click(object sender, EventArgs e)
|
||||
{
|
||||
//tabOptions.SelectTab(3);
|
||||
if (lowLedCheckBox.Checked)
|
||||
lowColorChooserButton_Click(sender, e);
|
||||
else colorChooserButton_Click(sender, e);
|
||||
|
||||
}
|
||||
|
||||
private void saveButton_Click(object sender, EventArgs e)
|
||||
private void Set()
|
||||
{
|
||||
Global.saveColor(device,
|
||||
(byte)redBar.Value,
|
||||
(byte)greenBar.Value,
|
||||
(byte)blueBar.Value);
|
||||
Global.saveLowColor(device,
|
||||
lowColorChooserButton.BackColor.R,
|
||||
lowColorChooserButton.BackColor.G,
|
||||
lowColorChooserButton.BackColor.B);
|
||||
Global.saveColor(device, (byte)redBar.Value, (byte)greenBar.Value, (byte)blueBar.Value);
|
||||
Global.saveLowColor(device, (byte)lowRedBar.Value, (byte)lowGreenBar.Value, (byte)lowBlueBar.Value);
|
||||
double middle;
|
||||
if (Double.TryParse(leftTriggerMiddlePoint.Text, out middle))
|
||||
Global.setLeftTriggerMiddle(device, middle);
|
||||
@ -337,11 +326,21 @@ namespace ScpServer
|
||||
Global.setTouchpadJitterCompensation(device, touchpadJitterCompensation.Checked);
|
||||
Global.setLowerRCOn(device, cBlowerRCOn.Checked);
|
||||
Global.setScrollSensitivity(device, (byte)numUDScroll.Value);
|
||||
int disconnectTimeout;
|
||||
if (int.TryParse(idleDisconnectTimeout.Text, out disconnectTimeout))
|
||||
Global.setIdleDisconnectTimeout(device, disconnectTimeout);
|
||||
Global.setDoubleTap(device, cBDoubleTap.Checked);
|
||||
Global.setButtonMouseSensitivity(device, tBMouseSens.Value);
|
||||
Global.setTapSensitivity(device, (byte)numUDTap.Value);
|
||||
Global.setIdleDisconnectTimeout(device, (int)idleDisconnectTimeout.Value);
|
||||
Global.setButtonMouseSensitivity(device, tBMouseSens.Value);
|
||||
Global.setRainbow(device, (int)numUDRainbow.Value);
|
||||
if (numUDRainbow.Value == 0)
|
||||
pBRainbow.Image = greyscale;
|
||||
else
|
||||
pBRainbow.Image = colored;
|
||||
}
|
||||
|
||||
private void saveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Set();
|
||||
|
||||
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("|"))
|
||||
{
|
||||
@ -357,91 +356,72 @@ namespace ScpServer
|
||||
|
||||
private void redBar_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
// New settings
|
||||
if (lowLedCheckBox.Checked)
|
||||
{
|
||||
//lowRedValLabel.Text = redBar.Value.ToString();
|
||||
lowColorChooserButton.BackColor = Color.FromArgb(
|
||||
redBar.Value,
|
||||
lowColorChooserButton.BackColor.G,
|
||||
lowColorChooserButton.BackColor.B);
|
||||
Global.saveLowColor(device, (byte)redBar.Value, lowColorChooserButton.BackColor.G, lowColorChooserButton.BackColor.B);
|
||||
}
|
||||
else
|
||||
{
|
||||
alphacolor = Math.Max(redBar.Value, Math.Max(greenBar.Value, blueBar.Value));
|
||||
reg = Color.FromArgb(redBar.Value, greenBar.Value, blueBar.Value);
|
||||
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
||||
colorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor +50)), full);
|
||||
Global.saveColor(device, (byte)redBar.Value, (byte)greenBar.Value, (byte)blueBar.Value);
|
||||
pBController.BackColor = colorChooserButton.BackColor;
|
||||
// Previous implementation
|
||||
redValLabel.Text = redBar.Value.ToString();
|
||||
//redValLabel.Text = (colorChooserButton.BackColor.GetBrightness() * 255 * 2).ToString();
|
||||
}
|
||||
alphacolor = Math.Max(redBar.Value, Math.Max(greenBar.Value, blueBar.Value));
|
||||
reg = Color.FromArgb(redBar.Value, greenBar.Value, blueBar.Value);
|
||||
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
||||
colorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||
Global.saveColor(device, (byte)redBar.Value, (byte)greenBar.Value, (byte)blueBar.Value);
|
||||
|
||||
pBController.BackColor = colorChooserButton.BackColor;
|
||||
redValLabel.Text = redBar.Value.ToString();
|
||||
}
|
||||
private void greenBar_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
// New settings
|
||||
if (lowLedCheckBox.Checked)
|
||||
{
|
||||
lowGreenValLabel.Text = greenBar.Value.ToString();
|
||||
lowColorChooserButton.BackColor = Color.FromArgb(
|
||||
lowColorChooserButton.BackColor.R,
|
||||
greenBar.Value,
|
||||
lowColorChooserButton.BackColor.B);
|
||||
Global.saveLowColor(device, lowColorChooserButton.BackColor.R, (byte)greenBar.Value, lowColorChooserButton.BackColor.B);
|
||||
}
|
||||
else
|
||||
{
|
||||
alphacolor = Math.Max(redBar.Value, Math.Max(greenBar.Value, blueBar.Value));
|
||||
reg = Color.FromArgb(redBar.Value, greenBar.Value, blueBar.Value);
|
||||
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
||||
colorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||
Global.saveColor(device, (byte)redBar.Value, (byte)greenBar.Value, (byte)blueBar.Value);
|
||||
alphacolor = Math.Max(redBar.Value, Math.Max(greenBar.Value, blueBar.Value));
|
||||
reg = Color.FromArgb(redBar.Value, greenBar.Value, blueBar.Value);
|
||||
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
||||
colorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||
Global.saveColor(device, (byte)redBar.Value, (byte)greenBar.Value, (byte)blueBar.Value);
|
||||
|
||||
pBController.BackColor = colorChooserButton.BackColor;
|
||||
// Previous implementation
|
||||
greenValLabel.Text = greenBar.Value.ToString();
|
||||
}
|
||||
pBController.BackColor = colorChooserButton.BackColor;
|
||||
greenValLabel.Text = greenBar.Value.ToString();
|
||||
}
|
||||
private void blueBar_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
// New settings
|
||||
if (lowLedCheckBox.Checked)
|
||||
{
|
||||
lowBlueValLabel.Text = blueBar.Value.ToString();
|
||||
lowColorChooserButton.BackColor = Color.FromArgb(
|
||||
lowColorChooserButton.BackColor.R,
|
||||
lowColorChooserButton.BackColor.G,
|
||||
blueBar.Value);
|
||||
//if (realTimeChangesCheckBox.Checked)
|
||||
Global.saveLowColor(device,
|
||||
lowColorChooserButton.BackColor.R,
|
||||
lowColorChooserButton.BackColor.G,
|
||||
(byte)blueBar.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
alphacolor = Math.Max(redBar.Value, Math.Max(greenBar.Value, blueBar.Value));
|
||||
reg = Color.FromArgb(redBar.Value, greenBar.Value, blueBar.Value);
|
||||
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
||||
colorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||
//if (realTimeChangesCheckBox.Checked)
|
||||
Global.saveColor(device, (byte)redBar.Value,
|
||||
(byte)greenBar.Value,
|
||||
(byte)blueBar.Value);
|
||||
alphacolor = Math.Max(redBar.Value, Math.Max(greenBar.Value, blueBar.Value));
|
||||
reg = Color.FromArgb(redBar.Value, greenBar.Value, blueBar.Value);
|
||||
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
||||
colorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||
Global.saveColor(device, (byte)redBar.Value, (byte)greenBar.Value, (byte)blueBar.Value);
|
||||
|
||||
pBController.BackColor = colorChooserButton.BackColor;
|
||||
// Previous implementation
|
||||
blueValLabel.Text = blueBar.Value.ToString();
|
||||
}
|
||||
pBController.BackColor = colorChooserButton.BackColor;
|
||||
blueValLabel.Text = blueBar.Value.ToString();
|
||||
}
|
||||
|
||||
private void lowRedBar_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
alphacolor = Math.Max(lowRedBar.Value, Math.Max(lowGreenBar.Value, lowBlueBar.Value));
|
||||
reg = Color.FromArgb(lowRedBar.Value, lowGreenBar.Value, lowBlueBar.Value);
|
||||
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
||||
lowColorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||
Global.saveLowColor(device, (byte)lowRedBar.Value, (byte)lowGreenBar.Value, (byte)lowBlueBar.Value);
|
||||
lowRedValLabel.Text = lowRedBar.Value.ToString();
|
||||
}
|
||||
|
||||
private void lowGreenBar_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
alphacolor = Math.Max(lowRedBar.Value, Math.Max(lowGreenBar.Value, lowBlueBar.Value));
|
||||
reg = Color.FromArgb(lowRedBar.Value, lowGreenBar.Value, lowBlueBar.Value);
|
||||
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
||||
lowColorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||
Global.saveLowColor(device, (byte)lowRedBar.Value, (byte)lowGreenBar.Value, (byte)lowBlueBar.Value);
|
||||
lowGreenValLabel.Text = lowGreenBar.Value.ToString();
|
||||
}
|
||||
|
||||
private void lowBlueBar_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
alphacolor = Math.Max(lowRedBar.Value, Math.Max(lowGreenBar.Value, lowBlueBar.Value));
|
||||
reg = Color.FromArgb(lowRedBar.Value, lowGreenBar.Value, lowBlueBar.Value);
|
||||
full = HuetoRGB(reg.GetHue(), reg.GetSaturation());
|
||||
lowColorChooserButton.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||
Global.saveLowColor(device, (byte)lowRedBar.Value, (byte)lowGreenBar.Value, (byte)lowBlueBar.Value);
|
||||
lowBlueValLabel.Text = lowBlueBar.Value.ToString();
|
||||
}
|
||||
|
||||
public Color HuetoRGB(float hue, float sat)
|
||||
{
|
||||
int C = (int)(sat*255);
|
||||
int X = (int)((sat * (float)(1 - Math.Abs((hue / 60) % 2 - 1)))*255);
|
||||
int C = (int)(sat * 255);
|
||||
int X = (int)((sat * (float)(1 - Math.Abs((hue / 60) % 2 - 1))) * 255);
|
||||
if (sat == 0)
|
||||
return Color.FromName("White");
|
||||
else if (0 <= hue && hue < 60)
|
||||
@ -501,30 +481,6 @@ namespace ScpServer
|
||||
|
||||
private void lowBatteryLed_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lowLedCheckBox.Checked)
|
||||
{
|
||||
fullLedPanel.Enabled = false;
|
||||
redBar.Value = int.Parse(lowRedValLabel.Text);
|
||||
greenBar.Value = int.Parse(lowGreenValLabel.Text);
|
||||
blueBar.Value = int.Parse(lowBlueValLabel.Text);
|
||||
|
||||
Global.saveLowColor(device,
|
||||
lowColorChooserButton.BackColor.R,
|
||||
lowColorChooserButton.BackColor.G,
|
||||
lowColorChooserButton.BackColor.B);
|
||||
}
|
||||
else
|
||||
{
|
||||
fullLedPanel.Enabled = true;
|
||||
redBar.Value = int.Parse(redValLabel.Text);
|
||||
greenBar.Value = int.Parse(greenValLabel.Text);
|
||||
blueBar.Value = int.Parse(blueValLabel.Text);
|
||||
|
||||
Global.saveColor(device,
|
||||
colorChooserButton.BackColor.R,
|
||||
colorChooserButton.BackColor.G,
|
||||
colorChooserButton.BackColor.B);
|
||||
}
|
||||
}
|
||||
private void ledAsBatteryIndicator_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
@ -534,14 +490,19 @@ namespace ScpServer
|
||||
if (batteryLed.Checked)
|
||||
{
|
||||
lowLedPanel.Visible = true;
|
||||
lowLedCheckBox.Visible = true;
|
||||
//lowLedCheckBox.Visible = true;
|
||||
fullLedPanel.Size = new Size(174, 127);
|
||||
fullColorLabel.Visible = true;
|
||||
|
||||
|
||||
Global.setLedAsBatteryIndicator(device, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
lowLedPanel.Visible = false;
|
||||
lowLedCheckBox.Visible = false;
|
||||
//lowLedCheckBox.Visible = false;
|
||||
fullLedPanel.Size = new Size(351, 127);
|
||||
fullColorLabel.Visible = false;
|
||||
|
||||
Global.setLedAsBatteryIndicator(device, false);
|
||||
}
|
||||
@ -563,9 +524,7 @@ namespace ScpServer
|
||||
|
||||
private void pictureBox_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (lowLedCheckBox.Checked)
|
||||
lowColorChooserButton_Click(sender, e);
|
||||
else colorChooserButton_Click(sender, e);
|
||||
colorChooserButton_Click(sender, e);
|
||||
}
|
||||
private void colorChooserButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
@ -577,15 +536,12 @@ namespace ScpServer
|
||||
greenValLabel.Text = advColorDialog.Color.G.ToString();
|
||||
blueValLabel.Text = advColorDialog.Color.B.ToString();
|
||||
colorChooserButton.BackColor = advColorDialog.Color;
|
||||
if (!lowLedCheckBox.Checked)
|
||||
{
|
||||
redBar.Value = advColorDialog.Color.R;
|
||||
greenBar.Value = advColorDialog.Color.G;
|
||||
blueBar.Value = advColorDialog.Color.B;
|
||||
}
|
||||
redBar.Value = advColorDialog.Color.R;
|
||||
greenBar.Value = advColorDialog.Color.G;
|
||||
blueBar.Value = advColorDialog.Color.B;
|
||||
}
|
||||
else Global.saveColor(device, oldLedColor[0], oldLedColor[1], oldLedColor[2]);
|
||||
Global.saveLowColor(device, oldLowLedColor[0], oldLowLedColor[1], oldLowLedColor[2]);
|
||||
//Global.saveLowColor(device, oldLowLedColor[0], oldLowLedColor[1], oldLowLedColor[2]);
|
||||
oldLedColor = null;
|
||||
oldLowLedColor = null;
|
||||
}
|
||||
@ -599,12 +555,9 @@ namespace ScpServer
|
||||
lowGreenValLabel.Text = advColorDialog.Color.G.ToString();
|
||||
lowBlueValLabel.Text = advColorDialog.Color.B.ToString();
|
||||
lowColorChooserButton.BackColor = advColorDialog.Color;
|
||||
if (lowLedCheckBox.Checked)
|
||||
{
|
||||
redBar.Value = advColorDialog.Color.R;
|
||||
greenBar.Value = advColorDialog.Color.G;
|
||||
blueBar.Value = advColorDialog.Color.B;
|
||||
}
|
||||
lowRedBar.Value = advColorDialog.Color.R;
|
||||
lowGreenBar.Value = advColorDialog.Color.G;
|
||||
lowBlueBar.Value = advColorDialog.Color.B;
|
||||
}
|
||||
else Global.saveLowColor(device, oldLowLedColor[0], oldLowLedColor[1], oldLowLedColor[2]);
|
||||
Global.saveColor(device, oldLedColor[0], oldLedColor[1], oldLedColor[2]);
|
||||
@ -827,5 +780,73 @@ namespace ScpServer
|
||||
Global.setButtonMouseSensitivity(device, tBMouseSens.Value);
|
||||
lBMouseSens.Text = tBMouseSens.Value.ToString();
|
||||
}
|
||||
|
||||
private void numUDRainbow_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
Global.setRainbow(device, (double)numUDRainbow.Value);
|
||||
}
|
||||
|
||||
private void pictureBox2_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (pBRainbow.Image == greyscale)
|
||||
{
|
||||
pBRainbow.Image = colored;
|
||||
ToggleRainbow(true);
|
||||
numUDRainbow.Value = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
pBRainbow.Image = greyscale;
|
||||
ToggleRainbow(false);
|
||||
numUDRainbow.Value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleRainbow(bool on)
|
||||
{
|
||||
numUDRainbow.Visible = on;
|
||||
if (on)
|
||||
{
|
||||
pBRainbow.Location = new Point(137, 139);
|
||||
batteryLed.Text = "Battery Level Dim";
|
||||
}
|
||||
else
|
||||
{
|
||||
pBRainbow.Location = new Point(215, 139);
|
||||
batteryLed.Text = "Battery Level Color";
|
||||
}
|
||||
lBspc.Visible = on;
|
||||
fullLedPanel.Enabled = !on;
|
||||
lowLedPanel.Enabled = !on;
|
||||
flashLed.Enabled = !on;
|
||||
}
|
||||
|
||||
private Bitmap GreyscaleImage(Bitmap image)
|
||||
{
|
||||
Bitmap c = (Bitmap)image;
|
||||
Bitmap d = new Bitmap(c.Width, c.Height);
|
||||
|
||||
for (int i = 0; i < c.Width; i++)
|
||||
{
|
||||
for (int x = 0; x < c.Height; x++)
|
||||
{
|
||||
Color oc = c.GetPixel(i, x);
|
||||
int grayScale = (int)((oc.R * 0.3) + (oc.G * 0.59) + (oc.B * 0.11));
|
||||
Color nc = Color.FromArgb(oc.A, grayScale, grayScale, grayScale);
|
||||
d.SetPixel(i, x, nc);
|
||||
}
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
private void fullColorLabel_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void tabLightBar_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -144,4 +144,7 @@
|
||||
<data name="mouse" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\mouse.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="rainbow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\rainbow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
10
DS4Tool/Properties/Resources1.Designer.cs
generated
10
DS4Tool/Properties/Resources1.Designer.cs
generated
@ -100,6 +100,16 @@ namespace ScpServer.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap rainbow {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("rainbow", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Start.
|
||||
/// </summary>
|
||||
|
BIN
DS4Tool/Resources/rainbow.png
Normal file
BIN
DS4Tool/Resources/rainbow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 655 B |
@ -271,7 +271,8 @@ namespace ScpServer
|
||||
//if (Index == 0)
|
||||
// checkFirst = false;
|
||||
}
|
||||
tooltip += "\n[" + (Index + 1) + "] " + rootHub.getShortDS4ControllerInfo(Index); // Carefully stay under the 63 character limit.
|
||||
if (rootHub.getShortDS4ControllerInfo(Index) != "None")
|
||||
tooltip += "\n" + (Index + 1) + ": " + rootHub.getShortDS4ControllerInfo(Index); // Carefully stay under the 63 character limit.
|
||||
}
|
||||
btnClear.Enabled = lvDebug.Items.Count > 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user