Skip to content

Commit f9a66e8

Browse files
authored
Merge branch 'master' into patch-5
2 parents 8ebc155 + a744cd1 commit f9a66e8

File tree

134 files changed

+33837
-11218
lines changed

Some content is hidden

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

134 files changed

+33837
-11218
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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,3 +416,4 @@ utils/DXFiles/
416416
!*.dll
417417
!*.exe
418418
utils/vswhere.exe
419+
*.generated.h

Client/core/CCore.cpp

Lines changed: 29 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,71 +1233,51 @@ void CCore::DoPostFramePulse()
12331233
m_pGUI->SelectInputHandlers(INPUT_CORE);
12341234
}
12351235

1236-
if (m_pGame->GetSystemState() == 5) // GS_INIT_ONCE
1237-
{
1238-
WatchDogCompletedSection("L2"); // gta_sa.set seems ok
1239-
WatchDogCompletedSection("L3"); // No hang on startup
1240-
}
1241-
12421236
// This is the first frame in the menu?
12431237
if (m_pGame->GetSystemState() == 7) // GS_FRONTEND
12441238
{
1245-
// Wait 250 frames more than the time it took to get status 7 (fade-out time)
1246-
static short WaitForMenu = 0;
1239+
if (m_bFirstFrame)
1240+
{
1241+
m_bFirstFrame = false;
12471242

1248-
// Do crash dump encryption while the credit screen is displayed
1249-
if (WaitForMenu == 0)
1243+
WatchDogCompletedSection("L2"); // gta_sa.set seems ok
1244+
WatchDogCompletedSection("L3"); // No hang on startup
12501245
HandleCrashDumpEncryption();
12511246

1252-
// Cope with early finish
1253-
if (m_pGame->HasCreditScreenFadedOut())
1254-
WaitForMenu = 250;
1247+
// Disable vsync while it's all dark
1248+
m_pGame->DisableVSync();
12551249

1256-
if (WaitForMenu >= 250)
1257-
{
1258-
if (m_bFirstFrame)
1250+
// Parse the command line
1251+
// Does it begin with mtasa://?
1252+
if (m_szCommandLineArgs && strnicmp(m_szCommandLineArgs, "mtasa://", 8) == 0)
12591253
{
1260-
m_bFirstFrame = false;
1261-
1262-
// Disable vsync while it's all dark
1263-
m_pGame->DisableVSync();
1264-
1265-
// Parse the command line
1266-
// Does it begin with mtasa://?
1267-
if (m_szCommandLineArgs && strnicmp(m_szCommandLineArgs, "mtasa://", 8) == 0)
1254+
SString strArguments = GetConnectCommandFromURI(m_szCommandLineArgs);
1255+
// Run the connect command
1256+
if (strArguments.length() > 0 && !m_pCommands->Execute(strArguments))
12681257
{
1269-
SString strArguments = GetConnectCommandFromURI(m_szCommandLineArgs);
1270-
// Run the connect command
1271-
if (strArguments.length() > 0 && !m_pCommands->Execute(strArguments))
1272-
{
1273-
ShowMessageBox(_("Error") + _E("CC41"), _("Error executing URL"), MB_BUTTON_OK | MB_ICON_ERROR);
1274-
}
1258+
ShowMessageBox(_("Error") + _E("CC41"), _("Error executing URL"), MB_BUTTON_OK | MB_ICON_ERROR);
12751259
}
1276-
else
1260+
}
1261+
else
1262+
{
1263+
// We want to load a mod?
1264+
const char* szOptionValue;
1265+
if (szOptionValue = GetCommandLineOption("l"))
12771266
{
1278-
// We want to load a mod?
1279-
const char* szOptionValue;
1280-
if (szOptionValue = GetCommandLineOption("l"))
1281-
{
1282-
// Try to load the mod
1283-
if (!m_pModManager->Load(szOptionValue, m_szCommandLineArgs))
1284-
{
1285-
SString strTemp(_("Error running mod specified in command line ('%s')"), szOptionValue);
1286-
ShowMessageBox(_("Error") + _E("CC42"), strTemp, MB_BUTTON_OK | MB_ICON_ERROR); // Command line Mod load failed
1287-
}
1288-
}
1289-
// We want to connect to a server?
1290-
else if (szOptionValue = GetCommandLineOption("c"))
1267+
// Try to load the mod
1268+
if (!m_pModManager->Load(szOptionValue, m_szCommandLineArgs))
12911269
{
1292-
CCommandFuncs::Connect(szOptionValue);
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
12931272
}
12941273
}
1274+
// We want to connect to a server?
1275+
else if (szOptionValue = GetCommandLineOption("c"))
1276+
{
1277+
CCommandFuncs::Connect(szOptionValue);
1278+
}
12951279
}
12961280
}
1297-
else
1298-
{
1299-
WaitForMenu++;
1300-
}
13011281

13021282
if (m_bWaitToSetNick && GetLocalGUI()->GetMainMenu()->IsVisible() && !GetLocalGUI()->GetMainMenu()->IsFading())
13031283
{

Client/core/CGUI.cpp

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ void CLocalGUI::CreateWindows(bool bGameIsAlreadyLoaded)
158158
m_pLabelVersionTag->SetTextColor(255, 255, 255);
159159
m_pLabelVersionTag->SetZOrderingEnabled(false);
160160
m_pLabelVersionTag->MoveToBack();
161-
m_pLabelVersionTag->SetVisible(false);
161+
if (MTASA_VERSION_TYPE < VERSION_TYPE_RELEASE)
162+
m_pLabelVersionTag->SetAlwaysOnTop(true);
162163

163164
// Create mainmenu
164165
m_pMainMenu = new CMainMenu(pGUI);
@@ -286,27 +287,6 @@ void CLocalGUI::Draw()
286287
// Update mainmenu stuff
287288
m_pMainMenu->Update();
288289

289-
// Make sure our version labels are always visible
290-
static short WaitForMenu = 0;
291-
292-
// Cope with early finish
293-
if (pGame->HasCreditScreenFadedOut())
294-
WaitForMenu = 250;
295-
296-
if (SystemState == 7 || SystemState == 9)
297-
{
298-
if (WaitForMenu < 250)
299-
{
300-
WaitForMenu++;
301-
}
302-
else
303-
{
304-
m_pLabelVersionTag->SetVisible(true);
305-
if (MTASA_VERSION_TYPE < VERSION_TYPE_RELEASE)
306-
m_pLabelVersionTag->SetAlwaysOnTop(true);
307-
}
308-
}
309-
310290
// If we're ingame, make sure the chatbox is drawn
311291
bool bChatVisible = (SystemState == 9 /* GS_INGAME */ && m_pMainMenu->GetIsIngame() && m_bChatboxVisible && !CCore::GetSingleton().IsOfflineMod());
312292
if (m_pChat->IsVisible() != bChatVisible)

Client/core/CLocalization.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
// TRANSLATORS: Replace with your language native name
1616
#define NATIVE_LANGUAGE_NAME _td("English")
1717

18+
struct NativeLanguageName
19+
{
20+
std::string locale;
21+
std::string name;
22+
} g_nativeLanguageNames[] = {
23+
#include "languages.generated.h"
24+
};
25+
1826
CLocalization::CLocalization(const SString& strLocale, const SString& strLocalePath)
1927
{
2028
// Set log callbacks so we can record problems
@@ -95,12 +103,23 @@ CLanguage* CLocalization::GetLanguage(SString strLocale)
95103
SString CLocalization::GetLanguageNativeName(SString strLocale)
96104
{
97105
strLocale = ValidateLocale(strLocale);
106+
107+
// Try to find the native language name in our sorted compile-time array first, using binary search.
108+
auto begin = g_nativeLanguageNames;
109+
auto end = g_nativeLanguageNames + _countof(g_nativeLanguageNames);
110+
auto iter = std::lower_bound(begin, end, strLocale, [](const NativeLanguageName& a, const std::string& b) { return a.locale < b; });
111+
112+
if (iter != end && iter->locale == strLocale)
113+
return iter->name;
114+
115+
// If not found, we fall back to the loading the language file and using the name from there.
98116
SString strNativeName = GetLanguage(strLocale)->Translate(NATIVE_LANGUAGE_NAME);
99117
if (strNativeName == "English" && strLocale != "en_US")
100118
{
101119
// If native name not available, use English version
102120
strNativeName = GetLanguage(strLocale)->GetName();
103121
}
122+
104123
return strNativeName;
105124
}
106125

Client/core/CMainMenu.cpp

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
#define CORE_MTA_FILLER "cgui\\images\\mta_filler.png"
4949
#define CORE_MTA_VERSION "cgui\\images\\version.png"
5050

51-
static int WaitForMenu = 0;
5251
static const SColor headlineColors[] = {SColorRGBA(233, 234, 106, 255), SColorRGBA(233 / 6 * 4, 234 / 6 * 4, 106 / 6 * 4, 255),
5352
SColorRGBA(233 / 7 * 3, 234 / 7 * 3, 106 / 7 * 3, 255)};
5453

@@ -70,11 +69,10 @@ CMainMenu::CMainMenu(CGUI* pManager)
7069

7170
// Initialize
7271
m_pManager = pManager;
73-
m_bIsVisible = false;
72+
m_bIsVisible = true;
7473
m_bIsFullyVisible = false;
7574
m_bIsIngame = true;
7675
// m_bIsInSubWindow = false;
77-
m_bStarted = false;
7876
m_fFader = 0;
7977
m_ucFade = FADE_INVISIBLE;
8078
m_bCursorAlphaReset = false;
@@ -656,47 +654,22 @@ void CMainMenu::Update()
656654
// Force the mainmenu on if we're at GTA's mainmenu or not ingame
657655
if ((SystemState == 7 || SystemState == 9) && !m_bIsIngame)
658656
{
659-
// Cope with early finish
660-
if (pGame->HasCreditScreenFadedOut())
661-
WaitForMenu = std::max(WaitForMenu, 250);
662-
663-
// Fade up
664-
if (WaitForMenu >= 250)
657+
if (!m_bStarted)
665658
{
666-
m_bIsVisible = true;
667659
m_bStarted = true;
668-
}
669660

670-
// Create headlines while the screen is still black
671-
if (WaitForMenu == 250)
672661
m_pNewsBrowser->CreateHeadlines();
673-
674-
// Start updater after fade up is complete
675-
if (WaitForMenu == 275)
676662
GetVersionUpdater()->EnableChecking(true);
677663

678-
#if _WIN32_WINNT <= _WIN32_WINNT_WINXP
679-
if (WaitForMenu == 275)
680-
{
681-
CCore::GetSingletonPtr()->ShowErrorMessageBox("", XP_VISTA_WARNING, "au-revoir-xp-vista");
682-
}
683-
#endif
684-
685-
if (WaitForMenu == 299)
686-
{
687-
if (!g_pCore->GetCVars()->GetValue("discord_rpc_share_data_firsttime", false)
688-
&& g_pCore->GetCVars()->GetValue("allow_discord_rpc", false)
689-
&& !g_pCore->GetCVars()->GetValue("discord_rpc_share_data", false))
664+
if (!g_pCore->GetCVars()->GetValue("discord_rpc_share_data_firsttime", false) && g_pCore->GetCVars()->GetValue("allow_discord_rpc", false) &&
665+
!g_pCore->GetCVars()->GetValue("discord_rpc_share_data", false))
690666
{
691667
m_Settings.ShowRichPresenceShareDataQuestionBox();
692668
CVARS_SET("discord_rpc_share_data_firsttime", true);
693669
}
694670
else
695671
CVARS_SET("discord_rpc_share_data_firsttime", true);
696672
}
697-
698-
if (WaitForMenu < 300)
699-
WaitForMenu++;
700673
}
701674

702675
// If we're visible

Client/core/CMainMenu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class CMainMenu
144144
int m_menuBY;
145145

146146
CGraphics* m_pGraphics;
147-
bool m_bStarted;
147+
bool m_bStarted{false};
148148
CVector2D m_ScreenSize;
149149

150150
// Fade variables

Client/core/ServerBrowser/CServerCache.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ bool CServerCache::LoadServerCache()
186186

187187
MapSet(m_ServerCachedMap, key, info);
188188
}
189+
190+
delete pNode;
191+
delete m_pConfigFile;
192+
189193
return true;
190194
}
191195

@@ -302,6 +306,9 @@ void CServerCache::StaticSaveServerCache()
302306
XMLAccess.SetSubNodeValue(CONFIG_NODE_SERVER_INT "11", dataSet);
303307

304308
m_pConfigFile->Write();
309+
310+
delete pNode;
311+
delete m_pConfigFile;
305312
}
306313

307314
///////////////////////////////////////////////////////////////

Client/core/premake5.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ project "Client Core"
5555
"PNG_SETJMP_NOT_SUPPORTED"
5656
}
5757

58+
prebuildcommands {
59+
"%[%{!wks.location}/../utils/gen_language_list.exe] %[%{!wks.location}/../Shared/data/MTA San Andreas/MTA/locale] %[languages.generated.h]"
60+
}
61+
5862
filter "architecture:not x86"
5963
flags { "ExcludeFromBuild" }
6064

Client/game_sa/CGameSA.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,14 +1041,6 @@ void CGameSA::SetupBrokenModels()
10411041
FixModelCol(3553, 3554);
10421042
}
10431043

1044-
// Well, has it?
1045-
bool CGameSA::HasCreditScreenFadedOut()
1046-
{
1047-
BYTE ucAlpha = *(BYTE*)0xBAB320; // CLoadingScreen::m_FadeAlpha
1048-
bool bCreditScreenFadedOut = (GetSystemState() >= 7) && (ucAlpha < 6);
1049-
return bCreditScreenFadedOut;
1050-
}
1051-
10521044
// Ensure replaced/restored textures for models in the GTA map are correct
10531045
void CGameSA::FlushPendingRestreamIPL()
10541046
{

0 commit comments

Comments
 (0)