steam-deck-tools/PowerControl/Program.cs

49 lines
1.5 KiB
C#
Raw Normal View History

using CommonHelpers;
using PowerControl.Helpers;
using PowerControl.Helpers.AMD;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace PowerControl
{
internal static class Program
{
const int MAX_GPU_RETRIES = 3;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
2022-12-12 15:08:00 +01:00
Instance.WithSentry(() =>
{
2023-01-12 22:58:40 +01:00
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
2022-12-12 15:08:00 +01:00
if (Settings.Default.EnableExperimentalFeatures)
2022-11-23 10:30:13 +01:00
{
2023-01-12 22:58:40 +01:00
if (!AntiCheatSettings.Default.AckAntiCheat(
Controller.TitleWithVersion,
2023-01-12 22:58:40 +01:00
"You are running EXPERIMENTAL build.", null, false))
return;
2023-01-12 22:58:40 +01:00
}
2023-01-12 22:58:40 +01:00
for (int i = 0; !VangoghGPU.IsSupported && i < MAX_GPU_RETRIES; i++)
{
var status = Instance.WithGlobalMutex(1000, () => VangoghGPU.Detect());
if (status != VangoghGPU.DetectionStatus.Retryable)
break;
2023-01-12 22:58:40 +01:00
Thread.Sleep(300);
2022-11-23 10:30:13 +01:00
}
2022-12-12 15:08:00 +01:00
using (var controller = new Controller())
{
Application.Run();
}
});
}
}
}