mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-23 13:41:15 +01:00
Minor enhancements. Update changelog link. Add sleep period to reEnableDevice method.
This commit is contained in:
parent
96090fc857
commit
a2fb603d72
@ -214,13 +214,13 @@ namespace DS4Windows
|
|||||||
continue;
|
continue;
|
||||||
if (((Func<bool>)delegate
|
if (((Func<bool>)delegate
|
||||||
{
|
{
|
||||||
for (Int32 Index = 0; Index < DS4Controllers.Length; Index++)
|
for (Int32 Index = 0, arlength = DS4Controllers.Length; Index < arlength; Index++)
|
||||||
if (DS4Controllers[Index] != null && DS4Controllers[Index].MacAddress == device.MacAddress)
|
if (DS4Controllers[Index] != null && DS4Controllers[Index].MacAddress == device.MacAddress)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
})())
|
})())
|
||||||
continue;
|
continue;
|
||||||
for (Int32 Index = 0; Index < DS4Controllers.Length; Index++)
|
for (Int32 Index = 0, arlength = DS4Controllers.Length; Index < arlength; Index++)
|
||||||
if (DS4Controllers[Index] == null)
|
if (DS4Controllers[Index] == null)
|
||||||
{
|
{
|
||||||
LogDebug(Properties.Resources.FoundController + device.MacAddress + " (" + device.ConnectionType + ")");
|
LogDebug(Properties.Resources.FoundController + device.MacAddress + " (" + device.ConnectionType + ")");
|
||||||
@ -418,7 +418,7 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
DS4Device device = (DS4Device)sender;
|
DS4Device device = (DS4Device)sender;
|
||||||
int ind = -1;
|
int ind = -1;
|
||||||
for (int i = 0; i < DS4Controllers.Length; i++)
|
for (int i = 0, arlength = DS4Controllers.Length; ind == -1 && i < arlength; i++)
|
||||||
if (DS4Controllers[i] != null && device.MacAddress == DS4Controllers[i].MacAddress)
|
if (DS4Controllers[i] != null && device.MacAddress == DS4Controllers[i].MacAddress)
|
||||||
ind = i;
|
ind = i;
|
||||||
if (ind != -1)
|
if (ind != -1)
|
||||||
@ -434,10 +434,13 @@ namespace DS4Windows
|
|||||||
System.Threading.Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME);
|
System.Threading.Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME);
|
||||||
DS4Controllers[ind] = null;
|
DS4Controllers[ind] = null;
|
||||||
touchPad[ind] = null;
|
touchPad[ind] = null;
|
||||||
|
lag[ind] = false;
|
||||||
|
inWarnMonitor[ind] = false;
|
||||||
ControllerStatusChanged(this);
|
ControllerStatusChanged(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public bool[] lag = { false, false, false, false };
|
public bool[] lag = { false, false, false, false };
|
||||||
|
public bool[] inWarnMonitor = { false, false, false, false };
|
||||||
//Called every time the new input report has arrived
|
//Called every time the new input report has arrived
|
||||||
protected virtual void On_Report(object sender, EventArgs e)
|
protected virtual void On_Report(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -456,14 +459,23 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
LogDebug(device.error);
|
LogDebug(device.error);
|
||||||
}
|
}
|
||||||
if (DateTime.UtcNow - device.firstActive > TimeSpan.FromSeconds(5))
|
|
||||||
|
if (inWarnMonitor[ind])
|
||||||
{
|
{
|
||||||
int flashWhenLateAt = getFlashWhenLateAt();
|
int flashWhenLateAt = getFlashWhenLateAt();
|
||||||
if (device.Latency >= flashWhenLateAt && !lag[ind])
|
if (!lag[ind] && device.Latency >= flashWhenLateAt)
|
||||||
LagFlashWarning(ind, true);
|
LagFlashWarning(ind, true);
|
||||||
else if (device.Latency < flashWhenLateAt && lag[ind])
|
else if (lag[ind] && device.Latency < flashWhenLateAt)
|
||||||
LagFlashWarning(ind, false);
|
LagFlashWarning(ind, false);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (DateTime.UtcNow - device.firstActive > TimeSpan.FromSeconds(5))
|
||||||
|
{
|
||||||
|
inWarnMonitor[ind] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
device.getExposedState(ExposedState[ind], CurrentState[ind]);
|
device.getExposedState(ExposedState[ind], CurrentState[ind]);
|
||||||
DS4State cState = CurrentState[ind];
|
DS4State cState = CurrentState[ind];
|
||||||
device.getPreviousState(PreviousState[ind]);
|
device.getPreviousState(PreviousState[ind]);
|
||||||
|
@ -1718,7 +1718,7 @@ namespace DS4Windows
|
|||||||
keydown[i] = false;
|
keydown[i] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (ushort i = 0; i < keydown.Length; i++)
|
for (int i = 0, arlength = keydown.Length; i < arlength; i++)
|
||||||
{
|
{
|
||||||
if (keydown[i])
|
if (keydown[i])
|
||||||
if (i == 256) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_LEFTUP); //anything above 255 is not a keyvalue
|
if (i == 256) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_LEFTUP); //anything above 255 is not a keyvalue
|
||||||
@ -1752,9 +1752,9 @@ namespace DS4Windows
|
|||||||
else if (i == 284) macroControl[23] = false;
|
else if (i == 284) macroControl[23] = false;
|
||||||
else if (i == 285) macroControl[24] = false;
|
else if (i == 285) macroControl[24] = false;
|
||||||
else if (keyType.HasFlag(DS4KeyType.ScanCode))
|
else if (keyType.HasFlag(DS4KeyType.ScanCode))
|
||||||
InputMethods.performSCKeyRelease(i);
|
InputMethods.performSCKeyRelease((ushort)i);
|
||||||
else
|
else
|
||||||
InputMethods.performKeyRelease(i);
|
InputMethods.performKeyRelease((ushort)i);
|
||||||
}
|
}
|
||||||
DS4LightBar.forcedFlash[device] = 0;
|
DS4LightBar.forcedFlash[device] = 0;
|
||||||
DS4LightBar.forcelight[device] = false;
|
DS4LightBar.forcelight[device] = false;
|
||||||
|
16
DS4Windows/DS4Forms/Hotkeys.Designer.cs
generated
16
DS4Windows/DS4Forms/Hotkeys.Designer.cs
generated
@ -40,6 +40,7 @@
|
|||||||
this.tPHotkeys = new System.Windows.Forms.TabPage();
|
this.tPHotkeys = new System.Windows.Forms.TabPage();
|
||||||
this.lbHotkeys = new System.Windows.Forms.Label();
|
this.lbHotkeys = new System.Windows.Forms.Label();
|
||||||
this.tPCredits = new System.Windows.Forms.TabPage();
|
this.tPCredits = new System.Windows.Forms.TabPage();
|
||||||
|
this.linkTeokp = new System.Windows.Forms.LinkLabel();
|
||||||
this.linkKiliansch = new System.Windows.Forms.LinkLabel();
|
this.linkKiliansch = new System.Windows.Forms.LinkLabel();
|
||||||
this.linkChamilsaan = new System.Windows.Forms.LinkLabel();
|
this.linkChamilsaan = new System.Windows.Forms.LinkLabel();
|
||||||
this.linkBoganhobo = new System.Windows.Forms.LinkLabel();
|
this.linkBoganhobo = new System.Windows.Forms.LinkLabel();
|
||||||
@ -85,7 +86,6 @@
|
|||||||
this.lbTranslators = new System.Windows.Forms.Label();
|
this.lbTranslators = new System.Windows.Forms.Label();
|
||||||
this.linkSourceCode = new System.Windows.Forms.LinkLabel();
|
this.linkSourceCode = new System.Windows.Forms.LinkLabel();
|
||||||
this.lbLinkText = new System.Windows.Forms.Label();
|
this.lbLinkText = new System.Windows.Forms.Label();
|
||||||
this.linkTeokp = new System.Windows.Forms.LinkLabel();
|
|
||||||
this.tCAbout.SuspendLayout();
|
this.tCAbout.SuspendLayout();
|
||||||
this.tPHotkeys.SuspendLayout();
|
this.tPHotkeys.SuspendLayout();
|
||||||
this.tPCredits.SuspendLayout();
|
this.tPCredits.SuspendLayout();
|
||||||
@ -177,6 +177,13 @@
|
|||||||
this.tPCredits.Name = "tPCredits";
|
this.tPCredits.Name = "tPCredits";
|
||||||
this.tPCredits.UseVisualStyleBackColor = true;
|
this.tPCredits.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// linkTeokp
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.linkTeokp, "linkTeokp");
|
||||||
|
this.linkTeokp.Name = "linkTeokp";
|
||||||
|
this.linkTeokp.TabStop = true;
|
||||||
|
this.linkTeokp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkTeokp_LinkClicked);
|
||||||
|
//
|
||||||
// linkKiliansch
|
// linkKiliansch
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.linkKiliansch, "linkKiliansch");
|
resources.ApplyResources(this.linkKiliansch, "linkKiliansch");
|
||||||
@ -448,13 +455,6 @@
|
|||||||
resources.ApplyResources(this.lbLinkText, "lbLinkText");
|
resources.ApplyResources(this.lbLinkText, "lbLinkText");
|
||||||
this.lbLinkText.Name = "lbLinkText";
|
this.lbLinkText.Name = "lbLinkText";
|
||||||
//
|
//
|
||||||
// linkTeokp
|
|
||||||
//
|
|
||||||
resources.ApplyResources(this.linkTeokp, "linkTeokp");
|
|
||||||
this.linkTeokp.Name = "linkTeokp";
|
|
||||||
this.linkTeokp.TabStop = true;
|
|
||||||
this.linkTeokp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkTeokp_LinkClicked);
|
|
||||||
//
|
|
||||||
// Hotkeys
|
// Hotkeys
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this, "$this");
|
resources.ApplyResources(this, "$this");
|
||||||
|
@ -77,7 +77,7 @@ namespace DS4Windows
|
|||||||
|
|
||||||
private void lLChangelog_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
private void lLChangelog_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||||
{
|
{
|
||||||
Process.Start("https://docs.google.com/document/d/1l4xcgVQkGUskc5CQ0p069yW22Cd5WAH_yE3Fz2hXo0E/edit?usp=sharing");
|
Process.Start("https://docs.google.com/document/d/1CovpH08fbPSXrC6TmEprzgPwCe0tTjQ_HTFfDotpmxk/edit?usp=sharing");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void linkDonate_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
private void linkDonate_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -188,6 +188,9 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
throw new Exception("Error disabling device, error code = " + Marshal.GetLastWin32Error());
|
throw new Exception("Error disabling device, error code = " + Marshal.GetLastWin32Error());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.Threading.Thread.Sleep(50);
|
||||||
|
|
||||||
propChangeParams.stateChange = NativeMethods.DICS_ENABLE;
|
propChangeParams.stateChange = NativeMethods.DICS_ENABLE;
|
||||||
success = NativeMethods.SetupDiSetClassInstallParams(deviceInfoSet, ref deviceInfoData, ref propChangeParams, Marshal.SizeOf(propChangeParams));
|
success = NativeMethods.SetupDiSetClassInstallParams(deviceInfoSet, ref deviceInfoData, ref propChangeParams, Marshal.SizeOf(propChangeParams));
|
||||||
if (!success)
|
if (!success)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user