SteamController: Detect RTSS in foreground

This commit is contained in:
Kamil Trzciński 2022-12-12 12:31:59 +01:00
parent e5debff45b
commit 312fc97034
5 changed files with 25 additions and 9 deletions

View file

@ -1,15 +1,9 @@
using RTSSSharedMemoryNET;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace PowerControl.Helpers
namespace CommonHelpers
{
internal static class RTSS
public static class RTSS
{
public static bool IsOSDForeground()
{

View file

@ -22,12 +22,13 @@ namespace SteamController
public struct ContextState
{
public bool GameProcessRunning { get; set; }
public bool RTSSInForeground { get; set; }
public bool SteamUsesX360Controller { get; set; }
public bool SteamUsesSteamInput { get; set; }
public bool IsActive
{
get { return GameProcessRunning || SteamUsesSteamInput || SteamUsesSteamInput; }
get { return RTSSInForeground || GameProcessRunning || SteamUsesSteamInput || SteamUsesSteamInput; }
}
public override string ToString()
@ -36,6 +37,7 @@ namespace SteamController
if (GameProcessRunning) reason += " game";
if (SteamUsesX360Controller) reason += " steamX360";
if (SteamUsesSteamInput) reason += " steamInput";
if (RTSSInForeground) reason += " rtss";
return reason;
}
}

View file

@ -31,6 +31,7 @@ namespace SteamController
Managers = {
new Managers.ProcessManager(),
new Managers.SteamManager(),
new Managers.RTSSManager(),
new Managers.ProfileSwitcher(),
new Managers.SteamConfigsManager(),
new Managers.SharedDataManager(),

View file

@ -0,0 +1,12 @@
using CommonHelpers;
namespace SteamController.Managers
{
public sealed class RTSSManager : Manager
{
public override void Tick(Context context)
{
context.State.RTSSInForeground = SettingsDebug.Default.DetectRTSSForeground && RTSS.IsOSDForeground();
}
}
}

View file

@ -20,6 +20,13 @@ namespace SteamController
set { Set("KeepX360AlwaysConnected", value); }
}
[Description("If current foreground process uses overlay, treat it as a game.")]
public bool DetectRTSSForeground
{
get { return Get<bool>("DetectRTSSForeground", false); }
set { Set("DetectRTSSForeground", value); }
}
[Description("Use Lizard Buttons instead of emulated. This option is only for testing purposes.")]
public bool LizardButtons { get; set; } = false;