Skip to content

Commit 747819d

Browse files
authored
Merge branch 'master' into bugfix/animations_sync
2 parents 49e2c3b + 8117ebc commit 747819d

File tree

258 files changed

+9391
-5023
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

258 files changed

+9391
-5023
lines changed

Client/cefweb/CWebApp.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@ CefRefPtr<CefResourceHandler> CWebApp::HandleError(const SString& strError, unsi
2121

2222
void CWebApp::OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr<CefCommandLine> command_line)
2323
{
24-
command_line->AppendSwitch("disable-gpu-compositing");
25-
command_line->AppendSwitch("disable-gpu");
24+
CWebCore* pWebCore = static_cast<CWebCore*>(g_pCore->GetWebCore());
25+
26+
if (!pWebCore->GetGPUEnabled())
27+
command_line->AppendSwitch("disable-gpu");
28+
29+
command_line->AppendSwitch("disable-gpu-compositing"); // always disable this, causes issues with official builds
30+
2631
// command_line->AppendSwitch("disable-d3d11");
2732
command_line->AppendSwitch("enable-begin-frame-scheduling");
2833

Client/cefweb/CWebCore.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,13 @@ CWebCore::~CWebCore()
4949
delete m_pXmlConfig;
5050
}
5151

52-
bool CWebCore::Initialise()
52+
bool CWebCore::Initialise(bool gpuEnabled)
5353
{
5454
CefMainArgs mainArgs;
5555
void* sandboxInfo = nullptr;
56+
57+
m_bGPUEnabled = gpuEnabled;
58+
5659
CefRefPtr<CWebApp> app(new CWebApp);
5760

5861
#ifdef CEF_ENABLE_SANDBOX
@@ -71,7 +74,6 @@ bool CWebCore::Initialise()
7174
#else
7275
CefString(&settings.browser_subprocess_path).FromWString(FromUTF8(CalcMTASAPath("MTA\\CEF\\CEFLauncher_d.exe")));
7376
#endif
74-
CefString(&settings.resources_dir_path).FromWString(FromUTF8(CalcMTASAPath("MTA\\CEF")));
7577
CefString(&settings.cache_path).FromWString(FromUTF8(CalcMTASAPath("MTA\\CEF\\cache")));
7678
CefString(&settings.locales_dir_path).FromWString(FromUTF8(CalcMTASAPath("MTA\\CEF\\locales")));
7779
CefString(&settings.log_file).FromWString(FromUTF8(CalcMTASAPath("MTA\\CEF\\cefdebug.txt")));
@@ -870,3 +872,8 @@ void CWebCore::StaticFetchBlacklistFinished(const SHttpDownloadResult& result)
870872
OutputDebugLine("Updated browser blacklist!");
871873
#endif
872874
}
875+
876+
bool CWebCore::GetGPUEnabled() const noexcept
877+
{
878+
return m_bGPUEnabled;
879+
}

Client/cefweb/CWebCore.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class CWebCore : public CWebCoreInterface
5454
public:
5555
CWebCore();
5656
~CWebCore();
57-
bool Initialise() override;
57+
bool Initialise(bool gpuEnabled) override;
5858

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

111+
bool GetGPUEnabled() const noexcept;
112+
111113
private:
112114
typedef std::pair<bool, eWebFilterType> WebFilterPair;
113115

@@ -129,4 +131,7 @@ class CWebCore : public CWebCoreInterface
129131
CXMLFile* m_pXmlConfig;
130132
int m_iWhitelistRevision;
131133
int m_iBlacklistRevision;
134+
135+
// Shouldn't be changed after init
136+
bool m_bGPUEnabled;
132137
};

Client/cefweb/CWebView.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -936,10 +936,10 @@ void CWebView::OnBeforeClose(CefRefPtr<CefBrowser> browser)
936936
// //
937937
// //
938938
////////////////////////////////////////////////////////////////////
939-
bool CWebView::OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& target_url, const CefString& target_frame_name,
940-
CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture, const CefPopupFeatures& popupFeatures,
941-
CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings, CefRefPtr<CefDictionaryValue>& extra_info,
942-
bool* no_javascript_access)
939+
bool CWebView::OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, int popup_id, const CefString& target_url,
940+
const CefString& target_frame_name, CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture,
941+
const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings,
942+
CefRefPtr<CefDictionaryValue>& extra_info, bool* no_javascript_access)
943943
{
944944
// ATTENTION: This method is called on the IO thread
945945

Client/cefweb/CWebView.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ class CWebView : public CWebViewInterface,
152152

153153
// CefLifeSpawnHandler methods
154154
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) override;
155-
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& target_url, const CefString& target_frame_name,
156-
CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture, const CefPopupFeatures& popupFeatures,
157-
CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings, CefRefPtr<CefDictionaryValue>& extra_info,
158-
bool* no_javascript_access) override;
155+
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, int popup_id, const CefString& target_url,
156+
const CefString& target_frame_name, CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture,
157+
const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings,
158+
CefRefPtr<CefDictionaryValue>& extra_info, bool* no_javascript_access) override;
159159
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) override;
160160

161161
// CefJSDialogHandler methods

Client/core/CClientVariables.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ void CClientVariables::ValidateValues()
256256
ClampValue("mtavolume", 0.0f, 1.0f);
257257
ClampValue("voicevolume", 0.0f, 1.0f);
258258
ClampValue("mapalpha", 0, 255);
259+
ClampValue("mapimage", 0, 1);
259260
}
260261

261262
void CClientVariables::LoadDefaults()
@@ -273,9 +274,6 @@ void CClientVariables::LoadDefaults()
273274
DEFAULT("host", _S("127.0.0.1")); // hostname
274275
DEFAULT("port", 22003); // port
275276
DEFAULT("password", _S("")); // password
276-
DEFAULT("qc_host", _S("127.0.0.1")); // quick connect hostname
277-
DEFAULT("qc_port", 22003); // quick connect port
278-
DEFAULT("qc_password", _S("")); // quick connect password
279277
DEFAULT("debugfile", _S("")); // debug filename
280278
DEFAULT("console_pos", CVector2D(0, 0)); // console position
281279
DEFAULT("console_size", CVector2D(200, 200)); // console size
@@ -313,7 +311,8 @@ void CClientVariables::LoadDefaults()
313311
DEFAULT("mastervolume", 1.0f); // master volume
314312
DEFAULT("mtavolume", 1.0f); // custom sound's volume
315313
DEFAULT("voicevolume", 1.0f); // voice chat output volume
316-
DEFAULT("mapalpha", 155); // map alpha
314+
DEFAULT("mapalpha", 155); // player map alpha
315+
DEFAULT("mapimage", 0); // player map image
317316
DEFAULT("browser_speed", 1); // Browser speed
318317
DEFAULT("single_download", 0); // Single connection for downloads
319318
DEFAULT("packet_tag", 0); // Tag network packets
@@ -357,7 +356,7 @@ void CClientVariables::LoadDefaults()
357356
DEFAULT("allow_discord_rpc", true); // Enable Discord Rich Presence
358357
DEFAULT("discord_rpc_share_data", false); // Consistent Rich Presence data sharing
359358
DEFAULT("discord_rpc_share_data_firsttime", false); // Display the user data sharing consent dialog box - for the first time
360-
DEFAULT("_beta_qc_rightclick_command", _S("reconnect")); // Command to run when right clicking quick connect (beta - can be removed at any time)
359+
DEFAULT("browser_enable_gpu", true); // Enable GPU in CEF? (allows stuff like WebGL to function)
361360

362361
if (!Exists("locale"))
363362
{

Client/core/CCommandFuncs.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ void CCommandFuncs::Reconnect(const char* szParameters)
302302
unsigned int uiPort;
303303

304304
CVARS_GET("host", strHost);
305-
CVARS_GET("nick", strNick);
306305
CVARS_GET("password", strPassword);
307306
CVARS_GET("port", uiPort);
308307

@@ -315,7 +314,7 @@ void CCommandFuncs::Reconnect(const char* szParameters)
315314
// Verify and convert the port number
316315
if (uiPort <= 0 || uiPort > 0xFFFF)
317316
{
318-
CCore::GetSingleton().GetConsole()->Print(_("connect: Bad port number"));
317+
CCore::GetSingleton().GetConsole()->Print(_("reconnect: Bad port number"));
319318
return;
320319
}
321320

@@ -330,16 +329,16 @@ void CCommandFuncs::Reconnect(const char* szParameters)
330329
// Start the connect
331330
if (CCore::GetSingleton().GetConnectManager()->Reconnect(strHost.c_str(), usPort, strPassword.c_str(), false))
332331
{
333-
CCore::GetSingleton().GetConsole()->Printf(_("connect: Connecting to %s:%u..."), strHost.c_str(), usPort);
332+
CCore::GetSingleton().GetConsole()->Printf(_("reconnect: Reconnecting to %s:%u..."), strHost.c_str(), usPort);
334333
}
335334
else
336335
{
337-
CCore::GetSingleton().GetConsole()->Printf(_("connect: could not connect to %s:%u!"), strHost.c_str(), usPort);
336+
CCore::GetSingleton().GetConsole()->Printf(_("reconnect: could not connect to %s:%u!"), strHost.c_str(), usPort);
338337
}
339338
}
340339
else
341340
{
342-
CCore::GetSingleton().GetConsole()->Print("connect: Failed to unload current mod");
341+
CCore::GetSingleton().GetConsole()->Print("reconnect: Failed to unload current mod");
343342
}
344343
}
345344

Client/core/CConnectManager.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ bool CConnectManager::Connect(const char* szHost, unsigned short usPort, const c
145145

146146
// Display the status box
147147
SString strBuffer(_("Connecting to %s:%u ..."), m_strHost.c_str(), m_usPort);
148+
if (m_bReconnect)
149+
strBuffer = SString(_("Reconnecting to %s:%u ..."), m_strHost.c_str(), m_usPort);
148150
CCore::GetSingleton().ShowMessageBox(_("CONNECTING"), strBuffer, MB_BUTTON_CANCEL | MB_ICON_INFO, m_pOnCancelClick);
149151
WriteDebugEvent(SString("Connecting to %s:%u ...", m_strHost.c_str(), m_usPort));
150152

Client/core/CConsole.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class CConsole : public CConsoleInterface
4141
bool IsInputActive();
4242
void ActivateInput();
4343

44-
void HandleTextAccepted(bool bHandled);
4544
void GetCommandInfo(const std::string& strIn, std::string& strCmdOut, std::string& strCmdLineOut);
4645

4746
void ResetHistoryChanges();

Client/core/CCore.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,8 +1155,12 @@ CWebCoreInterface* CCore::GetWebCore()
11551155
{
11561156
if (m_pWebCore == nullptr)
11571157
{
1158+
bool gpuEnabled;
1159+
auto cvars = g_pCore->GetCVars();
1160+
cvars->Get("browser_enable_gpu", gpuEnabled);
1161+
11581162
m_pWebCore = CreateModule<CWebCoreInterface>(m_WebCoreModule, "CefWeb", "cefweb", "InitWebCoreInterface", this);
1159-
m_pWebCore->Initialise();
1163+
m_pWebCore->Initialise(gpuEnabled);
11601164
}
11611165
return m_pWebCore;
11621166
}
@@ -1869,6 +1873,13 @@ void CCore::RecalculateFrameRateLimit(uint uiServerFrameRateLimit, bool bLogToCo
18691873
if ((m_uiFrameRateLimit == 0 || uiClientScriptRate < m_uiFrameRateLimit) && uiClientScriptRate > 0)
18701874
m_uiFrameRateLimit = uiClientScriptRate;
18711875

1876+
// Removes Limiter from Frame Graph if limit is zero and skips frame limit
1877+
if (m_uiFrameRateLimit == 0)
1878+
{
1879+
m_bQueuedFrameRateValid = false;
1880+
GetGraphStats()->RemoveTimingPoint("Limiter");
1881+
}
1882+
18721883
// Print new limits to the console
18731884
if (bLogToConsole)
18741885
{

Client/core/CGUI.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,15 @@ CLocalGUI::~CLocalGUI()
5656

5757
void CLocalGUI::SetSkin(const char* szName)
5858
{
59+
CVector2D consolePos, consoleSize;
60+
5961
bool guiWasLoaded = m_pMainMenu != NULL;
6062
if (guiWasLoaded)
63+
{
64+
consolePos = m_pConsole->GetPosition();
65+
consoleSize = m_pConsole->GetSize();
6166
DestroyWindows();
67+
}
6268

6369
std::string error;
6470

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

95101
if (guiWasLoaded)
102+
{
96103
CreateWindows(guiWasLoaded);
104+
m_pConsole->SetPosition(consolePos);
105+
m_pConsole->SetSize(consoleSize);
106+
}
97107

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

107-
CVector2D vPos = m_pConsole->GetPosition();
108-
CVector2D vSize = m_pConsole->GetSize();
117+
CVector2D consolePos = m_pConsole->GetPosition();
118+
CVector2D consoleSize = m_pConsole->GetSize();
109119

110120
if (guiWasLoaded)
111121
DestroyWindows();
@@ -119,12 +129,8 @@ void CLocalGUI::ChangeLocale(const char* szName)
119129
if (guiWasLoaded)
120130
{
121131
CreateWindows(guiWasLoaded);
122-
123-
if (m_pConsole != nullptr)
124-
{
125-
m_pConsole->SetPosition(vPos);
126-
m_pConsole->SetSize(vSize);
127-
}
132+
m_pConsole->SetPosition(consolePos);
133+
m_pConsole->SetSize(consoleSize);
128134
}
129135
}
130136

Client/core/CGraphStats.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class CGraphStats : public CGraphStatsInterface
3939
virtual void SetEnabled(bool bEnabled);
4040
virtual bool IsEnabled();
4141
virtual void AddTimingPoint(const char* szName);
42+
virtual void RemoveTimingPoint(const char* szName);
4243

4344
protected:
4445
bool m_bEnabled;
@@ -189,6 +190,21 @@ void CGraphStats::AddTimingPoint(const char* szName)
189190
pLine->dataHistory[pLine->iDataPos] = AvgData;
190191
}
191192

193+
///////////////////////////////////////////////////////////////
194+
//
195+
// CGraphStats::RemoveTimingPoint
196+
//
197+
//
198+
//
199+
///////////////////////////////////////////////////////////////
200+
void CGraphStats::RemoveTimingPoint(const char* szName)
201+
{
202+
if (!IsEnabled() || szName[0] == 0)
203+
return;
204+
205+
MapRemove(m_LineList, szName);
206+
}
207+
192208
///////////////////////////////////////////////////////////////
193209
//
194210
// CGraphStats::Draw

Client/core/CGraphStats.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class CGraphStatsInterface
2323
virtual void SetEnabled(bool bEnabled) = 0;
2424
virtual bool IsEnabled() = 0;
2525
virtual void AddTimingPoint(const char* szName) = 0;
26+
virtual void RemoveTimingPoint(const char* szName) = 0;
2627
};
2728

2829
CGraphStatsInterface* GetGraphStats();

Client/core/CMainMenu.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -912,17 +912,13 @@ bool CMainMenu::OnQuickConnectButtonClick(CGUIElement* pElement, bool left)
912912
if (m_ucFade != FADE_VISIBLE)
913913
return false;
914914

915-
// If we're right clicking, execute special command
916-
if (!left)
915+
if (left)
916+
g_pCore->GetCommands()->Execute("reconnect", "");
917+
else
917918
{
918-
std::string command;
919-
CVARS_GET("_beta_qc_rightclick_command", command);
920-
g_pCore->GetCommands()->Execute(command.data());
921-
return true;
919+
m_ServerBrowser.SetVisible(true);
920+
m_ServerBrowser.OnQuickConnectButtonClick();
922921
}
923-
924-
m_ServerBrowser.SetVisible(true);
925-
m_ServerBrowser.OnQuickConnectButtonClick();
926922
return true;
927923
}
928924

0 commit comments

Comments
 (0)