From d26300ea2ac9d8465f8b9f842ddb914a5b8a43cd Mon Sep 17 00:00:00 2001
From: ZyCromerZ <neetroid97@gmail.com>
Date: Fri, 17 Jun 2022 02:26:34 +0700
Subject: [PATCH] fix module mode sometimes not working properly

Signed-off-by: ZyCromerZ <neetroid97@gmail.com>
---
 system/etc/ZyC-Core/main.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/system/etc/ZyC-Core/main.sh b/system/etc/ZyC-Core/main.sh
index cb985ed..52a8d7e 100644
--- a/system/etc/ZyC-Core/main.sh
+++ b/system/etc/ZyC-Core/main.sh
@@ -109,7 +109,6 @@
                 else
                     ## auto
                     [[ "$ModuleMode" != "Auto" ]] && WriteOnly "Auto" $PMConfig/modules_mode.conf
-                    [[ "$GameDetected" == "y" ]] && GoTurbo="$MaxCheckGpuUsage" && GoNormal="0"
 
                     if [[ "$GpuStatus" -ge "$MaxGpuUsage" ]] && [[ "$GheymingMode" == "n" ]] && [[ "$GoTurbo" -le "$MaxCheckGpuUsage" ]];then
                         GoTurbo=$(($GoTurbo+1))
@@ -118,6 +117,9 @@
                         GoNormal=$(($GoNormal+1))
                         [[ "$GoTurbo" -ge "0" ]] && GoTurbo=$(($GoTurbo-1))
                     fi
+
+                    [[ "$GameDetected" == "y" ]] && GoTurbo="$MaxCheckGpuUsage" && GoNormal="0"
+
                     [[ "$StopSpamSendInfo" == "y" ]] && StopSpamSendInfo="n"
                 fi
 
@@ -157,10 +159,10 @@
                     fi
                 fi
 
-                if [[ "$GoTurbo" -ge "$MaxCheckGpuUsage" ]];then
+                if [[ "$GoTurbo" -ge "$MaxCheckGpuUsage" ]] || [[ "$GoTurbo" -le "0" ]];then
                     GoTurbo="0"
                 fi
-                if [[ "$GoNormal" -ge "$MaxCheckGpuUsage" ]];then
+                if [[ "$GoNormal" -ge "$MaxCheckGpuUsage" ]] || [[ "$GoNormal" -le "0" ]];then
                     GoNormal="0"
                 fi
 
-- 
GitLab