Skip to content

Commit 7d39066

Browse files
authored
Merge branch 'master' into l10n/master
2 parents 637a80d + bca4425 commit 7d39066

File tree

2,471 files changed

+569271
-16148
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,471 files changed

+569271
-16148
lines changed

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: 10 additions & 0 deletions
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

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/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)