Skip to content

Commit 9cae917

Browse files
committed
Merge branch 'master' into next
2 parents 9de0aaa + 9c3f81c commit 9cae917

File tree

952 files changed

+70543
-54318
lines changed

Some content is hidden

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

952 files changed

+70543
-54318
lines changed

.github/workflows/rebuild-pots.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,17 @@ jobs:
6565
git commit -m "Update installer en_US pot"
6666
fi
6767
68-
echo "::echo::on"
69-
7068
# Check for local commits
7169
if [[ $(git diff --name-only "@{upstream}..") ]]
7270
then
73-
echo "::set-output name=has_changes::true"
71+
echo "has_changes=true" >> $GITHUB_ENV
7472
else
75-
echo "::set-output name=has_changes::false"
73+
echo "has_changes=false" >> $GITHUB_ENV
7674
fi
7775
7876
# Get rid of all other changes
7977
git checkout -- .
8078
git clean -fd
81-
- if: ${{ steps.stage_changes.outputs.has_changes == 'true' }}
79+
- if: ${{ env.has_changes == 'true' }}
8280
name: Push changes
8381
run: git push

.github/workflows/stale.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
stale:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: multitheftauto/stale-action@v1.0.3
11+
- uses: multitheftauto/stale-action@v3.0.0
1212
id: stale
1313
with:
1414
close-pr-message: "This draft pull request was closed because it has been marked stale for 30 days with no activity."

Client/ceflauncher_DLL/Main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*****************************************************************************/
1010
#define WIN32_LEAN_AND_MEAN
1111
#include <Windows.h>
12+
#include <delayimp.h>
1213
#include "CCefApp.h"
1314
#include <string>
1415
#include <cef3/cef/include/cef_sandbox_win.h>
@@ -30,6 +31,9 @@ int _declspec(dllexport) InitCEF()
3031
std::wstring mtaPath = currentFileName.substr(0, pos - 3); // Strip "CEF"
3132
SetDllDirectory(mtaPath.c_str());
3233

34+
// Load libcef.dll from the DLL directory
35+
assert(SUCCEEDED(__HrLoadAllImportsForDll("libcef.dll")));
36+
3337
// Load CEF
3438
CefMainArgs mainArgs(GetModuleHandle(NULL));
3539
CefRefPtr<CCefApp> app{new CCefApp};

Client/ceflauncher_DLL/premake5.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ project "CEFLauncher DLL"
2222
"*.cpp"
2323
}
2424

25-
links { "CEF", "libcef.lib", "Psapi.lib", "version.lib", "Winmm.lib", "Ws2_32.lib", "DbgHelp.lib" }
25+
links { "delayimp", "CEF", "libcef.lib", "Psapi.lib", "version.lib", "Winmm.lib", "Ws2_32.lib", "DbgHelp.lib" }
26+
linkoptions { "/DELAYLOAD:libcef.dll" }
2627

2728
filter "architecture:not x86"
2829
flags { "ExcludeFromBuild" }

Client/core/CChat.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,40 @@ bool CChat::CharacterKeyHandler(CGUIKeyEventArgs KeyboardArgs)
745745
if (m_strLastPlayerName.size() != 0)
746746
m_strLastPlayerName.clear();
747747

748+
if (KeyboardArgs.codepoint == 127) // "delete" char, used to remove the previous word from input
749+
{
750+
if (m_strInputText.size() > 0)
751+
{
752+
// Convert our string to UTF8 before resizing, then back to ANSI.
753+
std::wstring wstrText = MbUTF8ToUTF16(m_strInputText);
754+
std::wstring_view wstrTextView = wstrText;
755+
756+
if (wstrTextView.back() == L' ' || wstrTextView.back() == L'-')
757+
{
758+
size_t lastPos = wstrTextView.find_last_not_of(wstrTextView.back());
759+
if (lastPos != std::string::npos)
760+
wstrTextView.remove_suffix(wstrTextView.size() - lastPos);
761+
else
762+
wstrText.clear();
763+
}
764+
765+
size_t lastSpacePos = wstrTextView.find_last_of(L' ');
766+
size_t lastDashPos = wstrTextView.find_last_of(L'-');
767+
size_t lastPos = lastSpacePos;
768+
769+
if ((lastSpacePos == std::string::npos || lastDashPos > lastSpacePos) && lastDashPos != std::string::npos)
770+
lastPos = lastDashPos;
771+
772+
if (lastPos != std::string::npos)
773+
wstrText.resize(lastPos + 1);
774+
else
775+
wstrText.clear();
776+
777+
SetInputText(UTF16ToMbUTF8(wstrText).c_str());
778+
}
779+
break;
780+
}
781+
748782
// If we haven't exceeded the maximum number of characters per chat message, append the char to the message and update the input control
749783
if (MbUTF8ToUTF16(m_strInputText).size() < m_iCharacterLimit)
750784
{

Client/core/CClientVariables.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ class CClientVariables : public CCVarsInterface, public CSingleton<CClientVariab
7777
m_iRevision++;
7878
Node(strVariable)->SetTagContent(val);
7979
};
80+
void Set(const std::string& strVariable, const char* val)
81+
{
82+
SAN;
83+
m_iRevision++;
84+
Node(strVariable)->SetTagContent(val);
85+
};
8086
void Set(const std::string& strVariable, const std::string& val)
8187
{
8288
SAN;

Client/core/CCore.cpp

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#define ALLOC_STATS_MODULE_NAME "core"
1919
#include "SharedUtil.hpp"
2020
#include <clocale>
21+
#include "DXHook/CDirect3DHook9.h"
22+
#include "DXHook/CDirect3DHookManager.h"
2123
#include "CTimingCheckpoints.hpp"
2224
#include "CModelCacheManager.h"
2325
#include <SharedUtil.Detours.h>
@@ -1467,7 +1469,22 @@ void CCore::ParseCommandLine(std::map<std::string, std::string>& options, const
14671469
}
14681470

14691471
const char* szCmdLine = GetCommandLine();
1470-
char szCmdLineCopy[512];
1472+
1473+
// Skip the leading game executable path (starts and ends with a quotation mark).
1474+
if (szCmdLine[0] == '"')
1475+
{
1476+
if (const char* afterPath = strchr(szCmdLine + 1, '"'); afterPath != nullptr)
1477+
{
1478+
++afterPath;
1479+
1480+
while (*afterPath && isspace(*afterPath))
1481+
++afterPath;
1482+
1483+
szCmdLine = afterPath;
1484+
}
1485+
}
1486+
1487+
char szCmdLineCopy[512];
14711488
STRNCPY(szCmdLineCopy, szCmdLine, sizeof(szCmdLineCopy));
14721489

14731490
char* pCmdLineEnd = szCmdLineCopy + strlen(szCmdLineCopy);
@@ -1729,6 +1746,21 @@ void CCore::ApplyCoreInitSettings()
17291746
SetProcessDPIAware();
17301747
}
17311748
#endif
1749+
1750+
if (int revision = GetApplicationSettingInt("reset-settings-revision"); revision < 21486)
1751+
{
1752+
// Force users with default skin to the 2023 version by replacing "Default" with "Default 2023".
1753+
// The GUI skin "Default 2023" was introduced in commit 2d9e03324b07e355031ecb3263477477f1a91399.
1754+
std::string currentSkinName;
1755+
CVARS_GET("current_skin", currentSkinName);
1756+
1757+
if (currentSkinName == "Default")
1758+
{
1759+
CVARS_SET("current_skin", "Default 2023");
1760+
}
1761+
1762+
SetApplicationSettingInt("reset-settings-revision", 21486);
1763+
}
17321764
}
17331765

17341766
//

Client/core/CCredits.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ CCredits::CCredits()
124124
"Philip \"Fenix\" Farquharson\n"
125125
"Seweryn \"Neproify\" Figura\n"
126126
"Alejandro \"AlexTMjugador\" González\n"
127-
"Adrian \"AGraber\" Graber\n"
128127
"Kevin \"ciber96\" Gross\n"
129128
"Robin \"robhol\" Holm\n"
130129
"Bob \"NanoBob\" van Hooff\n"

Client/core/CFilePathTranslator.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
/*****************************************************************************
22
*
3-
* PROJECT: Multi Theft Auto v1.0
3+
* PROJECT: Multi Theft Auto
44
* LICENSE: See LICENSE in the top level directory
5-
* FILE: core/CFilePathTranslator.cpp
5+
* FILE: Client/core/CFilePathTranslator.cpp
66
* PURPOSE: Easy interface to file paths
77
*
8-
* Multi Theft Auto is available from http://www.multitheftauto.com/
8+
* Multi Theft Auto is available from https://multitheftauto.com/
99
*
1010
*****************************************************************************/
1111

1212
#include "StdInc.h"
13+
#include "CFilePathTranslator.h"
14+
#include <filesystem>
1315

14-
using std::string;
16+
extern std::filesystem::path g_gtaDirectory;
1517

1618
CFilePathTranslator::CFilePathTranslator()
1719
{
@@ -21,7 +23,7 @@ CFilePathTranslator::~CFilePathTranslator()
2123
{
2224
}
2325

24-
bool CFilePathTranslator::GetFileFromModPath(const string& FileToGet, string& TranslatedFilePathOut)
26+
bool CFilePathTranslator::GetFileFromModPath(const std::string& FileToGet, std::string& TranslatedFilePathOut)
2527
{
2628
// Translate the path to this file.
2729
TranslatedFilePathOut = m_ModPath;
@@ -31,7 +33,7 @@ bool CFilePathTranslator::GetFileFromModPath(const string& FileToGet, string& Tr
3133
return true;
3234
}
3335

34-
bool CFilePathTranslator::GetFileFromWorkingDirectory(const string& FileToGet, string& TranslatedFilePathOut)
36+
bool CFilePathTranslator::GetFileFromWorkingDirectory(const std::string& FileToGet, std::string& TranslatedFilePathOut)
3537
{
3638
// Translate the path to this file.
3739
TranslatedFilePathOut = m_WorkingDirectory;
@@ -41,21 +43,21 @@ bool CFilePathTranslator::GetFileFromWorkingDirectory(const string& FileToGet, s
4143
return true;
4244
}
4345

44-
void CFilePathTranslator::GetModPath(string& ModPathOut)
46+
void CFilePathTranslator::GetModPath(std::string& ModPathOut)
4547
{
4648
ModPathOut = m_ModPath;
4749
}
4850

49-
void CFilePathTranslator::SetModPath(const string& PathBasedOffWorkingDirectory)
51+
void CFilePathTranslator::SetModPath(const std::string& PathBasedOffWorkingDirectory)
5052
{
5153
m_ModPath = m_WorkingDirectory;
5254
m_ModPath += '\\';
5355
m_ModPath += PathBasedOffWorkingDirectory;
5456
}
5557

56-
void CFilePathTranslator::SetCurrentWorkingDirectory(const string& PathBasedOffModuleRoot)
58+
void CFilePathTranslator::SetCurrentWorkingDirectory(const std::string& PathBasedOffModuleRoot)
5759
{
58-
string RootDirectory;
60+
std::string RootDirectory;
5961

6062
// Get the root directory.
6163
GetMTASARootDirectory(RootDirectory);
@@ -71,17 +73,17 @@ void CFilePathTranslator::UnSetCurrentWorkingDirectory()
7173
m_WorkingDirectory = "";
7274
}
7375

74-
void CFilePathTranslator::GetCurrentWorkingDirectory(string& WorkingDirectoryOut)
76+
void CFilePathTranslator::GetCurrentWorkingDirectory(std::string& WorkingDirectoryOut)
7577
{
7678
WorkingDirectoryOut = m_WorkingDirectory;
7779
}
7880

79-
void CFilePathTranslator::GetGTARootDirectory(string& ModuleRootDirOut)
81+
void CFilePathTranslator::GetGTARootDirectory(std::string& ModuleRootDirOut)
8082
{
81-
ModuleRootDirOut = GetLaunchPath();
83+
ModuleRootDirOut = g_gtaDirectory.u8string();
8284
}
8385

84-
void CFilePathTranslator::GetMTASARootDirectory(string& InstallRootDirOut)
86+
void CFilePathTranslator::GetMTASARootDirectory(std::string& InstallRootDirOut)
8587
{
8688
InstallRootDirOut = GetMTASABaseDir();
8789
}

Client/core/CFilePathTranslator.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*****************************************************************************
22
*
3-
* PROJECT: Multi Theft Auto v1.0
3+
* PROJECT: Multi Theft Auto
44
* LICENSE: See LICENSE in the top level directory
5-
* FILE: core/CFilePathTranslator.h
5+
* FILE: Client/core/CFilePathTranslator.h
66
* PURPOSE: Header file for file path translator class
77
*
8-
* Multi Theft Auto is available from http://www.multitheftauto.com/
8+
* Multi Theft Auto is available from https://multitheftauto.com/
99
*
1010
*****************************************************************************/
1111

Client/core/CGUI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ CLocalGUI* CSingleton<CLocalGUI>::m_pSingleton = NULL;
2424
#endif
2525
#define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam))
2626

27-
const char* const DEFAULT_SKIN_NAME = "Default"; // TODO: Change to whatever the default skin is if it changes
27+
const char* const DEFAULT_SKIN_NAME = "Default 2023"; // TODO: Change to whatever the default skin is if it changes
2828

2929
CLocalGUI::CLocalGUI()
3030
{

Client/core/CGUI.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class CLocalGUI;
2424
#include <gui/CGUI.h>
2525

2626
#include "CConsole.h"
27-
#include "CFilePathTranslator.h"
2827
#include "CMainMenu.h"
2928
#include "CSetCursorPosHook.h"
3029
#include "CSingleton.h"

Client/core/CKeyBinds.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,6 +2014,9 @@ void CKeyBinds::DoPostFramePulse()
20142014
{
20152015
for (const KeyBindPtr& bind : m_binds)
20162016
{
2017+
if (bind->isBeingDeleted || !bind->boundKey)
2018+
continue;
2019+
20172020
switch (bind->type)
20182021
{
20192022
case KeyBindType::COMMAND:

Client/core/CMessageLoopHook.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ LRESULT CALLBACK CMessageLoopHook::ProcessMessage(HWND hwnd, UINT uMsg, WPARAM w
185185
return 0;
186186
}
187187

188+
// Disable the system context menu by clicking on window bar (freezes the game).
189+
// Disable right mouse button outside application window area (holding it over window bar freezes the game).
190+
if (uMsg == WM_CONTEXTMENU || uMsg == WM_NCRBUTTONDOWN)
191+
{
192+
return 0;
193+
}
194+
188195
// Quit message?
189196
if (uMsg == WM_CLOSE)
190197
{
@@ -546,7 +553,7 @@ void CMessageLoopHook::StartWindowMovement()
546553

547554
LONG lExStyle = GetWindowLong(m_MovementDummyWindow, GWL_EXSTYLE);
548555
lExStyle &= ~(WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE);
549-
lExStyle |= WS_EX_LAYERED;
556+
lExStyle |= WS_EX_LAYERED | WS_EX_TOOLWINDOW;
550557
SetWindowLong(m_MovementDummyWindow, GWL_EXSTYLE, lExStyle);
551558
SetLayeredWindowAttributes(m_MovementDummyWindow, 0, 140, LWA_ALPHA);
552559

Client/core/CModManager.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
/*****************************************************************************
22
*
3-
* PROJECT: Multi Theft Auto v1.0
3+
* PROJECT: Multi Theft Auto
44
* LICENSE: See LICENSE in the top level directory
5-
* FILE: core/CModManager.cpp
5+
* FILE: Client/core/CModManager.cpp
66
* PURPOSE: Game mod loading manager
77
*
8-
* Multi Theft Auto is available from http://www.multitheftauto.com/
8+
* Multi Theft Auto is available from https://multitheftauto.com/
99
*
1010
*****************************************************************************/
1111

1212
#include "StdInc.h"
13+
#include "CModManager.h"
14+
#include "CFilePathTranslator.h"
1315
#include <game/CGame.h>
1416
#define DECLARE_PROFILER_SECTION_CModManager
1517
#include "profiler/SharedUtil.Profiler.h"

Client/core/CModManager.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*****************************************************************************
22
*
3-
* PROJECT: Multi Theft Auto v1.0
3+
* PROJECT: Multi Theft Auto
44
* LICENSE: See LICENSE in the top level directory
5-
* FILE: core/CModManager.h
5+
* FILE: Client/core/CModManager.h
66
* PURPOSE: Header file for game mod manager class
77
*
8-
* Multi Theft Auto is available from http://www.multitheftauto.com/
8+
* Multi Theft Auto is available from https://multitheftauto.com/
99
*
1010
*****************************************************************************/
1111

0 commit comments

Comments
 (0)