diff --git a/Client/cefweb/CWebApp.cpp b/Client/cefweb/CWebApp.cpp index 64302d6a42..ed9fd0f55f 100644 --- a/Client/cefweb/CWebApp.cpp +++ b/Client/cefweb/CWebApp.cpp @@ -17,17 +17,11 @@ #include #include "CAjaxResourceHandler.h" #include "CWebAppAuth.h" // IPC code generation +#include "Wine.h" #include namespace { - // Helper to detect Wine/Proton environment - bool IsRunningOnWine() - { - HMODULE hNtdll = GetModuleHandle("ntdll.dll"); - return hNtdll && GetProcAddress(hNtdll, "wine_get_version"); - } - // Centralises command-line switch setup so both pre-launch callbacks stay in sync void ConfigureCommandLineSwitches(const CefRefPtr& commandLine, const CefString& processType) { @@ -89,7 +83,7 @@ namespace } // Wine/Proton compatibility: Allow GPU unless explicitly disabled or forced software - if (IsRunningOnWine()) + if (Wine::IsRunningOnWine()) { if (std::getenv("MTA_FORCE_SOFTWARE_RENDERING")) { diff --git a/Client/loader/MainFunctions.cpp b/Client/loader/MainFunctions.cpp index b79b443606..fceebc5d89 100644 --- a/Client/loader/MainFunctions.cpp +++ b/Client/loader/MainFunctions.cpp @@ -8,6 +8,7 @@ * *****************************************************************************/ +#include "Wine.h" #include "MainFunctions.h" #include "Main.h" #include "Utils.h" @@ -25,6 +26,7 @@ #include #include #include +#include #include #pragma comment(lib, "dbghelp.lib") @@ -1215,6 +1217,12 @@ void ValidateGTAPath() ////////////////////////////////////////////////////////// void CheckAntiVirusStatus() { + if (Wine::IsRunningOnWine()) + { + WriteDebugEvent("Skipping AV check under Wine"); + return; + } + std::vector enabledList, disabledList; GetWMIAntiVirusStatus(enabledList, disabledList); diff --git a/Client/sdk/Wine.h b/Client/sdk/Wine.h new file mode 100644 index 0000000000..f03f7860f7 --- /dev/null +++ b/Client/sdk/Wine.h @@ -0,0 +1,33 @@ +/***************************************************************************** + * + * PROJECT: Multi Theft Auto + * LICENSE: See LICENSE in the top level directory + * PURPOSE: Wine/Proton detection utility + * + * Multi Theft Auto is available from https://multitheftauto.com/ + * + *****************************************************************************/ + +#pragma once + +#include + +namespace Wine +{ + ///////////////////////////////////////////////////////// + // + // IsRunningOnWine + // + // Detect if we are running under Wine/Proton + // + ///////////////////////////////////////////////////////// + inline bool IsRunningOnWine() + { + HMODULE hNtdll = GetModuleHandleA("ntdll.dll"); + if (!hNtdll) + return false; + + FARPROC wineVersion = GetProcAddress(hNtdll, "wine_get_version"); + return wineVersion != nullptr; + } +}