mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-05 06:15:26 +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
|
|
@ -9,8 +9,6 @@ namespace SteamController.Managers
|
|||
"Playnite.FullscreenApp"
|
||||
};
|
||||
|
||||
private bool activated;
|
||||
|
||||
private Process? FindActivationProcess()
|
||||
{
|
||||
foreach (var processName in ActivationProcessNames)
|
||||
|
|
@ -25,23 +23,7 @@ namespace SteamController.Managers
|
|||
|
||||
public override void Tick(Context context)
|
||||
{
|
||||
// React to state change
|
||||
if (FindActivationProcess() is not null)
|
||||
{
|
||||
if (!activated)
|
||||
{
|
||||
activated = true;
|
||||
context.SelectController();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (activated)
|
||||
{
|
||||
activated = false;
|
||||
context.BackToDefault();
|
||||
}
|
||||
}
|
||||
context.GameProcessRunning = FindActivationProcess() is not null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32,14 +32,11 @@ namespace SteamController.Managers
|
|||
Devices.Xbox360Controller.VendorID,
|
||||
Devices.Xbox360Controller.ProductID
|
||||
) != true;
|
||||
|
||||
context.SelectController();
|
||||
}
|
||||
else
|
||||
{
|
||||
context.SteamUsesSteamInput = false;
|
||||
context.SteamUsesX360Controller = false;
|
||||
context.BackToDefault();
|
||||
}
|
||||
|
||||
lastState = usesController;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue