mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-02-02 13:44:22 +01:00
Detect SAS (Secure Attention Sequence) in a way that does not prevent screen sleep
This commit is contained in:
parent
2db4dcf5ae
commit
fec7e87c21
|
|
@ -18,3 +18,4 @@
|
|||
- Automatically manage steam controller configs when using Steam Input
|
||||
- Allow to assign BackPanel keys to X360 controller (breaks all current configs to set mappings)
|
||||
- All SteamDeckTools settings are stored in `.ini` file in root folder
|
||||
- Detect SAS (Secure Attention Sequence) in a way that does not prevent screen sleep
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ namespace SteamController
|
|||
}
|
||||
|
||||
public bool RequestEnable { get; set; } = true;
|
||||
public bool KeyboardMouseValid { get; set; } = true;
|
||||
public ContextState State;
|
||||
|
||||
public event Action<Profiles.Profile> ProfileChanged;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ namespace SteamController
|
|||
new Managers.SteamManager(),
|
||||
new Managers.ProfileSwitcher(),
|
||||
new Managers.SteamConfigsManager(),
|
||||
new Managers.SharedDataManager()
|
||||
new Managers.SharedDataManager(),
|
||||
new Managers.SASManager()
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -141,7 +142,7 @@ namespace SteamController
|
|||
|
||||
var isDesktop = context.CurrentProfile?.IsDesktop ?? false;
|
||||
|
||||
if (!context.Mouse.Valid)
|
||||
if (!context.KeyboardMouseValid)
|
||||
{
|
||||
notifyIcon.Text = TitleWithVersion + ". Cannot send input.";
|
||||
notifyIcon.Icon = Resources.microsoft_xbox_controller_off_red;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ namespace SteamController.Devices
|
|||
// TODO: Unsure what it is
|
||||
public const int XButtonID = 0;
|
||||
public const int YButtonID = 1;
|
||||
public const int UpdateValidInterval = 100;
|
||||
|
||||
InputSimulator simulator = new InputSimulator();
|
||||
|
||||
|
|
@ -46,9 +45,6 @@ namespace SteamController.Devices
|
|||
|
||||
Accum movedX, movedY, verticalScroll, horizontalScroll;
|
||||
|
||||
bool? valid = null;
|
||||
DateTime lastValid = DateTime.Now;
|
||||
|
||||
public enum Button
|
||||
{
|
||||
Left,
|
||||
|
|
@ -68,11 +64,6 @@ namespace SteamController.Devices
|
|||
}
|
||||
}
|
||||
|
||||
public bool Valid
|
||||
{
|
||||
get { return valid ?? true; }
|
||||
}
|
||||
|
||||
public Button[] DownButtons
|
||||
{
|
||||
get { return mouseButtons.ToArray(); }
|
||||
|
|
@ -90,29 +81,10 @@ namespace SteamController.Devices
|
|||
{
|
||||
try
|
||||
{
|
||||
if (action())
|
||||
{
|
||||
valid = true;
|
||||
lastValid = DateTime.Now;
|
||||
}
|
||||
|
||||
action();
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
valid = false;
|
||||
lastValid = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateValid()
|
||||
{
|
||||
if (valid is null || lastValid.AddMilliseconds(UpdateValidInterval) < DateTime.Now)
|
||||
{
|
||||
Safe(() =>
|
||||
{
|
||||
simulator.Mouse.MoveMouseBy(0, 0);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -235,8 +207,6 @@ namespace SteamController.Devices
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
UpdateValid();
|
||||
}
|
||||
|
||||
public void MouseClick(Button button)
|
||||
|
|
|
|||
13
SteamController/Managers/SASManager.cs
Normal file
13
SteamController/Managers/SASManager.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System.Diagnostics;
|
||||
using SteamController.Helpers;
|
||||
|
||||
namespace SteamController.Managers
|
||||
{
|
||||
public sealed class SASManager : Manager
|
||||
{
|
||||
public override void Tick(Context context)
|
||||
{
|
||||
context.KeyboardMouseValid = ForegroundProcess.Find() is not null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -28,17 +28,18 @@ namespace SteamController.Profiles
|
|||
return Status.Done;
|
||||
}
|
||||
|
||||
if (!c.Mouse.Valid)
|
||||
if (!c.KeyboardMouseValid)
|
||||
{
|
||||
// Failed to acquire secure context
|
||||
// Enable emergency Lizard
|
||||
c.Steam.LizardButtons = true;
|
||||
c.Steam.LizardMouse = true;
|
||||
return Status.Done;
|
||||
}
|
||||
|
||||
c.Steam.LizardButtons = SteamModeLizardButtons;
|
||||
c.Steam.LizardMouse = SteamModeLizardMouse;
|
||||
else
|
||||
{
|
||||
c.Steam.LizardButtons = SteamModeLizardButtons;
|
||||
c.Steam.LizardMouse = SteamModeLizardMouse;
|
||||
}
|
||||
|
||||
EmulateScrollOnLPad(c);
|
||||
EmulateScrollOnLStick(c);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace SteamController.Profiles
|
|||
{
|
||||
public override bool Selected(Context context)
|
||||
{
|
||||
return context.Enabled && context.X360.Valid && context.Mouse.Valid && !context.State.SteamUsesSteamInput;
|
||||
return context.Enabled && context.X360.Valid && context.KeyboardMouseValid && !context.State.SteamUsesSteamInput;
|
||||
}
|
||||
|
||||
internal override ProfilesSettings.BackPanelSettings BackPanelSettings
|
||||
|
|
|
|||
Loading…
Reference in a new issue