Skip to content

Commit 3dd88e4

Browse files
committed
Fixed issue with xinput unplug routine on device removal
Related to issue Jays2Kings#554
1 parent 4d989bb commit 3dd88e4

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

DS4Windows/DS4Control/ScpUtil.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,7 +2602,6 @@ public bool LoadProfile(int device, bool launchprogram, ControlService control,
26022602
catch { dinputOnly[device] = false; missingSetting = true; }
26032603

26042604
bool oldUseDInputOnly = Global.useDInputOnly[device];
2605-
Global.useDInputOnly[device] = dinputOnly[device];
26062605

26072606
// Only change xinput devices under certain conditions. Avoid
26082607
// performing this upon program startup before loading devices.
@@ -2618,20 +2617,14 @@ public bool LoadProfile(int device, bool launchprogram, ControlService control,
26182617
{
26192618
if (dinputOnly[device] == true)
26202619
{
2621-
Global.useDInputOnly[device] = true;
26222620
xinputPlug = false;
26232621
xinputStatus = true;
26242622
}
26252623
else if (synced && isAlive)
26262624
{
2627-
Global.useDInputOnly[device] = false;
26282625
xinputPlug = true;
26292626
xinputStatus = true;
26302627
}
2631-
else if (!synced)
2632-
{
2633-
Global.useDInputOnly[device] = true;
2634-
}
26352628
}
26362629
}
26372630
}
@@ -2995,12 +2988,12 @@ public bool LoadProfile(int device, bool launchprogram, ControlService control,
29952988
int xinputIndex = control.x360Bus.FirstController + device;
29962989
if (xinputResult)
29972990
{
2998-
dinputOnly[device] = false;
2991+
Global.useDInputOnly[device] = false;
29992992
AppLogger.LogToGui("X360 Controller # " + xinputIndex + " connected", false);
30002993
}
30012994
else
30022995
{
3003-
dinputOnly[device] = true;
2996+
Global.useDInputOnly[device] = true;
30042997
AppLogger.LogToGui("X360 Controller # " + xinputIndex + " failed. Using DInput only mode", true);
30052998
}
30062999
}
@@ -3010,11 +3003,12 @@ public bool LoadProfile(int device, bool launchprogram, ControlService control,
30103003
int xinputIndex = control.x360Bus.FirstController + device;
30113004
if (xinputResult)
30123005
{
3013-
dinputOnly[device] = true;
3006+
Global.useDInputOnly[device] = true;
30143007
AppLogger.LogToGui("X360 Controller # " + xinputIndex + " unplugged", false);
30153008
}
30163009
else
30173010
{
3011+
Global.useDInputOnly[device] = false;
30183012
AppLogger.LogToGui("X360 Controller # " + xinputIndex + " failed to unplug", true);
30193013
}
30203014
}

0 commit comments

Comments
 (0)