mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-23 01:39:17 +01:00
Changes to fix Quick Charge option
This commit is contained in:
parent
7b1d7f243f
commit
63dddf4373
@ -7,6 +7,7 @@ using System.Media;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using static DS4Windows.Global;
|
||||
using System.Threading;
|
||||
|
||||
namespace DS4Windows
|
||||
{
|
||||
@ -242,7 +243,7 @@ namespace DS4Windows
|
||||
|
||||
CurrentState[i].Battery = PreviousState[i].Battery = 0; // Reset for the next connection's initial status change.
|
||||
x360Bus.Unplug(i);
|
||||
useDInputOnly[i] = false;
|
||||
useDInputOnly[i] = true;
|
||||
anyUnplugged = true;
|
||||
DS4Controllers[i] = null;
|
||||
touchPad[i] = null;
|
||||
@ -634,7 +635,7 @@ namespace DS4Windows
|
||||
touchPad[ind] = null;
|
||||
lag[ind] = false;
|
||||
inWarnMonitor[ind] = false;
|
||||
useDInputOnly[ind] = false;
|
||||
useDInputOnly[ind] = true;
|
||||
System.Threading.Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME);
|
||||
OnControllerRemoved(this, ind);
|
||||
}
|
||||
@ -671,9 +672,23 @@ namespace DS4Windows
|
||||
{
|
||||
int flashWhenLateAt = getFlashWhenLateAt();
|
||||
if (!lag[ind] && device.Latency >= flashWhenLateAt)
|
||||
LagFlashWarning(ind, true);
|
||||
{
|
||||
device.getUiContext()?.Post(new SendOrPostCallback(delegate (object state4)
|
||||
{
|
||||
LagFlashWarning(ind, true);
|
||||
}), null);
|
||||
|
||||
//LagFlashWarning(ind, true);
|
||||
}
|
||||
else if (lag[ind] && device.Latency < flashWhenLateAt)
|
||||
LagFlashWarning(ind, false);
|
||||
{
|
||||
device.getUiContext()?.Post(new SendOrPostCallback(delegate (object state4)
|
||||
{
|
||||
LagFlashWarning(ind, false);
|
||||
}), null);
|
||||
|
||||
//LagFlashWarning(ind, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -691,11 +706,22 @@ namespace DS4Windows
|
||||
if (!device.firstReport && device.IsAlive())
|
||||
{
|
||||
device.firstReport = true;
|
||||
OnDeviceStatusChanged(this, ind);
|
||||
device.getUiContext()?.Post(new SendOrPostCallback(delegate (object state4)
|
||||
{
|
||||
OnDeviceStatusChanged(this, ind);
|
||||
}), null);
|
||||
|
||||
//OnDeviceStatusChanged(this, ind);
|
||||
|
||||
}
|
||||
else if (pState.Battery != cState.Battery || device.oldCharging != device.isCharging())
|
||||
{
|
||||
OnBatteryStatusChange(this, ind, cState.Battery, device.isCharging());
|
||||
device.getUiContext()?.Post(new SendOrPostCallback(delegate (object state4)
|
||||
{
|
||||
OnBatteryStatusChange(this, ind, cState.Battery, device.isCharging());
|
||||
}), null);
|
||||
|
||||
//OnBatteryStatusChange(this, ind, cState.Battery, device.isCharging());
|
||||
}
|
||||
|
||||
if (getEnableTouchToggle(ind))
|
||||
|
@ -249,7 +249,7 @@ namespace DS4Windows
|
||||
public const int XINPUT_UNPLUG_SETTLE_TIME = 250; // Inhibit races that occur with the asynchronous teardown of ScpVBus -> X360 driver instance.
|
||||
public static string[] tempprofilename = new string[5] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public static bool[] tempprofileDistance = new bool[5] { false, false, false, false, false };
|
||||
public static bool[] useDInputOnly = new bool[5] { false, false, false, false, false };
|
||||
public static bool[] useDInputOnly = new bool[5] { true, true, true, true, true };
|
||||
|
||||
public static X360Controls[] defaultButtonMapping = { X360Controls.None, X360Controls.LXNeg, X360Controls.LXPos,
|
||||
X360Controls.LYNeg, X360Controls.LYPos, X360Controls.RXNeg, X360Controls.RXPos, X360Controls.RYNeg, X360Controls.RYPos,
|
||||
|
@ -384,6 +384,11 @@ namespace DS4Windows
|
||||
}
|
||||
|
||||
private SynchronizationContext uiContext = null;
|
||||
public SynchronizationContext getUiContext()
|
||||
{
|
||||
return uiContext;
|
||||
}
|
||||
|
||||
private Queue<Action> eventQueue = new Queue<Action>();
|
||||
private object eventQueueLock = new object();
|
||||
|
||||
@ -692,6 +697,7 @@ namespace DS4Windows
|
||||
Removal?.Invoke(this, EventArgs.Empty);
|
||||
}), null);
|
||||
|
||||
timeoutExecuted = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -722,6 +728,7 @@ namespace DS4Windows
|
||||
Removal?.Invoke(this, EventArgs.Empty);
|
||||
}), null);
|
||||
|
||||
timeoutExecuted = true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -109,7 +109,7 @@ namespace DS4Windows
|
||||
// Grab reference to exclusively opened HidDevice so device
|
||||
// stays hidden to other processes
|
||||
DisabledDevices.Add(hDevice);
|
||||
DevicePaths.Add(hDevice.DevicePath);
|
||||
//DevicePaths.Add(hDevice.DevicePath);
|
||||
}
|
||||
|
||||
continue;
|
||||
@ -184,7 +184,7 @@ namespace DS4Windows
|
||||
device.HidDevice.CloseDevice();
|
||||
Devices.Remove(device.MacAddress);
|
||||
DevicePaths.Remove(device.HidDevice.DevicePath);
|
||||
purgeHiddenExclusiveDevices();
|
||||
//purgeHiddenExclusiveDevices();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user