mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-04 13:57:39 +00:00
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:
parent
203338b669
commit
ecbd0407c0
41 changed files with 2486 additions and 34 deletions
73
SteamController/Devices/SteamControllerLizard.cs
Normal file
73
SteamController/Devices/SteamControllerLizard.cs
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
using hidapi;
|
||||
using PowerControl.External;
|
||||
using static CommonHelpers.Log;
|
||||
|
||||
namespace SteamController.Devices
|
||||
{
|
||||
public partial class SteamController
|
||||
{
|
||||
public const int LizardModeUpdateInterval = 250;
|
||||
|
||||
public bool LizardMouse { get; set; } = true;
|
||||
public bool LizardButtons { get; set; } = true;
|
||||
|
||||
private bool? savedLizardMouse;
|
||||
private bool? savedLizardButtons;
|
||||
private DateTime lizardMouseUpdated = DateTime.Now;
|
||||
private DateTime lizardButtonUpdated = DateTime.Now;
|
||||
|
||||
private void UpdateLizardMouse()
|
||||
{
|
||||
if (savedLizardMouse == LizardMouse)
|
||||
{
|
||||
// We need to explicitly disable lizard every some time
|
||||
// but don't fight enabling it, as someone else might be taking control (Steam?)
|
||||
if (LizardMouse || lizardMouseUpdated.AddMilliseconds(LizardModeUpdateInterval) > DateTime.Now)
|
||||
return;
|
||||
}
|
||||
|
||||
if (LizardMouse)
|
||||
{
|
||||
//Enable mouse emulation
|
||||
byte[] data = new byte[] { 0x8e, 0x00 };
|
||||
neptuneDevice.RequestFeatureReport(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Disable mouse emulation
|
||||
byte[] data = new byte[] { 0x87, 0x03, 0x08, 0x07 };
|
||||
neptuneDevice.RequestFeatureReport(data);
|
||||
}
|
||||
|
||||
savedLizardMouse = LizardMouse;
|
||||
lizardMouseUpdated = DateTime.Now;
|
||||
}
|
||||
|
||||
private void UpdateLizardButtons()
|
||||
{
|
||||
if (savedLizardButtons == LizardButtons)
|
||||
{
|
||||
// We need to explicitly disable lizard every some time
|
||||
// but don't fight enabling it, as someone else might be taking control (Steam?)
|
||||
if (LizardButtons || lizardButtonUpdated.AddMilliseconds(LizardModeUpdateInterval) > DateTime.Now)
|
||||
return;
|
||||
}
|
||||
|
||||
if (LizardButtons)
|
||||
{
|
||||
//Enable keyboard/mouse button emulation
|
||||
byte[] data = new byte[] { 0x85, 0x00 };
|
||||
neptuneDevice.RequestFeatureReport(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Disable keyboard/mouse button emulation
|
||||
byte[] data = new byte[] { 0x81, 0x00 };
|
||||
neptuneDevice.RequestFeatureReport(data);
|
||||
}
|
||||
|
||||
savedLizardButtons = LizardButtons;
|
||||
lizardButtonUpdated = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue