mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-12 00:09:11 +01:00
Take result status for virtual bus plugin events back into account
This commit is contained in:
parent
33aef3a4c6
commit
99c812301d
@ -106,8 +106,16 @@ namespace DS4Windows
|
|||||||
int xinputIndex = x360Bus.FirstController + index;
|
int xinputIndex = x360Bus.FirstController + index;
|
||||||
LogDebug("Plugging in X360 Controller #" + xinputIndex);
|
LogDebug("Plugging in X360 Controller #" + xinputIndex);
|
||||||
bool xinputResult = x360Bus.Plugin(index);
|
bool xinputResult = x360Bus.Plugin(index);
|
||||||
useDInputOnly[index] = false;
|
if (xinputResult)
|
||||||
LogDebug("X360 Controller # " + xinputIndex + " connected");
|
{
|
||||||
|
useDInputOnly[index] = false;
|
||||||
|
LogDebug("X360 Controller # " + xinputIndex + " connected");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
useDInputOnly[index] = true;
|
||||||
|
LogDebug("X360 Controller # " + xinputIndex + " failed. Using DInput only mode");
|
||||||
|
}
|
||||||
|
|
||||||
return xinputResult;
|
return xinputResult;
|
||||||
}
|
}
|
||||||
@ -116,8 +124,15 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
bool unplugResult = x360Bus.Unplug(index);
|
bool unplugResult = x360Bus.Unplug(index);
|
||||||
int xinputIndex = x360Bus.FirstController + index;
|
int xinputIndex = x360Bus.FirstController + index;
|
||||||
useDInputOnly[index] = true;
|
if (unplugResult)
|
||||||
LogDebug("X360 Controller # " + xinputIndex + " unplugged");
|
{
|
||||||
|
useDInputOnly[index] = true;
|
||||||
|
LogDebug("X360 Controller # " + xinputIndex + " unplugged");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogDebug("X360 Controller # " + xinputIndex + " failed to unplug");
|
||||||
|
}
|
||||||
|
|
||||||
return unplugResult;
|
return unplugResult;
|
||||||
}
|
}
|
||||||
@ -179,8 +194,16 @@ namespace DS4Windows
|
|||||||
int xinputIndex = x360Bus.FirstController + i;
|
int xinputIndex = x360Bus.FirstController + i;
|
||||||
LogDebug("Plugging in X360 Controller #" + xinputIndex);
|
LogDebug("Plugging in X360 Controller #" + xinputIndex);
|
||||||
bool xinputResult = x360Bus.Plugin(i);
|
bool xinputResult = x360Bus.Plugin(i);
|
||||||
LogDebug("X360 Controller # " + xinputIndex + " connected");
|
if (xinputResult)
|
||||||
useDInputOnly[i] = false;
|
{
|
||||||
|
useDInputOnly[i] = false;
|
||||||
|
LogDebug("X360 Controller # " + xinputIndex + " connected");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
useDInputOnly[i] = true;
|
||||||
|
LogDebug("X360 Controller # " + xinputIndex + " failed. Using DInput only mode");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
device.Report += this.On_Report;
|
device.Report += this.On_Report;
|
||||||
@ -361,8 +384,16 @@ namespace DS4Windows
|
|||||||
int xinputIndex = x360Bus.FirstController + Index;
|
int xinputIndex = x360Bus.FirstController + Index;
|
||||||
LogDebug("Plugging in X360 Controller #" + xinputIndex);
|
LogDebug("Plugging in X360 Controller #" + xinputIndex);
|
||||||
bool xinputResult = x360Bus.Plugin(Index);
|
bool xinputResult = x360Bus.Plugin(Index);
|
||||||
LogDebug("X360 Controller # " + xinputIndex + " connected");
|
if (xinputResult)
|
||||||
useDInputOnly[Index] = false;
|
{
|
||||||
|
useDInputOnly[Index] = false;
|
||||||
|
LogDebug("X360 Controller # " + xinputIndex + " connected");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
useDInputOnly[Index] = true;
|
||||||
|
LogDebug("X360 Controller # " + xinputIndex + " failed. Using DInput only mode");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TouchPadOn(Index, device);
|
TouchPadOn(Index, device);
|
||||||
@ -609,8 +640,15 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
bool unplugResult = x360Bus.Unplug(ind);
|
bool unplugResult = x360Bus.Unplug(ind);
|
||||||
int xinputIndex = x360Bus.FirstController + ind;
|
int xinputIndex = x360Bus.FirstController + ind;
|
||||||
LogDebug("X360 Controller # " + xinputIndex + " unplugged");
|
if (unplugResult)
|
||||||
useDInputOnly[ind] = true;
|
{
|
||||||
|
useDInputOnly[ind] = true;
|
||||||
|
LogDebug("X360 Controller # " + xinputIndex + " unplugged");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogDebug("X360 Controller # " + xinputIndex + " failed to unplug");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -620,8 +658,16 @@ namespace DS4Windows
|
|||||||
int xinputIndex = x360Bus.FirstController + ind;
|
int xinputIndex = x360Bus.FirstController + ind;
|
||||||
LogDebug("Plugging in X360 Controller #" + xinputIndex);
|
LogDebug("Plugging in X360 Controller #" + xinputIndex);
|
||||||
bool xinputResult = x360Bus.Plugin(ind);
|
bool xinputResult = x360Bus.Plugin(ind);
|
||||||
LogDebug("X360 Controller # " + xinputIndex + " connected");
|
if (xinputResult)
|
||||||
useDInputOnly[ind] = false;
|
{
|
||||||
|
useDInputOnly[ind] = false;
|
||||||
|
LogDebug("X360 Controller # " + xinputIndex + " connected");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
useDInputOnly[ind] = true;
|
||||||
|
LogDebug("X360 Controller # " + xinputIndex + " failed. Using DInput only mode");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2845,13 +2845,30 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
bool xinputResult = control.x360Bus.Plugin(device);
|
bool xinputResult = control.x360Bus.Plugin(device);
|
||||||
int xinputIndex = control.x360Bus.FirstController + device;
|
int xinputIndex = control.x360Bus.FirstController + device;
|
||||||
Log.LogToGui("X360 Controller # " + xinputIndex + " connected", false);
|
if (xinputResult)
|
||||||
|
{
|
||||||
|
dinputOnly[device] = false;
|
||||||
|
Log.LogToGui("X360 Controller # " + xinputIndex + " connected", false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dinputOnly[device] = true;
|
||||||
|
Log.LogToGui("X360 Controller # " + xinputIndex + " failed. Using DInput only mode", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (xinputStatus && !xinputPlug)
|
else if (xinputStatus && !xinputPlug)
|
||||||
{
|
{
|
||||||
bool xinputResult = control.x360Bus.Unplug(device);
|
bool xinputResult = control.x360Bus.Unplug(device);
|
||||||
int xinputIndex = control.x360Bus.FirstController + device;
|
int xinputIndex = control.x360Bus.FirstController + device;
|
||||||
Log.LogToGui("X360 Controller # " + xinputIndex + " unplugged", false);
|
if (xinputResult)
|
||||||
|
{
|
||||||
|
dinputOnly[device] = true;
|
||||||
|
Log.LogToGui("X360 Controller # " + xinputIndex + " unplugged", false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log.LogToGui("X360 Controller # " + xinputIndex + " failed to unplug", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tempDev.setRumble(0, 0);
|
tempDev.setRumble(0, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user