mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-27 09:01: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;
|
inWarnMonitor[ind] = false;
|
||||||
useDInputOnly[ind] = true;
|
useDInputOnly[ind] = true;
|
||||||
Global.activeOutDevType[ind] = OutContType.None;
|
Global.activeOutDevType[ind] = OutContType.None;
|
||||||
Global.linkedProfileCheck[ind] = false;
|
|
||||||
/*uiContext?.Post(new SendOrPostCallback((state) =>
|
/*uiContext?.Post(new SendOrPostCallback((state) =>
|
||||||
{
|
{
|
||||||
OnControllerRemoved(this, ind);
|
OnControllerRemoved(this, ind);
|
||||||
|
@ -152,17 +152,30 @@ namespace DS4WinWPF.DS4Forms.ViewModels
|
|||||||
private void Controller_Removal(object sender, EventArgs e)
|
private void Controller_Removal(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
DS4Device currentDev = sender as DS4Device;
|
DS4Device currentDev = sender as DS4Device;
|
||||||
|
CompositeDeviceModel found = null;
|
||||||
_colListLocker.EnterReadLock();
|
_colListLocker.EnterReadLock();
|
||||||
foreach (CompositeDeviceModel temp in controllerCol)
|
foreach (CompositeDeviceModel temp in controllerCol)
|
||||||
{
|
{
|
||||||
if (temp.Device == currentDev)
|
if (temp.Device == currentDev)
|
||||||
{
|
{
|
||||||
controllerCol.Remove(temp);
|
found = temp;
|
||||||
controllerDict.Remove(temp.DevIndex);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_colListLocker.ExitReadLock();
|
_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