From 6850b644a0cd1fd4215e01e0fbfd9af4bcb1fca1 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Fri, 1 Mar 2024 20:14:53 +0100 Subject: [PATCH] Fix for detecting exit of game --- app/AutoTDP/AutoTDPService.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/AutoTDP/AutoTDPService.cs b/app/AutoTDP/AutoTDPService.cs index 3b686522..e3408d65 100644 --- a/app/AutoTDP/AutoTDPService.cs +++ b/app/AutoTDP/AutoTDPService.cs @@ -266,17 +266,21 @@ namespace GHelper.AutoTDP CurrentTDP = powerLimiter.GetCPUPowerLimit(); while (currentGame is not null && Running) { - GameFPS = framerateSouce.GetFramerate(instance); + //prevent FPS from going to 0 which causes issues with the math + + double fps = framerateSouce.GetFramerate(instance); Logger.WriteLine("[AutoTDPService] (" + instance.ProcessName + ") Framerate " + GameFPS); - if (GameFPS < 0.0d) + if (fps < 0.0d) { //Game is not running anymore or RTSS lost its hook Reset(); return; } + + GameFPS = Math.Max(5, fps); AdjustPowerLimit(profile); try