Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C++20 support for Client #3636

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
4d49b80
Main
Moris-Onz Aug 9, 2024
1f10a85
Fixed part 1
Moris-Onz Aug 9, 2024
79b76ef
Fixed part 2
Moris-Onz Aug 9, 2024
d59efc1
Fix crash
Moris-Onz Aug 9, 2024
5cd6fc3
Fast fix by TracerDS
Moris-Onz Aug 9, 2024
1d8c1d7
Fixed by Tederis
Moris-Onz Aug 10, 2024
6a86788
Fast 666
Moris-Onz Aug 10, 2024
87a30e2
Merge branch 'master' into client_c20
G-Moris Aug 12, 2024
bd8e747
Merge branch 'master' into client_c20
G-Moris Aug 14, 2024
d64cd42
Merge branch 'master' into client_c20
G-Moris Aug 15, 2024
649cc85
Merge branch 'master' into client_c20
G-Moris Aug 15, 2024
41a6ccb
Merge branch 'master' into client_c20
G-Moris Aug 17, 2024
c55ed03
Merge branch 'master' into client_c20
G-Moris Aug 18, 2024
876e654
Merge branch 'master' into client_c20
G-Moris Aug 19, 2024
8c58a63
Merge branch 'master' into client_c20
G-Moris Aug 19, 2024
17f9dae
Merge branch 'master' into client_c20
G-Moris Aug 20, 2024
9fbe17f
Merge branch 'master' into client_c20
G-Moris Aug 22, 2024
3e8779b
Merge branch 'master' into client_c20
G-Moris Aug 25, 2024
160909f
Fixed by Botder
Moris-Onz Aug 25, 2024
9f3ebd3
Merge branch 'client_c20' of https://github.com/G-Moris/mtasa-blue in…
Moris-Onz Aug 25, 2024
fb1b6f7
Merge branch 'master' into client_c20
G-Moris Aug 28, 2024
9b171c2
Mini refactor
Moris-Onz Aug 28, 2024
6383ddf
Merge branch 'client_c20' of https://github.com/G-Moris/mtasa-blue in…
Moris-Onz Aug 28, 2024
4f0f087
Merge branch 'master' into client_c20
G-Moris Aug 31, 2024
65644c4
Merge branch 'master' into client_c20
G-Moris Sep 3, 2024
e964cb2
Merge branch 'master' into client_c20
G-Moris Sep 6, 2024
30c42e7
Update CEGUI
Moris-Onz Sep 6, 2024
01f3de7
Merge branch 'client_c20' of https://github.com/G-Moris/mtasa-blue in…
Moris-Onz Sep 6, 2024
33981ff
Update CEGUI (Full)
Moris-Onz Sep 6, 2024
055752b
Update Discord RPC and Tinygettext
Moris-Onz Sep 6, 2024
e7f3a86
Update Lunasvg
Moris-Onz Sep 6, 2024
7a11241
Test Fix multiplayer_sa
Moris-Onz Sep 6, 2024
903f812
Test fix game_sa
Moris-Onz Sep 6, 2024
50b0ac8
Merge branch 'master' into client_c20
G-Moris Sep 17, 2024
a9ff24c
Merge branch 'master' into client_c20
G-Moris Sep 22, 2024
0e16f15
Merge branch 'master' into client_c20
G-Moris Sep 26, 2024
ec3c7de
Merge branch 'master' into client_c20
G-Moris Sep 28, 2024
56990d5
Merge branch 'master' into client_c20
G-Moris Oct 5, 2024
5c137e2
Merge branch 'master' into client_c20
G-Moris Oct 11, 2024
c589f0b
Merge branch 'master' into client_c20
G-Moris Oct 14, 2024
10af729
std::string from CCommands
Moris-Onz Oct 14, 2024
b98217d
Merge branch 'client_c20' of https://github.com/G-Moris/mtasa-blue in…
Moris-Onz Oct 14, 2024
062cdff
Refactoring changes
Moris-Onz Oct 14, 2024
034fbf0
a fix for the minimalism of changes #1
Moris-Onz Oct 14, 2024
22f98f7
adjustments
Moris-Onz Oct 14, 2024
7daf065
Merge branch 'master' into client_c20
G-Moris Oct 16, 2024
8b44e2a
Merge branch 'master' into client_c20
G-Moris Oct 19, 2024
1face51
Merge branch 'master' into client_c20
G-Moris Nov 7, 2024
249aadf
Merge branch 'master' into client_c20
G-Moris Nov 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Client/ceflauncher/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ project "CEFLauncher"
targetname "CEFLauncher"
targetdir(buildpath("mta/cef"))

cppdialect "C++20"

includedirs { "../sdk" }

links { "CEFLauncher DLL"}
Expand Down
2 changes: 2 additions & 0 deletions Client/ceflauncher_DLL/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ project "CEFLauncher DLL"
targetname "CEFLauncher_DLL"
targetdir(buildpath("mta/cef"))

cppdialect "C++20"

includedirs { "../../vendor/cef3/cef" }
libdirs { "../../vendor/cef3/cef/Release" }

Expand Down
2 changes: 2 additions & 0 deletions Client/cefweb/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ project "Client Webbrowser"
targetname "cefweb"
targetdir(buildpath("mta"))

cppdialect "C++20"

filter "system:windows"
includedirs { "../../vendor/sparsehash/src/windows" }
linkoptions { "/SAFESEH:NO" }
Expand Down
4 changes: 2 additions & 2 deletions Client/core/CAdditionalVertexStreamManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,13 @@ SAdditionalStreamInfo* CAdditionalVertexStreamManager::CreateAdditionalStreamInf
declNew->Usage = D3DDECLUSAGE_NORMAL;
declNew->UsageIndex = 0;
if (FAILED(m_pDevice->CreateVertexDeclaration(elements, &info.pVertexDeclaration)))
return false;
return nullptr;

// Create new stream
info.Stride = sizeof(float) * 3;
UINT Size2 = ConvertPTSize(state.decl.VertexBufferDesc1.Size);
if (FAILED(m_pDevice->CreateVertexBuffer(Size2, D3DUSAGE_WRITEONLY, 0, D3DPOOL_MANAGED, &info.pStreamData, NULL)))
return false;
return nullptr;

// Save info
MapSet(m_AdditionalStreamInfoMap, state.stream1.pStreamData, info);
Expand Down
29 changes: 17 additions & 12 deletions Client/core/CCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,11 @@ bool CCommands::Execute(const char* szCommandLine)
bool CCommands::Execute(const char* szCommand, const char* szParametersIn, bool bHandleRemotely, bool bIsScriptedBind)
{
// Copy szParametersIn so the contents can be changed
char* szParameters = NULL;
char* szParameters = nullptr;
if (szParametersIn)
{
size_t sizeParameters = strlen(szParametersIn) + 1;
szParameters = static_cast<char*>(alloca(sizeParameters));
memcpy(szParameters, szParametersIn, sizeParameters);
szParameters = new char[strlen(szParametersIn) + 1];
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
std::strcpy(szParameters, szParametersIn);
}

// HACK: if its a 'chatboxsay' command, use the next parameter
Expand All @@ -108,15 +107,12 @@ bool CCommands::Execute(const char* szCommand, const char* szParametersIn, bool

// Split it into command and arguments
szCommand = strtok(szBuffer, " ");
szParameters = strtok(NULL, "\0");
if (szCommand == NULL)
{
szParameters = strtok(nullptr, "\0");
if (!szCommand)
return false;
}
if (szParameters == NULL)
{
szParameters = "";
}

if (!szParameters)
std::strcpy(szParameters, "");
}
}
else
Expand Down Expand Up @@ -181,6 +177,10 @@ bool CCommands::Execute(const char* szCommand, const char* szParametersIn, bool
ss << key << " = " << val;
val = ss.str();
CCore::GetSingleton().GetConsole()->Print(val.c_str());

if (szParameters)
delete[] szParameters;

return true;
}
}
Expand Down Expand Up @@ -209,7 +209,12 @@ bool CCommands::Execute(const char* szCommand, const char* szParametersIn, bool
{
bool bAllowScriptedBind = (!pEntry || pEntry->bAllowScriptedBind);
if (m_pfnExecuteHandler(szCommand, szParameters, bHandleRemotely, (pEntry != NULL), bIsScriptedBind, bAllowScriptedBind))
{
if (szParameters)
delete[] szParameters;

return true;
}
}

// Unknown command
Expand Down
4 changes: 2 additions & 2 deletions Client/core/CCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ static HMODULE WINAPI SkipDirectPlay_LoadLibraryA(LPCSTR fileName)
const fs::path inLaunchDir = fs::path{FromUTF8(GetLaunchPath())} / "enbseries" / "enbhelper.dll";

if (fs::is_regular_file(inLaunchDir, ec))
return Win32LoadLibraryA(inLaunchDir.u8string().c_str());
return Win32LoadLibraryA(inLaunchDir.string().c_str());
G-Moris marked this conversation as resolved.
Show resolved Hide resolved

// Try to load enbhelper.dll from the GTA install directory second.
const fs::path inGTADir = g_gtaDirectory / "enbseries" / "enbhelper.dll";

if (fs::is_regular_file(inGTADir, ec))
return Win32LoadLibraryA(inGTADir.u8string().c_str());
return Win32LoadLibraryA(inGTADir.string().c_str());
G-Moris marked this conversation as resolved.
Show resolved Hide resolved

return nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion Client/core/CEntryHistory.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class CEntryHistory
// Return a specific entry from history
CEntryHistoryItem* Get(unsigned int index)
{
auto& iter = std::next(m_entries.begin(), index);
auto iter = std::next(m_entries.begin(), index);
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
if (iter != m_entries.end())
return &(*iter);
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion Client/core/CFilePathTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void CFilePathTranslator::GetCurrentWorkingDirectory(std::string& WorkingDirecto

void CFilePathTranslator::GetGTARootDirectory(std::string& ModuleRootDirOut)
{
ModuleRootDirOut = g_gtaDirectory.u8string();
ModuleRootDirOut = g_gtaDirectory.string();
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
}

void CFilePathTranslator::GetMTASARootDirectory(std::string& InstallRootDirOut)
Expand Down
4 changes: 2 additions & 2 deletions Client/core/CKeyBinds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2300,7 +2300,7 @@ void CKeyBinds::BindCommand(const char* szCmdLine)
{
CConsoleInterface* pConsole = m_pCore->GetConsole();

char* szError = "* Syntax: bind <defaults/key> [<up/down>] <command> [<arguments>]";
const char* szError = "* Syntax: bind <defaults/key> [<up/down>] <command> [<arguments>]";
if (szCmdLine == NULL)
{
pConsole->Print(szError);
Expand Down Expand Up @@ -2383,7 +2383,7 @@ void CKeyBinds::UnbindCommand(const char* szCmdLine)
{
CConsoleInterface* pConsole = m_pCore->GetConsole();

char* szError = "* Syntax: unbind <all/key> [<up/down/both> <command>]";
const char* szError = "* Syntax: unbind <all/key> [<up/down/both> <command>]";
if (szCmdLine == NULL)
{
pConsole->Print(szError);
Expand Down
4 changes: 2 additions & 2 deletions Client/core/CVersionUpdater.Util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ namespace
SString GetAttribute(const SString& strName) const
{
const SString* pValue = MapFind(attributeMap, strName);
return pValue ? *pValue : "";
return pValue ? *pValue : SStringX("");
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
}
void SetAttribute(const SString& strName, const SString& strValue) { MapSet(attributeMap, strName, strValue); }
};
Expand Down Expand Up @@ -606,7 +606,7 @@ namespace
SaveReportSettings();
}

SString GetFilter() const { return strFilter != "" ? strFilter : "+all"; }
SString GetFilter() const { return !strFilter.empty() ? strFilter : SStringX("+all"); }

int GetMinSize() const { return iMinSize; }

Expand Down
8 changes: 4 additions & 4 deletions Client/core/Graphics/CRenderItem.EffectTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace
SString m_strReport;
std::map<SString, SString> m_FileMD5Map;

CIncludeManager::CIncludeManager(const SString& strRootPath, const SString& strCurrentPath)
CIncludeManager(const SString& strRootPath, const SString& strCurrentPath)
{
m_strRootPath = strRootPath;
m_strCurrentPath = strCurrentPath;
Expand Down Expand Up @@ -228,15 +228,15 @@ void CEffectTemplate::CreateUnderlyingData(const SString& strFile, const SString
if (bDebug)
dwFlags |= D3DXSHADER_DEBUG;

SString strMetaPath = bIsRawData ? "" : strFile.Right(strFile.length() - strRootPath.length());
CIncludeManager IncludeManager(strRootPath, ExtractPath(strMetaPath));
const char* szMetaPath = bIsRawData ? "" : strFile.Right(strFile.length() - strRootPath.length()).c_str();
CIncludeManager IncludeManager(strRootPath, ExtractPath(szMetaPath));
LPD3DXBUFFER pBufferErrors = NULL;
if (bIsRawData)
m_CreateHResult =
MyD3DXCreateEffect(m_pDevice, strFile, strFile.length(), &macroList[0], &IncludeManager, dwFlags, NULL, &m_pD3DEffect, &pBufferErrors);
else
m_CreateHResult =
MyD3DXCreateEffectFromFile(m_pDevice, ExtractFilename(strMetaPath), &macroList[0], &IncludeManager, dwFlags, NULL, &m_pD3DEffect, &pBufferErrors);
MyD3DXCreateEffectFromFile(m_pDevice, ExtractFilename(szMetaPath), &macroList[0], &IncludeManager, dwFlags, NULL, &m_pD3DEffect, &pBufferErrors);

// Handle compile errors
strOutStatus = "";
Expand Down
16 changes: 8 additions & 8 deletions Client/core/ServerBrowser/CServerBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1078,21 +1078,21 @@ void CServerBrowser::AddServerToList(CServerListItem* pServer, const ServerBrows
pServer->iRowIndex = iIndex;
}

const SString strVersion = !bIncludeOtherVersions ? "" : pServer->strVersion;
const char* szVersion = !bIncludeOtherVersions ? "" : pServer->strVersion.c_str();
const SString strVersionSortKey = pServer->strVersionSortKey + pServer->strTieBreakSortKey;

const SString strPlayers = pServer->nMaxPlayers == 0 ? "" : SString("%d / %d", pServer->nPlayers, pServer->nMaxPlayers);
const char* szPlayers = pServer->nMaxPlayers == 0 ? "" : SString("%d / %d", pServer->nPlayers, pServer->nMaxPlayers).c_str();
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
const SString strPlayersSortKey = SString("%04d-", pServer->nMaxPlayers ? pServer->nPlayers + 1 : 0) + pServer->strTieBreakSortKey;

const SString strPing = pServer->nPing == 9999 ? "" : SString("%d", pServer->nPing);
const char* szPing = pServer->nPing == 9999 ? "" : SString("%d", pServer->nPing).c_str();
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
const SString strPingSortKey = SString("%04d-", pServer->nPing) + pServer->strTieBreakSortKey;

// The row index could change at any point here if list sorting is enabled
iIndex = m_pServerList[Type]->SetItemText(iIndex, m_hVersion[Type], strVersion, false, false, true, strVersionSortKey);
iIndex = m_pServerList[Type]->SetItemText(iIndex, m_hName[Type], pServer->strName, false, false, true, pServer->strNameSortKey);
iIndex = m_pServerList[Type]->SetItemText(iIndex, m_hGame[Type], pServer->strGameMode, false, false, true);
iIndex = m_pServerList[Type]->SetItemText(iIndex, m_hPlayers[Type], strPlayers, false, false, true, strPlayersSortKey);
iIndex = m_pServerList[Type]->SetItemText(iIndex, m_hPing[Type], strPing, false, false, true, strPingSortKey);
iIndex = m_pServerList[Type]->SetItemText(iIndex, m_hVersion[Type], szVersion, false, false, true, strVersionSortKey);
iIndex = m_pServerList[Type]->SetItemText(iIndex, m_hName[Type], pServer->strName.c_str(), false, false, true, pServer->strNameSortKey);
iIndex = m_pServerList[Type]->SetItemText(iIndex, m_hGame[Type], pServer->strGameMode.c_str(), false, false, true);
iIndex = m_pServerList[Type]->SetItemText(iIndex, m_hPlayers[Type], szPlayers, false, false, true, strPlayersSortKey);
iIndex = m_pServerList[Type]->SetItemText(iIndex, m_hPing[Type], szPing, false, false, true, strPingSortKey);

// Locked icon
m_pServerList[Type]->SetItemImage(iIndex, m_hLocked[Type], pServer->bPassworded ? m_pLockedIcon : NULL);
Expand Down
2 changes: 2 additions & 0 deletions Client/core/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ project "Client Core"
targetname "core"
targetdir(buildpath("mta"))

cppdialect "C++20"

filter "system:windows"
includedirs { "../../vendor/sparsehash/src/windows" }
linkoptions { "/SAFESEH:NO" }
Expand Down
2 changes: 1 addition & 1 deletion Client/game_sa/CModelInfoSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1708,7 +1708,7 @@ void CModelInfoSA::CopyStreamingInfoFromModel(ushort usBaseModelID)
pTargetModelStreamingInfo->sizeInBlocks = pBaseModelStreamingInfo->sizeInBlocks;
}

void CModelInfoSA::MakePedModel(char* szTexture)
void CModelInfoSA::MakePedModel(const char* szTexture)
{
// Create a new CPedModelInfo
CPedModelInfoSA pedModelInfo;
Expand Down
2 changes: 1 addition & 1 deletion Client/game_sa/CModelInfoSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ class CModelInfoSA : public CModelInfo
RwObject* GetRwObject() { return m_pInterface ? m_pInterface->pRwObject : NULL; }

// CModelInfoSA methods
void MakePedModel(char* szTexture);
void MakePedModel(const char* szTexture);
void MakeObjectModel(ushort usBaseModelID);
void MakeVehicleAutomobile(ushort usBaseModelID);
void MakeTimedObjectModel(ushort usBaseModelID);
Expand Down
5 changes: 4 additions & 1 deletion Client/game_sa/CWeaponSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,11 @@ bool CWeaponSA::Fire(CEntity* pFiringEntity, CVector* pvecOrigin, CVector* pvecT
return bReturn;
}

void CWeaponSA::AddGunshell(CEntity* pFiringEntity, CVector* pvecOrigin, CVector2D* pvecDirection, float fSize)
void CWeaponSA::AddGunshell(CEntity* pFiringEntity, const CVector& vecOrigin, const CVector2D& vecDirection, float fSize)
{
const CVector* pvecOrigin = &vecOrigin;
const CVector2D* pvecDirection = &vecDirection;
G-Moris marked this conversation as resolved.
Show resolved Hide resolved

DWORD dwEntityInterface = 0;
if (pFiringEntity)
dwEntityInterface = (DWORD)pFiringEntity->GetInterface();
Expand Down
2 changes: 1 addition & 1 deletion Client/game_sa/CWeaponSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class CWeaponSA : public CWeapon
void Initialize(eWeaponType type, unsigned int uiAmmo, CPed* pPed);
void Update(CPed* pPed);
bool Fire(CEntity* pFiringEntity, CVector* pvecOrigin, CVector* pvecOffset, CEntity* pTargetEntity, CVector* pvec_1, CVector* pvec_2);
void AddGunshell(CEntity* pFiringEntity, CVector* pvecOrigin, CVector2D* pvecDirection, float fSize);
void AddGunshell(CEntity* pFiringEntity, const CVector& vecOrigin, const CVector2D& vecDirection, float fSize);
void DoBulletImpact(CEntity* pFiringEntity, CEntitySAInterface* pEntityInterface, CVector* pvecOrigin, CVector* pvecTarget, CColPoint* pColPoint, int i_1);
unsigned char GenerateDamageEvent(CPed* pPed, CEntity* pResponsible, eWeaponType weaponType, int iDamagePerHit, ePedPieceTypes hitZone, int i_2);
bool ProcessLineOfSight(const CVector* vecStart, const CVector* vecEnd, CColPoint** colCollision, CEntity** CollisionEntity, const SLineOfSightFlags flags,
Expand Down
2 changes: 2 additions & 0 deletions Client/gui/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ project "GUI"
targetname "cgui"
targetdir(buildpath("mta"))

cppdialect "C++20"

filter "system:windows"
includedirs { "../../vendor/sparsehash/src/windows" }

Expand Down
2 changes: 2 additions & 0 deletions Client/launch/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ project "Client Launcher"
targetdir(buildpath("."))
debugdir(buildpath("."))

cppdialect "C++20"

includedirs {
"../../Shared/sdk",
"../sdk",
Expand Down
2 changes: 2 additions & 0 deletions Client/loader-proxy/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ project "Loader Proxy"
targetdir(buildpath("mta"))
targetsuffix ""

cppdialect "C++20"

vpaths {
["Headers/*"] = "**.h",
["Sources"] = { "*.cpp" },
Expand Down
16 changes: 8 additions & 8 deletions Client/loader/CInstallManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,13 +655,13 @@ SString CInstallManager::_PrepareLaunchLocation()
if (fs::is_regular_file(sourcePath, ec))
{
SString strMessage(_("MTA:SA cannot launch because copying a file failed:"));
strMessage += "\n\n" + targetPath.u8string();
strMessage += "\n\n" + targetPath.string();
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
BrowseToSolution("copy-files", ASK_GO_ONLINE, strMessage);
}
else
{
SString strMessage(_("MTA:SA cannot launch because an MTA:SA file is incorrect or missing:"));
strMessage += "\n\n" + sourcePath.u8string();
strMessage += "\n\n" + sourcePath.string();
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
BrowseToSolution("mta-datafiles-missing", ASK_GO_ONLINE, strMessage);
}

Expand Down Expand Up @@ -693,15 +693,15 @@ SString CInstallManager::_ProcessGtaPatchCheck()
if (!FileGenerator::IsPatchBase(patchBasePath))
{
SString strMessage(_("MTA:SA cannot launch because a GTA:SA file is incorrect or missing:"));
strMessage += "\n\n" + patchBasePath.u8string();
strMessage += "\n\n" + patchBasePath.string();
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
BrowseToSolution("gengta_pakfiles", ASK_GO_ONLINE, strMessage);
return "quit";
}

if (!FileGenerator::IsPatchDiff(patchDiffPath))
{
SString strMessage(_("MTA:SA cannot launch because an MTA:SA file is incorrect or missing:"));
strMessage += "\n\n" + patchDiffPath.u8string();
strMessage += "\n\n" + patchDiffPath.string();
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
BrowseToSolution("mta-datafiles-missing", ASK_GO_ONLINE, strMessage);
return "quit";
}
Expand Down Expand Up @@ -771,7 +771,7 @@ SString CInstallManager::_ProcessGtaDllCheck()
if (isAdmin)
{
SString strMessage(_("MTA:SA cannot launch because a GTA:SA file is incorrect or missing:"));
strMessage += "\n\n" + dependecyPath.u8string();
strMessage += "\n\n" + dependecyPath.string();
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
BrowseToSolution(SString("gendep_error&name=%s", dependency.fileName), ASK_GO_ONLINE, strMessage);
return "quit";
}
Expand Down Expand Up @@ -826,7 +826,7 @@ SString CInstallManager::_ProcessGtaVersionCheck()
if (isAdmin)
{
SString strMessage(_("MTA:SA cannot launch because the GTA:SA executable is incorrect or missing:"));
strMessage += "\n\n" + gtaExePath.u8string();
strMessage += "\n\n" + gtaExePath.string();
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
strMessage +=
"\n\n" +
_("Please check your anti-virus for a false-positive detection, try to add an exception for the GTA:SA executable and restart MTA:SA.");
Expand All @@ -851,7 +851,7 @@ SString CInstallManager::_ProcessGtaVersionCheck()
if (isAdmin)
{
SString strMessage(_("MTA:SA cannot launch because the GTA:SA executable is not loadable:"));
strMessage += "\n\n" + gtaExePath.u8string();
strMessage += "\n\n" + gtaExePath.string();
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
BrowseToSolution(SString("gengta_error&code=%d", ec.value()), ASK_GO_ONLINE, strMessage);
return "quit";
}
Expand All @@ -874,7 +874,7 @@ SString CInstallManager::_ProcessGtaVersionCheck()
if (isAdmin)
{
SString strMessage(_("MTA:SA cannot launch because patching GTA:SA has failed:"));
strMessage += "\n\n" + gtaExePath.u8string();
strMessage += "\n\n" + gtaExePath.string();
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
BrowseToSolution(SString("patchgta_error&code=%d", ec.value()), ASK_GO_ONLINE, strMessage);
return "quit";
}
Expand Down
2 changes: 1 addition & 1 deletion Client/loader/Install.Manifest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static void ParseManifestVersion1(std::ifstream& manifest, std::vector<ManifestF
{
uint32_t checksum{};

if (auto& [ptr, ec] = std::from_chars(line.data(), line.data() + space, checksum, 16); ec == std::errc{})
if (const auto& [ptr, ec] = std::from_chars(line.data(), line.data() + space, checksum, 16); ec == std::errc{})
{
ManifestFile file{};
file.relativePath = line.substr(space + 1);
Expand Down
2 changes: 1 addition & 1 deletion Client/loader/MainFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ int LaunchGame(SString strCmdLine)
const SString strGTAPath = GetGTAPath();
const SString strMTASAPath = GetMTASAPath();
SString strMtaDir = PathJoin(strMTASAPath, "mta");
SString strGTAEXEPath = GetGameExecutablePath().u8string();
SString strGTAEXEPath = GetGameExecutablePath().string();
G-Moris marked this conversation as resolved.
Show resolved Hide resolved

SetDllDirectory(strMtaDir);
if (!CheckService(CHECK_SERVICE_PRE_CREATE) && !IsUserAdmin())
Expand Down
Loading
Loading