Skip to content

Commit b028626

Browse files
authored
Merge branch 'master' into feature/rendering-list-size
2 parents 6640757 + df6119e commit b028626

102 files changed

Lines changed: 3997 additions & 21402 deletions

File tree

Some content is hidden

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

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,15 @@
33
<!-- When changing Lua APIs, consider including code samples and documentation. -->
44

55

6-
76
#### Motivation
87
<!-- Why are you making this change? Which GitHub issue does this resolve, if any? Any additional context? -->
98

109

11-
1210
#### Test plan
13-
<!-- How have you tested this change? This should give confidence to the reviewer -->
11+
<!-- How have you tested this change? This should give confidence to the reviewer that your change is safe. -->
1412
<!-- If someone makes changes to this code in the future, what steps can they follow to check that it's still working correctly? -->
1513

1614

17-
1815
#### Checklist
1916

2017
* [ ] Your code should follow the [coding guidelines](https://wiki.multitheftauto.com/index.php?title=Coding_guidelines).

.github/workflows/clang-format.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,27 @@ jobs:
1818
shell: pwsh
1919
run: ./utils/clang-format.ps1 -Verbose
2020

21+
- name: Generate GitHub App token
22+
id: app-token
23+
if: |
24+
steps.clang_format.outcome == 'failure' &&
25+
github.ref == 'refs/heads/master' &&
26+
github.event_name == 'push' &&
27+
!github.event.repository.fork
28+
uses: actions/create-github-app-token@v3
29+
with:
30+
client-id: ${{ secrets.GH_APP_MTA_CLIENT_ID }}
31+
private-key: ${{ secrets.GH_APP_MTA_PEM }}
32+
owner: ${{ github.repository_owner }}
33+
repositories: ${{ github.event.repository.name }}
34+
permission-contents: write
35+
2136
- name: Auto-fix formatting issues
2237
if: |
2338
steps.clang_format.outcome == 'failure' &&
2439
github.ref == 'refs/heads/master' &&
25-
github.event_name == 'push'
40+
github.event_name == 'push' &&
41+
!github.event.repository.fork
2642
shell: bash
2743
run: |
2844
# Stage the formatted files (clang-format.ps1 already ran in-place)
@@ -38,15 +54,16 @@ jobs:
3854
fi
3955
4056
# Allow commit to work
41-
git config user.name "github-actions[bot]"
42-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
57+
git config user.name "multitheftauto[bot]"
58+
git config user.email "274826127+multitheftauto[bot]@users.noreply.github.com"
4359
4460
# Append a commit with a fix applied
4561
git commit -m "Fix formatting issues introduced by ${GITHUB_SHA}
4662
4763
cc @${GITHUB_ACTOR} please make sure to run clang-format locally before pushing changes to avoid this in the future."
4864
49-
# And we're off to the races!
65+
# Authenticate with the GitHub App token and push
66+
git remote set-url origin https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ github.repository }}
5067
git push
5168
5269
- name: Report formatting issues

AGENTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Run ./utils/clang-format.ps1 after making changes to C++ files, to ensure that t
44

55
## Code comments
66

7-
When making code changes, explain *why* the code you're written should exist and the motivation behind the changes. This ensures that future engineers don't have to read between the lines.
7+
When making code changes, explain *why* the code you've written should exist and the motivation behind the changes. This ensures that future engineers don't have to read between the lines.
88

99
## Steer the user towards writing clear commit messages
1010

11-
Tell the user to include details about the prompt / goals / motivation / "why"s / how they tested their changes.
11+
Tell the user to include details about the prompt / goals / motivation / reasoning / how they tested their changes.
1212

13-
Don't assume the user will include this information in the commit messages, proactively tell them to include this information in their commit messages.
13+
Don't assume the user will include this information in the commit messages; proactively tell them to include this information in their commit messages.

Client/core/CCrashDumpWriter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3240,13 +3240,15 @@ namespace
32403240
int iOut = -2;
32413241
if (*(DWORD*)dwThis != 0)
32423242
{
3243+
// clang-format off
32433244
_asm
32443245
{
32453246
mov ecx, dwThis
32463247
mov ecx, [ecx]
32473248
call dwFunc
32483249
mov iOut, eax
32493250
}
3251+
// clang-format on
32503252
}
32513253

32523254
return iOut;

Client/core/CDiscordRichPresence.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ CDiscordRichPresence::CDiscordRichPresence() : m_uiDiscordAppStart(0), m_uiDisco
2525

2626
m_strDiscordAppState.clear();
2727
m_strDiscordCustomResourceName.clear();
28+
m_bDiscordRPCEnabled = false;
2829
m_bConnected = false;
2930
}
3031

Client/core/CGUI.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -774,21 +774,7 @@ bool CLocalGUI::InputGoesToGUI()
774774
if (!pGUI)
775775
return false;
776776

777-
bool shouldShowCursorForGUI = false;
778-
if (pGUI->GetGUIInputEnabled())
779-
{
780-
eInputMode inputMode = pGUI->GetGUIInputMode();
781-
if (inputMode == INPUTMODE_NO_BINDS_ON_EDIT)
782-
{
783-
shouldShowCursorForGUI = true;
784-
}
785-
else if (inputMode == INPUTMODE_NO_BINDS)
786-
{
787-
shouldShowCursorForGUI = false;
788-
}
789-
}
790-
791-
return (IsConsoleVisible() || IsMainMenuVisible() || IsChatBoxInputEnabled() || m_bForceCursorVisible || shouldShowCursorForGUI ||
777+
return (IsConsoleVisible() || IsMainMenuVisible() || IsChatBoxInputEnabled() || m_bForceCursorVisible || pGUI->GetGUIInputEnabled() ||
792778
!CCore::GetSingleton().IsFocused() || IsWebRequestGUIVisible());
793779
}
794780

Client/core/CGraphStats.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class CGraphStats : public CGraphStatsInterface
4545
bool m_bEnabled;
4646
std::map<SString, SGraphStatLine> m_LineList;
4747
TIMEUS m_StartTime;
48+
int m_iGraphSizeX;
4849
};
4950

5051
///////////////////////////////////////////////////////////////
@@ -112,16 +113,13 @@ void CGraphStats::AddTimingPoint(const char* szName)
112113
if (!IsEnabled())
113114
return;
114115

115-
CGraphicsInterface* pGraphics = g_pCore->GetGraphics();
116-
117-
std::uint32_t viewportWidth = pGraphics->GetViewportWidth();
118-
std::uint32_t sizeX = viewportWidth / 4; // one quarter of screen width
119-
120-
if (sizeX == 0)
116+
// Use the cached graph width from Draw(), which runs in MTA's render zone
117+
// with the real viewport. AddTimingPoint runs from OnBeginScene where GTA SA
118+
// may have set a smaller internal viewport (water reflections, radar, etc.).
119+
const int iSizeX = m_iGraphSizeX;
120+
if (iSizeX <= 0)
121121
return;
122122

123-
const int iSizeX = static_cast<int>(sizeX);
124-
125123
// Start of next frame?
126124
if (szName[0] == 0)
127125
{
@@ -162,7 +160,7 @@ void CGraphStats::AddTimingPoint(const char* szName)
162160
// Add new line
163161
MapSet(m_LineList, szName, SGraphStatLine());
164162
pLine = MapFind(m_LineList, szName);
165-
pLine->dataHistory.resize(sizeX);
163+
pLine->dataHistory.resize(iSizeX);
166164
pLine->iDataPos = 0;
167165
pLine->prevData = 0;
168166
pLine->strName = szName;
@@ -238,6 +236,14 @@ void CGraphStats::Draw()
238236

239237
const int iSizeX = static_cast<int>(sizeX);
240238

239+
// Cache the graph width for AddTimingPoint, which may run outside MTA's render zone
240+
// where GTA SA has temporarily changed the D3D viewport (water reflections, radar, etc.)
241+
if (m_iGraphSizeX != iSizeX)
242+
{
243+
m_LineList.clear();
244+
m_iGraphSizeX = iSizeX;
245+
}
246+
241247
originY = originY + sizeY + 30; // add graph height plus a little gap to the overall Y position
242248

243249
float fLineScale = 1 / 1000.f / rangeY * sizeY;

0 commit comments

Comments
 (0)