Skip to content

Commit

Permalink
Merge remote-tracking branch 'mta_main/master' into TheNormalnij/remo…
Browse files Browse the repository at this point in the history
…ve_vtbl
  • Loading branch information
TheNormalnij committed Oct 26, 2024
2 parents ae60251 + e92702c commit dd0d38f
Show file tree
Hide file tree
Showing 83 changed files with 3,030 additions and 2,311 deletions.
9 changes: 7 additions & 2 deletions Client/cefweb/CWebApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ CefRefPtr<CefResourceHandler> CWebApp::HandleError(const SString& strError, unsi

void CWebApp::OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr<CefCommandLine> command_line)
{
command_line->AppendSwitch("disable-gpu-compositing");
command_line->AppendSwitch("disable-gpu");
CWebCore* pWebCore = static_cast<CWebCore*>(g_pCore->GetWebCore());

if (!pWebCore->GetGPUEnabled())
command_line->AppendSwitch("disable-gpu");

command_line->AppendSwitch("disable-gpu-compositing"); // always disable this, causes issues with official builds

// command_line->AppendSwitch("disable-d3d11");
command_line->AppendSwitch("enable-begin-frame-scheduling");

Expand Down
10 changes: 9 additions & 1 deletion Client/cefweb/CWebCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ CWebCore::~CWebCore()
delete m_pXmlConfig;
}

bool CWebCore::Initialise()
bool CWebCore::Initialise(bool gpuEnabled)
{
CefMainArgs mainArgs;
void* sandboxInfo = nullptr;

m_bGPUEnabled = gpuEnabled;

CefRefPtr<CWebApp> app(new CWebApp);

#ifdef CEF_ENABLE_SANDBOX
Expand Down Expand Up @@ -869,3 +872,8 @@ void CWebCore::StaticFetchBlacklistFinished(const SHttpDownloadResult& result)
OutputDebugLine("Updated browser blacklist!");
#endif
}

bool CWebCore::GetGPUEnabled() const noexcept
{
return m_bGPUEnabled;
}
7 changes: 6 additions & 1 deletion Client/cefweb/CWebCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CWebCore : public CWebCoreInterface
public:
CWebCore();
~CWebCore();
bool Initialise() override;
bool Initialise(bool gpuEnabled) override;

CWebViewInterface* CreateWebView(unsigned int uiWidth, unsigned int uiHeight, bool bIsLocal, CWebBrowserItem* pWebBrowserRenderItem, bool bTransparent);
void DestroyWebView(CWebViewInterface* pWebViewInterface);
Expand Down Expand Up @@ -108,6 +108,8 @@ class CWebCore : public CWebCoreInterface
static void StaticFetchWhitelistFinished(const SHttpDownloadResult& result);
static void StaticFetchBlacklistFinished(const SHttpDownloadResult& result);

bool GetGPUEnabled() const noexcept;

private:
typedef std::pair<bool, eWebFilterType> WebFilterPair;

Expand All @@ -129,4 +131,7 @@ class CWebCore : public CWebCoreInterface
CXMLFile* m_pXmlConfig;
int m_iWhitelistRevision;
int m_iBlacklistRevision;

// Shouldn't be changed after init
bool m_bGPUEnabled;
};
1 change: 1 addition & 0 deletions Client/core/CClientVariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ void CClientVariables::LoadDefaults()
DEFAULT("discord_rpc_share_data", false); // Consistent Rich Presence data sharing
DEFAULT("discord_rpc_share_data_firsttime", false); // Display the user data sharing consent dialog box - for the first time
DEFAULT("_beta_qc_rightclick_command", _S("reconnect")); // Command to run when right clicking quick connect (beta - can be removed at any time)
DEFAULT("browser_enable_gpu", true); // Enable GPU in CEF? (allows stuff like WebGL to function)

if (!Exists("locale"))
{
Expand Down
6 changes: 5 additions & 1 deletion Client/core/CCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1155,8 +1155,12 @@ CWebCoreInterface* CCore::GetWebCore()
{
if (m_pWebCore == nullptr)
{
bool gpuEnabled;
auto cvars = g_pCore->GetCVars();
cvars->Get("browser_enable_gpu", gpuEnabled);

m_pWebCore = CreateModule<CWebCoreInterface>(m_WebCoreModule, "CefWeb", "cefweb", "InitWebCoreInterface", this);
m_pWebCore->Initialise();
m_pWebCore->Initialise(gpuEnabled);
}
return m_pWebCore;
}
Expand Down
22 changes: 14 additions & 8 deletions Client/core/CGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,15 @@ CLocalGUI::~CLocalGUI()

void CLocalGUI::SetSkin(const char* szName)
{
CVector2D consolePos, consoleSize;

bool guiWasLoaded = m_pMainMenu != NULL;
if (guiWasLoaded)
{
consolePos = m_pConsole->GetPosition();
consoleSize = m_pConsole->GetSize();
DestroyWindows();
}

std::string error;

Expand Down Expand Up @@ -93,7 +99,11 @@ void CLocalGUI::SetSkin(const char* szName)
m_LastSettingsRevision = cvars->GetRevision();

if (guiWasLoaded)
{
CreateWindows(guiWasLoaded);
m_pConsole->SetPosition(consolePos);
m_pConsole->SetSize(consoleSize);
}

if (CCore::GetSingleton().GetConsole() && !error.empty())
CCore::GetSingleton().GetConsole()->Echo(error.c_str());
Expand All @@ -104,8 +114,8 @@ void CLocalGUI::ChangeLocale(const char* szName)
bool guiWasLoaded = m_pMainMenu != NULL;
assert(guiWasLoaded);

CVector2D vPos = m_pConsole->GetPosition();
CVector2D vSize = m_pConsole->GetSize();
CVector2D consolePos = m_pConsole->GetPosition();
CVector2D consoleSize = m_pConsole->GetSize();

if (guiWasLoaded)
DestroyWindows();
Expand All @@ -119,12 +129,8 @@ void CLocalGUI::ChangeLocale(const char* szName)
if (guiWasLoaded)
{
CreateWindows(guiWasLoaded);

if (m_pConsole != nullptr)
{
m_pConsole->SetPosition(vPos);
m_pConsole->SetSize(vSize);
}
m_pConsole->SetPosition(consolePos);
m_pConsole->SetSize(consoleSize);
}
}

Expand Down
Loading

0 comments on commit dd0d38f

Please sign in to comment.