SteamController: Fix PS button and Gyro support for DS4

Make DS4 fields be readonly and optimise DS4 packets.
This commit is contained in:
Kamil Trzciński 2023-02-11 13:37:17 +01:00
parent eed1453daf
commit 00a30cbf5c
5 changed files with 65 additions and 54 deletions

View file

@ -1,6 +1,5 @@
using Nefarius.ViGEm.Client.Targets.Xbox360;
using CommonHelpers;
using SteamController.Devices;
using SteamController.ProfilesSettings;
namespace SteamController.Profiles.Predefined
{
@ -27,14 +26,20 @@ namespace SteamController.Profiles.Predefined
get { return ProfilesSettings.DS4BackPanelSettings.Default; }
}
private TimedValue<bool> btnSteamPressed;
public override Status Run(Context context)
{
context.Steam.LizardButtons = false;
context.Steam.LizardMouse = false;
context.DS4.Connected = true;
// Lock BtnSteam
if (context.Steam.BtnSteam.Pressed())
btnSteamPressed = new TimedValue<bool>(true, 100);
// Controls
context.DS4.Overwrite(DS4Controller.PS, context.Steam.BtnSteam.Pressed(), 100);
context.DS4[DS4Controller.PS] = btnSteamPressed.GetValueOrDefault(false);
context.DS4[DS4Controller.Share] = context.Steam.BtnMenu;
context.DS4[DS4Controller.Options] = context.Steam.BtnOptions;
@ -85,8 +90,8 @@ namespace SteamController.Profiles.Predefined
// Accel & Gyro
context.DS4[DS4Controller.GyroX] = context.Steam.GyroPitch;
context.DS4[DS4Controller.GyroY] = context.Steam.GyroRoll;
context.DS4[DS4Controller.GyroZ] = context.Steam.GyroYaw;
context.DS4[DS4Controller.GyroY] = context.Steam.GyroYaw;
context.DS4[DS4Controller.GyroZ] = context.Steam.GyroRoll;
context.DS4[DS4Controller.AccelX] = context.Steam.AccelX;
context.DS4[DS4Controller.AccelY] = context.Steam.AccelY;
context.DS4[DS4Controller.AccelZ] = context.Steam.AccelZ;