mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-26 00:21:48 +01:00
Save config upon controller unplug
Used to assist with persisting linked profile setting
This commit is contained in:
parent
2b7234873e
commit
164fbd5154
@ -1284,7 +1284,6 @@ namespace DS4Windows
|
||||
inWarnMonitor[ind] = false;
|
||||
useDInputOnly[ind] = true;
|
||||
Global.activeOutDevType[ind] = OutContType.None;
|
||||
Global.linkedProfileCheck[ind] = false;
|
||||
/*uiContext?.Post(new SendOrPostCallback((state) =>
|
||||
{
|
||||
OnControllerRemoved(this, ind);
|
||||
|
@ -152,17 +152,30 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
||||
private void Controller_Removal(object sender, EventArgs e)
|
||||
{
|
||||
DS4Device currentDev = sender as DS4Device;
|
||||
CompositeDeviceModel found = null;
|
||||
_colListLocker.EnterReadLock();
|
||||
foreach (CompositeDeviceModel temp in controllerCol)
|
||||
{
|
||||
if (temp.Device == currentDev)
|
||||
{
|
||||
controllerCol.Remove(temp);
|
||||
controllerDict.Remove(temp.DevIndex);
|
||||
found = temp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_colListLocker.ExitReadLock();
|
||||
|
||||
if (found != null)
|
||||
{
|
||||
_colListLocker.EnterWriteLock();
|
||||
controllerCol.Remove(found);
|
||||
controllerDict.Remove(found.DevIndex);
|
||||
System.Windows.Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Global.Save();
|
||||
});
|
||||
Global.linkedProfileCheck[found.DevIndex] = false;
|
||||
_colListLocker.ExitWriteLock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user