mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-07 23:33:52 +00:00
Improve VirtualX360Code to ToViGEm mapping
This commit is contained in:
parent
36d0169119
commit
26171639eb
3 changed files with 37 additions and 35 deletions
|
|
@ -1,3 +1,5 @@
|
|||
using Nefarius.ViGEm.Client.Targets.Xbox360;
|
||||
|
||||
namespace SteamController.ProfilesSettings
|
||||
{
|
||||
public enum VirtualX360Code
|
||||
|
|
@ -21,4 +23,32 @@ namespace SteamController.ProfilesSettings
|
|||
X360_LS,
|
||||
X360_RS
|
||||
}
|
||||
|
||||
public static class VirtualX360CodeExtensions
|
||||
{
|
||||
private static readonly Dictionary<VirtualX360Code, Xbox360Button> codeToButton = new Dictionary<VirtualX360Code, Xbox360Button>()
|
||||
{
|
||||
{ VirtualX360Code.X360_UP, Xbox360Button.Up },
|
||||
{ VirtualX360Code.X360_DOWN, Xbox360Button.Down },
|
||||
{ VirtualX360Code.X360_LEFT, Xbox360Button.Left },
|
||||
{ VirtualX360Code.X360_RIGHT, Xbox360Button.Right },
|
||||
{ VirtualX360Code.X360_BACK, Xbox360Button.Back },
|
||||
{ VirtualX360Code.X360_START, Xbox360Button.Start },
|
||||
{ VirtualX360Code.X360_A, Xbox360Button.A },
|
||||
{ VirtualX360Code.X360_B, Xbox360Button.B },
|
||||
{ VirtualX360Code.X360_X, Xbox360Button.X },
|
||||
{ VirtualX360Code.X360_Y, Xbox360Button.Y },
|
||||
{ VirtualX360Code.X360_LB, Xbox360Button.LeftShoulder },
|
||||
{ VirtualX360Code.X360_RB, Xbox360Button.RightShoulder },
|
||||
{ VirtualX360Code.X360_LS, Xbox360Button.LeftThumb },
|
||||
{ VirtualX360Code.X360_RS, Xbox360Button.RightThumb }
|
||||
};
|
||||
|
||||
public static Xbox360Button? ToViGEm(this VirtualX360Code code)
|
||||
{
|
||||
if (codeToButton.TryGetValue(code, out var button))
|
||||
return button;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue