Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions Client/cefweb/CWebApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,11 @@
#include <cef3/cef/include/wrapper/cef_stream_resource_handler.h>
#include "CAjaxResourceHandler.h"
#include "CWebAppAuth.h" // IPC code generation
#include "Wine.h"
#include <cstdlib>

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<CefCommandLine>& commandLine, const CefString& processType)
{
Expand Down Expand Up @@ -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"))
{
Expand Down
8 changes: 8 additions & 0 deletions Client/loader/MainFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*
*****************************************************************************/

#include "Wine.h"
#include "MainFunctions.h"
#include "Main.h"
#include "Utils.h"
Expand All @@ -25,6 +26,7 @@
#include <set>
#include <string>
#include <locale.h>
#include <windows.h>
#include <DbgHelp.h>
#pragma comment(lib, "dbghelp.lib")

Expand Down Expand Up @@ -1215,6 +1217,12 @@ void ValidateGTAPath()
//////////////////////////////////////////////////////////
void CheckAntiVirusStatus()
{
if (Wine::IsRunningOnWine())
{
WriteDebugEvent("Skipping AV check under Wine");
return;
}

std::vector<SString> enabledList, disabledList;
GetWMIAntiVirusStatus(enabledList, disabledList);

Expand Down
33 changes: 33 additions & 0 deletions Client/sdk/Wine.h
Original file line number Diff line number Diff line change
@@ -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 <windows.h>

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;
}
}
Loading