Fix for detecting exit of game

This commit is contained in:
IceStormNG
2024-03-01 20:14:53 +01:00
parent 0370aa8c94
commit 6850b644a0

View File

@@ -266,17 +266,21 @@ namespace GHelper.AutoTDP
CurrentTDP = powerLimiter.GetCPUPowerLimit(); CurrentTDP = powerLimiter.GetCPUPowerLimit();
while (currentGame is not null && Running) 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); 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 //Game is not running anymore or RTSS lost its hook
Reset(); Reset();
return; return;
} }
GameFPS = Math.Max(5, fps);
AdjustPowerLimit(profile); AdjustPowerLimit(profile);
try try