mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-07 15:23:55 +00:00
Split Profiles into Profiles/Default and Profiles/Predefined
This commit is contained in:
parent
86b73001a2
commit
bdcb70d685
9 changed files with 19 additions and 26 deletions
76
SteamController/Profiles/Predefined/DesktopProfile.cs
Normal file
76
SteamController/Profiles/Predefined/DesktopProfile.cs
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
using WindowsInput;
|
||||
|
||||
namespace SteamController.Profiles.Predefined
|
||||
{
|
||||
public sealed class DesktopProfile : Default.BackPanelShortcutsProfile
|
||||
{
|
||||
private const String Consumed = "DesktopProfileOwner";
|
||||
|
||||
public DesktopProfile()
|
||||
{
|
||||
IsDesktop = true;
|
||||
}
|
||||
|
||||
internal override ProfilesSettings.BackPanelSettings BackPanelSettings
|
||||
{
|
||||
get { return ProfilesSettings.DesktopPanelSettings.Default; }
|
||||
}
|
||||
|
||||
public override bool Selected(Context context)
|
||||
{
|
||||
return context.Enabled;
|
||||
}
|
||||
|
||||
public override Status Run(Context c)
|
||||
{
|
||||
if (base.Run(c).IsDone)
|
||||
{
|
||||
return Status.Done;
|
||||
}
|
||||
|
||||
if (!c.KeyboardMouseValid)
|
||||
{
|
||||
// Failed to acquire secure context
|
||||
// Enable emergency Lizard
|
||||
c.Steam.LizardButtons = true;
|
||||
c.Steam.LizardMouse = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
c.Steam.LizardButtons = SettingsDebug.Default.LizardButtons;
|
||||
c.Steam.LizardMouse = SettingsDebug.Default.LizardMouse;
|
||||
}
|
||||
|
||||
EmulateScrollOnLPad(c);
|
||||
EmulateScrollOnLStick(c);
|
||||
EmulateMouseOnRPad(c);
|
||||
EmulateMouseOnRStick(c);
|
||||
EmulateDPadArrows(c);
|
||||
|
||||
c.Keyboard[VirtualKeyCode.RETURN] = c.Steam.BtnA;
|
||||
c.Keyboard[VirtualKeyCode.BACK] = c.Steam.BtnB;
|
||||
|
||||
return Status.Continue;
|
||||
}
|
||||
|
||||
private void EmulateScrollOnLStick(Context c)
|
||||
{
|
||||
if (c.Steam.LeftThumbX)
|
||||
{
|
||||
c.Mouse.HorizontalScroll(c.Steam.LeftThumbX.DeltaValue * Context.ThumbToWhellSensitivity);
|
||||
}
|
||||
if (c.Steam.LeftThumbY)
|
||||
{
|
||||
c.Mouse.VerticalScroll(c.Steam.LeftThumbY.DeltaValue * Context.ThumbToWhellSensitivity * (double)Settings.Default.ScrollDirection);
|
||||
}
|
||||
}
|
||||
|
||||
private void EmulateDPadArrows(Context c)
|
||||
{
|
||||
c.Keyboard[VirtualKeyCode.LEFT] = c.Steam.BtnDpadLeft;
|
||||
c.Keyboard[VirtualKeyCode.RIGHT] = c.Steam.BtnDpadRight;
|
||||
c.Keyboard[VirtualKeyCode.UP] = c.Steam.BtnDpadUp;
|
||||
c.Keyboard[VirtualKeyCode.DOWN] = c.Steam.BtnDpadDown;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue