Enforce lightbar mode setting

This commit is contained in:
Travis Nickles 2020-02-22 16:09:33 -06:00
parent fcb081ee5d
commit 6442030926

View File

@ -45,7 +45,8 @@ namespace DS4Windows
bool useForceLight = forcelight[deviceNum]; bool useForceLight = forcelight[deviceNum];
LightbarSettingInfo lightbarSettingInfo = getLightbarSettingsInfo(deviceNum); LightbarSettingInfo lightbarSettingInfo = getLightbarSettingsInfo(deviceNum);
LightbarDS4WinInfo lightModeInfo = lightbarSettingInfo.ds4winSettings; LightbarDS4WinInfo lightModeInfo = lightbarSettingInfo.ds4winSettings;
if (!defaultLight && !useForceLight && lightbarSettingInfo.mode == LightbarMode.DS4Win) bool useLightRoutine = lightbarSettingInfo.mode == LightbarMode.DS4Win;
if (!defaultLight && !useForceLight && useLightRoutine)
{ {
if (lightModeInfo.useCustomLed) if (lightModeInfo.useCustomLed)
{ {
@ -256,17 +257,25 @@ namespace DS4Windows
else if (useForceLight) else if (useForceLight)
{ {
color = forcedColor[deviceNum]; color = forcedColor[deviceNum];
useLightRoutine = true;
} }
else if (shuttingdown) else if (shuttingdown)
{
color = new DS4Color(0, 0, 0); color = new DS4Color(0, 0, 0);
useLightRoutine = true;
}
else else
{ {
if (device.getConnectionType() == ConnectionType.BT) if (device.getConnectionType() == ConnectionType.BT)
color = new DS4Color(32, 64, 64); color = new DS4Color(32, 64, 64);
else else
color = new DS4Color(0, 0, 0); color = new DS4Color(0, 0, 0);
useLightRoutine = true;
} }
if (useLightRoutine)
{
bool distanceprofile = DistanceProfiles[deviceNum] || tempprofileDistance[deviceNum]; bool distanceprofile = DistanceProfiles[deviceNum] || tempprofileDistance[deviceNum];
//distanceprofile = (ProfilePath[deviceNum].ToLower().Contains("distance") || tempprofilename[deviceNum].ToLower().Contains("distance")); //distanceprofile = (ProfilePath[deviceNum].ToLower().Contains("distance") || tempprofilename[deviceNum].ToLower().Contains("distance"));
if (distanceprofile && !defaultLight) if (distanceprofile && !defaultLight)
@ -280,7 +289,6 @@ namespace DS4Windows
DS4Color redCol = new DS4Color(255, 0, 0); DS4Color redCol = new DS4Color(255, 0, 0);
color = getTransitionedColor(ref maxCol, ref redCol, rumble); color = getTransitionedColor(ref maxCol, ref redCol, rumble);
} }
else else
{ {
DS4Color maxCol = new DS4Color(max, max, 0); DS4Color maxCol = new DS4Color(max, max, 0);
@ -290,7 +298,6 @@ namespace DS4Windows
color = getTransitionedColor(ref color, ref tempCol, color = getTransitionedColor(ref color, ref tempCol,
device.getLeftHeavySlowRumble()); device.getLeftHeavySlowRumble());
} }
} }
DS4HapticState haptics = new DS4HapticState DS4HapticState haptics = new DS4HapticState
@ -338,6 +345,7 @@ namespace DS4Windows
device.SetHapticState(ref haptics); device.SetHapticState(ref haptics);
//device.pushHapticState(ref haptics); //device.pushHapticState(ref haptics);
} }
}
public static bool defaultLight = false, shuttingdown = false; public static bool defaultLight = false, shuttingdown = false;