mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-23 23:21:49 +01:00
Remove reliance on plug return status
Plug change can be delayed but still be successful. Possibly related to issue #147.
This commit is contained in:
parent
3c94a872aa
commit
3b33caf247
@ -179,16 +179,8 @@ namespace DS4Windows
|
||||
int xinputIndex = x360Bus.FirstController + i;
|
||||
LogDebug("Plugging in X360 Controller #" + xinputIndex);
|
||||
bool xinputResult = x360Bus.Plugin(i);
|
||||
if (xinputResult)
|
||||
{
|
||||
LogDebug("X360 Controller # " + xinputIndex + " connected");
|
||||
useDInputOnly[i] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug("X360 Controller # " + xinputIndex + " failed. Using DInput only mode");
|
||||
useDInputOnly[i] = true;
|
||||
}
|
||||
LogDebug("X360 Controller # " + xinputIndex + " connected");
|
||||
useDInputOnly[i] = false;
|
||||
}
|
||||
|
||||
device.Report += this.On_Report;
|
||||
@ -369,16 +361,8 @@ namespace DS4Windows
|
||||
int xinputIndex = x360Bus.FirstController + Index;
|
||||
LogDebug("Plugging in X360 Controller #" + xinputIndex);
|
||||
bool xinputResult = x360Bus.Plugin(Index);
|
||||
if (xinputResult)
|
||||
{
|
||||
LogDebug("X360 Controller # " + xinputIndex + " connected");
|
||||
useDInputOnly[Index] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug("X360 Controller # " + xinputIndex + " failed. Using DInput only mode");
|
||||
useDInputOnly[Index] = true;
|
||||
}
|
||||
LogDebug("X360 Controller # " + xinputIndex + " connected");
|
||||
useDInputOnly[Index] = false;
|
||||
}
|
||||
|
||||
TouchPadOn(Index, device);
|
||||
@ -625,15 +609,8 @@ namespace DS4Windows
|
||||
{
|
||||
bool unplugResult = x360Bus.Unplug(ind);
|
||||
int xinputIndex = x360Bus.FirstController + ind;
|
||||
if (unplugResult)
|
||||
{
|
||||
LogDebug("X360 Controller # " + xinputIndex + " unplugged");
|
||||
useDInputOnly[ind] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug("X360 Controller # " + xinputIndex + " failed to unplug");
|
||||
}
|
||||
LogDebug("X360 Controller # " + xinputIndex + " unplugged");
|
||||
useDInputOnly[ind] = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -643,16 +620,8 @@ namespace DS4Windows
|
||||
int xinputIndex = x360Bus.FirstController + ind;
|
||||
LogDebug("Plugging in X360 Controller #" + xinputIndex);
|
||||
bool xinputResult = x360Bus.Plugin(ind);
|
||||
if (xinputResult)
|
||||
{
|
||||
LogDebug("X360 Controller # " + xinputIndex + " connected");
|
||||
useDInputOnly[ind] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug("X360 Controller # " + xinputIndex + " failed. Using DInput only mode");
|
||||
useDInputOnly[ind] = true;
|
||||
}
|
||||
LogDebug("X360 Controller # " + xinputIndex + " connected");
|
||||
useDInputOnly[ind] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -688,14 +657,7 @@ namespace DS4Windows
|
||||
{
|
||||
bool unplugResult = x360Bus.Unplug(ind);
|
||||
int xinputIndex = x360Bus.FirstController + ind;
|
||||
if (unplugResult)
|
||||
{
|
||||
LogDebug("X360 Controller # " + xinputIndex + " unplugged");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug("X360 Controller # " + xinputIndex + " failed to unplug");
|
||||
}
|
||||
LogDebug("X360 Controller # " + xinputIndex + " unplugged");
|
||||
}
|
||||
|
||||
string removed = Properties.Resources.ControllerWasRemoved.Replace("*Mac address*", (ind + 1).ToString());
|
||||
|
@ -2844,20 +2844,14 @@ namespace DS4Windows
|
||||
if (xinputStatus && xinputPlug)
|
||||
{
|
||||
bool xinputResult = control.x360Bus.Plugin(device);
|
||||
if (xinputResult)
|
||||
{
|
||||
int xinputIndex = control.x360Bus.FirstController + device;
|
||||
Log.LogToGui("X360 Controller # " + xinputIndex + " connected", false);
|
||||
}
|
||||
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);
|
||||
}
|
||||
int xinputIndex = control.x360Bus.FirstController + device;
|
||||
Log.LogToGui("X360 Controller # " + xinputIndex + " unplugged", false);
|
||||
}
|
||||
|
||||
tempDev.setRumble(0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user