Skip to content

Commit f3645b8

Browse files
committed
2 parents 58ae23f + 708f50a commit f3645b8

File tree

488 files changed

+24577
-20046
lines changed

Some content is hidden

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

488 files changed

+24577
-20046
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Crowdin Auto-Merge
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * 5' # This cron expression runs the workflow every Friday at midnight (UTC)
6+
workflow_dispatch:
7+
8+
jobs:
9+
crowdin-auto-merge:
10+
if: github.event.repository.fork == false
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup Git
19+
run: |
20+
git config --global user.name 'github-actions[bot]'
21+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
22+
23+
- name: Auto-merge pull request
24+
run: |
25+
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --author 'MTABot' --base 'master' --head 'l10n/master' --state open --json number --jq '.[0].number')
26+
if [ -n "$PR_NUMBER" ]; then
27+
gh pr merge $PR_NUMBER --squash --repo ${{ github.repository }} --admin --subject "New Crowdin updates (PR #$PR_NUMBER)" --body ""
28+
git push origin --delete l10n/master
29+
fi
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/dockerimage.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
dockerfile: Dockerfile.armhf
2727
- tag: arm64
2828
dockerfile: Dockerfile.arm64
29+
if: github.event.repository.fork == false
2930
runs-on: ubuntu-latest
3031
steps:
3132
- uses: actions/checkout@v4

.github/workflows/rebuild-pots.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on: [push, workflow_dispatch]
44

55
jobs:
66
test:
7+
if: github.event.repository.fork == false
78
runs-on: ubuntu-latest
89
steps:
910
- uses: actions/checkout@v4
@@ -23,6 +24,7 @@ jobs:
2324
run: pytest "utils/localization/tests"
2425
shell: bash -l {0}
2526
rebuild-pots:
27+
if: github.event.repository.fork == false
2628
runs-on: ubuntu-latest
2729
needs: test
2830
steps:

.github/workflows/stale.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66

77
jobs:
88
stale:
9+
if: github.event.repository.fork == false
910
runs-on: ubuntu-latest
1011
steps:
1112
- uses: multitheftauto/stale-action@v3.0.0

.github/workflows/sync-master-to-maetro.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
jobs:
99
sync-master-to-maetro:
10+
if: github.event.repository.fork == false
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v4

.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/CChat.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,29 @@ bool CChat::CharacterKeyHandler(CGUIKeyEventArgs KeyboardArgs)
650650

651651
// If the input isn't empty and isn't identical to the previous entry in history, add it to the history
652652
if (!m_strInputText.empty() && (m_pInputHistory->Empty() || m_pInputHistory->GetLast() != m_strInputText))
653-
m_pInputHistory->Add(m_strInputText);
653+
{
654+
if (m_strCommand.empty() && m_strInputText[0] != '/')
655+
{
656+
// If the input is not a command, store it
657+
m_pInputHistory->Add(m_strInputText);
658+
}
659+
else if (m_strCommand.compare("login") != 0)
660+
{
661+
// If the input is a command, check that it isn't the 'login' command, if it is censor it
662+
char szInput[256];
663+
unsigned int uiLength = sizeof(szInput) - 1;
664+
665+
strncpy(szInput, m_strInputText.c_str() + 1, uiLength);
666+
szInput[uiLength] = '\0';
667+
668+
const char* szCommand = strtok(szInput, " ");
669+
670+
if (szCommand && (strcmp(szCommand, "login") != 0))
671+
m_pInputHistory->Add(m_strInputText);
672+
else if ((m_pInputHistory->Empty() || m_pInputHistory->GetLast() != std::string("/login")))
673+
m_pInputHistory->Add("/login");
674+
}
675+
}
654676

655677
SetInputVisible(false);
656678

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

0 commit comments

Comments
 (0)