mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-23 01:39:17 +01:00
Fix for device plugin changes while switching profiles
This commit is contained in:
parent
866b91e08b
commit
42a67143ea
@ -2031,6 +2031,9 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
profilepath = propath;
|
profilepath = propath;
|
||||||
|
|
||||||
|
bool xinputPlug = false;
|
||||||
|
bool xinputStatus = false;
|
||||||
|
|
||||||
if (File.Exists(profilepath))
|
if (File.Exists(profilepath))
|
||||||
{
|
{
|
||||||
XmlNode Item;
|
XmlNode Item;
|
||||||
@ -2385,25 +2388,17 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
if (dinputOnly[device] == true)
|
if (dinputOnly[device] == true)
|
||||||
{
|
{
|
||||||
bool xinputResult = control.x360Bus.Unplug(device);
|
Global.useDInputOnly[device] = true;
|
||||||
if (xinputResult)
|
xinputPlug = false;
|
||||||
{
|
xinputStatus = true;
|
||||||
int xinputIndex = control.x360Bus.FirstController + device;
|
|
||||||
Log.LogToGui("X360 Controller # " + xinputIndex + " unplugged", false);
|
|
||||||
Global.useDInputOnly[device] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//changed = true;
|
//changed = true;
|
||||||
}
|
}
|
||||||
else if (synced && isAlive)
|
else if (synced && isAlive)
|
||||||
{
|
{
|
||||||
bool xinputResult = control.x360Bus.Plugin(device);
|
Global.useDInputOnly[device] = false;
|
||||||
if (xinputResult)
|
xinputPlug = true;
|
||||||
{
|
xinputStatus = true;
|
||||||
int xinputIndex = control.x360Bus.FirstController + device;
|
|
||||||
Log.LogToGui("X360 Controller # " + xinputIndex + " connected", false);
|
|
||||||
Global.useDInputOnly[device] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//changed = true;
|
//changed = true;
|
||||||
}
|
}
|
||||||
@ -2756,6 +2751,24 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
tempDev.setIdleTimeout(idleDisconnectTimeout[device]);
|
tempDev.setIdleTimeout(idleDisconnectTimeout[device]);
|
||||||
tempDev.setBTPollRate(btPollRate[device]);
|
tempDev.setBTPollRate(btPollRate[device]);
|
||||||
|
if (xinputStatus && xinputPlug)
|
||||||
|
{
|
||||||
|
bool xinputResult = control.x360Bus.Plugin(device);
|
||||||
|
if (xinputResult)
|
||||||
|
{
|
||||||
|
int xinputIndex = control.x360Bus.FirstController + device;
|
||||||
|
Log.LogToGui("X360 Controller # " + xinputIndex + " connected", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (xinputStatus && !xinputPlug)
|
||||||
|
{
|
||||||
|
bool xinputResult = control.x360Bus.Unplug(device);
|
||||||
|
if (xinputResult)
|
||||||
|
{
|
||||||
|
int xinputIndex = control.x360Bus.FirstController + device;
|
||||||
|
Log.LogToGui("X360 Controller # " + xinputIndex + " unplugged", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Program.rootHub.touchPad[device]?.ResetTrackAccel(trackballFriction[device]);
|
Program.rootHub.touchPad[device]?.ResetTrackAccel(trackballFriction[device]);
|
||||||
|
Loading…
Reference in New Issue
Block a user