Skip to content

Commit 840288f

Browse files
authored
Merge branch 'master' into startstop
2 parents 965d83f + a5665dd commit 840288f

File tree

2,641 files changed

+653099
-94767
lines changed

Some content is hidden

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

2,641 files changed

+653099
-94767
lines changed

Client/cefweb/CWebApp.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ void CWebApp::OnBeforeCommandLineProcessing(const CefString& process_type, CefRe
2626
if (!pWebCore->GetGPUEnabled())
2727
command_line->AppendSwitch("disable-gpu");
2828

29+
// Disable the AutoDeElevate feature to make launching CEF with Admin privileges work.
30+
// https://github.com/chromiumembedded/cef/issues/3960
31+
// https://chromium-review.googlesource.com/c/chromium/src/+/6515318
32+
command_line->AppendSwitch("do-not-de-elevate");
33+
2934
command_line->AppendSwitch("disable-gpu-compositing"); // always disable this, causes issues with official builds
3035

3136
// command_line->AppendSwitch("disable-d3d11");

Client/core/CClientVariables.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ void CClientVariables::LoadDefaults()
359359
DEFAULT("browser_enable_gpu", true); // Enable GPU in CEF? (allows stuff like WebGL to function)
360360
DEFAULT("process_cpu_affinity", true); // Set CPU 0 affinity to improve game performance and fix the known issue in single-threaded games
361361
DEFAULT("ask_before_disconnect", true); // Ask before disconnecting from a server
362+
DEFAULT("allow_steam_client", false); // Allow connecting with the local Steam client (to set GTA:SA ingame status)
362363

363364
if (!Exists("locale"))
364365
{

Client/core/CCore.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <SharedUtil.Detours.h>
2727
#include <ServerBrowser/CServerCache.h>
2828
#include "CDiscordRichPresence.h"
29+
#include "CSteamClient.h"
2930

3031
using SharedUtil::CalcMTASAPath;
3132
using namespace std;
@@ -160,6 +161,7 @@ CCore::CCore()
160161

161162
// Create tray icon
162163
m_pTrayIcon = new CTrayIcon();
164+
m_steamClient = std::make_unique<CSteamClient>();
163165

164166
// Create discord rich presence
165167
m_pDiscordRichPresence = std::shared_ptr<CDiscordRichPresence>(new CDiscordRichPresence());
@@ -173,6 +175,8 @@ CCore::~CCore()
173175
if (m_pDiscordRichPresence)
174176
m_pDiscordRichPresence.reset();
175177

178+
m_steamClient.reset();
179+
176180
// Destroy tray icon
177181
delete m_pTrayIcon;
178182

@@ -1228,6 +1232,12 @@ void CCore::DoPostFramePulse()
12281232
ApplyConsoleSettings();
12291233
ApplyGameSettings();
12301234

1235+
// Allow connecting with the local Steam client
1236+
bool allowSteamClient = false;
1237+
CVARS_GET("allow_steam_client", allowSteamClient);
1238+
if (allowSteamClient)
1239+
m_steamClient->Connect();
1240+
12311241
m_pGUI->SelectInputHandlers(INPUT_CORE);
12321242
}
12331243

@@ -1273,7 +1283,8 @@ void CCore::DoPostFramePulse()
12731283
}
12741284
}
12751285

1276-
if (m_menuFrame >= 75 && m_requestNewNickname && GetLocalGUI()->GetMainMenu()->IsVisible() && !GetLocalGUI()->GetMainMenu()->IsFading())
1286+
if (m_menuFrame >= 75 && m_requestNewNickname && GetLocalGUI()->GetMainMenu()->IsVisible() && !GetLocalGUI()->GetMainMenu()->IsFading() &&
1287+
!GetLocalGUI()->GetMainMenu()->GetQuestionWindow()->IsVisible())
12771288
{
12781289
// Request a new nickname if we're waiting for one
12791290
GetLocalGUI()->GetMainMenu()->GetSettingsWindow()->RequestNewNickname();
@@ -1452,6 +1463,9 @@ void CCore::Quit(bool bInstantly)
14521463

14531464
WatchDogBeginSection("Q0"); // Allow loader to detect freeze on exit
14541465

1466+
// Hide game window to make quit look instant
1467+
ShowWindow(GetHookedWindow(), SW_HIDE);
1468+
14551469
// Destroy the client
14561470
CModManager::GetSingleton().Unload();
14571471

Client/core/CCore.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ class CDiscordInterface;
7070
#define CONFIG_HISTORY_LIST_TAG "connected_server"
7171
#define IDT_TIMER1 1234
7272

73+
class CSteamClient;
74+
7375
extern class CCore* g_pCore;
7476
extern class CGraphics* g_pGraphics;
7577
extern class CLocalization* g_pLocalization;
@@ -104,6 +106,7 @@ class CCore : public CCoreInterface, public CSingleton<CCore>
104106
CWebCoreInterface* GetWebCore();
105107
CTrayIconInterface* GetTrayIcon() { return m_pTrayIcon; };
106108
std::shared_ptr<CDiscordInterface> GetDiscord();
109+
CSteamClient* GetSteamClient() { return m_steamClient.get(); }
107110

108111
void SaveConfig(bool bWaitUntilFinished = false);
109112

@@ -311,6 +314,7 @@ class CCore : public CCoreInterface, public CSingleton<CCore>
311314
CClientVariables m_ClientVariables;
312315
CWebCoreInterface* m_pWebCore = nullptr;
313316
CTrayIcon* m_pTrayIcon;
317+
std::unique_ptr<CSteamClient> m_steamClient;
314318
std::shared_ptr<CDiscordRichPresence> m_pDiscordRichPresence;
315319

316320
// Hook interfaces.

Client/core/CFileFormatPng.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include "StdInc.h"
1212
#include <libpng/png.h>
13-
#include <libpng/pngpriv.h>
1413

1514
///////////////////////////////////////////////////////////////
1615
//
@@ -112,7 +111,15 @@ void ParseRGB(CBuffer& outImage, const png_structp& png_ptr, const png_infop& in
112111
///////////////////////////////////////////////////////////////
113112
void ReadDataFromInputStream(png_structp png_ptr, png_bytep outBytes, png_size_t byteCountToRead)
114113
{
115-
CBufferReadStream& stream = *(CBufferReadStream*)png_ptr->io_ptr;
114+
if (!png_ptr)
115+
return;
116+
117+
void* ioPtr = png_get_io_ptr(png_ptr);
118+
119+
if (!ioPtr)
120+
return;
121+
122+
CBufferReadStream& stream = *(CBufferReadStream*)ioPtr;
116123
stream.ReadBytes((byte*)outBytes, (size_t)byteCountToRead);
117124
}
118125

@@ -215,13 +222,19 @@ bool PngDecode(const void* pData, uint uiDataSize, CBuffer* pOutBuffer, uint& ui
215222
///////////////////////////////////////////////////////////////
216223
void my_png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
217224
{
218-
CBufferWriteStream* pStream = (CBufferWriteStream*)png_ptr->io_ptr;
225+
if (!png_ptr)
226+
return;
227+
228+
void* io_ptr = png_get_io_ptr(png_ptr);
219229

220-
if (!pStream)
230+
if (!io_ptr)
221231
return;
222-
pStream->WriteBytes(data, length);
232+
233+
CBufferWriteStream* stream = (CBufferWriteStream*)io_ptr;
234+
stream->WriteBytes(data, length);
223235
}
224236

237+
225238
///////////////////////////////////////////////////////////////
226239
//
227240
// PngEncode

Client/core/CSettings.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <core/CClientCommands.h>
1414
#include <game/CGame.h>
1515
#include <game/CSettings.h>
16+
#include "CSteamClient.h"
1617

1718
using namespace std;
1819

@@ -405,6 +406,11 @@ void CSettings::CreateGUI()
405406
m_pCheckBoxAllowDiscordRPC->GetPosition(vecTemp, false);
406407
m_pCheckBoxAllowDiscordRPC->AutoSize(NULL, 20.0f);
407408

409+
m_pCheckBoxAllowSteamClient = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabMultiplayer, _("Allow GTA:SA ingame status on Steam"), false));
410+
m_pCheckBoxAllowSteamClient->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 20.0f));
411+
m_pCheckBoxAllowSteamClient->GetPosition(vecTemp, false);
412+
m_pCheckBoxAllowSteamClient->AutoSize(NULL, 20.0f);
413+
408414
// Enable camera photos getting saved to documents folder
409415
m_pPhotoSavingCheckbox = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabMultiplayer, _("Save photos taken by camera weapon to GTA San Andreas User Files folder"), true));
410416
m_pPhotoSavingCheckbox->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 20.0f));
@@ -3085,6 +3091,14 @@ void CSettings::LoadData()
30853091
CVARS_GET("allow_discord_rpc", bAllowDiscordRPC);
30863092
m_pCheckBoxAllowDiscordRPC->SetSelected(bAllowDiscordRPC);
30873093

3094+
// Allow connecting with the local Steam client
3095+
bool allowSteamClient = false;
3096+
CVARS_GET("allow_steam_client", allowSteamClient);
3097+
m_pCheckBoxAllowSteamClient->SetSelected(allowSteamClient);
3098+
3099+
if (allowSteamClient)
3100+
g_pCore->GetSteamClient()->Connect();
3101+
30883102
bool bAskBeforeDisconnect;
30893103
CVARS_GET("ask_before_disconnect", bAskBeforeDisconnect);
30903104
m_pCheckBoxAskBeforeDisconnect->SetSelected(bAskBeforeDisconnect);
@@ -3566,6 +3580,12 @@ void CSettings::SaveData()
35663580
}
35673581
}
35683582

3583+
// Allow connecting with the local Steam client
3584+
bool allowSteamClient = m_pCheckBoxAllowSteamClient->GetSelected();
3585+
CVARS_SET("allow_steam_client", allowSteamClient);
3586+
if (allowSteamClient)
3587+
g_pCore->GetSteamClient()->Connect();
3588+
35693589
bool bAskBeforeDisconnect = m_pCheckBoxAskBeforeDisconnect->GetSelected();
35703590
CVARS_SET("ask_before_disconnect", bAskBeforeDisconnect);
35713591

Client/core/CSettings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ class CSettings
158158
CGUICheckBox* m_pCheckBoxAllowExternalSounds;
159159
CGUICheckBox* m_pCheckBoxCustomizedSAFiles;
160160
CGUICheckBox* m_pCheckBoxAllowDiscordRPC;
161+
CGUICheckBox* m_pCheckBoxAllowSteamClient = nullptr;
161162
CGUICheckBox* m_pCheckBoxAlwaysShowTransferBox;
162163
CGUICheckBox* m_pCheckBoxGrass;
163164
CGUICheckBox* m_pCheckBoxHeatHaze;

0 commit comments

Comments
 (0)