mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-02-20 01:42:41 +01:00
Revert to older ViGEm client API
This commit is contained in:
parent
d9873a7232
commit
2e62bad0f6
@ -34,7 +34,10 @@ namespace DS4Windows
|
|||||||
bool[] buttonsdown = new bool[4] { false, false, false, false };
|
bool[] buttonsdown = new bool[4] { false, false, false, false };
|
||||||
bool[] held = new bool[DS4_CONTROLLER_COUNT];
|
bool[] held = new bool[DS4_CONTROLLER_COUNT];
|
||||||
int[] oldmouse = new int[DS4_CONTROLLER_COUNT] { -1, -1, -1, -1 };
|
int[] oldmouse = new int[DS4_CONTROLLER_COUNT] { -1, -1, -1, -1 };
|
||||||
public IXbox360Controller[] x360controls = new IXbox360Controller[4] { null, null, null, null };
|
public Xbox360Controller[] x360controls = new Xbox360Controller[4] { null, null, null, null };
|
||||||
|
private Xbox360Report[] x360reports = new Xbox360Report[4] { new Xbox360Report(), new Xbox360Report(),
|
||||||
|
new Xbox360Report(), new Xbox360Report()
|
||||||
|
};
|
||||||
Thread tempThread;
|
Thread tempThread;
|
||||||
public List<string> affectedDevs = new List<string>()
|
public List<string> affectedDevs = new List<string>()
|
||||||
{
|
{
|
||||||
@ -421,7 +424,7 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
LogDebug("Plugging in X360 Controller #" + (i + 1));
|
LogDebug("Plugging in X360 Controller #" + (i + 1));
|
||||||
useDInputOnly[i] = false;
|
useDInputOnly[i] = false;
|
||||||
x360controls[i] = vigemTestClient.CreateXbox360Controller();
|
x360controls[i] = new Xbox360Controller(vigemTestClient);
|
||||||
int devIndex = i;
|
int devIndex = i;
|
||||||
x360controls[i].FeedbackReceived += (sender, args) =>
|
x360controls[i].FeedbackReceived += (sender, args) =>
|
||||||
{
|
{
|
||||||
@ -677,7 +680,7 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
LogDebug("Plugging in X360 Controller #" + (Index + 1));
|
LogDebug("Plugging in X360 Controller #" + (Index + 1));
|
||||||
useDInputOnly[Index] = false;
|
useDInputOnly[Index] = false;
|
||||||
x360controls[Index] = vigemTestClient.CreateXbox360Controller();
|
x360controls[Index] = new Xbox360Controller(vigemTestClient);
|
||||||
int devIndex = Index;
|
int devIndex = Index;
|
||||||
x360controls[Index].FeedbackReceived += (sender, args) =>
|
x360controls[Index].FeedbackReceived += (sender, args) =>
|
||||||
{
|
{
|
||||||
@ -718,7 +721,7 @@ namespace DS4Windows
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testNewReport(ref IXbox360Controller cont, DS4State state,
|
private void testNewReport(ref Xbox360Report xboxreport, DS4State state,
|
||||||
int device)
|
int device)
|
||||||
{
|
{
|
||||||
Xbox360Buttons tempButtons = 0;
|
Xbox360Buttons tempButtons = 0;
|
||||||
@ -743,54 +746,54 @@ namespace DS4Windows
|
|||||||
if (state.Cross) tempButtons |= Xbox360Buttons.A;
|
if (state.Cross) tempButtons |= Xbox360Buttons.A;
|
||||||
if (state.Square) tempButtons |= Xbox360Buttons.X;
|
if (state.Square) tempButtons |= Xbox360Buttons.X;
|
||||||
if (state.PS) tempButtons |= Xbox360Buttons.Guide;
|
if (state.PS) tempButtons |= Xbox360Buttons.Guide;
|
||||||
cont.SetButtonsFull((ushort)tempButtons);
|
xboxreport.SetButtonsFull(tempButtons);
|
||||||
}
|
}
|
||||||
|
|
||||||
cont.LeftTrigger = state.L2;
|
xboxreport.LeftTrigger = state.L2;
|
||||||
cont.RightTrigger = state.R2;
|
xboxreport.RightTrigger = state.R2;
|
||||||
|
|
||||||
SASteeringWheelEmulationAxisType steeringWheelMappedAxis = Global.GetSASteeringWheelEmulationAxis(device);
|
SASteeringWheelEmulationAxisType steeringWheelMappedAxis = Global.GetSASteeringWheelEmulationAxis(device);
|
||||||
switch (steeringWheelMappedAxis)
|
switch (steeringWheelMappedAxis)
|
||||||
{
|
{
|
||||||
case SASteeringWheelEmulationAxisType.None:
|
case SASteeringWheelEmulationAxisType.None:
|
||||||
cont.LeftThumbX = AxisScale(state.LX, false);
|
xboxreport.LeftThumbX = AxisScale(state.LX, false);
|
||||||
cont.LeftThumbY = AxisScale(state.LY, true);
|
xboxreport.LeftThumbY = AxisScale(state.LY, true);
|
||||||
cont.RightThumbX = AxisScale(state.RX, false);
|
xboxreport.RightThumbX = AxisScale(state.RX, false);
|
||||||
cont.RightThumbY = AxisScale(state.RY, true);
|
xboxreport.RightThumbY = AxisScale(state.RY, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SASteeringWheelEmulationAxisType.LX:
|
case SASteeringWheelEmulationAxisType.LX:
|
||||||
cont.LeftThumbX = (short)state.SASteeringWheelEmulationUnit;
|
xboxreport.LeftThumbX = (short)state.SASteeringWheelEmulationUnit;
|
||||||
cont.LeftThumbY = AxisScale(state.LY, true);
|
xboxreport.LeftThumbY = AxisScale(state.LY, true);
|
||||||
cont.RightThumbX = AxisScale(state.RX, false);
|
xboxreport.RightThumbX = AxisScale(state.RX, false);
|
||||||
cont.RightThumbY = AxisScale(state.RY, true);
|
xboxreport.RightThumbY = AxisScale(state.RY, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SASteeringWheelEmulationAxisType.LY:
|
case SASteeringWheelEmulationAxisType.LY:
|
||||||
cont.LeftThumbX = AxisScale(state.LX, false);
|
xboxreport.LeftThumbX = AxisScale(state.LX, false);
|
||||||
cont.LeftThumbY = (short)state.SASteeringWheelEmulationUnit;
|
xboxreport.LeftThumbY = (short)state.SASteeringWheelEmulationUnit;
|
||||||
cont.RightThumbX = AxisScale(state.RX, false);
|
xboxreport.RightThumbX = AxisScale(state.RX, false);
|
||||||
cont.RightThumbY = AxisScale(state.RY, true);
|
xboxreport.RightThumbY = AxisScale(state.RY, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SASteeringWheelEmulationAxisType.RX:
|
case SASteeringWheelEmulationAxisType.RX:
|
||||||
cont.LeftThumbX = AxisScale(state.LX, false);
|
xboxreport.LeftThumbX = AxisScale(state.LX, false);
|
||||||
cont.LeftThumbY = AxisScale(state.LY, true);
|
xboxreport.LeftThumbY = AxisScale(state.LY, true);
|
||||||
cont.RightThumbX = (short)state.SASteeringWheelEmulationUnit;
|
xboxreport.RightThumbX = (short)state.SASteeringWheelEmulationUnit;
|
||||||
cont.RightThumbY = AxisScale(state.RY, true);
|
xboxreport.RightThumbY = AxisScale(state.RY, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SASteeringWheelEmulationAxisType.RY:
|
case SASteeringWheelEmulationAxisType.RY:
|
||||||
cont.LeftThumbX = AxisScale(state.LX, false);
|
xboxreport.LeftThumbX = AxisScale(state.LX, false);
|
||||||
cont.LeftThumbY = AxisScale(state.LY, true);
|
xboxreport.LeftThumbY = AxisScale(state.LY, true);
|
||||||
cont.RightThumbX = AxisScale(state.RX, false);
|
xboxreport.RightThumbX = AxisScale(state.RX, false);
|
||||||
cont.RightThumbY = (short)state.SASteeringWheelEmulationUnit;
|
xboxreport.RightThumbY = (short)state.SASteeringWheelEmulationUnit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SASteeringWheelEmulationAxisType.L2R2:
|
case SASteeringWheelEmulationAxisType.L2R2:
|
||||||
cont.LeftTrigger = cont.RightTrigger = 0;
|
xboxreport.LeftTrigger = xboxreport.RightTrigger = 0;
|
||||||
if (state.SASteeringWheelEmulationUnit >= 0) cont.LeftTrigger = (Byte)state.SASteeringWheelEmulationUnit;
|
if (state.SASteeringWheelEmulationUnit >= 0) xboxreport.LeftTrigger = (Byte)state.SASteeringWheelEmulationUnit;
|
||||||
else cont.RightTrigger = (Byte)state.SASteeringWheelEmulationUnit;
|
else xboxreport.RightTrigger = (Byte)state.SASteeringWheelEmulationUnit;
|
||||||
goto case SASteeringWheelEmulationAxisType.None;
|
goto case SASteeringWheelEmulationAxisType.None;
|
||||||
|
|
||||||
case SASteeringWheelEmulationAxisType.VJoy1X:
|
case SASteeringWheelEmulationAxisType.VJoy1X:
|
||||||
@ -1054,7 +1057,7 @@ namespace DS4Windows
|
|||||||
if (!getDInputOnly(ind))
|
if (!getDInputOnly(ind))
|
||||||
{
|
{
|
||||||
LogDebug("Plugging in X360 Controller #" + (ind + 1));
|
LogDebug("Plugging in X360 Controller #" + (ind + 1));
|
||||||
x360controls[ind] = vigemTestClient.CreateXbox360Controller();
|
x360controls[ind] = new Xbox360Controller(vigemTestClient);
|
||||||
x360controls[ind].FeedbackReceived += (eventsender, args) =>
|
x360controls[ind].FeedbackReceived += (eventsender, args) =>
|
||||||
{
|
{
|
||||||
SetDevRumble(device, args.LargeMotor, args.SmallMotor, ind);
|
SetDevRumble(device, args.LargeMotor, args.SmallMotor, ind);
|
||||||
@ -1235,8 +1238,8 @@ namespace DS4Windows
|
|||||||
|
|
||||||
if (!useDInputOnly[ind])
|
if (!useDInputOnly[ind])
|
||||||
{
|
{
|
||||||
testNewReport(ref x360controls[ind], cState, ind);
|
testNewReport(ref x360reports[ind], cState, ind);
|
||||||
x360controls[ind]?.SubmitReport();
|
x360controls[ind]?.SendReport(x360reports[ind]);
|
||||||
//x360Bus.Parse(cState, processingData[ind].Report, ind);
|
//x360Bus.Parse(cState, processingData[ind].Report, ind);
|
||||||
// We push the translated Xinput state, and simultaneously we
|
// We push the translated Xinput state, and simultaneously we
|
||||||
// pull back any possible rumble data coming from Xinput consumers.
|
// pull back any possible rumble data coming from Xinput consumers.
|
||||||
|
@ -3063,9 +3063,9 @@ namespace DS4Windows
|
|||||||
tempDev.setBTPollRate(btPollRate[device]);
|
tempDev.setBTPollRate(btPollRate[device]);
|
||||||
if (xinputStatus && xinputPlug)
|
if (xinputStatus && xinputPlug)
|
||||||
{
|
{
|
||||||
control.x360controls[device] = control.vigemTestClient.CreateXbox360Controller();
|
control.x360controls[device] = new Nefarius.ViGEm.Client.Targets.Xbox360Controller(control.vigemTestClient);
|
||||||
control.x360controls[device].Connect();
|
control.x360controls[device].Connect();
|
||||||
Global.useDInputOnly[device] = false;
|
Global.useDInputOnly[device] = false;
|
||||||
AppLogger.LogToGui("X360 Controller # " + (device + 1) + " connected", false);
|
AppLogger.LogToGui("X360 Controller # " + (device + 1) + " connected", false);
|
||||||
}
|
}
|
||||||
else if (xinputStatus && !xinputPlug)
|
else if (xinputStatus && !xinputPlug)
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DS4Windows
|
|
||||||
{
|
|
||||||
[Flags]
|
|
||||||
public enum Xbox360Buttons : ushort
|
|
||||||
{
|
|
||||||
Up = 0x0001,
|
|
||||||
Down = 0x0002,
|
|
||||||
Left = 0x0004,
|
|
||||||
Right = 0x0008,
|
|
||||||
Start = 0x0010,
|
|
||||||
Back = 0x0020,
|
|
||||||
LeftThumb = 0x0040,
|
|
||||||
RightThumb = 0x0080,
|
|
||||||
LeftShoulder = 0x0100,
|
|
||||||
RightShoulder = 0x0200,
|
|
||||||
Guide = 0x0400,
|
|
||||||
A = 0x1000,
|
|
||||||
B = 0x2000,
|
|
||||||
X = 0x4000,
|
|
||||||
Y = 0x8000
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Xbox360Axes
|
|
||||||
{
|
|
||||||
LeftThumbX,
|
|
||||||
LeftThumbY,
|
|
||||||
RightThumbX,
|
|
||||||
RightThumbY
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Xbox360Sliders
|
|
||||||
{
|
|
||||||
LeftTrigger,
|
|
||||||
RightTrigger
|
|
||||||
}
|
|
||||||
}
|
|
@ -117,10 +117,10 @@
|
|||||||
<HintPath>..\packages\TaskScheduler.2.8.0\lib\net452\Microsoft.Win32.TaskScheduler.dll</HintPath>
|
<HintPath>..\packages\TaskScheduler.2.8.0\lib\net452\Microsoft.Win32.TaskScheduler.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Nefarius.ViGEm.Client" Condition="'$(Platform)' == 'x64'">
|
<Reference Include="Nefarius.ViGEm.Client" Condition="'$(Platform)' == 'x64'">
|
||||||
<HintPath>.\libs\x64\Nefarius.ViGEmClient\Nefarius.ViGEm.Client.dll</HintPath>
|
<HintPath>.\libs\x64\Nefarius.ViGEm.Client\Nefarius.ViGEm.Client.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Nefarius.ViGEm.Client" Condition="'$(Platform)' == 'x86'">
|
<Reference Include="Nefarius.ViGEm.Client" Condition="'$(Platform)' == 'x86'">
|
||||||
<HintPath>.\libs\x86\Nefarius.ViGEmClient\Nefarius.ViGEm.Client.dll</HintPath>
|
<HintPath>.\libs\x86\Nefarius.ViGEm.Client\Nefarius.ViGEm.Client.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
@ -147,7 +147,6 @@
|
|||||||
<Compile Include="DS4Control\ScpUtil.cs" />
|
<Compile Include="DS4Control\ScpUtil.cs" />
|
||||||
<Compile Include="DS4Control\UdpServer.cs" />
|
<Compile Include="DS4Control\UdpServer.cs" />
|
||||||
<Compile Include="DS4Control\Util.cs" />
|
<Compile Include="DS4Control\Util.cs" />
|
||||||
<Compile Include="DS4Control\VigemXbox360Report.cs" />
|
|
||||||
<Compile Include="DS4Forms\LanguagePackComboBox.cs">
|
<Compile Include="DS4Forms\LanguagePackComboBox.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user