mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-24 15:41:49 +01:00
Fixed service changing when dinput only mode has changed
This commit is contained in:
parent
22912dff50
commit
4f4bf78bea
@ -191,6 +191,8 @@ namespace DS4Windows
|
|||||||
if (showlog)
|
if (showlog)
|
||||||
LogDebug(Properties.Resources.StoppingX360);
|
LogDebug(Properties.Resources.StoppingX360);
|
||||||
|
|
||||||
|
LogDebug("Closing connection to Scp Virtual Bus");
|
||||||
|
|
||||||
bool anyUnplugged = false;
|
bool anyUnplugged = false;
|
||||||
for (int i = 0, arlength = DS4Controllers.Length; i < arlength; i++)
|
for (int i = 0, arlength = DS4Controllers.Length; i < arlength; i++)
|
||||||
{
|
{
|
||||||
|
@ -57,6 +57,8 @@ namespace DS4Windows
|
|||||||
string logFile = appdatapath + @"\DS4Service.log";
|
string logFile = appdatapath + @"\DS4Service.log";
|
||||||
bool turnOffTemp;
|
bool turnOffTemp;
|
||||||
bool runningBat;
|
bool runningBat;
|
||||||
|
private bool changingService;
|
||||||
|
public bool ChangingService => changingService;
|
||||||
Dictionary<Control, string> hoverTextDict = new Dictionary<Control, string>();
|
Dictionary<Control, string> hoverTextDict = new Dictionary<Control, string>();
|
||||||
// 0 index is used for application version text. 1 - 4 indices are used for controller status
|
// 0 index is used for application version text. 1 - 4 indices are used for controller status
|
||||||
string[] notifyText = new string[5]
|
string[] notifyText = new string[5]
|
||||||
@ -943,11 +945,13 @@ namespace DS4Windows
|
|||||||
private void serviceStartup(bool log)
|
private void serviceStartup(bool log)
|
||||||
{
|
{
|
||||||
var uiContext = SynchronizationContext.Current;
|
var uiContext = SynchronizationContext.Current;
|
||||||
|
changingService = true;
|
||||||
TaskRunner.Run(() =>
|
TaskRunner.Run(() =>
|
||||||
{
|
{
|
||||||
//Thread.CurrentThread.Priority = ThreadPriority.AboveNormal;
|
//Thread.CurrentThread.Priority = ThreadPriority.AboveNormal;
|
||||||
Program.rootHub.Start(uiContext, log);
|
Program.rootHub.Start(uiContext, log);
|
||||||
Invoke((System.Action)(() => { serviceStartupFinish(); }));
|
Invoke((System.Action)(() => { serviceStartupFinish(); }));
|
||||||
|
changingService = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -968,10 +972,12 @@ namespace DS4Windows
|
|||||||
|
|
||||||
private void serviceShutdown(bool log)
|
private void serviceShutdown(bool log)
|
||||||
{
|
{
|
||||||
|
changingService = true;
|
||||||
TaskRunner.Run(() =>
|
TaskRunner.Run(() =>
|
||||||
{
|
{
|
||||||
Program.rootHub.Stop(log);
|
Program.rootHub.Stop(log);
|
||||||
Invoke((System.Action)(() => { serviceShutdownFinish(); }));
|
Invoke((System.Action)(() => { serviceShutdownFinish(); }));
|
||||||
|
changingService = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1604,7 +1604,7 @@ namespace DS4Windows
|
|||||||
if (olddinputcheck != cBDinput.Checked)
|
if (olddinputcheck != cBDinput.Checked)
|
||||||
{
|
{
|
||||||
root.btnStartStop_Clicked(false);
|
root.btnStartStop_Clicked(false);
|
||||||
root.btnStartStop_Clicked(false);
|
finishDInputChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btnRumbleHeavyTest.Text == Properties.Resources.StopText)
|
if (btnRumbleHeavyTest.Text == Properties.Resources.StopText)
|
||||||
@ -2128,10 +2128,23 @@ namespace DS4Windows
|
|||||||
if (!loading && device < 4)
|
if (!loading && device < 4)
|
||||||
{
|
{
|
||||||
root.btnStartStop_Clicked(false);
|
root.btnStartStop_Clicked(false);
|
||||||
root.btnStartStop_Clicked(false);
|
finishDInputChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void finishDInputChange()
|
||||||
|
{
|
||||||
|
await System.Threading.Tasks.Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
while (root.ChangingService)
|
||||||
|
{
|
||||||
|
System.Threading.Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
root.btnStartStop_Clicked(false);
|
||||||
|
}
|
||||||
|
|
||||||
private void cbStartTouchpadOff_CheckedChanged(object sender, EventArgs e)
|
private void cbStartTouchpadOff_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
StartTouchpadOff[device] = cbStartTouchpadOff.Checked;
|
StartTouchpadOff[device] = cbStartTouchpadOff.Checked;
|
||||||
|
Loading…
Reference in New Issue
Block a user