mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-08 15:54:00 +00:00
Fix using Playnite to launch Steam game where on exit Desktop was activated
This commit is contained in:
parent
381f940d8b
commit
c2f37dedd9
6 changed files with 56 additions and 23 deletions
45
SteamController/Managers/ProfileSwitcher.cs
Normal file
45
SteamController/Managers/ProfileSwitcher.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using System.Diagnostics;
|
||||
using SteamController.Helpers;
|
||||
|
||||
namespace SteamController.Managers
|
||||
{
|
||||
public sealed class ProfileSwitcher : Manager
|
||||
{
|
||||
[Flags]
|
||||
private enum ActiveMode
|
||||
{
|
||||
None,
|
||||
SteamInput = 1,
|
||||
SteamX360 = 2,
|
||||
OtherGame = 4
|
||||
}
|
||||
|
||||
private ActiveMode wasActive;
|
||||
|
||||
public override void Tick(Context context)
|
||||
{
|
||||
ActiveMode active = GetActiveMode(context);
|
||||
if (wasActive == active)
|
||||
return;
|
||||
|
||||
if (active != ActiveMode.None)
|
||||
context.SelectController();
|
||||
else
|
||||
context.BackToDefault();
|
||||
|
||||
wasActive = active;
|
||||
}
|
||||
|
||||
private ActiveMode GetActiveMode(Context context)
|
||||
{
|
||||
ActiveMode mode = ActiveMode.None;
|
||||
if (context.SteamUsesSteamInput)
|
||||
mode |= ActiveMode.SteamInput;
|
||||
if (context.SteamUsesX360Controller)
|
||||
mode |= ActiveMode.SteamX360;
|
||||
if (context.GameProcessRunning)
|
||||
mode |= ActiveMode.OtherGame;
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue