Skip to content

Commit 812ec31

Browse files
committed
Merge branch 'master' into svg-ptr-fix
2 parents df9d47d + e62d9f4 commit 812ec31

File tree

181 files changed

+129948
-107673
lines changed

Some content is hidden

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

181 files changed

+129948
-107673
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "Update crowdin-translators.json"
2+
3+
on:
4+
workflow_dispatch:
5+
delete:
6+
branches:
7+
- l10n/master
8+
9+
jobs:
10+
generate_translators:
11+
if: github.event.repository.fork == false
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
ref: master
18+
token: ${{ secrets.POT_CI_PAT }}
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: latest
24+
cache: 'npm'
25+
cache-dependency-path: ./utils/localization/generate-translators/package-lock.json
26+
27+
- name: Install dependencies
28+
working-directory: ./utils/localization/generate-translators
29+
run: npm clean-install
30+
31+
- name: Generate translators
32+
working-directory: ./utils/localization/generate-translators
33+
env:
34+
CROWDIN_TOKEN: "${{ secrets.CROWDIN_TOKEN }}"
35+
CROWDIN_ORGANIZATION: "multitheftauto"
36+
CROWDIN_PROJECT_ID: "13" # Multi Theft Auto
37+
CROWDIN_IGNORE_USER_ID: "2" # multitheftautoqa
38+
run: npm run ci
39+
40+
- name: Commit changes
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
run: |
44+
git config --global user.name 'github-actions[bot]'
45+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
46+
47+
git add ./utils/localization/generate-translators/crowdin-translators.json
48+
49+
if ! git diff-index --quiet HEAD; then
50+
git commit -m "Update crowdin-translators.json" -m "[ci skip]"
51+
git push
52+
fi

Client/cefweb/CWebCore.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ std::unordered_set<SString> CWebCore::AllowPendingPages(bool bRemember)
409409
}
410410

411411
// Trigger an event now
412-
auto pCurrentMod = g_pCore->GetModManager()->GetCurrentMod();
412+
auto pCurrentMod = g_pCore->GetModManager()->GetClient();
413413
if (!pCurrentMod)
414414
return std::unordered_set<SString>();
415415

Client/core/CChat.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,11 +699,11 @@ bool CChat::CharacterKeyHandler(CGUIKeyEventArgs KeyboardArgs)
699699
SString strPlayerNamePart = strCurrentInput.substr(iFound);
700700

701701
CModManager* pModManager = CModManager::GetSingletonPtr();
702-
if (pModManager && pModManager->GetCurrentMod())
702+
if (pModManager && pModManager->IsLoaded())
703703
{
704704
// Create vector and get playernames from deathmatch module
705705
std::vector<SString> vPlayerNames;
706-
pModManager->GetCurrentMod()->GetPlayerNames(vPlayerNames);
706+
pModManager->GetClient()->GetPlayerNames(vPlayerNames);
707707

708708
for (std::vector<SString>::iterator iter = vPlayerNames.begin(); iter != vPlayerNames.end(); ++iter)
709709
{

Client/core/CCommandFuncs.cpp

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -167,36 +167,13 @@ void CCommandFuncs::Clear(const char* szParameters)
167167

168168
void CCommandFuncs::Load(const char* szParameters)
169169
{
170-
if (!szParameters)
171-
{
172-
CCore::GetSingleton().GetConsole()->Printf("* Syntax: load <mod-name> [<arguments>]");
173-
return;
174-
}
175-
176-
// Copy the buffer
177-
char* szTemp = new char[strlen(szParameters) + 1];
178-
strcpy(szTemp, szParameters);
179-
180-
// Split it up into mod name and the arguments
181-
char* szModName = strtok(szTemp, " ");
182-
char* szArguments = strtok(NULL, "\0");
183-
184-
if (szModName)
185-
{
186-
// Load the mod with the given arguments
187-
CModManager::GetSingleton().RequestLoad(szModName, szArguments);
188-
}
189-
else
190-
CCore::GetSingleton().GetConsole()->Printf("* Syntax: load <mod-name> [<arguments>]");
191-
192-
// Free the temp buffer
193-
delete[] szTemp;
170+
CModManager::GetSingleton().RequestLoad(szParameters);
194171
}
195172

196173
void CCommandFuncs::Unload(const char* szParameters)
197174
{
198175
// Any mod loaded?
199-
if (CModManager::GetSingleton().GetCurrentMod())
176+
if (CModManager::GetSingleton().IsLoaded())
200177
{
201178
// Unload it
202179
CModManager::GetSingleton().RequestUnload();
@@ -209,6 +186,12 @@ void CCommandFuncs::Unload(const char* szParameters)
209186

210187
void CCommandFuncs::Connect(const char* szParameters)
211188
{
189+
if (!CCore::GetSingleton().IsNetworkReady())
190+
{
191+
CCore::GetSingleton().GetConsole()->Print(_("connect: Network is not ready, please wait a moment"));
192+
return;
193+
}
194+
212195
// Parse the arguments (host port nick pass)
213196
char szBuffer[256] = "";
214197
if (szParameters)
@@ -264,7 +247,7 @@ void CCommandFuncs::Connect(const char* szParameters)
264247
CModManager::GetSingleton().Unload();
265248

266249
// Only connect if there is no mod loaded
267-
if (!CModManager::GetSingleton().GetCurrentMod())
250+
if (!CModManager::GetSingleton().IsLoaded())
268251
{
269252
// Start the connect
270253
if (CCore::GetSingleton().GetConnectManager()->Connect(szHost, usPort, strNick.c_str(), szPass))
@@ -284,7 +267,7 @@ void CCommandFuncs::Connect(const char* szParameters)
284267

285268
void CCommandFuncs::ReloadNews(const char* szParameters)
286269
{
287-
if (CModManager::GetSingleton().GetCurrentMod())
270+
if (CModManager::GetSingleton().IsLoaded())
288271
{
289272
CCore::GetSingleton().GetConsole()->Print("reloadnews: can't do this whilst connected to server");
290273
return;
@@ -296,6 +279,12 @@ void CCommandFuncs::ReloadNews(const char* szParameters)
296279

297280
void CCommandFuncs::Reconnect(const char* szParameters)
298281
{
282+
if (!CCore::GetSingleton().IsNetworkReady())
283+
{
284+
CCore::GetSingleton().GetConsole()->Print(_("reconnect: Network is not ready, please wait a moment"));
285+
return;
286+
}
287+
299288
CModManager::GetSingleton().Unload();
300289

301290
std::string strHost, strNick, strPassword;
@@ -309,7 +298,7 @@ void CCommandFuncs::Reconnect(const char* szParameters)
309298
CModManager::GetSingleton().Unload();
310299

311300
// Any mod loaded?
312-
if (!CModManager::GetSingleton().GetCurrentMod())
301+
if (!CModManager::GetSingleton().IsLoaded())
313302
{
314303
// Verify and convert the port number
315304
if (uiPort <= 0 || uiPort > 0xFFFF)

Client/core/CConnectManager.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*****************************************************************************/
1111

1212
#include "StdInc.h"
13-
#include "net/packetenums.h"
13+
#include "net/Packets.h"
1414
using namespace std;
1515

1616
static CConnectManager* g_pConnectManager = NULL;
@@ -52,6 +52,12 @@ bool CConnectManager::Connect(const char* szHost, unsigned short usPort, const c
5252
assert(szNick);
5353
assert(szPassword);
5454

55+
if (!CCore::GetSingleton().IsNetworkReady())
56+
{
57+
CCore::GetSingleton().GetLocalGUI()->GetMainMenu()->ShowNetworkNotReadyWindow();
58+
return false;
59+
}
60+
5561
m_bNotifyServerBrowser = bNotifyServerBrowser;
5662

5763
// For detecting startup problems
@@ -337,10 +343,13 @@ void CConnectManager::DoPulse()
337343
}
338344
else if (m_bReconnect)
339345
{
340-
std::string strNick;
341-
CVARS_GET("nick", strNick);
342-
Connect(m_strHost.c_str(), m_usPort, strNick.c_str(), m_strPassword.c_str(), false);
343-
m_bReconnect = false;
346+
if (CCore::GetSingleton().IsNetworkReady())
347+
{
348+
std::string strNick;
349+
CVARS_GET("nick", strNick);
350+
Connect(m_strHost.c_str(), m_usPort, strNick.c_str(), m_strPassword.c_str(), false);
351+
m_bReconnect = false;
352+
}
344353
}
345354
}
346355

@@ -364,7 +373,7 @@ bool CConnectManager::StaticProcessPacket(unsigned char ucPacketID, NetBitStream
364373
// Process packet data
365374
CCore::GetSingleton().GetNetwork()->SetServerBitStreamVersion(usServerBitStreamVersion);
366375

367-
if (strModName != "")
376+
if (strModName == "deathmatch")
368377
{
369378
// Populate the arguments to pass it (-c host port nick)
370379
SString strArguments("%s %s", g_pConnectManager->m_strNick.c_str(), g_pConnectManager->m_strPassword.c_str());
@@ -399,7 +408,7 @@ bool CConnectManager::StaticProcessPacket(unsigned char ucPacketID, NetBitStream
399408
g_pConnectManager->m_tConnectStarted = 0;
400409

401410
// Load the mod
402-
if (!CModManager::GetSingleton().Load(strModName, strArguments))
411+
if (!CModManager::GetSingleton().Load(strArguments))
403412
{
404413
// Failed loading the mod
405414
strArguments.Format(_("No such mod installed (%s)"), strModName.c_str());

Client/core/CCore.cpp

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,11 @@ CCore::CCore()
117117
m_pfnMessageProcessor = NULL;
118118
m_pMessageBox = NULL;
119119

120-
m_bFirstFrame = true;
121120
m_bIsOfflineMod = false;
122121
m_bQuitOnPulse = false;
123122
m_bDestroyMessageBox = false;
124123
m_bCursorToggleControls = false;
125124
m_bLastFocused = true;
126-
m_bWaitToSetNick = false;
127125
m_DiagnosticDebug = EDiagnosticDebug::NONE;
128126

129127
// Create our Direct3DData handler.
@@ -151,14 +149,14 @@ CCore::CCore()
151149
m_bDoneFrameRateLimit = false;
152150
m_uiFrameRateLimit = 0;
153151
m_uiServerFrameRateLimit = 0;
154-
m_uiNewNickWaitFrames = 0;
155152
m_iUnminimizeFrameCounter = 0;
156153
m_bDidRecreateRenderTargets = false;
157154
m_fMinStreamingMemory = 0;
158155
m_fMaxStreamingMemory = 0;
159156
m_bGettingIdleCallsFromMultiplayer = false;
160157
m_bWindowsTimerEnabled = false;
161158
m_timeDiscordAppLastUpdate = 0;
159+
m_CurrentRefreshRate = 60;
162160

163161
// Create tray icon
164162
m_pTrayIcon = new CTrayIcon();
@@ -515,7 +513,7 @@ void CCore::EnableChatInput(char* szCommand, DWORD dwColor)
515513
{
516514
if (m_pLocalGUI)
517515
{
518-
if (m_pGame->GetSystemState() == 9 /* GS_PLAYING_GAME */ && m_pModManager->GetCurrentMod() != NULL && !IsOfflineMod() && !m_pGame->IsAtMenu() &&
516+
if (m_pGame->GetSystemState() == 9 /* GS_PLAYING_GAME */ && m_pModManager->IsLoaded() && !IsOfflineMod() && !m_pGame->IsAtMenu() &&
519517
!m_pLocalGUI->GetMainMenu()->IsVisible() && !m_pLocalGUI->GetConsole()->IsVisible() && !m_pLocalGUI->IsChatBoxInputEnabled())
520518
{
521519
CChat* pChat = m_pLocalGUI->GetChat();
@@ -1236,16 +1234,22 @@ void CCore::DoPostFramePulse()
12361234
// This is the first frame in the menu?
12371235
if (m_pGame->GetSystemState() == 7) // GS_FRONTEND
12381236
{
1239-
if (m_bFirstFrame)
1240-
{
1241-
m_bFirstFrame = false;
1237+
if (m_menuFrame < 255)
1238+
++m_menuFrame;
12421239

1240+
if (m_menuFrame == 1)
1241+
{
12431242
WatchDogCompletedSection("L2"); // gta_sa.set seems ok
12441243
WatchDogCompletedSection("L3"); // No hang on startup
12451244
HandleCrashDumpEncryption();
12461245

12471246
// Disable vsync while it's all dark
12481247
m_pGame->DisableVSync();
1248+
}
1249+
1250+
if (m_menuFrame >= 5 && !m_isNetworkReady && m_pNet->IsReady())
1251+
{
1252+
m_isNetworkReady = true;
12491253

12501254
// Parse the command line
12511255
// Does it begin with mtasa://?
@@ -1262,33 +1266,18 @@ void CCore::DoPostFramePulse()
12621266
{
12631267
// We want to load a mod?
12641268
const char* szOptionValue;
1265-
if (szOptionValue = GetCommandLineOption("l"))
1266-
{
1267-
// Try to load the mod
1268-
if (!m_pModManager->Load(szOptionValue, m_szCommandLineArgs))
1269-
{
1270-
SString strTemp(_("Error running mod specified in command line ('%s')"), szOptionValue);
1271-
ShowMessageBox(_("Error") + _E("CC42"), strTemp, MB_BUTTON_OK | MB_ICON_ERROR); // Command line Mod load failed
1272-
}
1273-
}
1274-
// We want to connect to a server?
1275-
else if (szOptionValue = GetCommandLineOption("c"))
1269+
if (szOptionValue = GetCommandLineOption("c"))
12761270
{
12771271
CCommandFuncs::Connect(szOptionValue);
12781272
}
12791273
}
12801274
}
12811275

1282-
if (m_bWaitToSetNick && GetLocalGUI()->GetMainMenu()->IsVisible() && !GetLocalGUI()->GetMainMenu()->IsFading())
1276+
if (m_menuFrame >= 75 && m_requestNewNickname && GetLocalGUI()->GetMainMenu()->IsVisible() && !GetLocalGUI()->GetMainMenu()->IsFading())
12831277
{
1284-
if (m_uiNewNickWaitFrames > 75)
1285-
{
1286-
// Request a new nickname if we're waiting for one
1287-
GetLocalGUI()->GetMainMenu()->GetSettingsWindow()->RequestNewNickname();
1288-
m_bWaitToSetNick = false;
1289-
}
1290-
else
1291-
m_uiNewNickWaitFrames++;
1278+
// Request a new nickname if we're waiting for one
1279+
GetLocalGUI()->GetMainMenu()->GetSettingsWindow()->RequestNewNickname();
1280+
m_requestNewNickname = false;
12921281
}
12931282
}
12941283

@@ -1847,6 +1836,9 @@ void CCore::RecalculateFrameRateLimit(uint uiServerFrameRateLimit, bool bLogToCo
18471836
if ((m_uiFrameRateLimit == 0 || uiClientScriptRate < m_uiFrameRateLimit) && uiClientScriptRate > 0)
18481837
m_uiFrameRateLimit = uiClientScriptRate;
18491838

1839+
if (!IsConnected())
1840+
m_uiFrameRateLimit = m_CurrentRefreshRate;
1841+
18501842
// Removes Limiter from Frame Graph if limit is zero and skips frame limit
18511843
if (m_uiFrameRateLimit == 0)
18521844
{
@@ -1873,6 +1865,12 @@ void CCore::SetClientScriptFrameRateLimit(uint uiClientScriptFrameRateLimit)
18731865
RecalculateFrameRateLimit(-1, false);
18741866
}
18751867

1868+
void CCore::SetCurrentRefreshRate(uint value)
1869+
{
1870+
m_CurrentRefreshRate = value;
1871+
RecalculateFrameRateLimit(-1, false);
1872+
}
1873+
18761874
//
18771875
// Make sure the frame rate limit has been applied since the last call
18781876
//
@@ -1933,7 +1931,7 @@ void CCore::ApplyQueuedFrameRateLimit()
19331931
double dSpare = dTargetTimeToUse - m_FrameRateTimer.Get();
19341932
if (dSpare <= 0.0)
19351933
break;
1936-
if (dSpare >= 2.0)
1934+
if (dSpare >= 10.0)
19371935
Sleep(1);
19381936
}
19391937
m_FrameRateTimer.Reset();
@@ -2195,8 +2193,9 @@ void CCore::HandleIdlePulse()
21952193
DoPreFramePulse();
21962194
DoPostFramePulse();
21972195
}
2198-
if (m_pModManager->GetCurrentMod())
2199-
m_pModManager->GetCurrentMod()->IdleHandler();
2196+
2197+
if (m_pModManager->IsLoaded())
2198+
m_pModManager->GetClient()->IdleHandler();
22002199
}
22012200

22022201
//

0 commit comments

Comments
 (0)