mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-26 02:54:20 +01:00
Added max saturation setting for rainbow lightbar mode
Related to issue #802
This commit is contained in:
parent
114b07699a
commit
9b25bb83cb
@ -76,10 +76,17 @@ namespace DS4Windows
|
||||
else if (counters[deviceNum] > 180000)
|
||||
counters[deviceNum] = 0;
|
||||
|
||||
double maxSat = GetMaxSatRainbow(deviceNum);
|
||||
if (getLedAsBatteryIndicator(deviceNum))
|
||||
color = HuetoRGB((float)counters[deviceNum] % 360, (byte)(device.getBattery() * 2.55));
|
||||
{
|
||||
byte useSat = (byte)(maxSat == 1.0 ?
|
||||
device.getBattery() * 2.55 :
|
||||
device.getBattery() * 2.55 * maxSat);
|
||||
color = HuetoRGB((float)counters[deviceNum] % 360, useSat);
|
||||
}
|
||||
else
|
||||
color = HuetoRGB((float)counters[deviceNum] % 360, 255);
|
||||
color = HuetoRGB((float)counters[deviceNum] % 360,
|
||||
(byte)(maxSat == 1.0 ? 255 : 255 * maxSat));
|
||||
|
||||
}
|
||||
else if (getLedAsBatteryIndicator(deviceNum))
|
||||
|
@ -759,6 +759,12 @@ namespace DS4Windows
|
||||
return m_Config.rainbow[index];
|
||||
}
|
||||
|
||||
public static double[] MaxSatRainbow => m_Config.maxRainbowSat;
|
||||
public static double GetMaxSatRainbow(int index)
|
||||
{
|
||||
return m_Config.maxRainbowSat[index];
|
||||
}
|
||||
|
||||
public static bool[] FlushHIDQueue => m_Config.flushHIDQueue;
|
||||
public static bool getFlushHIDQueue(int index)
|
||||
{
|
||||
@ -1879,6 +1885,8 @@ namespace DS4Windows
|
||||
new DS4Color(Color.Blue)
|
||||
};
|
||||
|
||||
public double[] maxRainbowSat = new double[5] { 1.0, 1.0, 1.0, 1.0, 1.0 };
|
||||
|
||||
public int[] chargingType = new int[5] { 0, 0, 0, 0, 0 };
|
||||
public string[] launchProgram = new string[5] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public bool[] dinputOnly = new bool[5] { false, false, false, false, false };
|
||||
@ -2217,6 +2225,7 @@ namespace DS4Windows
|
||||
XmlNode xmlR2Maxzone = m_Xdoc.CreateNode(XmlNodeType.Element, "R2MaxZone", null); xmlR2Maxzone.InnerText = r2ModInfo[device].maxZone.ToString(); Node.AppendChild(xmlR2Maxzone);
|
||||
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 xmlMaxSatRainbow = m_Xdoc.CreateNode(XmlNodeType.Element, "MaxSatRainbow", null); xmlMaxSatRainbow.InnerText = Convert.ToInt32(maxRainbowSat[device] * 100.0).ToString(); Node.AppendChild(xmlMaxSatRainbow);
|
||||
XmlNode xmlLSD = m_Xdoc.CreateNode(XmlNodeType.Element, "LSDeadZone", null); xmlLSD.InnerText = lsModInfo[device].deadZone.ToString(); Node.AppendChild(xmlLSD);
|
||||
XmlNode xmlRSD = m_Xdoc.CreateNode(XmlNodeType.Element, "RSDeadZone", null); xmlRSD.InnerText = rsModInfo[device].deadZone.ToString(); Node.AppendChild(xmlRSD);
|
||||
XmlNode xmlLSAD = m_Xdoc.CreateNode(XmlNodeType.Element, "LSAntiDeadZone", null); xmlLSAD.InnerText = lsModInfo[device].antiDeadZone.ToString(); Node.AppendChild(xmlLSAD);
|
||||
@ -2974,6 +2983,11 @@ namespace DS4Windows
|
||||
catch { missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/Rainbow"); double.TryParse(Item.InnerText, out rainbow[device]); }
|
||||
catch { rainbow[device] = 0; missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/MaxSatRainbow");
|
||||
int.TryParse(Item.InnerText, out int temp);
|
||||
maxRainbowSat[device] = Math.Max(0, Math.Min(100, temp)) / 100.0;
|
||||
}
|
||||
catch { maxRainbowSat[device] = 1.0; missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSDeadZone"); int.TryParse(Item.InnerText, out lsModInfo[device].deadZone); }
|
||||
catch { lsModInfo[device].deadZone = 10; missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSDeadZone"); int.TryParse(Item.InnerText, out rsModInfo[device].deadZone); }
|
||||
@ -4566,6 +4580,7 @@ namespace DS4Windows
|
||||
scrollSensitivity[device] = 0;
|
||||
touchpadInvert[device] = 0;
|
||||
rainbow[device] = 0;
|
||||
maxRainbowSat[device] = 1.0;
|
||||
flashAt[device] = 0;
|
||||
mouseAccel[device] = false;
|
||||
btPollRate[device] = 4;
|
||||
|
49
DS4Windows/DS4Forms/Options.Designer.cs
generated
49
DS4Windows/DS4Forms/Options.Designer.cs
generated
@ -256,8 +256,6 @@
|
||||
this.lbWhileCharging = new System.Windows.Forms.Label();
|
||||
this.panel5 = new System.Windows.Forms.Panel();
|
||||
this.btnRainbow = new System.Windows.Forms.Button();
|
||||
this.lbRainbowB = new System.Windows.Forms.Label();
|
||||
this.nUDRainbowB = new System.Windows.Forms.NumericUpDown();
|
||||
this.nUDRainbow = new System.Windows.Forms.NumericUpDown();
|
||||
this.lbspc = new System.Windows.Forms.Label();
|
||||
this.tabAxis = new System.Windows.Forms.TabPage();
|
||||
@ -454,6 +452,8 @@
|
||||
this.panel12 = new System.Windows.Forms.Panel();
|
||||
this.OutContTypeCb = new System.Windows.Forms.ComboBox();
|
||||
this.outcontLb = new System.Windows.Forms.Label();
|
||||
this.maxRainSatTB = new System.Windows.Forms.TrackBar();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDTap)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDScroll)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDTouch)).BeginInit();
|
||||
@ -501,7 +501,6 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDflashLED)).BeginInit();
|
||||
this.panel4.SuspendLayout();
|
||||
this.panel5.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDRainbowB)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDRainbow)).BeginInit();
|
||||
this.tabAxis.SuspendLayout();
|
||||
this.flowLayoutPanel3.SuspendLayout();
|
||||
@ -570,6 +569,7 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDIdleDisconnect)).BeginInit();
|
||||
this.panel11.SuspendLayout();
|
||||
this.panel12.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.maxRainSatTB)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// cBLightbyBattery
|
||||
@ -2712,9 +2712,9 @@
|
||||
//
|
||||
// panel5
|
||||
//
|
||||
this.panel5.Controls.Add(this.label1);
|
||||
this.panel5.Controls.Add(this.maxRainSatTB);
|
||||
this.panel5.Controls.Add(this.btnRainbow);
|
||||
this.panel5.Controls.Add(this.lbRainbowB);
|
||||
this.panel5.Controls.Add(this.nUDRainbowB);
|
||||
this.panel5.Controls.Add(this.nUDRainbow);
|
||||
this.panel5.Controls.Add(this.lbspc);
|
||||
resources.ApplyResources(this.panel5, "panel5");
|
||||
@ -2727,26 +2727,6 @@
|
||||
this.btnRainbow.Name = "btnRainbow";
|
||||
this.btnRainbow.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// lbRainbowB
|
||||
//
|
||||
resources.ApplyResources(this.lbRainbowB, "lbRainbowB");
|
||||
this.lbRainbowB.Name = "lbRainbowB";
|
||||
//
|
||||
// nUDRainbowB
|
||||
//
|
||||
resources.ApplyResources(this.nUDRainbowB, "nUDRainbowB");
|
||||
this.nUDRainbowB.Maximum = new decimal(new int[] {
|
||||
150,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nUDRainbowB.Name = "nUDRainbowB";
|
||||
this.nUDRainbowB.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// nUDRainbow
|
||||
//
|
||||
resources.ApplyResources(this.nUDRainbow, "nUDRainbow");
|
||||
@ -4717,6 +4697,19 @@
|
||||
resources.ApplyResources(this.outcontLb, "outcontLb");
|
||||
this.outcontLb.Name = "outcontLb";
|
||||
//
|
||||
// maxRainSatTB
|
||||
//
|
||||
resources.ApplyResources(this.maxRainSatTB, "maxRainSatTB");
|
||||
this.maxRainSatTB.Maximum = 100;
|
||||
this.maxRainSatTB.Name = "maxRainSatTB";
|
||||
this.maxRainSatTB.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||
this.maxRainSatTB.Value = 100;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
resources.ApplyResources(this.label1, "label1");
|
||||
this.label1.Name = "label1";
|
||||
//
|
||||
// Options
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
@ -4785,7 +4778,6 @@
|
||||
this.panel4.PerformLayout();
|
||||
this.panel5.ResumeLayout(false);
|
||||
this.panel5.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDRainbowB)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDRainbow)).EndInit();
|
||||
this.tabAxis.ResumeLayout(false);
|
||||
this.flowLayoutPanel3.ResumeLayout(false);
|
||||
@ -4871,6 +4863,7 @@
|
||||
this.panel11.PerformLayout();
|
||||
this.panel12.ResumeLayout(false);
|
||||
this.panel12.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.maxRainSatTB)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@ -5103,8 +5096,6 @@
|
||||
private System.Windows.Forms.Label lbWhileCharging;
|
||||
private System.Windows.Forms.Panel panel5;
|
||||
private System.Windows.Forms.Button btnRainbow;
|
||||
private System.Windows.Forms.Label lbRainbowB;
|
||||
private System.Windows.Forms.NumericUpDown nUDRainbowB;
|
||||
private System.Windows.Forms.NumericUpDown nUDRainbow;
|
||||
private System.Windows.Forms.Label lbspc;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
|
||||
@ -5300,5 +5291,7 @@
|
||||
private System.Windows.Forms.LinkLabel lbSixZCurveEditorURL;
|
||||
private System.Windows.Forms.TextBox tBSixXCustomOutputCurve;
|
||||
private System.Windows.Forms.LinkLabel lbSixXCurveEditorURL;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TrackBar maxRainSatTB;
|
||||
}
|
||||
}
|
@ -438,6 +438,7 @@ namespace DS4Windows.Forms
|
||||
cBLightbyBattery.Click += ledAsBatteryIndicator_CheckedChanged;
|
||||
btnRainbow.Click += btnRainbow_Click;
|
||||
nUDRainbow.ValueChanged += numUDRainbow_ValueChanged;
|
||||
maxRainSatTB.ValueChanged += MaxRainSatTB_ValueChanged;
|
||||
|
||||
// Other events
|
||||
nUDRumbleBoost.ValueChanged += rumbleBoostBar_ValueChanged;
|
||||
@ -457,6 +458,14 @@ namespace DS4Windows.Forms
|
||||
OutContTypeCb.SelectedIndexChanged += OutContTypeCb_SelectedIndexChanged;
|
||||
}
|
||||
|
||||
private void MaxRainSatTB_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (loading == false)
|
||||
{
|
||||
MaxSatRainbow[device] = maxRainSatTB.Value / 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
private void LbSixZCurveEditorURL_Click(object sender, EventArgs e)
|
||||
{
|
||||
string customDefinition = szOutBezierCurveObj[device].ToString();
|
||||
@ -625,6 +634,8 @@ namespace DS4Windows.Forms
|
||||
else
|
||||
btnFlashColor.BackColor = Color.FromArgb(fColor.red, fColor.green, fColor.blue);
|
||||
|
||||
maxRainSatTB.Value = (int)(MaxSatRainbow[device] * 100.0);
|
||||
|
||||
nUDRumbleBoost.Value = RumbleBoost[device];
|
||||
nUDTouch.Value = TouchSensitivity[device];
|
||||
cBSlide.Checked = TouchSensitivity[device] > 0;
|
||||
@ -1095,6 +1106,7 @@ namespace DS4Windows.Forms
|
||||
pBHoveredButton.Image = null;
|
||||
|
||||
nUDRainbow.Value = 0;
|
||||
maxRainSatTB.Value = 100;
|
||||
nUDL2.Value = 0;
|
||||
nUDR2.Value = 0;
|
||||
nUDL2Maxzone.Value = 1;
|
||||
@ -1643,6 +1655,7 @@ namespace DS4Windows.Forms
|
||||
|
||||
IdleDisconnectTimeout[device] = (int)(nUDIdleDisconnect.Value * 60);
|
||||
Rainbow[device] = (int)nUDRainbow.Value;
|
||||
MaxSatRainbow[device] = maxRainSatTB.Value / 100.0;
|
||||
RSModInfo[device].deadZone = (int)Math.Round((nUDRS.Value * 127), 0);
|
||||
LSModInfo[device].deadZone = (int)Math.Round((nUDLS.Value * 127), 0);
|
||||
LSModInfo[device].antiDeadZone = (int)(nUDLSAntiDead.Value * 100);
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user