diff --git a/COCBot/GUI/MBR GUI Control Bottom.au3 b/COCBot/GUI/MBR GUI Control Bottom.au3 index 0c08e114..757a60a0 100644 --- a/COCBot/GUI/MBR GUI Control Bottom.au3 +++ b/COCBot/GUI/MBR GUI Control Bottom.au3 @@ -22,8 +22,7 @@ Func Initiate() SetLogCentered(" " & $g_sBotTitle & " Powered by MyBot.run ", "~", $COLOR_DEBUG) Local $Compiled = @ScriptName & (@Compiled ? " Executable" : " Script") - Local $iFixV = String((@OSVersion = "WIN_10" And @OSBuild >= "22000") ? ("WIN_11") : (@OSVersion)) - SetLog($Compiled & " running on " & $iFixV & " " & @OSServicePack & " " & @OSArch) + SetLog($Compiled & " running on " & _OSVersion() & " " & @OSServicePack & " " & @OSArch) If Not $g_bSearchMode Then SetLogCentered(" Bot Start ", Default, $COLOR_SUCCESS) Else diff --git a/COCBot/Team__AiO__MOD++/functions/Mod's/ModFuncs.au3 b/COCBot/Team__AiO__MOD++/functions/Mod's/ModFuncs.au3 index ce82f10a..668c272f 100644 --- a/COCBot/Team__AiO__MOD++/functions/Mod's/ModFuncs.au3 +++ b/COCBot/Team__AiO__MOD++/functions/Mod's/ModFuncs.au3 @@ -352,4 +352,31 @@ Func ForegroundFixer($sPackage = Default) AndroidAdbSendShellCommand("am start -W -n " & $g_sAndroidGamePackage & "/" & $g_sAndroidGameClass, 60000) EndIf EndFunc ;==>ForegroundFixer -; #ce \ No newline at end of file +; #ce +Func _OSVersion() + Static $s_iTrueOSVersion = 0 + If $s_iTrueOSVersion > 0 Then + Return $s_iTrueOSVersion + EndIf + + $s_iTrueOSVersion = @OSVersion + + Local $sCurrentBuildNumber = RegRead($g_sHKLM & "\SOFTWARE" & $g_sWow6432Node & "\Microsoft\Windows NT\CurrentVersion\", "ProductName") + If @error Then $sCurrentBuildNumber = "" + + If ("WIN_10" = @OSVersion Or StringInStr($sCurrentBuildNumber, "Windows 10") > 0) And (_OSBuild() >= "22000" And _OSBuild() <= "32000") Then + $s_iTrueOSVersion = "WIN_11" + EndIf + + Return $s_iTrueOSVersion +EndFunc ;==>_OSVersion + +Func _OSBuild() + Static $s_iTrueOSBuild = 0 + If $s_iTrueOSBuild > 0 Then + Return $s_iTrueOSBuild + EndIf + $s_iTrueOSBuild = RegRead($g_sHKLM & "\SOFTWARE" & $g_sWow6432Node & "\Microsoft\Windows NT\CurrentVersion\", "CurrentBuildNumber") + If @error Or Number($s_iTrueOSBuild) = 0 Then $s_iTrueOSBuild = @OSBuild + Return SetError(0, 0, $s_iTrueOSBuild) +EndFunc ;==>_OSBuild diff --git a/COCBot/functions/Android/AndroidMEmu.au3 b/COCBot/functions/Android/AndroidMEmu.au3 index e293a1d4..89d318d3 100644 --- a/COCBot/functions/Android/AndroidMEmu.au3 +++ b/COCBot/functions/Android/AndroidMEmu.au3 @@ -104,7 +104,7 @@ Func GetMEmuBackgroundMode() Local $iOpenGL = $g_iAndroidBackgroundModeOpenGL ; hack for super strange Windows Fall Creator Update with OpenGL and DirectX problems ; doesn't have this issue with OSBuild : 17134 - If @OSBuild >= 16299 And @OSBuild < 17134 Then + If _OSBuild() >= 16299 And _OSBuild() < 17134 Then SetDebugLog("DirectX/OpenGL Fix applied for Windows Build 16299") $iDirectX = $g_iAndroidBackgroundModeOpenGL $iOpenGL = $g_iAndroidBackgroundModeDirectX diff --git a/COCBot/functions/Android/AndroidNox.au3 b/COCBot/functions/Android/AndroidNox.au3 index eaaae716..642ea25a 100644 --- a/COCBot/functions/Android/AndroidNox.au3 +++ b/COCBot/functions/Android/AndroidNox.au3 @@ -138,7 +138,7 @@ Func GetNoxBackgroundMode() Local $iOpenGL = $g_iAndroidBackgroundModeOpenGL ; hack for super strange Windows Fall Creator Update with OpenGL and DirectX problems ; doesn't have this issue with OSBuild : 17134 - If @OSBuild >= 16299 And @OSBuild < 17134 Then + If _OSBuild() >= 16299 And _OSBuild() < 17134 Then SetDebugLog("DirectX/OpenGL Fix applied for Windows Build 16299") $iDirectX = $g_iAndroidBackgroundModeOpenGL $iOpenGL = $g_iAndroidBackgroundModeDirectX diff --git a/COCBot/functions/Main Screen/RemoveGhostTrayIcons.au3 b/COCBot/functions/Main Screen/RemoveGhostTrayIcons.au3 index 3e18fa8e..608dc54a 100644 --- a/COCBot/functions/Main Screen/RemoveGhostTrayIcons.au3 +++ b/COCBot/functions/Main Screen/RemoveGhostTrayIcons.au3 @@ -567,7 +567,7 @@ Func _FindTrayToolbarWindow($iWin = 1) If @error Then Return -1 $hWnd = DllCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hWnd[0], "hwnd", 0, "str", "TrayNotifyWnd", "ptr", 0) If @error Then Return -1 - If @OSVersion <> "WIN_2000" Then + If _OSVersion() <> "WIN_2000" Then $hWnd = DllCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hWnd[0], "hwnd", 0, "str", "SysPager", "ptr", 0) If @error Then Return -1 EndIf diff --git a/COCBot/functions/Other/CreateLogFile.au3 b/COCBot/functions/Other/CreateLogFile.au3 index 20842615..29e07db0 100644 --- a/COCBot/functions/Other/CreateLogFile.au3 +++ b/COCBot/functions/Other/CreateLogFile.au3 @@ -67,9 +67,8 @@ Func CreateLogFile() SetDebugLog("@WorkingDir: " & @WorkingDir) SetDebugLog("@AutoItPID: " & @AutoItPID) SetDebugLog("@OSArch: " & @OSArch) - Local $iFixV = String((@OSVersion = "WIN_10" And @OSBuild >= "22000") ? ("WIN_11") : (@OSVersion)) - SetDebugLog("@OSVersion: " & $iFixV) - SetDebugLog("@OSBuild: " & @OSBuild) + SetDebugLog("@OSVersion: " & _OSVersion()) + SetDebugLog("@OSBuild: " & _OSBuild()) SetDebugLog("@OSServicePack: " & @OSServicePack) SetDebugLog("Primary Display: " & @DesktopWidth & " x " & @DesktopHeight & " - " & @DesktopDepth & "bit") diff --git a/MyBot.run.au3 b/MyBot.run.au3 index 0bedcb22..55793825 100644 --- a/MyBot.run.au3 +++ b/MyBot.run.au3 @@ -642,8 +642,7 @@ Func FinalInitialization(Const $sAI) EndIf If $g_bAndroidShieldEnabled = False Then - Local $iFixV = String((@OSVersion = "WIN_10" And @OSBuild >= "22000") ? ("WIN_11") : (@OSVersion)) - SetLog(GetTranslatedFileIni("MBR GUI Design - Loading", "Msg_Android_instance_05", "Android Shield not available for %s", $iFixV), $COLOR_ACTION) + SetLog(GetTranslatedFileIni("MBR GUI Design - Loading", "Msg_Android_instance_05", "Android Shield not available for %s", _OSVersion()), $COLOR_ACTION) EndIf DisableProcessWindowsGhosting()