mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2025-12-06 07:12:01 +01:00
SteamController: Allow to configure DS4 back buttons
This commit is contained in:
parent
eb774e11fa
commit
3d03f5e929
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
## 0.6.x
|
||||
|
||||
- SteamController: Allow to configure DS4 back buttons
|
||||
- SteamController: Allow to `EnableDS4Support=false` to hide DS4 controller
|
||||
- All: Support [unofficial APU drivers](https://sourceforge.net/projects/amernimezone/files/Release%20Polaris-Vega-Navi/AMD%20SOC%20Driver%20Variant/) that present themselves as `AMD Radeon 670M`
|
||||
- PowerControl: Show Game Profiles menu item
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using CommonHelpers;
|
||||
using SteamController.Devices;
|
||||
using SteamController.ProfilesSettings;
|
||||
|
||||
namespace SteamController.Profiles.Predefined
|
||||
{
|
||||
|
|
@ -110,6 +111,25 @@ namespace SteamController.Profiles.Predefined
|
|||
return Status.Continue;
|
||||
}
|
||||
|
||||
private void SetVirtualDS4Code(Context c, VirtualDS4Code ds4Code, bool value)
|
||||
{
|
||||
var button = ds4Code.ToDS4Button();
|
||||
if (button is not null)
|
||||
c.DS4[button.Value] = value;
|
||||
}
|
||||
|
||||
protected override void BackPanelShortcuts(Context c)
|
||||
{
|
||||
base.BackPanelShortcuts(c);
|
||||
|
||||
var settings = ProfilesSettings.DS4BackPanelSettings.Default;
|
||||
|
||||
SetVirtualDS4Code(c, settings.L4_DS4, c.Steam.BtnL4);
|
||||
SetVirtualDS4Code(c, settings.L5_DS4, c.Steam.BtnL5);
|
||||
SetVirtualDS4Code(c, settings.R4_DS4, c.Steam.BtnR4);
|
||||
SetVirtualDS4Code(c, settings.R5_DS4, c.Steam.BtnR5);
|
||||
}
|
||||
|
||||
private Point? GetTPadPoint(SteamAxis x, SteamAxis y)
|
||||
{
|
||||
if (x || y)
|
||||
|
|
|
|||
|
|
@ -12,5 +12,33 @@ namespace SteamController.ProfilesSettings
|
|||
public DS4BackPanelSettings() : base("DS4BackPanelSettings")
|
||||
{
|
||||
}
|
||||
|
||||
[Description(MappingsDescription)]
|
||||
public VirtualDS4Code L4_DS4
|
||||
{
|
||||
get { return Get<VirtualDS4Code>("L4_DS4", VirtualDS4Code.None); }
|
||||
set { Set("L4_DS4", value); }
|
||||
}
|
||||
|
||||
[Description(MappingsDescription)]
|
||||
public VirtualDS4Code L5_DS4
|
||||
{
|
||||
get { return Get<VirtualDS4Code>("L5_DS4", VirtualDS4Code.None); }
|
||||
set { Set("L5_DS4", value); }
|
||||
}
|
||||
|
||||
[Description(MappingsDescription)]
|
||||
public VirtualDS4Code R4_DS4
|
||||
{
|
||||
get { return Get<VirtualDS4Code>("R4_DS4", VirtualDS4Code.None); }
|
||||
set { Set("R4_DS4", value); }
|
||||
}
|
||||
|
||||
[Description(MappingsDescription)]
|
||||
public VirtualDS4Code R5_DS4
|
||||
{
|
||||
get { return Get<VirtualDS4Code>("R5_DS4", VirtualDS4Code.None); }
|
||||
set { Set("R5_DS4", value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
52
SteamController/ProfilesSettings/VirtualDS4Code.cs
Normal file
52
SteamController/ProfilesSettings/VirtualDS4Code.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
using Nefarius.ViGEm.Client.Targets.DualShock4;
|
||||
using SteamController.Devices;
|
||||
|
||||
namespace SteamController.ProfilesSettings
|
||||
{
|
||||
public enum VirtualDS4Code
|
||||
{
|
||||
None = 0,
|
||||
|
||||
DS4_TRIANGLE,
|
||||
DS4_CIRCLE,
|
||||
DS4_CROSS,
|
||||
DS4_SQUARE,
|
||||
|
||||
DS4_OPTIONS,
|
||||
DS4_SHARE,
|
||||
|
||||
DS4_STICK_LEFT,
|
||||
DS4_STICK_RIGHT,
|
||||
|
||||
DS4_L1,
|
||||
DS4_R1,
|
||||
DS4_L2,
|
||||
DS4_R2,
|
||||
}
|
||||
|
||||
public static class VirtualDS4CodeExtensions
|
||||
{
|
||||
private static readonly Dictionary<VirtualDS4Code, DS4Controller.DualShock4Button> codeToButton = new Dictionary<VirtualDS4Code, DS4Controller.DualShock4Button>()
|
||||
{
|
||||
{ VirtualDS4Code.DS4_TRIANGLE, DS4Controller.Triangle },
|
||||
{ VirtualDS4Code.DS4_CIRCLE, DS4Controller.Circle },
|
||||
{ VirtualDS4Code.DS4_CROSS, DS4Controller.Cross },
|
||||
{ VirtualDS4Code.DS4_SQUARE, DS4Controller.Square },
|
||||
{ VirtualDS4Code.DS4_OPTIONS, DS4Controller.Options },
|
||||
{ VirtualDS4Code.DS4_SHARE, DS4Controller.Share },
|
||||
{ VirtualDS4Code.DS4_STICK_LEFT, DS4Controller.ThumbLeft },
|
||||
{ VirtualDS4Code.DS4_STICK_RIGHT, DS4Controller.ThumbRight },
|
||||
{ VirtualDS4Code.DS4_L1, DS4Controller.ShoulderLeft },
|
||||
{ VirtualDS4Code.DS4_R1, DS4Controller.ShoulderRight },
|
||||
{ VirtualDS4Code.DS4_L2, DS4Controller.TriggerLeft },
|
||||
{ VirtualDS4Code.DS4_R2, DS4Controller.TriggerRight }
|
||||
};
|
||||
|
||||
public static DS4Controller.DualShock4Button? ToDS4Button(this VirtualDS4Code code)
|
||||
{
|
||||
if (codeToButton.TryGetValue(code, out var button))
|
||||
return button;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue