Add SteamController implementation

This adds a Steam Shortcuts, Desktop Mode, and X360 Emulation
- Supports all Steam Shortcuts (including on-screen keyboard, and brightness)
- Supports Desktop mode (with a scroll on left pad and left stick), and trackpoint (on right stick)
- Supports X360 mode: hold Options for 1s to switch between Desktop and X360
- Holding Steam button enables Desktop like controls and stops passing all inputs to X360
This commit is contained in:
Kamil Trzciński 2022-11-24 22:37:24 +01:00
parent 203338b669
commit ecbd0407c0
41 changed files with 2486 additions and 34 deletions

View file

@ -88,7 +88,7 @@ namespace PowerControl
osdDismissTimer = new System.Windows.Forms.Timer(components);
osdDismissTimer.Interval = 3000;
osdDismissTimer.Tick += delegate(object ? sender, EventArgs e)
osdDismissTimer.Tick += delegate (object? sender, EventArgs e)
{
hideOSD();
};
@ -150,7 +150,7 @@ namespace PowerControl
{
GlobalHotKey.RegisterHotKey("VolumeUp", () =>
{
if ((neptuneDeviceState.buttons5 & (byte)SDCButton5.BTN_QUICK_ACCESS) != 0)
if (neptuneDeviceState.buttons5.HasFlag(SDCButton5.BTN_QUICK_ACCESS))
rootMenu.SelectNext("Brightness");
else
rootMenu.SelectNext("Volume");
@ -160,7 +160,7 @@ namespace PowerControl
GlobalHotKey.RegisterHotKey("VolumeDown", () =>
{
if ((neptuneDeviceState.buttons5 & (byte)SDCButton5.BTN_QUICK_ACCESS) != 0)
if (neptuneDeviceState.buttons5.HasFlag(SDCButton5.BTN_QUICK_ACCESS))
rootMenu.SelectPrev("Brightness");
else
rootMenu.SelectPrev("Volume");
@ -207,7 +207,7 @@ namespace PowerControl
}
// Consume only some events to avoid under-running SWICD
if ((input.buttons5 & (byte)SDCButton5.BTN_QUICK_ACCESS) != 0)
if (neptuneDeviceState.buttons5.HasFlag(SDCButton5.BTN_QUICK_ACCESS))
Thread.Sleep(1000 / 30);
else
Thread.Sleep(250);
@ -230,12 +230,12 @@ namespace PowerControl
return; // otherwise it did not yet trigger
// Reset sequence: 3 dots + L4|R4|L5|R5
if (input.buttons0 == (ushort)SDCButton0.BTN_L5 &&
input.buttons1 == (byte)SDCButton1.BTN_R5 &&
if (input.buttons0 == SDCButton0.BTN_L5 &&
input.buttons1 == SDCButton1.BTN_R5 &&
input.buttons2 == 0 &&
input.buttons3 == 0 &&
input.buttons4 == (byte)(SDCButton4.BTN_L4 | SDCButton4.BTN_R4) &&
input.buttons5 == (byte)SDCButton5.BTN_QUICK_ACCESS)
input.buttons4 == (SDCButton4.BTN_L4 | SDCButton4.BTN_R4) &&
input.buttons5 == SDCButton5.BTN_QUICK_ACCESS)
{
rootMenu.Show();
rootMenu.Reset();
@ -243,7 +243,7 @@ namespace PowerControl
return;
}
if ((input.buttons5 & (byte)SDCButton5.BTN_QUICK_ACCESS) == 0 || !RTSS.IsOSDForeground())
if (!neptuneDeviceState.buttons5.HasFlag(SDCButton5.BTN_QUICK_ACCESS) || !RTSS.IsOSDForeground())
{
// schedule next repeat far in the future
dismissNeptuneInput();
@ -258,19 +258,19 @@ namespace PowerControl
{
return;
}
else if (input.buttons0 == (ushort)SDCButton0.BTN_DPAD_LEFT)
else if (input.buttons0 == SDCButton0.BTN_DPAD_LEFT)
{
rootMenu.SelectPrev();
}
else if (input.buttons0 == (ushort)SDCButton0.BTN_DPAD_RIGHT)
else if (input.buttons0 == SDCButton0.BTN_DPAD_RIGHT)
{
rootMenu.SelectNext();
}
else if (input.buttons0 == (ushort)SDCButton0.BTN_DPAD_UP)
else if (input.buttons0 == SDCButton0.BTN_DPAD_UP)
{
rootMenu.Prev();
}
else if (input.buttons0 == (ushort)SDCButton0.BTN_DPAD_DOWN)
else if (input.buttons0 == SDCButton0.BTN_DPAD_DOWN)
{
rootMenu.Next();
}