- DS4 implementation changes

- Using my own build of ViGEmClient with extra functions
This commit is contained in:
David Khachaturov 2020-04-20 15:14:50 +01:00
parent 6bd8bc0ea9
commit 0577c68b43
4 changed files with 26 additions and 4 deletions

View file

@ -110,8 +110,8 @@
<Reference Include="JetBrains.Annotations, Version=2018.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2018.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="Nefarius.ViGEm.Client, Version=1.16.150.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nefarius.ViGEm.Client.1.16.150\lib\net452\Nefarius.ViGEm.Client.dll</HintPath>
<Reference Include="Nefarius.ViGEm.Client, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nefarius.ViGEm.Client.1.0.0\lib\net452\Nefarius.ViGEm.Client.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />

View file

@ -223,6 +223,7 @@ namespace BetterJoyForCemu {
public IXbox360Controller xin;
public IDualShock4Controller ds4;
short ds4_ts = 0;
int rumblePeriod = Int32.Parse(ConfigurationManager.AppSettings["RumblePeriod"]);
int lowFreq = Int32.Parse(ConfigurationManager.AppSettings["LowFreqRumble"]);
@ -932,6 +933,7 @@ namespace BetterJoyForCemu {
ds4.SetButtonState(!swapXY ? DualShock4Button.Triangle : DualShock4Button.Square, buttons[(int)(isLeft ? Button.X : Button.DPAD_UP)]);
ds4.SetButtonState(!swapXY ? DualShock4Button.Square : DualShock4Button.Triangle, buttons[(int)(isLeft ? Button.Y : Button.DPAD_LEFT)]);
ds4.SetDPadDirection(DualShock4DPadDirection.None);
if (buttons[(int)(isLeft ? Button.DPAD_UP : Button.X)])
if (buttons[(int)(isLeft ? Button.DPAD_LEFT : Button.Y)])
ds4.SetDPadDirection(DualShock4DPadDirection.Northwest);
@ -986,7 +988,7 @@ namespace BetterJoyForCemu {
ds4.SetAxisValue(DualShock4Axis.RightThumbY, CastStickValueByte((other == this && !isLeft) ? stick[1] : stick2[1]));
} else { // single joycon mode
ds4.SetAxisValue(DualShock4Axis.LeftThumbY, CastStickValueByte((isLeft ? 1 : -1) * stick[0]));
ds4.SetAxisValue(DualShock4Axis.LeftThumbX, CastStickValueByte((isLeft ? -1 : 1) * stick[1]));
ds4.SetAxisValue(DualShock4Axis.LeftThumbX, CastStickValueByte((isLeft ? 1 : -1) * stick[1]));
}
}
@ -997,6 +999,26 @@ namespace BetterJoyForCemu {
ds4.SetSliderValue(DualShock4Slider.LeftTrigger, (byte)(buttons[(int)(isLeft ? Button.SHOULDER_2 : Button.SHOULDER_1)] ? Byte.MaxValue : 0));
ds4.SetSliderValue(DualShock4Slider.RightTrigger, (byte)(buttons[(int)(isLeft ? Button.SHOULDER_1 : Button.SHOULDER_2)] ? Byte.MaxValue : 0));
}
// Gyro and accel
ds4_ts += 188; // 1.5ms
ds4.SetIMUTimestamp(ds4_ts);
/*Vector3 gyr = GetGyro() * 1024f;
ds4.SetIMUValue(DualShock4IMU.GyroX, (short) gyr.X);
ds4.SetIMUValue(DualShock4IMU.GyroY, (short) gyr.Y);
ds4.SetIMUValue(DualShock4IMU.GyroZ, (short) gyr.Z);
Vector3 acc = GetAccel() * 8192f;
ds4.SetIMUValue(DualShock4IMU.AccelX, (short) acc.X);
ds4.SetIMUValue(DualShock4IMU.AccelY, (short)-acc.Y);
ds4.SetIMUValue(DualShock4IMU.AccelZ, (short)acc.Z);*/
ds4_ts = 14;
ds4.SetIMUTimestamp(0);
ds4.SetIMUValue(DualShock4IMU.GyroX, ds4_ts);
ds4.SetIMUValue(DualShock4IMU.GyroY, ds4_ts);
ds4.SetIMUValue(DualShock4IMU.GyroZ, ds4_ts);
ds4.SetIMUValue(DualShock4IMU.AccelX, ds4_ts);
ds4.SetIMUValue(DualShock4IMU.AccelY, ds4_ts);
ds4.SetIMUValue(DualShock4IMU.AccelZ, ds4_ts);
}
// Get Gyro/Accel data

View file

@ -5,6 +5,6 @@
<package id="Fielder.Fody" version="1.2.3" targetFramework="net461" />
<package id="Fody" version="4.2.1" targetFramework="net461" developmentDependency="true" />
<package id="JetBrains.Annotations" version="2018.3.0" targetFramework="net461" />
<package id="Nefarius.ViGEm.Client" version="1.16.150" targetFramework="net461" />
<package id="Nefarius.ViGEm.Client" version="1.0.0" targetFramework="net461" />
<package id="WindowsInput" version="6.1.1" targetFramework="net461" />
</packages>

Binary file not shown.