mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-22 09:19:18 +01:00
Group fields used for lightbar routine
This commit is contained in:
parent
456e1dc410
commit
53fc454a20
@ -42,22 +42,25 @@ namespace DS4Windows
|
||||
public static void updateLightBar(DS4Device device, int deviceNum)
|
||||
{
|
||||
DS4Color color;
|
||||
if (!defaultLight && !forcelight[deviceNum])
|
||||
bool useForceLight = forcelight[deviceNum];
|
||||
LightbarSettingInfo lightbarSettingInfo = getLightbarSettingsInfo(deviceNum);
|
||||
LightbarDS4WinInfo lightModeInfo = lightbarSettingInfo.ds4winSettings;
|
||||
if (!defaultLight && !useForceLight)
|
||||
{
|
||||
if (getUseCustomLed(deviceNum))
|
||||
if (lightModeInfo.useCustomLed)
|
||||
{
|
||||
if (getLedAsBatteryIndicator(deviceNum))
|
||||
if (lightModeInfo.ledAsBattery)
|
||||
{
|
||||
ref DS4Color fullColor = ref getCustomColor(deviceNum);
|
||||
ref DS4Color lowColor = ref getLowColor(deviceNum);
|
||||
ref DS4Color fullColor = ref lightModeInfo.m_CustomLed; // ref getCustomColor(deviceNum);
|
||||
ref DS4Color lowColor = ref lightModeInfo.m_LowLed; //ref getLowColor(deviceNum);
|
||||
color = getTransitionedColor(ref lowColor, ref fullColor, device.getBattery());
|
||||
}
|
||||
else
|
||||
color = getCustomColor(deviceNum);
|
||||
color = lightModeInfo.m_CustomLed; //getCustomColor(deviceNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
double rainbow = getRainbow(deviceNum);
|
||||
double rainbow = lightModeInfo.rainbow;// getRainbow(deviceNum);
|
||||
if (rainbow > 0)
|
||||
{
|
||||
// Display rainbow
|
||||
@ -76,8 +79,8 @@ namespace DS4Windows
|
||||
else if (counters[deviceNum] > 180000)
|
||||
counters[deviceNum] = 0;
|
||||
|
||||
double maxSat = GetMaxSatRainbow(deviceNum);
|
||||
if (getLedAsBatteryIndicator(deviceNum))
|
||||
double maxSat = lightModeInfo.maxRainbowSat; // GetMaxSatRainbow(deviceNum);
|
||||
if (lightModeInfo.ledAsBattery)
|
||||
{
|
||||
byte useSat = (byte)(maxSat == 1.0 ?
|
||||
device.getBattery() * 2.55 :
|
||||
@ -89,10 +92,10 @@ namespace DS4Windows
|
||||
(byte)(maxSat == 1.0 ? 255 : 255 * maxSat));
|
||||
|
||||
}
|
||||
else if (getLedAsBatteryIndicator(deviceNum))
|
||||
else if (lightModeInfo.ledAsBattery)
|
||||
{
|
||||
ref DS4Color fullColor = ref getMainColor(deviceNum);
|
||||
ref DS4Color lowColor = ref getLowColor(deviceNum);
|
||||
ref DS4Color fullColor = ref lightModeInfo.m_Led; //ref getMainColor(deviceNum);
|
||||
ref DS4Color lowColor = ref lightModeInfo.m_LowLed; //ref getLowColor(deviceNum);
|
||||
color = getTransitionedColor(ref lowColor, ref fullColor, device.getBattery());
|
||||
}
|
||||
else
|
||||
@ -101,15 +104,15 @@ namespace DS4Windows
|
||||
}
|
||||
}
|
||||
|
||||
if (device.getBattery() <= getFlashAt(deviceNum) && !defaultLight && !device.isCharging())
|
||||
if (device.getBattery() <= lightModeInfo.flashAt && !defaultLight && !device.isCharging())
|
||||
{
|
||||
ref DS4Color flashColor = ref getFlashColor(deviceNum);
|
||||
ref DS4Color flashColor = ref lightModeInfo.m_FlashLed; //ref getFlashColor(deviceNum);
|
||||
if (!(flashColor.red == 0 &&
|
||||
flashColor.green == 0 &&
|
||||
flashColor.blue == 0))
|
||||
color = flashColor;
|
||||
|
||||
if (getFlashType(deviceNum) == 1)
|
||||
if (lightModeInfo.flashType == 1)
|
||||
{
|
||||
double ratio = 0.0;
|
||||
|
||||
@ -158,10 +161,10 @@ namespace DS4Windows
|
||||
}
|
||||
|
||||
int idleDisconnectTimeout = getIdleDisconnectTimeout(deviceNum);
|
||||
if (idleDisconnectTimeout > 0 && getLedAsBatteryIndicator(deviceNum) &&
|
||||
if (idleDisconnectTimeout > 0 && lightModeInfo.ledAsBattery &&
|
||||
(!device.isCharging() || device.getBattery() >= 100))
|
||||
{
|
||||
//Fade lightbar by idle time
|
||||
// Fade lightbar by idle time
|
||||
TimeSpan timeratio = new TimeSpan(DateTime.UtcNow.Ticks - device.lastActive.Ticks);
|
||||
double botratio = timeratio.TotalMilliseconds;
|
||||
double topratio = TimeSpan.FromSeconds(idleDisconnectTimeout).TotalMilliseconds;
|
||||
@ -182,7 +185,7 @@ namespace DS4Windows
|
||||
|
||||
if (device.isCharging() && device.getBattery() < 100)
|
||||
{
|
||||
switch (getChargingType(deviceNum))
|
||||
switch (lightModeInfo.chargingType)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
@ -243,14 +246,14 @@ namespace DS4Windows
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
color = getChargingColor(deviceNum);
|
||||
color = lightModeInfo.m_ChargingLed; //getChargingColor(deviceNum);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (forcelight[deviceNum])
|
||||
else if (useForceLight)
|
||||
{
|
||||
color = forcedColor[deviceNum];
|
||||
}
|
||||
@ -297,12 +300,12 @@ namespace DS4Windows
|
||||
|
||||
if (haptics.IsLightBarSet())
|
||||
{
|
||||
if (forcelight[deviceNum] && forcedFlash[deviceNum] > 0)
|
||||
if (useForceLight && forcedFlash[deviceNum] > 0)
|
||||
{
|
||||
haptics.LightBarFlashDurationOff = haptics.LightBarFlashDurationOn = (byte)(25 - forcedFlash[deviceNum]);
|
||||
haptics.LightBarExplicitlyOff = true;
|
||||
}
|
||||
else if (device.getBattery() <= getFlashAt(deviceNum) && getFlashType(deviceNum) == 0 && !defaultLight && !device.isCharging())
|
||||
else if (device.getBattery() <= lightModeInfo.flashAt && lightModeInfo.flashType == 0 && !defaultLight && !device.isCharging())
|
||||
{
|
||||
int level = device.getBattery() / 10;
|
||||
if (level >= 10)
|
||||
|
@ -43,4 +43,56 @@ namespace DS4Windows
|
||||
public bool useSmoothing;
|
||||
public double smoothWeight;
|
||||
}
|
||||
|
||||
public enum LightbarMode : uint
|
||||
{
|
||||
None,
|
||||
DS4Win,
|
||||
Passthru,
|
||||
}
|
||||
|
||||
public class LightbarDS4WinInfo
|
||||
{
|
||||
public bool useCustomLed;
|
||||
public bool ledAsBattery;
|
||||
public DS4Color m_CustomLed = new DS4Color(0, 0, 255);
|
||||
public DS4Color m_Led;
|
||||
public DS4Color m_LowLed;
|
||||
public DS4Color m_ChargingLed;
|
||||
public DS4Color m_FlashLed;
|
||||
public double rainbow;
|
||||
public double maxRainbowSat = 1.0;
|
||||
public int flashAt;
|
||||
public byte flashType;
|
||||
public int chargingType;
|
||||
}
|
||||
|
||||
public class LightbarSettingInfo
|
||||
{
|
||||
public LightbarMode mode = LightbarMode.DS4Win;
|
||||
public LightbarDS4WinInfo ds4winSettings = new LightbarDS4WinInfo();
|
||||
public LightbarMode Mode
|
||||
{
|
||||
get => mode;
|
||||
set
|
||||
{
|
||||
if (mode == value) return;
|
||||
mode = value;
|
||||
ChangedMode?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
public event EventHandler ChangedMode;
|
||||
|
||||
public LightbarSettingInfo()
|
||||
{
|
||||
/*ChangedMode += (sender, e) =>
|
||||
{
|
||||
if (mode != LightbarMode.DS4Win)
|
||||
{
|
||||
ds4winSettings = null;
|
||||
}
|
||||
};
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
@ -1066,6 +1066,12 @@ namespace DS4Windows
|
||||
return m_Config.chargingType[index];
|
||||
}
|
||||
|
||||
public static LightbarSettingInfo[] LightbarSettingsInfo => m_Config.lightbarSettingInfo;
|
||||
public static LightbarSettingInfo getLightbarSettingsInfo(int index)
|
||||
{
|
||||
return m_Config.lightbarSettingInfo[index];
|
||||
}
|
||||
|
||||
public static bool[] DinputOnly => m_Config.dinputOnly;
|
||||
public static bool getDInputOnly(int index)
|
||||
{
|
||||
@ -1223,40 +1229,46 @@ namespace DS4Windows
|
||||
public static void SetGyroMouseToggle(int index, bool value, ControlService control)
|
||||
=> m_Config.SetGyroMouseToggle(index, value, control);
|
||||
|
||||
public static DS4Color[] MainColor => m_Config.m_Leds;
|
||||
//public static DS4Color[] MainColor => m_Config.m_Leds;
|
||||
public static ref DS4Color getMainColor(int index)
|
||||
{
|
||||
return ref m_Config.m_Leds[index];
|
||||
return ref m_Config.lightbarSettingInfo[index].ds4winSettings.m_Led;
|
||||
//return ref m_Config.m_Leds[index];
|
||||
}
|
||||
|
||||
public static DS4Color[] LowColor => m_Config.m_LowLeds;
|
||||
//public static DS4Color[] LowColor => m_Config.m_LowLeds;
|
||||
public static ref DS4Color getLowColor(int index)
|
||||
{
|
||||
return ref m_Config.m_LowLeds[index];
|
||||
return ref m_Config.lightbarSettingInfo[index].ds4winSettings.m_LowLed;
|
||||
//return ref m_Config.m_LowLeds[index];
|
||||
}
|
||||
|
||||
public static DS4Color[] ChargingColor => m_Config.m_ChargingLeds;
|
||||
//public static DS4Color[] ChargingColor => m_Config.m_ChargingLeds;
|
||||
public static ref DS4Color getChargingColor(int index)
|
||||
{
|
||||
return ref m_Config.m_ChargingLeds[index];
|
||||
return ref m_Config.lightbarSettingInfo[index].ds4winSettings.m_ChargingLed;
|
||||
//return ref m_Config.m_ChargingLeds[index];
|
||||
}
|
||||
|
||||
public static DS4Color[] CustomColor => m_Config.m_CustomLeds;
|
||||
//public static DS4Color[] CustomColor => m_Config.m_CustomLeds;
|
||||
public static ref DS4Color getCustomColor(int index)
|
||||
{
|
||||
return ref m_Config.m_CustomLeds[index];
|
||||
return ref m_Config.lightbarSettingInfo[index].ds4winSettings.m_CustomLed;
|
||||
//return ref m_Config.m_CustomLeds[index];
|
||||
}
|
||||
|
||||
public static bool[] UseCustomLed => m_Config.useCustomLeds;
|
||||
//public static bool[] UseCustomLed => m_Config.useCustomLeds;
|
||||
public static bool getUseCustomLed(int index)
|
||||
{
|
||||
return m_Config.useCustomLeds[index];
|
||||
return m_Config.lightbarSettingInfo[index].ds4winSettings.useCustomLed;
|
||||
//return m_Config.useCustomLeds[index];
|
||||
}
|
||||
|
||||
public static DS4Color[] FlashColor => m_Config.m_FlashLeds;
|
||||
//public static DS4Color[] FlashColor => m_Config.m_FlashLeds;
|
||||
public static ref DS4Color getFlashColor(int index)
|
||||
{
|
||||
return ref m_Config.m_FlashLeds[index];
|
||||
return ref m_Config.lightbarSettingInfo[index].ds4winSettings.m_FlashLed;
|
||||
//return ref m_Config.m_FlashLeds[index];
|
||||
}
|
||||
|
||||
public static byte[] TapSensitivity => m_Config.tapSensitivity;
|
||||
@ -2140,6 +2152,13 @@ namespace DS4Windows
|
||||
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 LightbarSettingInfo[] lightbarSettingInfo = new LightbarSettingInfo[5]
|
||||
{
|
||||
new LightbarSettingInfo(), new LightbarSettingInfo(),
|
||||
new LightbarSettingInfo(), new LightbarSettingInfo(),
|
||||
new LightbarSettingInfo()
|
||||
};
|
||||
|
||||
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 };
|
||||
public bool[] startTouchpadOff = new bool[5] { false, false, false, false, false };
|
||||
@ -2154,10 +2173,12 @@ namespace DS4Windows
|
||||
public bool[] gyroMouseStickTriggerTurns = new bool[5] { true, true, true, true, true };
|
||||
public GyroMouseStickInfo[] gyroMStickInfo = new GyroMouseStickInfo[5]
|
||||
{
|
||||
new GyroMouseStickInfo(), new GyroMouseStickInfo(),
|
||||
new GyroMouseStickInfo(),
|
||||
new GyroMouseStickInfo(),
|
||||
new GyroMouseStickInfo(), new GyroMouseStickInfo(),
|
||||
new GyroMouseStickInfo()
|
||||
};
|
||||
|
||||
public bool[] gyroMouseStickToggle = new bool[5] { false, false, false,
|
||||
false, false };
|
||||
|
||||
@ -2249,6 +2270,17 @@ namespace DS4Windows
|
||||
profileActions[i].Add("Disconnect Controller");
|
||||
profileActionCount[i] = profileActions[i].Count;
|
||||
}
|
||||
|
||||
SetupDefaultColors();
|
||||
}
|
||||
|
||||
private void SetupDefaultColors()
|
||||
{
|
||||
lightbarSettingInfo[0].ds4winSettings.m_Led = new DS4Color(Color.Blue);
|
||||
lightbarSettingInfo[1].ds4winSettings.m_Led = new DS4Color(Color.Red);
|
||||
lightbarSettingInfo[2].ds4winSettings.m_Led = new DS4Color(Color.Green);
|
||||
lightbarSettingInfo[3].ds4winSettings.m_Led = new DS4Color(Color.Pink);
|
||||
lightbarSettingInfo[4].ds4winSettings.m_Led = new DS4Color(Color.White);
|
||||
}
|
||||
|
||||
private string stickOutputCurveString(int id)
|
||||
@ -2450,26 +2482,28 @@ namespace DS4Windows
|
||||
|
||||
Node = m_Xdoc.CreateNode(XmlNodeType.Element, "DS4Windows", null);
|
||||
|
||||
LightbarDS4WinInfo lightInfo = lightbarSettingInfo[device].ds4winSettings;
|
||||
|
||||
XmlNode xmlFlushHIDQueue = m_Xdoc.CreateNode(XmlNodeType.Element, "flushHIDQueue", null); xmlFlushHIDQueue.InnerText = flushHIDQueue[device].ToString(); Node.AppendChild(xmlFlushHIDQueue);
|
||||
XmlNode xmlTouchToggle = m_Xdoc.CreateNode(XmlNodeType.Element, "touchToggle", null); xmlTouchToggle.InnerText = enableTouchToggle[device].ToString(); Node.AppendChild(xmlTouchToggle);
|
||||
XmlNode xmlIdleDisconnectTimeout = m_Xdoc.CreateNode(XmlNodeType.Element, "idleDisconnectTimeout", null); xmlIdleDisconnectTimeout.InnerText = idleDisconnectTimeout[device].ToString(); Node.AppendChild(xmlIdleDisconnectTimeout);
|
||||
XmlNode xmlColor = m_Xdoc.CreateNode(XmlNodeType.Element, "Color", null);
|
||||
xmlColor.InnerText = m_Leds[device].red.ToString() + "," + m_Leds[device].green.ToString() + "," + m_Leds[device].blue.ToString();
|
||||
xmlColor.InnerText = lightInfo.m_Led.red.ToString() + "," + lightInfo.m_Led.green.ToString() + "," + lightInfo.m_Led.blue.ToString();
|
||||
Node.AppendChild(xmlColor);
|
||||
XmlNode xmlRumbleBoost = m_Xdoc.CreateNode(XmlNodeType.Element, "RumbleBoost", null); xmlRumbleBoost.InnerText = rumble[device].ToString(); Node.AppendChild(xmlRumbleBoost);
|
||||
XmlNode xmlRumbleAutostopTime = m_Xdoc.CreateNode(XmlNodeType.Element, "RumbleAutostopTime", null); xmlRumbleAutostopTime.InnerText = rumbleAutostopTime[device].ToString(); Node.AppendChild(xmlRumbleAutostopTime);
|
||||
XmlNode xmlLedAsBatteryIndicator = m_Xdoc.CreateNode(XmlNodeType.Element, "ledAsBatteryIndicator", null); xmlLedAsBatteryIndicator.InnerText = ledAsBattery[device].ToString(); Node.AppendChild(xmlLedAsBatteryIndicator);
|
||||
XmlNode xmlLowBatteryFlash = m_Xdoc.CreateNode(XmlNodeType.Element, "FlashType", null); xmlLowBatteryFlash.InnerText = flashType[device].ToString(); Node.AppendChild(xmlLowBatteryFlash);
|
||||
XmlNode xmlFlashBatterAt = m_Xdoc.CreateNode(XmlNodeType.Element, "flashBatteryAt", null); xmlFlashBatterAt.InnerText = flashAt[device].ToString(); Node.AppendChild(xmlFlashBatterAt);
|
||||
XmlNode xmlLedAsBatteryIndicator = m_Xdoc.CreateNode(XmlNodeType.Element, "ledAsBatteryIndicator", null); xmlLedAsBatteryIndicator.InnerText = lightInfo.ledAsBattery.ToString(); Node.AppendChild(xmlLedAsBatteryIndicator);
|
||||
XmlNode xmlLowBatteryFlash = m_Xdoc.CreateNode(XmlNodeType.Element, "FlashType", null); xmlLowBatteryFlash.InnerText = lightInfo.flashType.ToString(); Node.AppendChild(xmlLowBatteryFlash);
|
||||
XmlNode xmlFlashBatterAt = m_Xdoc.CreateNode(XmlNodeType.Element, "flashBatteryAt", null); xmlFlashBatterAt.InnerText = lightInfo.flashAt.ToString(); Node.AppendChild(xmlFlashBatterAt);
|
||||
XmlNode xmlTouchSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "touchSensitivity", null); xmlTouchSensitivity.InnerText = touchSensitivity[device].ToString(); Node.AppendChild(xmlTouchSensitivity);
|
||||
XmlNode xmlLowColor = m_Xdoc.CreateNode(XmlNodeType.Element, "LowColor", null);
|
||||
xmlLowColor.InnerText = m_LowLeds[device].red.ToString() + "," + m_LowLeds[device].green.ToString() + "," + m_LowLeds[device].blue.ToString();
|
||||
xmlLowColor.InnerText = lightInfo.m_LowLed.red.ToString() + "," + lightInfo.m_LowLed.green.ToString() + "," + lightInfo.m_LowLed.blue.ToString();
|
||||
Node.AppendChild(xmlLowColor);
|
||||
XmlNode xmlChargingColor = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingColor", null);
|
||||
xmlChargingColor.InnerText = m_ChargingLeds[device].red.ToString() + "," + m_ChargingLeds[device].green.ToString() + "," + m_ChargingLeds[device].blue.ToString();
|
||||
xmlChargingColor.InnerText = lightInfo.m_ChargingLed.red.ToString() + "," + lightInfo.m_ChargingLed.green.ToString() + "," + lightInfo.m_ChargingLed.blue.ToString();
|
||||
Node.AppendChild(xmlChargingColor);
|
||||
XmlNode xmlFlashColor = m_Xdoc.CreateNode(XmlNodeType.Element, "FlashColor", null);
|
||||
xmlFlashColor.InnerText = m_FlashLeds[device].red.ToString() + "," + m_FlashLeds[device].green.ToString() + "," + m_FlashLeds[device].blue.ToString();
|
||||
xmlFlashColor.InnerText = lightInfo.m_FlashLed.red.ToString() + "," + lightInfo.m_FlashLed.green.ToString() + "," + lightInfo.m_FlashLed.blue.ToString();
|
||||
Node.AppendChild(xmlFlashColor);
|
||||
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);
|
||||
@ -2486,8 +2520,8 @@ namespace DS4Windows
|
||||
XmlNode xmlL2MaxOutput = m_Xdoc.CreateNode(XmlNodeType.Element, "L2MaxOutput", null); xmlL2MaxOutput.InnerText = l2ModInfo[device].maxOutput.ToString(); Node.AppendChild(xmlL2MaxOutput);
|
||||
XmlNode xmlR2MaxOutput = m_Xdoc.CreateNode(XmlNodeType.Element, "R2MaxOutput", null); xmlR2MaxOutput.InnerText = r2ModInfo[device].maxOutput.ToString(); Node.AppendChild(xmlR2MaxOutput);
|
||||
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 xmlRainbow = m_Xdoc.CreateNode(XmlNodeType.Element, "Rainbow", null); xmlRainbow.InnerText = lightInfo.rainbow.ToString(); Node.AppendChild(xmlRainbow);
|
||||
XmlNode xmlMaxSatRainbow = m_Xdoc.CreateNode(XmlNodeType.Element, "MaxSatRainbow", null); xmlMaxSatRainbow.InnerText = Convert.ToInt32(lightInfo.maxRainbowSat * 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);
|
||||
@ -2512,7 +2546,7 @@ namespace DS4Windows
|
||||
xmlSens.InnerText = $"{LSSens[device]}|{RSSens[device]}|{l2Sens[device]}|{r2Sens[device]}|{SXSens[device]}|{SZSens[device]}";
|
||||
Node.AppendChild(xmlSens);
|
||||
|
||||
XmlNode xmlChargingType = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingType", null); xmlChargingType.InnerText = chargingType[device].ToString(); Node.AppendChild(xmlChargingType);
|
||||
XmlNode xmlChargingType = m_Xdoc.CreateNode(XmlNodeType.Element, "ChargingType", null); xmlChargingType.InnerText = lightInfo.chargingType.ToString(); Node.AppendChild(xmlChargingType);
|
||||
XmlNode xmlMouseAccel = m_Xdoc.CreateNode(XmlNodeType.Element, "MouseAcceleration", null); xmlMouseAccel.InnerText = mouseAccel[device].ToString(); Node.AppendChild(xmlMouseAccel);
|
||||
//XmlNode xmlShiftMod = m_Xdoc.CreateNode(XmlNodeType.Element, "ShiftModifier", null); xmlShiftMod.InnerText = shiftModifier[device].ToString(); Node.AppendChild(xmlShiftMod);
|
||||
XmlNode xmlLaunchProgram = m_Xdoc.CreateNode(XmlNodeType.Element, "LaunchProgram", null); xmlLaunchProgram.InnerText = launchProgram[device].ToString(); Node.AppendChild(xmlLaunchProgram);
|
||||
@ -3065,6 +3099,7 @@ namespace DS4Windows
|
||||
}
|
||||
|
||||
OutContType oldContType = Global.activeOutDevType[device];
|
||||
LightbarDS4WinInfo lightInfo = lightbarSettingInfo[device].ds4winSettings;
|
||||
|
||||
// Make sure to reset currently set profile values before parsing
|
||||
ResetProfile(device);
|
||||
@ -3087,21 +3122,21 @@ namespace DS4Windows
|
||||
else
|
||||
colors = new string[0];
|
||||
|
||||
m_Leds[device].red = byte.Parse(colors[0]);
|
||||
m_Leds[device].green = byte.Parse(colors[1]);
|
||||
m_Leds[device].blue = byte.Parse(colors[2]);
|
||||
lightInfo.m_Led.red = byte.Parse(colors[0]);
|
||||
lightInfo.m_Led.green = byte.Parse(colors[1]);
|
||||
lightInfo.m_Led.blue = byte.Parse(colors[2]);
|
||||
}
|
||||
catch { missingSetting = true; }
|
||||
|
||||
if (m_Xdoc.SelectSingleNode("/" + rootname + "/Color") == null)
|
||||
{
|
||||
//Old method of color saving
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/Red"); Byte.TryParse(Item.InnerText, out m_Leds[device].red); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/Red"); Byte.TryParse(Item.InnerText, out lightInfo.m_Led.red); }
|
||||
catch { missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/Green"); Byte.TryParse(Item.InnerText, out m_Leds[device].green); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/Green"); Byte.TryParse(Item.InnerText, out lightInfo.m_Led.green); }
|
||||
catch { missingSetting = true; }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/Blue"); Byte.TryParse(Item.InnerText, out m_Leds[device].blue); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/Blue"); Byte.TryParse(Item.InnerText, out lightInfo.m_Led.blue); }
|
||||
catch { missingSetting = true; }
|
||||
}
|
||||
|
||||
@ -3111,13 +3146,13 @@ namespace DS4Windows
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RumbleAutostopTime"); Int32.TryParse(Item.InnerText, out rumbleAutostopTime[device]); }
|
||||
catch { missingSetting = true; }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ledAsBatteryIndicator"); Boolean.TryParse(Item.InnerText, out ledAsBattery[device]); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ledAsBatteryIndicator"); Boolean.TryParse(Item.InnerText, out lightInfo.ledAsBattery); }
|
||||
catch { missingSetting = true; }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/FlashType"); Byte.TryParse(Item.InnerText, out flashType[device]); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/FlashType"); Byte.TryParse(Item.InnerText, out lightInfo.flashType); }
|
||||
catch { missingSetting = true; }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/flashBatteryAt"); Int32.TryParse(Item.InnerText, out flashAt[device]); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/flashBatteryAt"); Int32.TryParse(Item.InnerText, out lightInfo.flashAt); }
|
||||
catch { missingSetting = true; }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/touchSensitivity"); Byte.TryParse(Item.InnerText, out touchSensitivity[device]); }
|
||||
@ -3133,20 +3168,20 @@ namespace DS4Windows
|
||||
else
|
||||
colors = new string[0];
|
||||
|
||||
m_LowLeds[device].red = byte.Parse(colors[0]);
|
||||
m_LowLeds[device].green = byte.Parse(colors[1]);
|
||||
m_LowLeds[device].blue = byte.Parse(colors[2]);
|
||||
lightInfo.m_LowLed.red = byte.Parse(colors[0]);
|
||||
lightInfo.m_LowLed.green = byte.Parse(colors[1]);
|
||||
lightInfo.m_LowLed.blue = byte.Parse(colors[2]);
|
||||
}
|
||||
catch { missingSetting = true; }
|
||||
|
||||
if (m_Xdoc.SelectSingleNode("/" + rootname + "/LowColor") == null)
|
||||
{
|
||||
//Old method of color saving
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LowRed"); byte.TryParse(Item.InnerText, out m_LowLeds[device].red); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LowRed"); byte.TryParse(Item.InnerText, out lightInfo.m_LowLed.red); }
|
||||
catch { missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LowGreen"); byte.TryParse(Item.InnerText, out m_LowLeds[device].green); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LowGreen"); byte.TryParse(Item.InnerText, out lightInfo.m_LowLed.green); }
|
||||
catch { missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LowBlue"); byte.TryParse(Item.InnerText, out m_LowLeds[device].blue); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LowBlue"); byte.TryParse(Item.InnerText, out lightInfo.m_LowLed.blue); }
|
||||
catch { missingSetting = true; }
|
||||
}
|
||||
|
||||
@ -3160,19 +3195,19 @@ namespace DS4Windows
|
||||
else
|
||||
colors = new string[0];
|
||||
|
||||
m_ChargingLeds[device].red = byte.Parse(colors[0]);
|
||||
m_ChargingLeds[device].green = byte.Parse(colors[1]);
|
||||
m_ChargingLeds[device].blue = byte.Parse(colors[2]);
|
||||
lightInfo.m_ChargingLed.red = byte.Parse(colors[0]);
|
||||
lightInfo.m_ChargingLed.green = byte.Parse(colors[1]);
|
||||
lightInfo.m_ChargingLed.blue = byte.Parse(colors[2]);
|
||||
}
|
||||
catch { missingSetting = true; }
|
||||
|
||||
if (m_Xdoc.SelectSingleNode("/" + rootname + "/ChargingColor") == null)
|
||||
{
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ChargingRed"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device].red); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ChargingRed"); Byte.TryParse(Item.InnerText, out lightInfo.m_ChargingLed.red); }
|
||||
catch { missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ChargingGreen"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device].green); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ChargingGreen"); Byte.TryParse(Item.InnerText, out lightInfo.m_ChargingLed.green); }
|
||||
catch { missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ChargingBlue"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device].blue); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ChargingBlue"); Byte.TryParse(Item.InnerText, out lightInfo.m_ChargingLed.blue); }
|
||||
catch { missingSetting = true; }
|
||||
}
|
||||
|
||||
@ -3184,9 +3219,9 @@ namespace DS4Windows
|
||||
colors = Item.InnerText.Split(',');
|
||||
else
|
||||
colors = new string[0];
|
||||
m_FlashLeds[device].red = byte.Parse(colors[0]);
|
||||
m_FlashLeds[device].green = byte.Parse(colors[1]);
|
||||
m_FlashLeds[device].blue = byte.Parse(colors[2]);
|
||||
lightInfo.m_FlashLed.red = byte.Parse(colors[0]);
|
||||
lightInfo.m_FlashLed.green = byte.Parse(colors[1]);
|
||||
lightInfo.m_FlashLed.blue = byte.Parse(colors[2]);
|
||||
}
|
||||
catch { missingSetting = true; }
|
||||
|
||||
@ -3265,13 +3300,13 @@ namespace DS4Windows
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ButtonMouseSensitivity"); int.TryParse(Item.InnerText, out buttonMouseSensitivity[device]); }
|
||||
catch { missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/Rainbow"); double.TryParse(Item.InnerText, out rainbow[device]); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/Rainbow"); double.TryParse(Item.InnerText, out lightInfo.rainbow); }
|
||||
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;
|
||||
lightInfo.maxRainbowSat = Math.Max(0, Math.Min(100, temp)) / 100.0;
|
||||
}
|
||||
catch { maxRainbowSat[device] = 1.0; missingSetting = true; }
|
||||
catch { lightInfo.maxRainbowSat = 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); }
|
||||
@ -3365,7 +3400,7 @@ namespace DS4Windows
|
||||
}
|
||||
catch { missingSetting = true; }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ChargingType"); int.TryParse(Item.InnerText, out chargingType[device]); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ChargingType"); int.TryParse(Item.InnerText, out lightInfo.chargingType); }
|
||||
catch { missingSetting = true; }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/MouseAcceleration"); bool.TryParse(Item.InnerText, out mouseAccel[device]); }
|
||||
catch { missingSetting = true; }
|
||||
@ -4781,8 +4816,7 @@ namespace DS4Windows
|
||||
idleDisconnectTimeout[device] = 0;
|
||||
touchpadJitterCompensation[device] = true;
|
||||
lowerRCOn[device] = false;
|
||||
ledAsBattery[device] = false;
|
||||
flashType[device] = 0;
|
||||
|
||||
rumble[device] = 100;
|
||||
rumbleAutostopTime[device] = 0;
|
||||
touchSensitivity[device] = 100;
|
||||
@ -4806,13 +4840,12 @@ namespace DS4Windows
|
||||
doubleTap[device] = false;
|
||||
scrollSensitivity[device] = 0;
|
||||
touchpadInvert[device] = 0;
|
||||
rainbow[device] = 0;
|
||||
maxRainbowSat[device] = 1.0;
|
||||
flashAt[device] = 0;
|
||||
mouseAccel[device] = false;
|
||||
btPollRate[device] = 4;
|
||||
|
||||
m_LowLeds[device] = new DS4Color(Color.Black);
|
||||
LightbarDS4WinInfo lightInfo = lightbarSettingInfo[device].ds4winSettings;
|
||||
lightInfo.m_LowLed = new DS4Color(Color.Black);
|
||||
//m_LowLeds[device] = new DS4Color(Color.Black);
|
||||
|
||||
Color tempColor = Color.Blue;
|
||||
switch(device)
|
||||
@ -4825,13 +4858,29 @@ namespace DS4Windows
|
||||
default: tempColor = Color.Blue; break;
|
||||
}
|
||||
|
||||
m_Leds[device] = new DS4Color(tempColor);
|
||||
lightInfo.m_Led = new DS4Color(tempColor);
|
||||
lightInfo.m_ChargingLed = new DS4Color(Color.Black);
|
||||
lightInfo.m_FlashLed = new DS4Color(Color.Black);
|
||||
lightInfo.flashAt = 0;
|
||||
lightInfo.flashType = 0;
|
||||
lightInfo.chargingType = 0;
|
||||
lightInfo.rainbow = 0;
|
||||
lightInfo.maxRainbowSat = 1.0;
|
||||
lightInfo.ledAsBattery = false;
|
||||
|
||||
/*m_Leds[device] = new DS4Color(tempColor);
|
||||
m_ChargingLeds[device] = new DS4Color(Color.Black);
|
||||
m_FlashLeds[device] = new DS4Color(Color.Black);
|
||||
//useCustomLeds[device] = false;
|
||||
//m_CustomLeds[device] = new DS4Color(Color.Blue);
|
||||
|
||||
chargingType[device] = 0;
|
||||
rainbow[device] = 0;
|
||||
maxRainbowSat[device] = 1.0;
|
||||
flashAt[device] = 0;
|
||||
ledAsBattery[device] = false;
|
||||
flashType[device] = 0;
|
||||
*/
|
||||
launchProgram[device] = string.Empty;
|
||||
dinputOnly[device] = false;
|
||||
startTouchpadOff[device] = false;
|
||||
|
@ -198,13 +198,13 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
get
|
||||
{
|
||||
DS4Color color;
|
||||
if (Global.UseCustomLed[devIndex])
|
||||
if (Global.LightbarSettingsInfo[devIndex].ds4winSettings.useCustomLed)
|
||||
{
|
||||
color = Global.CustomColor[devIndex];
|
||||
color = Global.LightbarSettingsInfo[devIndex].ds4winSettings.m_CustomLed; //Global.CustomColor[devIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
color = Global.MainColor[devIndex];
|
||||
color = Global.LightbarSettingsInfo[devIndex].ds4winSettings.m_Led;
|
||||
}
|
||||
return $"#FF{color.red.ToString("X2")}{color.green.ToString("X2")}{color.blue.ToString("X2")}";
|
||||
}
|
||||
@ -217,7 +217,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
get
|
||||
{
|
||||
DS4Color color;
|
||||
color = Global.CustomColor[devIndex];
|
||||
color = Global.LightbarSettingsInfo[devIndex].ds4winSettings.m_CustomLed;
|
||||
return new Color() { R = color.red, G = color.green, B = color.blue, A = 255 };
|
||||
}
|
||||
}
|
||||
@ -321,7 +321,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
HookEvents(true);
|
||||
}
|
||||
|
||||
useCustomColor = Global.UseCustomLed[devIndex];
|
||||
useCustomColor = Global.LightbarSettingsInfo[devIndex].ds4winSettings.useCustomLed;
|
||||
}
|
||||
|
||||
public void ChangeSelectedProfile()
|
||||
@ -428,7 +428,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
{
|
||||
useCustomColor = false;
|
||||
RefreshLightContext();
|
||||
Global.UseCustomLed[devIndex] = false;
|
||||
Global.LightbarSettingsInfo[devIndex].ds4winSettings.useCustomLed = false;
|
||||
LightColorChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
@ -436,7 +436,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
{
|
||||
useCustomColor = true;
|
||||
RefreshLightContext();
|
||||
Global.UseCustomLed[devIndex] = true;
|
||||
Global.LightbarSettingsInfo[devIndex].ds4winSettings.useCustomLed = true;
|
||||
LightColorChanged?.Invoke(this, EventArgs.Empty);
|
||||
RequestColorPicker?.Invoke(this);
|
||||
}
|
||||
@ -449,7 +449,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public void UpdateCustomLightColor(Color color)
|
||||
{
|
||||
Global.CustomColor[devIndex] = new DS4Color() { red = color.R, green = color.G, blue = color.B };
|
||||
Global.LightbarSettingsInfo[devIndex].ds4winSettings.m_CustomLed = new DS4Color() { red = color.R, green = color.G, blue = color.B };
|
||||
LightColorChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
get
|
||||
{
|
||||
System.Windows.Media.Brush tempBrush;
|
||||
ref DS4Color color = ref Global.MainColor[device];
|
||||
ref DS4Color color = ref Global.LightbarSettingsInfo[device].ds4winSettings.m_Led;
|
||||
if (!RainbowExists)
|
||||
{
|
||||
lightbarColBrush.Color = new System.Windows.Media.Color()
|
||||
@ -54,7 +54,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
ref DS4Color color = ref Global.MainColor[device];
|
||||
ref DS4Color color = ref Global.LightbarSettingsInfo[device].ds4winSettings.m_Led; //ref Global.MainColor[device];
|
||||
return new System.Windows.Media.Color()
|
||||
{
|
||||
A = 255,
|
||||
@ -70,7 +70,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
ref DS4Color color = ref Global.MainColor[device];
|
||||
ref DS4Color color = ref Global.LightbarSettingsInfo[device].ds4winSettings.m_Led; //ref Global.MainColor[device];
|
||||
return $"#FF{color.red.ToString("X2")}{color.green.ToString("X2")}{color.blue.ToString("X2")}";
|
||||
/*return new System.Windows.Media.Color()
|
||||
{
|
||||
@ -86,10 +86,10 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public int MainColorR
|
||||
{
|
||||
get => Global.MainColor[device].red;
|
||||
get => Global.LightbarSettingsInfo[device].ds4winSettings.m_Led.red;
|
||||
set
|
||||
{
|
||||
Global.MainColor[device].red = (byte)value;
|
||||
Global.LightbarSettingsInfo[device].ds4winSettings.m_Led.red = (byte)value;
|
||||
MainColorRChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
@ -97,16 +97,16 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public string MainColorRString
|
||||
{
|
||||
get => $"#{ Global.MainColor[device].red.ToString("X2")}FF0000";
|
||||
get => $"#{ Global.LightbarSettingsInfo[device].ds4winSettings.m_Led.red.ToString("X2")}FF0000";
|
||||
}
|
||||
public event EventHandler MainColorRStringChanged;
|
||||
|
||||
public int MainColorG
|
||||
{
|
||||
get => Global.MainColor[device].green;
|
||||
get => Global.LightbarSettingsInfo[device].ds4winSettings.m_Led.green;
|
||||
set
|
||||
{
|
||||
Global.MainColor[device].green = (byte)value;
|
||||
Global.LightbarSettingsInfo[device].ds4winSettings.m_Led.green = (byte)value;
|
||||
MainColorGChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
@ -114,16 +114,16 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public string MainColorGString
|
||||
{
|
||||
get => $"#{ Global.MainColor[device].green.ToString("X2")}00FF00";
|
||||
get => $"#{ Global.LightbarSettingsInfo[device].ds4winSettings.m_Led.green.ToString("X2")}00FF00";
|
||||
}
|
||||
public event EventHandler MainColorGStringChanged;
|
||||
|
||||
public int MainColorB
|
||||
{
|
||||
get => Global.MainColor[device].blue;
|
||||
get => Global.LightbarSettingsInfo[device].ds4winSettings.m_Led.blue;
|
||||
set
|
||||
{
|
||||
Global.MainColor[device].blue = (byte)value;
|
||||
Global.LightbarSettingsInfo[device].ds4winSettings.m_Led.blue = (byte)value;
|
||||
MainColorBChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
@ -131,7 +131,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public string MainColorBString
|
||||
{
|
||||
get => $"#{ Global.MainColor[device].blue.ToString("X2")}0000FF";
|
||||
get => $"#{ Global.LightbarSettingsInfo[device].ds4winSettings.m_Led.blue.ToString("X2")}0000FF";
|
||||
}
|
||||
public event EventHandler MainColorBStringChanged;
|
||||
|
||||
@ -139,7 +139,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
ref DS4Color color = ref Global.LowColor[device];
|
||||
ref DS4Color color = ref Global.LightbarSettingsInfo[device].ds4winSettings.m_LowLed; //ref Global.LowColor[device];
|
||||
return $"#FF{color.red.ToString("X2")}{color.green.ToString("X2")}{color.blue.ToString("X2")}";
|
||||
}
|
||||
}
|
||||
@ -147,10 +147,10 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public int LowColorR
|
||||
{
|
||||
get => Global.LowColor[device].red;
|
||||
get => Global.LightbarSettingsInfo[device].ds4winSettings.m_LowLed.red;
|
||||
set
|
||||
{
|
||||
Global.LowColor[device].red = (byte)value;
|
||||
Global.LightbarSettingsInfo[device].ds4winSettings.m_LowLed.red = (byte)value;
|
||||
LowColorRChanged?.Invoke(this, EventArgs.Empty);
|
||||
LowColorRStringChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
@ -159,16 +159,16 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public string LowColorRString
|
||||
{
|
||||
get => $"#{ Global.LowColor[device].red.ToString("X2")}FF0000";
|
||||
get => $"#{ Global.LightbarSettingsInfo[device].ds4winSettings.m_LowLed.red.ToString("X2")}FF0000";
|
||||
}
|
||||
public event EventHandler LowColorRStringChanged;
|
||||
|
||||
public int LowColorG
|
||||
{
|
||||
get => Global.LowColor[device].green;
|
||||
get => Global.LightbarSettingsInfo[device].ds4winSettings.m_LowLed.green;
|
||||
set
|
||||
{
|
||||
Global.LowColor[device].green = (byte)value;
|
||||
Global.LightbarSettingsInfo[device].ds4winSettings.m_LowLed.green = (byte)value;
|
||||
LowColorGChanged?.Invoke(this, EventArgs.Empty);
|
||||
LowColorGStringChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
@ -177,16 +177,16 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public string LowColorGString
|
||||
{
|
||||
get => $"#{ Global.LowColor[device].green.ToString("X2")}00FF00";
|
||||
get => $"#{ Global.LightbarSettingsInfo[device].ds4winSettings.m_LowLed.green.ToString("X2")}00FF00";
|
||||
}
|
||||
public event EventHandler LowColorGStringChanged;
|
||||
|
||||
public int LowColorB
|
||||
{
|
||||
get => Global.LowColor[device].blue;
|
||||
get => Global.LightbarSettingsInfo[device].ds4winSettings.m_LowLed.blue;
|
||||
set
|
||||
{
|
||||
Global.LowColor[device].blue = (byte)value;
|
||||
Global.LightbarSettingsInfo[device].ds4winSettings.m_LowLed.blue = (byte)value;
|
||||
LowColorBChanged?.Invoke(this, EventArgs.Empty);
|
||||
LowColorBStringChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
@ -195,7 +195,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public string LowColorBString
|
||||
{
|
||||
get => $"#{ Global.LowColor[device].blue.ToString("X2")}0000FF";
|
||||
get => $"#{ Global.LightbarSettingsInfo[device].ds4winSettings.m_LowLed.blue.ToString("X2")}0000FF";
|
||||
}
|
||||
public event EventHandler LowColorBStringChanged;
|
||||
|
||||
@ -203,7 +203,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
ref DS4Color color = ref Global.LowColor[device];
|
||||
ref DS4Color color = ref Global.LightbarSettingsInfo[device].ds4winSettings.m_LowLed;
|
||||
return new System.Windows.Media.Color()
|
||||
{
|
||||
A = 255,
|
||||
@ -216,24 +216,24 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public int FlashTypeIndex
|
||||
{
|
||||
get => Global.FlashType[device];
|
||||
set => Global.FlashType[device] = (byte)value;
|
||||
get => Global.LightbarSettingsInfo[device].ds4winSettings.flashType; //Global.FlashType[device];
|
||||
set => Global.LightbarSettingsInfo[device].ds4winSettings.flashType = (byte)value;
|
||||
}
|
||||
|
||||
public int FlashAt
|
||||
{
|
||||
get => Global.FlashAt[device];
|
||||
set => Global.FlashAt[device] = value;
|
||||
get => Global.LightbarSettingsInfo[device].ds4winSettings.flashAt; //Global.FlashAt[device];
|
||||
set => Global.LightbarSettingsInfo[device].ds4winSettings.flashAt = value;
|
||||
}
|
||||
|
||||
public string FlashColor
|
||||
{
|
||||
get
|
||||
{
|
||||
ref DS4Color color = ref Global.FlashColor[device];
|
||||
ref DS4Color color = ref Global.LightbarSettingsInfo[device].ds4winSettings.m_FlashLed;
|
||||
if (color.red == 0 && color.green == 0 && color.blue == 0)
|
||||
{
|
||||
color = ref Global.MainColor[device];
|
||||
color = ref Global.LightbarSettingsInfo[device].ds4winSettings.m_Led;
|
||||
}
|
||||
|
||||
return $"#FF{color.red.ToString("X2")}{color.green.ToString("X2")}{color.blue.ToString("X2")}";
|
||||
@ -245,10 +245,10 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
ref DS4Color color = ref Global.FlashColor[device];
|
||||
ref DS4Color color = ref Global.LightbarSettingsInfo[device].ds4winSettings.m_FlashLed;
|
||||
if (color.red == 0 && color.green == 0 && color.blue == 0)
|
||||
{
|
||||
color = ref Global.MainColor[device];
|
||||
color = ref Global.LightbarSettingsInfo[device].ds4winSettings.m_Led;
|
||||
}
|
||||
|
||||
return new System.Windows.Media.Color()
|
||||
@ -263,20 +263,20 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public int ChargingType
|
||||
{
|
||||
get => Global.ChargingType[device];
|
||||
get => Global.LightbarSettingsInfo[device].ds4winSettings.chargingType;
|
||||
set
|
||||
{
|
||||
Global.ChargingType[device] = value;
|
||||
Global.LightbarSettingsInfo[device].ds4winSettings.chargingType = value;
|
||||
ChargingColorVisibleChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ColorBatteryPercent
|
||||
{
|
||||
get => Global.LedAsBatteryIndicator[device];
|
||||
get => Global.LightbarSettingsInfo[device].ds4winSettings.ledAsBattery;
|
||||
set
|
||||
{
|
||||
Global.LedAsBatteryIndicator[device] = value;
|
||||
Global.LightbarSettingsInfo[device].ds4winSettings.ledAsBattery = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
ref DS4Color color = ref Global.ChargingColor[device];
|
||||
ref DS4Color color = ref Global.LightbarSettingsInfo[device].ds4winSettings.m_ChargingLed;
|
||||
return $"#FF{color.red.ToString("X2")}{color.green.ToString("X2")}{color.blue.ToString("X2")}";
|
||||
}
|
||||
}
|
||||
@ -294,7 +294,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
ref DS4Color color = ref Global.ChargingColor[device];
|
||||
ref DS4Color color = ref Global.LightbarSettingsInfo[device].ds4winSettings.m_ChargingLed;
|
||||
return new System.Windows.Media.Color()
|
||||
{
|
||||
A = 255,
|
||||
@ -307,16 +307,16 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public Visibility ChargingColorVisible
|
||||
{
|
||||
get => Global.ChargingType[device] == 3 ? Visibility.Visible : Visibility.Hidden;
|
||||
get => Global.LightbarSettingsInfo[device].ds4winSettings.chargingType == 3 ? Visibility.Visible : Visibility.Hidden;
|
||||
}
|
||||
public event EventHandler ChargingColorVisibleChanged;
|
||||
|
||||
public double Rainbow
|
||||
{
|
||||
get => Global.Rainbow[device];
|
||||
get => Global.LightbarSettingsInfo[device].ds4winSettings.rainbow;
|
||||
set
|
||||
{
|
||||
Global.Rainbow[device] = value;
|
||||
Global.LightbarSettingsInfo[device].ds4winSettings.rainbow = value;
|
||||
RainbowChanged?.Invoke(this, EventArgs.Empty);
|
||||
RainbowExistsChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
@ -325,15 +325,15 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public bool RainbowExists
|
||||
{
|
||||
get => Global.Rainbow[device] != 0.0;
|
||||
get => Global.LightbarSettingsInfo[device].ds4winSettings.rainbow != 0.0;
|
||||
}
|
||||
|
||||
public event EventHandler RainbowExistsChanged;
|
||||
|
||||
public double MaxSatRainbow
|
||||
{
|
||||
get => Global.MaxSatRainbow[device] * 100.0;
|
||||
set => Global.MaxSatRainbow[device] = value / 100.0;
|
||||
get => Global.LightbarSettingsInfo[device].ds4winSettings.maxRainbowSat * 100.0;
|
||||
set => Global.LightbarSettingsInfo[device].ds4winSettings.maxRainbowSat = value / 100.0;
|
||||
}
|
||||
|
||||
public int RumbleBoost
|
||||
@ -1493,7 +1493,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
ButtonMouseSensitivityChanged += (sender, args) =>
|
||||
{
|
||||
OutputMouseSpeed = CalculateOutputMouseSpeed(ButtonMouseSensitivity);
|
||||
OutputMouseSpeed = CalculateOutputMouseSpeed(ButtonMouseSensitivity);
|
||||
};
|
||||
}
|
||||
|
||||
@ -1508,19 +1508,19 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public void UpdateFlashColor(System.Windows.Media.Color color)
|
||||
{
|
||||
Global.FlashColor[device] = new DS4Color() { red = color.R, green = color.G, blue = color.B };
|
||||
Global.LightbarSettingsInfo[device].ds4winSettings.m_FlashLed = new DS4Color() { red = color.R, green = color.G, blue = color.B };
|
||||
FlashColorChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public void UpdateMainColor(System.Windows.Media.Color color)
|
||||
{
|
||||
Global.MainColor[device] = new DS4Color() { red = color.R, green = color.G, blue = color.B };
|
||||
Global.LightbarSettingsInfo[device].ds4winSettings.m_Led = new DS4Color() { red = color.R, green = color.G, blue = color.B };
|
||||
MainColorChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public void UpdateLowColor(System.Windows.Media.Color color)
|
||||
{
|
||||
ref DS4Color lowColor = ref Global.LowColor[device];
|
||||
ref DS4Color lowColor = ref Global.LightbarSettingsInfo[device].ds4winSettings.m_LowLed;
|
||||
lowColor.red = color.R;
|
||||
lowColor.green = color.G;
|
||||
lowColor.blue = color.B;
|
||||
@ -1568,7 +1568,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
|
||||
public void UpdateChargingColor(System.Windows.Media.Color color)
|
||||
{
|
||||
ref DS4Color chargeColor = ref Global.ChargingColor[device];
|
||||
ref DS4Color chargeColor = ref Global.LightbarSettingsInfo[device].ds4winSettings.m_ChargingLed;
|
||||
chargeColor.red = color.R;
|
||||
chargeColor.green = color.G;
|
||||
chargeColor.blue = color.B;
|
||||
|
Loading…
Reference in New Issue
Block a user