From 30cd69d65429ae1c79ab8c1eb11d4028e643e736 Mon Sep 17 00:00:00 2001 From: FileEX Date: Mon, 1 Sep 2025 21:30:27 +0200 Subject: [PATCH 1/3] ReportLogID enum --- Client/core/CChat.cpp | 2 +- Client/core/CCore.cpp | 12 +- Client/core/CCore.h | 4 +- Client/core/CCrashDumpWriter.cpp | 14 +- Client/core/CModManager.cpp | 2 +- Client/core/CModelCacheManager.cpp | 4 +- Client/core/CNewsBrowser.cpp | 8 +- Client/core/CQuestionBox.cpp | 2 +- Client/core/CVersionUpdater.Util.hpp | 8 +- Client/core/CVersionUpdater.cpp | 30 +-- Client/core/Core.cpp | 2 +- Client/core/DXHook/CDirect3DEvents9.cpp | 8 +- Client/core/DXHook/CDirect3DHook9.cpp | 2 +- Client/core/DXHook/CProxyDirect3D9.cpp | 2 +- .../core/DXHook/CProxyDirect3DIndexBuffer.cpp | 4 +- .../DXHook/CProxyDirect3DVertexBuffer.cpp | 10 +- Client/core/Graphics/CGraphics.cpp | 2 +- .../Graphics/CRenderItem.EffectCloner.cpp | 2 +- Client/core/Graphics/CVideoModeManager.cpp | 4 +- Client/game_sa/CAnimBlendAssocGroupSA.cpp | 2 +- Client/game_sa/CModelInfoSA.cpp | 4 +- .../game_sa/CRenderWareSA.TxdRightSizing.cpp | 2 +- Client/game_sa/CRenderWareSA.cpp | 2 +- Client/game_sa/gamesa_init.cpp | 4 +- Client/game_sa/gamesa_init.h | 2 +- Client/launch/Main.cpp | 26 +- Client/loader-proxy/main.cpp | 2 +- Client/loader/CInstallManager.cpp | 36 +-- Client/loader/CSequencer.h | 4 +- Client/loader/D3DStuff.cpp | 4 +- Client/loader/FileGenerator.cpp | 4 +- Client/loader/Install.Manifest.cpp | 2 +- Client/loader/Install.cpp | 52 ++-- Client/loader/Main.cpp | 11 +- Client/loader/MainFunctions.cpp | 50 ++-- Client/loader/Utils.cpp | 12 +- Client/loader/Utils.h | 2 +- Client/mods/deathmatch/ClientCommands.cpp | 2 +- Client/mods/deathmatch/logic/CClientGame.cpp | 32 +-- Client/mods/deathmatch/logic/CClientGame.h | 4 +- .../deathmatch/logic/CClientObjectManager.cpp | 2 +- Client/mods/deathmatch/logic/CClientPed.cpp | 4 +- .../mods/deathmatch/logic/CClientPlayer.cpp | 4 +- Client/mods/deathmatch/logic/CClientTXD.cpp | 2 +- .../mods/deathmatch/logic/CPacketHandler.cpp | 12 +- Client/mods/deathmatch/logic/CResource.cpp | 2 +- .../logic/CResourceFileDownloadManager.cpp | 6 +- .../deathmatch/logic/CResourceManager.cpp | 6 +- Client/mods/deathmatch/logic/lua/CLuaMain.cpp | 4 +- .../logic/luadefs/CLuaResourceDefs.cpp | 4 +- Client/multiplayer_sa/CMultiplayerSA.cpp | 2 +- .../CMultiplayerSA_ClothesCache.cpp | 2 +- .../CMultiplayerSA_CrashFixHacks.cpp | 24 +- .../multiplayer_sa/CMultiplayerSA_Files.cpp | 2 +- .../CMultiplayerSA_FixBadAnimId.cpp | 6 +- .../CMultiplayerSA_HookDestructors.cpp | 2 +- .../CMultiplayerSA_Rendering.cpp | 2 +- .../multiplayer_sa/multiplayer_hooksystem.cpp | 2 +- Client/multiplayer_sa/multiplayersa_init.cpp | 4 +- Client/multiplayer_sa/multiplayersa_init.h | 2 +- Client/sdk/core/CCoreInterface.h | 2 +- .../deathmatch/logic/luadefs/CLuaBlipDefs.cpp | 10 +- .../deathmatch/logic/luadefs/CLuaBlipDefs.h | 10 +- Shared/mods/deathmatch/logic/Utils.cpp | 4 +- Shared/sdk/SharedUtil.Misc.h | 4 +- Shared/sdk/SharedUtil.Misc.hpp | 20 +- Shared/sdk/SharedUtil.SysInfo.hpp | 16 +- Shared/sdk/enums/ReportLogID.h | 240 ++++++++++++++++++ 68 files changed, 512 insertions(+), 269 deletions(-) create mode 100644 Shared/sdk/enums/ReportLogID.h diff --git a/Client/core/CChat.cpp b/Client/core/CChat.cpp index bcb7fb8a56c..0e6c6b5f248 100644 --- a/Client/core/CChat.cpp +++ b/Client/core/CChat.cpp @@ -222,7 +222,7 @@ void CChat::Draw(bool bUseCacheTexture, bool bAllowOutline) if (m_iReportCount < 5) { m_iReportCount++; - AddReportLog(6532, SString("Chat rt chatSize:%2.0f %2.0f rtsize:%d %d card:%s", chatSize.fX, chatSize.fY, iRenderTargetSizeX, + AddReportLog(ReportLogID::CHAT_RT_FAIL, SString("Chat rt chatSize:%2.0f %2.0f rtsize:%d %d card:%s", chatSize.fX, chatSize.fY, iRenderTargetSizeX, iRenderTargetSizeY, g_pDeviceState->AdapterState.Name.c_str())); } } diff --git a/Client/core/CCore.cpp b/Client/core/CCore.cpp index c5e4748c67b..b9465c72368 100644 --- a/Client/core/CCore.cpp +++ b/Client/core/CCore.cpp @@ -779,7 +779,7 @@ void CCore::ShowNetErrorMessageBox(const SString& strTitle, SString strMessage, else if (bLinkRequiresErrorCode) strTroubleLink = ""; // No link if no error code - AddReportLog(7100, SString("Core - NetError (%s) (%s)", *strTitle, *strMessage)); + AddReportLog(ReportLogID::CORE_NET_ERROR, SString("Core - NetError (%s) (%s)", *strTitle, *strMessage)); ShowErrorMessageBox(strTitle, strMessage, strTroubleLink); } @@ -906,7 +906,7 @@ void LoadModule(CModuleLoader& m_Loader, const SString& strName, const SString& SString strDllDirectory = GetSystemDllDirectory(); if (CalcMTASAPath("mta").CompareI(strDllDirectory) == false) { - AddReportLog(3119, SString("DllDirectory wrong: DllDirectory:'%s' Path:'%s'", *strDllDirectory, *CalcMTASAPath("mta"))); + AddReportLog(ReportLogID::DLL_DIR_FAIL, SString("DllDirectory wrong: DllDirectory:'%s' Path:'%s'", *strDllDirectory, *CalcMTASAPath("mta"))); SetDllDirectory(CalcMTASAPath("mta")); } @@ -1457,7 +1457,7 @@ void CCore::Quit(bool bInstantly) { if (bInstantly) { - AddReportLog(7101, "Core - Quit"); + AddReportLog(ReportLogID::CORE_QUIT, "Core - Quit"); // Show that we are quiting (for the crash dump filename) SetApplicationSettingInt("last-server-ip", 1); @@ -2155,10 +2155,10 @@ void CCore::OnEnterCrashZone(uint uiId) // // LogEvent // -void CCore::LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, uint uiAddReportLogId) +void CCore::LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, ReportLogID addReportLogId) { - if (uiAddReportLogId) - AddReportLog(uiAddReportLogId, SString("%s - %s", szContext, szBody)); + if (addReportLogId != ReportLogID::NONE) + AddReportLog(addReportLogId, SString("%s - %s", szContext, szBody)); if (GetDebugIdEnabled(uiDebugId)) { diff --git a/Client/core/CCore.h b/Client/core/CCore.h index d7f7762b2ce..137c9ab21af 100644 --- a/Client/core/CCore.h +++ b/Client/core/CCore.h @@ -42,6 +42,8 @@ class CDiscordInterface; #include #include "CTrayIcon.h" +#include + #define DIRECTINPUT_VERSION 0x0800 #include @@ -252,7 +254,7 @@ class CCore : public CCoreInterface, public CSingleton void OnDeviceRestore(); void OnCrashAverted(uint uiId); void OnEnterCrashZone(uint uiId); - void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, uint uiAddReportLogId = 0); + void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, ReportLogID addReportLogId = ReportLogID::NONE); bool GetDebugIdEnabled(uint uiDebugId); EDiagnosticDebugType GetDiagnosticDebug(); void SetDiagnosticDebug(EDiagnosticDebugType value); diff --git a/Client/core/CCrashDumpWriter.cpp b/Client/core/CCrashDumpWriter.cpp index c15ef5dc72c..381ad7a5112 100644 --- a/Client/core/CCrashDumpWriter.cpp +++ b/Client/core/CCrashDumpWriter.cpp @@ -138,7 +138,7 @@ void CCrashDumpWriter::UpdateCounters() { if (ms_uiInvalidParameterCount > ms_uiInvalidParameterCountLogged && ms_uiInvalidParameterCountLogged < 10) { - AddReportLog(9206, SString("InvalidParameterCount changed from %d to %d", ms_uiInvalidParameterCountLogged, ms_uiInvalidParameterCount)); + AddReportLog(ReportLogID::INVALID_PARAMETER_COUNT, SString("InvalidParameterCount changed from %d to %d", ms_uiInvalidParameterCountLogged, ms_uiInvalidParameterCount)); ms_uiInvalidParameterCountLogged = ms_uiInvalidParameterCount; } } @@ -321,7 +321,7 @@ void CCrashDumpWriter::DumpMiniDump(_EXCEPTION_POINTERS* pException, CExceptionI } if (!hDll) - AddReportLog(9201, "CCrashDumpWriter::DumpMiniDump - Could not load DBGHELP.DLL"); + AddReportLog(ReportLogID::DBGHELP_FAIL, "CCrashDumpWriter::DumpMiniDump - Could not load DBGHELP.DLL"); // We could load a dll? if (hDll) @@ -329,14 +329,14 @@ void CCrashDumpWriter::DumpMiniDump(_EXCEPTION_POINTERS* pException, CExceptionI // Grab the MiniDumpWriteDump proc address auto pDump = reinterpret_cast(static_cast(GetProcAddress(hDll, "MiniDumpWriteDump"))); if (!pDump) - AddReportLog(9202, "CCrashDumpWriter::DumpMiniDump - Could not find MiniDumpWriteDump"); + AddReportLog(ReportLogID::DBGHELP_MINIDUMPWRITEDUMP_FAIL, "CCrashDumpWriter::DumpMiniDump - Could not find MiniDumpWriteDump"); if (pDump) { // Create the file HANDLE hFile = CreateFile(CalcMTASAPath("mta\\core.dmp"), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) - AddReportLog(9203, SString("CCrashDumpWriter::DumpMiniDump - Could not create '%s'", *CalcMTASAPath("mta\\core.dmp"))); + AddReportLog(ReportLogID::CREATE_DMP_FAIL, SString("CCrashDumpWriter::DumpMiniDump - Could not create '%s'", *CalcMTASAPath("mta\\core.dmp"))); if (hFile != INVALID_HANDLE_VALUE) { @@ -351,7 +351,7 @@ void CCrashDumpWriter::DumpMiniDump(_EXCEPTION_POINTERS* pException, CExceptionI (MINIDUMP_TYPE)(MiniDumpNormal | MiniDumpWithIndirectlyReferencedMemory), &ExInfo, NULL, NULL); if (!bResult) - AddReportLog(9204, SString("CCrashDumpWriter::DumpMiniDump - MiniDumpWriteDump failed (%08x)", GetLastError())); + AddReportLog(ReportLogID::DMP_MINIDUMPWRITEDUMP_FAIL, SString("CCrashDumpWriter::DumpMiniDump - MiniDumpWriteDump failed (%08x)", GetLastError())); else WriteDebugEvent("CCrashDumpWriter::DumpMiniDump - MiniDumpWriteDump succeeded"); @@ -498,7 +498,7 @@ void CCrashDumpWriter::DumpMiniDump(_EXCEPTION_POINTERS* pException, CExceptionI { CVARS_SET("volumetric_shadows", false); CCore::GetSingleton().SaveConfig(); - AddReportLog(9205, "Disabled volumetric shadows"); + AddReportLog(ReportLogID::DISABLE_VOLUMETRIC_SHADOWS, "Disabled volumetric shadows"); } CNet* pNet = CCore::GetSingleton().GetNetwork(); @@ -529,7 +529,7 @@ void CCrashDumpWriter::RunErrorTool(CExceptionInformation* pExceptionInformation pExceptionInformation->GetEIP(), pExceptionInformation->GetEFlags(), pExceptionInformation->GetCS(), pExceptionInformation->GetDS(), pExceptionInformation->GetSS(), pExceptionInformation->GetES(), pExceptionInformation->GetFS(), pExceptionInformation->GetGS()); - AddReportLog(3120, strMessage); + AddReportLog(ReportLogID::CRASH_INFO, strMessage); // Try relaunch with crashed flag SString strMTASAPath = GetMTASABaseDir(); diff --git a/Client/core/CModManager.cpp b/Client/core/CModManager.cpp index e00e8ee4bbb..63423ff90fd 100644 --- a/Client/core/CModManager.cpp +++ b/Client/core/CModManager.cpp @@ -148,7 +148,7 @@ bool CModManager::TryStart() if (CalcMTASAPath("mta").CompareI(dllSearchPath) == false) { - AddReportLog(3119, SString("DllDirectory wrong: DllDirectory:'%s' Path:'%s'", *dllSearchPath, *CalcMTASAPath("mta"))); + AddReportLog(ReportLogID::DLL_DIR_FAIL, SString("DllDirectory wrong: DllDirectory:'%s' Path:'%s'", *dllSearchPath, *CalcMTASAPath("mta"))); SetDllDirectory(CalcMTASAPath("mta")); } diff --git a/Client/core/CModelCacheManager.cpp b/Client/core/CModelCacheManager.cpp index 3e6ae2575bf..78ca3b8c3c7 100644 --- a/Client/core/CModelCacheManager.cpp +++ b/Client/core/CModelCacheManager.cpp @@ -159,7 +159,7 @@ void CModelCacheManagerImpl::PreLoad() // Crashed during previous PreLoad? if (WatchDogIsSectionOpen(WD_SECTION_PRELOAD_UPGRADES)) { - AddReportLog(8545, SString("PreLoad Upgrades - Crash detect - bSlowMethod:%d iLowestUnsafeUpgrade:%d", bSlowMethod, iLowestUnsafeUpgrade)); + AddReportLog(ReportLogID::PRELOAD_UPGRADE_CACHE_CRASH, SString("PreLoad Upgrades - Crash detect - bSlowMethod:%d iLowestUnsafeUpgrade:%d", bSlowMethod, iLowestUnsafeUpgrade)); iLowestUnsafeUpgrade = GetApplicationSettingInt(DIAG_PRELOAD_UPGRADE_ATTEMPT_ID); bSlowMethod = 1; SetApplicationSettingInt(DIAG_PRELOAD_UPGRADES_LOWEST_UNSAFE, iLowestUnsafeUpgrade); @@ -193,7 +193,7 @@ void CModelCacheManagerImpl::PreLoad() int iPrevHiScore = GetApplicationSettingInt(DIAG_PRELOAD_UPGRADES_HISCORE); SetApplicationSettingInt(DIAG_PRELOAD_UPGRADES_HISCORE, iLowestUnsafeUpgrade); if (iPrevHiScore > iLowestUnsafeUpgrade) - AddReportLog(8544, SString("PreLoad Upgrades - LowestUnsafeUpgrade fallen from %d to %d", iPrevHiScore, iLowestUnsafeUpgrade)); + AddReportLog(ReportLogID::PRELOAD_UPGRADE_FALLEN, SString("PreLoad Upgrades - LowestUnsafeUpgrade fallen from %d to %d", iPrevHiScore, iLowestUnsafeUpgrade)); CTickCount deltaTicks = CTickCount::Now() - startTicks; OutputDebugLine(SString("CModelCacheManagerImpl::PreLoad completed in %d ms", deltaTicks.ToInt())); diff --git a/Client/core/CNewsBrowser.cpp b/Client/core/CNewsBrowser.cpp index 9b76fbc4628..0cd19fd9de1 100644 --- a/Client/core/CNewsBrowser.cpp +++ b/Client/core/CNewsBrowser.cpp @@ -281,7 +281,7 @@ CGUIWindow* CNewsBrowser::LoadLayoutAndImages(CGUIElement* pParent, const SNewsI // Make sure we have the layout filename if (newsItem.strLayoutFilename.empty()) { - AddReportLog(3302, SString("CNewsBrowser::LoadLayout: Problem loading %s", *newsItem.strContentFullDir)); + AddReportLog(ReportLogID::NEWS_LAYOUT_FAIL, SString("CNewsBrowser::LoadLayout: Problem loading %s", *newsItem.strContentFullDir)); return NULL; } @@ -290,8 +290,8 @@ CGUIWindow* CNewsBrowser::LoadLayoutAndImages(CGUIElement* pParent, const SNewsI { if (!pManager->LoadImageset(newsItem.imagesetFilenameList[i])) { - AddReportLog( - 3303, SString("CNewsBrowser::LoadLayout: Problem with LoadImageset [%s] %s", *newsItem.strContentFullDir, *newsItem.imagesetFilenameList[i])); + AddReportLog(ReportLogID::NEWS_LAYOUT_IMAGESET_FAIL, SString("CNewsBrowser::LoadLayout: Problem with LoadImageset [%s] %s", + *newsItem.strContentFullDir, *newsItem.imagesetFilenameList[i])); return NULL; } } @@ -300,7 +300,7 @@ CGUIWindow* CNewsBrowser::LoadLayoutAndImages(CGUIElement* pParent, const SNewsI CGUIWindow* pWindow = pManager->LoadLayout(pParent, newsItem.strLayoutFilename); if (!pWindow) { - AddReportLog(3304, SString("CNewsBrowser::LoadLayout: Problem with LoadLayout [%s] %s", *newsItem.strContentFullDir, *newsItem.strLayoutFilename)); + AddReportLog(ReportLogID::NEW_LAYOUT_LOAD_FAIL, SString("CNewsBrowser::LoadLayout: Problem with LoadLayout [%s] %s", *newsItem.strContentFullDir, *newsItem.strLayoutFilename)); return NULL; } return pWindow; diff --git a/Client/core/CQuestionBox.cpp b/Client/core/CQuestionBox.cpp index 5b8bf46b661..7693dbfdc1e 100644 --- a/Client/core/CQuestionBox.cpp +++ b/Client/core/CQuestionBox.cpp @@ -102,7 +102,7 @@ void CQuestionBox::Show() m_pWindow->BringToFront(); g_pCore->RemoveMessageBox(); - AddReportLog(9100, SString("QuestionBox::Show [%s] %s", m_pWindow->GetText().c_str(), *m_strMsg.Left(200).Replace("\n", "|"))); + AddReportLog(ReportLogID::QUESTIONBOX_SHOW, SString("QuestionBox::Show [%s] %s", m_pWindow->GetText().c_str(), *m_strMsg.Left(200).Replace("\n", "|"))); } void CQuestionBox::Reset() diff --git a/Client/core/CVersionUpdater.Util.hpp b/Client/core/CVersionUpdater.Util.hpp index 669217ede77..6846991780e 100644 --- a/Client/core/CVersionUpdater.Util.hpp +++ b/Client/core/CVersionUpdater.Util.hpp @@ -356,25 +356,25 @@ namespace m_strTempFileName = MakeUniquePath(PathJoin(GetMTADataPath(), "temp", "buffer.xml")); if (!FileSave(m_strTempFileName, &data[0], uiSize)) { - AddReportLog(2501, SString("CXMLBuffer::SetFromBuffer: Could not save %s", m_strTempFileName.c_str())); + AddReportLog(ReportLogID::VER_UPD_XML_SAVE_FAIL, SString("CXMLBuffer::SetFromBuffer: Could not save %s", m_strTempFileName.c_str())); return NULL; } m_pXMLFile = CCore::GetSingleton().GetXML()->CreateXML(m_strTempFileName); if (!m_pXMLFile) { - AddReportLog(2502, SString("CXMLBuffer::SetFromBuffer: Could not CreateXML %s", m_strTempFileName.c_str())); + AddReportLog(ReportLogID::VER_UPD_XML_CREATE_FAIL, SString("CXMLBuffer::SetFromBuffer: Could not CreateXML %s", m_strTempFileName.c_str())); return NULL; } if (!m_pXMLFile->Parse()) { - AddReportLog(2503, SString("CXMLBuffer::SetFromBuffer: Could not parse %s", m_strTempFileName.c_str())); + AddReportLog(ReportLogID::VER_UPD_XML_PARSE_FAIL, SString("CXMLBuffer::SetFromBuffer: Could not parse %s", m_strTempFileName.c_str())); return NULL; } m_pRoot = m_pXMLFile->GetRootNode(); if (!m_pRoot) { - AddReportLog(2504, SString("CXMLBuffer::SetFromBuffer: No root node in %s", m_strTempFileName.c_str())); + AddReportLog(ReportLogID::VER_UPD_XML_MISSING_ROOT, SString("CXMLBuffer::SetFromBuffer: No root node in %s", m_strTempFileName.c_str())); return NULL; } diff --git a/Client/core/CVersionUpdater.cpp b/Client/core/CVersionUpdater.cpp index bec0ec6dda3..0ef9bcb7d6c 100644 --- a/Client/core/CVersionUpdater.cpp +++ b/Client/core/CVersionUpdater.cpp @@ -805,8 +805,8 @@ SString CVersionUpdater::GetResumableSaveLocation(const SString& strFilename, co const SString strSaveLocation = *iter; if (FileExists(strSaveLocation) && FileAppend(strSaveLocation, "") && FileSize(strSaveLocation) < iFilesize) { - AddReportLog( - 5008, SString("GetResumableSaveLocation: Will resume download at %d/%d for %s", (int)FileSize(strSaveLocation), iFilesize, *strSaveLocation)); + AddReportLog(ReportLogID::VER_UPD_RESUMABLE_EXISTS, SString("GetResumableSaveLocation: Will resume download at %d/%d for %s", + (int)FileSize(strSaveLocation), iFilesize, *strSaveLocation)); return strSaveLocation; } } @@ -820,7 +820,7 @@ SString CVersionUpdater::GetResumableSaveLocation(const SString& strFilename, co if (FileSave(strSaveLocation, "")) { FileDelete(strSaveLocation); - AddReportLog(5009, SString("GetResumableSaveLocation: New download of %d for %s", iFilesize, *strSaveLocation)); + AddReportLog(ReportLogID::VER_UPD_RESUMABLE_NEW, SString("GetResumableSaveLocation: New download of %d for %s", iFilesize, *strSaveLocation)); return strSaveLocation; } } @@ -2344,7 +2344,7 @@ void CVersionUpdater::_ProcessPatchFileQuery() SString playerVersion("%d.%d.%d-%d.%05d.%d.%03d", MTASA_VERSION_MAJOR, MTASA_VERSION_MINOR, MTASA_VERSION_MAINTENANCE, MTASA_VERSION_TYPE, MTASA_VERSION_BUILD, netRev, netRel); - AddReportLog(5061, SString("Processing patch file '%s' [%s, %s] with '%s' (version: %s) from '%s'", m_JobInfo.strFilename.c_str(), + AddReportLog(ReportLogID::VER_UPD_RESPONSE, SString("Processing patch file '%s' [%s, %s] with '%s' (version: %s) from '%s'", m_JobInfo.strFilename.c_str(), m_JobInfo.iFilesize.ToString().c_str(), m_JobInfo.strMD5.c_str(), m_JobInfo.strStatus.c_str(), playerVersion.c_str(), m_strLastQueryURL.c_str())); } @@ -2581,7 +2581,7 @@ void CVersionUpdater::_ProcessPatchFileDownload() if (m_JobInfo.serverList.size()) ListRemoveIndex(m_JobInfo.serverList, m_JobInfo.iCurrent--); m_ConditionMap.SetCondition("Download", "Fail", "Checksum"); - AddReportLog(5003, SString("DoPollDownload: Checksum wrong for %s (Want:%d-%s Got:%d-%s)", m_JobInfo.strFilename.c_str(), (int)m_JobInfo.iFilesize, + AddReportLog(ReportLogID::VER_UPD_POLLDOWNLOAD_CHECKSUM_FAIL, SString("DoPollDownload: Checksum wrong for %s (Want:%d-%s Got:%d-%s)", m_JobInfo.strFilename.c_str(), (int)m_JobInfo.iFilesize, m_JobInfo.strMD5.c_str(), uiSize, szMD5)); return; } @@ -2590,7 +2590,7 @@ void CVersionUpdater::_ProcessPatchFileDownload() // Check signature if (!CCore::GetSingleton().GetNetwork()->VerifySignature(pData, uiSize)) { - AddReportLog(5006, SString("DoPollDownload: Signature wrong for %s (MD5: %s)", m_JobInfo.strFilename.c_str(), m_JobInfo.strMD5.c_str())); + AddReportLog(ReportLogID::VER_UPD_POLLDOWNLOAD_SIGNATURE_FAIL, SString("DoPollDownload: Signature wrong for %s (MD5: %s)", m_JobInfo.strFilename.c_str(), m_JobInfo.strMD5.c_str())); m_ConditionMap.SetCondition("Download", "Fail", "Checksum"); return; } @@ -2614,7 +2614,7 @@ void CVersionUpdater::_ProcessPatchFileDownload() break; } - AddReportLog(5004, SString("DoPollDownload: Unable to use the path %s", strSaveLocation.c_str())); + AddReportLog(ReportLogID::VER_UPD_POLLDOWNLOAD_PATH_FAIL, SString("DoPollDownload: Unable to use the path %s", strSaveLocation.c_str())); } } @@ -2623,14 +2623,14 @@ void CVersionUpdater::_ProcessPatchFileDownload() if (m_JobInfo.serverList.size()) ListRemoveIndex(m_JobInfo.serverList, m_JobInfo.iCurrent--); m_ConditionMap.SetCondition("Download", "Fail", "Saving"); - AddReportLog(5005, SString("DoPollDownload: Unable to save the file %s (size %d)", m_JobInfo.strFilename.c_str(), uiSize)); + AddReportLog(ReportLogID::VER_UPD_POLLDOWNLOAD_SAVE_FAIL, SString("DoPollDownload: Unable to save the file %s (size %d)", m_JobInfo.strFilename.c_str(), uiSize)); return; } //////////////////////// m_JobInfo.strSaveLocation = strPathFilename; m_ConditionMap.SetCondition("Download", "Ok"); - AddReportLog(2007, SString("DoPollDownload: Downloaded %s", m_JobInfo.strSaveLocation.c_str())); + AddReportLog(ReportLogID::VER_UPD_POLLDOWNLOAD_SUCCESS, SString("DoPollDownload: Downloaded %s", m_JobInfo.strSaveLocation.c_str())); } /////////////////////////////////////////////////////////////// @@ -2678,14 +2678,14 @@ void CVersionUpdater::_StartDownload() CMD5Hasher::ConvertToHex(md5Result, szMD5); if (m_JobInfo.strMD5 != szMD5) { - AddReportLog(5807, SString("StartDownload: Cached file reuse - Size correct, but md5 did not match (%s)", *strPathFilename)); + AddReportLog(ReportLogID::VER_UPD_STARTDOWNLOAD_CHECKSUM_FAIL, SString("StartDownload: Cached file reuse - Size correct, but md5 did not match (%s)", *strPathFilename)); continue; } // Check signature if (!CCore::GetSingleton().GetNetwork()->VerifySignature(buffer.GetData(), buffer.GetSize())) { - AddReportLog(5808, SString("StartDownload: Cached file reuse - Size and md5 correct, but signature incorrect (%s)", *strPathFilename)); + AddReportLog(ReportLogID::VER_UPD_STARTDOWNLOAD_SIGNATURE_FAIL, SString("StartDownload: Cached file reuse - Size and md5 correct, but signature incorrect (%s)", *strPathFilename)); continue; } @@ -2693,7 +2693,7 @@ void CVersionUpdater::_StartDownload() m_JobInfo.strSaveLocation = strPathFilename; m_ConditionMap.SetCondition("ProcessResponse", ""); m_ConditionMap.SetCondition("Download", "Ok"); - AddReportLog(5809, SString("StartDownload: Cached file reuse - Size, md5 and signature correct (%s)", *strPathFilename)); + AddReportLog(ReportLogID::VER_UPD_STARTDOWNLOAD_SUCCESS, SString("StartDownload: Cached file reuse - Size, md5 and signature correct (%s)", *strPathFilename)); return; } } @@ -3332,7 +3332,7 @@ int CVersionUpdater::DoPollDownload() if ((m_JobInfo.downloadStatus == EDownloadStatus::Failure) || m_JobInfo.iIdleTimeLeft < 0) { GetHTTP()->Reset(); - AddReportLog(4002, SString("DoPollDownload: Regular fail for %s (status:%u time:%u)", m_strLastQueryURL.c_str(), m_JobInfo.iDownloadResultCode, + AddReportLog(ReportLogID::VER_UPD_POLLDOWNLOAD_FAIL, SString("DoPollDownload: Regular fail for %s (status:%u time:%u)", m_strLastQueryURL.c_str(), m_JobInfo.iDownloadResultCode, m_JobInfo.iIdleTime)); m_ConditionMap.SetCondition("Download", "Fail"); @@ -3352,12 +3352,12 @@ int CVersionUpdater::DoPollDownload() if (!m_JobInfo.downloadBuffer.empty()) { m_ConditionMap.SetCondition("Download", "Ok"); - AddReportLog(2005, SString("DoPollDownload: Downloaded %d bytes from %s", m_JobInfo.downloadBuffer.size(), m_strLastQueryURL.c_str())); + AddReportLog(ReportLogID::VER_UPD_POLLDOWNLOAD_RESPONSE, SString("DoPollDownload: Downloaded %d bytes from %s", m_JobInfo.downloadBuffer.size(), m_strLastQueryURL.c_str())); return RES_OK; } m_ConditionMap.SetCondition("Download", "Fail"); - AddReportLog(5007, SString("DoPollDownload: Fail for %s", m_strLastQueryURL.c_str())); + AddReportLog(ReportLogID::VER_UPD_POLLDOWNLOAD_URL_FAIL, SString("DoPollDownload: Fail for %s", m_strLastQueryURL.c_str())); return RES_FAIL; } diff --git a/Client/core/Core.cpp b/Client/core/Core.cpp index ef4e4677689..6ac96450156 100644 --- a/Client/core/Core.cpp +++ b/Client/core/Core.cpp @@ -49,7 +49,7 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, LPVOID) if (g_pCore) { - AddReportLog(7102, "Core - PROCESS_DETACH"); + AddReportLog(ReportLogID::CORE_PROCESS_DETACH, "Core - PROCESS_DETACH"); delete g_pCore; g_pCore = nullptr; diff --git a/Client/core/DXHook/CDirect3DEvents9.cpp b/Client/core/DXHook/CDirect3DEvents9.cpp index 9406cfcefb5..71bd8872f39 100644 --- a/Client/core/DXHook/CDirect3DEvents9.cpp +++ b/Client/core/DXHook/CDirect3DEvents9.cpp @@ -718,7 +718,7 @@ HRESULT CDirect3DEvents9::CreateVertexBuffer(IDirect3DDevice9* pDevice, UINT Len { SString strMessage("CreateVertexBuffer fail: hr:%x Length:%x Usage:%x FVF:%x Pool:%x", hr, Length, Usage, FVF, Pool); WriteDebugEvent(strMessage); - AddReportLog(8610, strMessage); + AddReportLog(ReportLogID::D3D_VERTEXBUFFER_FAIL, strMessage); CCore::GetSingleton().LogEvent(610, "CreateVertexBuffer", "", strMessage); return hr; } @@ -753,7 +753,7 @@ HRESULT CDirect3DEvents9::CreateIndexBuffer(IDirect3DDevice9* pDevice, UINT Leng { SString strMessage("CreateIndexBuffer fail: hr:%x Length:%x Usage:%x Format:%x Pool:%x", hr, Length, Usage, Format, Pool); WriteDebugEvent(strMessage); - AddReportLog(8611, strMessage); + AddReportLog(ReportLogID::D3D_INDEXBUFFER_FAIL, strMessage); CCore::GetSingleton().LogEvent(611, "CreateIndexBuffer", "", strMessage); return hr; } @@ -788,7 +788,7 @@ HRESULT CDirect3DEvents9::CreateTexture(IDirect3DDevice9* pDevice, UINT Width, U { SString strMessage("CreateTexture fail: hr:%x W:%x H:%x L:%x Usage:%x Format:%x Pool:%x", hr, Width, Height, Levels, Usage, Format, Pool); WriteDebugEvent(strMessage); - AddReportLog(8612, strMessage); + AddReportLog(ReportLogID::D3D_TEXTURE_FAIL, strMessage); CCore::GetSingleton().LogEvent(612, "CreateTexture", "", strMessage); return hr; } @@ -895,7 +895,7 @@ HRESULT CDirect3DEvents9::CreateVertexDeclaration(IDirect3DDevice9* pDevice, CON SString strMessage("CreateVertexDecl fail: hr:%x %s", hr, *strStatus); WriteDebugEvent(strMessage); - AddReportLog(8613, strMessage); + AddReportLog(ReportLogID::D3D_VERTEXDECL_FAIL, strMessage); CCore::GetSingleton().LogEvent(613, "CreateVertexDecl", "", strMessage); return hr; } diff --git a/Client/core/DXHook/CDirect3DHook9.cpp b/Client/core/DXHook/CDirect3DHook9.cpp index 21b0c86c2f7..10d3fbc2980 100644 --- a/Client/core/DXHook/CDirect3DHook9.cpp +++ b/Client/core/DXHook/CDirect3DHook9.cpp @@ -103,7 +103,7 @@ IDirect3D9* CDirect3DHook9::API_Direct3DCreate9(UINT SDKVersion) SString strMessage("D3DXCheckVersion FAILED (D3D_SDK_VERSION: %d D3DX_SDK_VERSION: %d SDKVersion: %d)", D3D_SDK_VERSION, D3DX_SDK_VERSION, SDKVersion); WriteDebugEvent(strMessage); - AddReportLog(9640, strMessage); + AddReportLog(ReportLogID::D3D_VERSION_FAIL, strMessage); } else { diff --git a/Client/core/DXHook/CProxyDirect3D9.cpp b/Client/core/DXHook/CProxyDirect3D9.cpp index 609f49e8ac5..a5177d3a22c 100644 --- a/Client/core/DXHook/CProxyDirect3D9.cpp +++ b/Client/core/DXHook/CProxyDirect3D9.cpp @@ -708,7 +708,7 @@ bool CreateDeviceSecondCallCheck(HRESULT& hOutResult, IDirect3D9* pDirect3D, UIN { SString strMessage(" Passing through call #%d to CreateDevice because not main thread", uiCreateCount); WriteDebugEvent(strMessage); - AddReportLog(8627, strMessage); + AddReportLog(ReportLogID::D3D_CREATEDEVICE_OTHER_THREAD, strMessage); return true; } diff --git a/Client/core/DXHook/CProxyDirect3DIndexBuffer.cpp b/Client/core/DXHook/CProxyDirect3DIndexBuffer.cpp index 63f00124327..bc6721d8124 100644 --- a/Client/core/DXHook/CProxyDirect3DIndexBuffer.cpp +++ b/Client/core/DXHook/CProxyDirect3DIndexBuffer.cpp @@ -111,7 +111,7 @@ HRESULT CProxyDirect3DIndexBuffer::Lock(UINT OffsetToLock, UINT SizeToLock, void SString strMessage("Lock IndexBuffer fail: hr:%x Length:%x Usage:%x Format:%x Pool:%x OffsetToLock:%x SizeToLock:%x Flags:%x", hr, m_iMemUsed, m_dwUsage, m_format, m_pool, OffsetToLock, SizeToLock, Flags); WriteDebugEvent(strMessage); - AddReportLog(8625, strMessage); + AddReportLog(ReportLogID::D3D_LOCK_INDEXBUFFER_FAIL, strMessage); CCore::GetSingleton().LogEvent(625, "Lock IndexBuffer", "", strMessage); } else if (*ppbData == NULL) @@ -119,7 +119,7 @@ HRESULT CProxyDirect3DIndexBuffer::Lock(UINT OffsetToLock, UINT SizeToLock, void SString strMessage("Lock IndexBuffer result NULL: hr:%x Length:%x Usage:%x Format:%x Pool:%x OffsetToLock:%x SizeToLock:%x Flags:%x", hr, m_iMemUsed, m_dwUsage, m_format, m_pool, OffsetToLock, SizeToLock, Flags); WriteDebugEvent(strMessage); - AddReportLog(8626, strMessage); + AddReportLog(ReportLogID::D3D_LOCK_INDEXBUFFER_NULL, strMessage); CCore::GetSingleton().LogEvent(626, "Lock IndexBuffer NULL", "", strMessage); } return hr; diff --git a/Client/core/DXHook/CProxyDirect3DVertexBuffer.cpp b/Client/core/DXHook/CProxyDirect3DVertexBuffer.cpp index 93d6b7deac5..3367c3948b0 100644 --- a/Client/core/DXHook/CProxyDirect3DVertexBuffer.cpp +++ b/Client/core/DXHook/CProxyDirect3DVertexBuffer.cpp @@ -123,17 +123,17 @@ HRESULT CProxyDirect3DVertexBuffer::Lock(UINT OffsetToLock, UINT SizeToLock, voi struct { const char* szText; - uint uiReportId; + ReportLogID uiReportId; uint uiLogEventId; } info; if (hr == D3D_OK) - info = {"result NULL", 8621, 621}; + info = {"result NULL", ReportLogID::D3D_LOCK_VERTEXBUFFER_NULL, 621}; else if (hr == STATUS_ARRAY_BOUNDS_EXCEEDED) - info = {"offset out of range", 8622, 622}; + info = {"offset out of range", ReportLogID::D3D_LOCK_VERTEXBUFFER_OOR, 622}; else if (hr == STATUS_ACCESS_VIOLATION) - info = {"access violation", 8623, 623}; + info = {"access violation", ReportLogID::D3D_LOCK_VERTEXBUFFER_AV, 623}; else - info = {"fail", 8620, 620}; + info = {"fail", ReportLogID::D3D_LOCK_VERTEXBUFFER_FAIL, 620}; SString strMessage("Lock VertexBuffer [%s] hr:%x Length:%x Usage:%x FVF:%x Pool:%x OffsetToLock:%x SizeToLock:%x Flags:%x", info.szText, hr, m_iMemUsed, m_dwUsage, m_dwFVF, m_pool, OffsetToLock, SizeToLock, Flags); diff --git a/Client/core/Graphics/CGraphics.cpp b/Client/core/Graphics/CGraphics.cpp index 9eb705f6f2f..c92232e19db 100644 --- a/Client/core/Graphics/CGraphics.cpp +++ b/Client/core/Graphics/CGraphics.cpp @@ -1378,7 +1378,7 @@ bool CGraphics::LoadStandardDXFonts() { SString strFileMd5 = GenerateHashHexStringFromFile(EHashFunctionType::MD5, strPathFilename); uint uiFileSize = (uint)FileSize(strPathFilename); - AddReportLog(9442, SString("Problem with AddFontResourceEx [MD5:%s Size:%d] %s ", *strFileMd5, uiFileSize, *strPathFilename)); + AddReportLog(ReportLogID::GRAPHICS_FONTRESOURCE_EX_FAIL, SString("Problem with AddFontResourceEx [MD5:%s Size:%d] %s ", *strFileMd5, uiFileSize, *strPathFilename)); if (!FileExists(strPathFilename)) { BrowseToSolution("mta-datafiles-missing", EXIT_GAME_FIRST | ASK_GO_ONLINE, "Error loading MTA font " + m_FontResourceNames[i]); diff --git a/Client/core/Graphics/CRenderItem.EffectCloner.cpp b/Client/core/Graphics/CRenderItem.EffectCloner.cpp index f2817f929a6..7ab17fa3a8a 100644 --- a/Client/core/Graphics/CRenderItem.EffectCloner.cpp +++ b/Client/core/Graphics/CRenderItem.EffectCloner.cpp @@ -85,7 +85,7 @@ CEffectWrap* CEffectCloner::CreateD3DEffect(const SString& strFile, const SStrin { strReport += SString("[effects cur:%d created:%d dest:%d]", g_pDeviceState->MemoryState.Effect.iCurrentCount, g_pDeviceState->MemoryState.Effect.iCreatedCount, g_pDeviceState->MemoryState.Effect.iDestroyedCount); - AddReportLog(7544, SString("NewEffectTemplate (call:%d) %s %s", uiCallCount, *strReport, *strFile)); + AddReportLog(ReportLogID::D3D_EFFECT_TEMPLATE_CREATED, SString("NewEffectTemplate (call:%d) %s %s", uiCallCount, *strReport, *strFile)); } if (!pEffectTemplate) return NULL; diff --git a/Client/core/Graphics/CVideoModeManager.cpp b/Client/core/Graphics/CVideoModeManager.cpp index 15b231d7076..1aafead2865 100644 --- a/Client/core/Graphics/CVideoModeManager.cpp +++ b/Client/core/Graphics/CVideoModeManager.cpp @@ -349,14 +349,14 @@ void CVideoModeManager::OnLoseFocus() SString deviceName = GetCurrentAdapterDeviceName(); if (!EnumDisplaySettingsA(deviceName.c_str(), ENUM_REGISTRY_SETTINGS, &dmScreenSettings)) { - AddReportLog(7340, SString("EnumDisplaySettings failed for %s", deviceName.c_str())); + AddReportLog(ReportLogID::VIDEO_ENUMSETTINGS_FAIL, SString("EnumDisplaySettings failed for %s", deviceName.c_str())); return; } int iChangeResult = ChangeDisplaySettingsExA(deviceName.c_str(), &dmScreenSettings, nullptr, CDS_RESET, nullptr); if (iChangeResult != DISP_CHANGE_SUCCESSFUL) { - AddReportLog(7341, SString("ChangeDisplaySettingsEx failed for %s (%d)", deviceName.c_str(), iChangeResult)); + AddReportLog(ReportLogID::VIDEO_DISPLAYSETTINGS_FAIL, SString("ChangeDisplaySettingsEx failed for %s (%d)", deviceName.c_str(), iChangeResult)); return; } } diff --git a/Client/game_sa/CAnimBlendAssocGroupSA.cpp b/Client/game_sa/CAnimBlendAssocGroupSA.cpp index e8e5af7bedd..796994e9f30 100644 --- a/Client/game_sa/CAnimBlendAssocGroupSA.cpp +++ b/Client/game_sa/CAnimBlendAssocGroupSA.cpp @@ -106,7 +106,7 @@ eAnimGroup CAnimBlendAssocGroupSA::GetGroupID() { if ((DWORD)m_pInterface < 0x250) { - g_pCore->LogEvent(543, "CAnimBlendAssocGroupSA::GetGroupID", "Incorrect Group Interface", SString("pAnimAssocGroupInterface = %p", m_pInterface), 543); + g_pCore->LogEvent(543, "CAnimBlendAssocGroupSA::GetGroupID", "Incorrect Group Interface", SString("pAnimAssocGroupInterface = %p", m_pInterface), ReportLogID::INVALID_ANIM_ASSOC_GROUP_INTERFACE); } return static_cast(m_pInterface->groupID); }; diff --git a/Client/game_sa/CModelInfoSA.cpp b/Client/game_sa/CModelInfoSA.cpp index b06d2a9a789..b508efc8b79 100644 --- a/Client/game_sa/CModelInfoSA.cpp +++ b/Client/game_sa/CModelInfoSA.cpp @@ -407,13 +407,13 @@ void CModelInfoSA::Request(EModelRequestType requestType, const char* szTag) } if (!IsLoaded()) { - AddReportLog(6641, SString("Blocking load fail: %d (%s)", m_dwModelID, szTag)); + AddReportLog(ReportLogID::MODEL_INFO_LOAD_FAIL, SString("Blocking load fail: %d (%s)", m_dwModelID, szTag)); LogEvent(641, "Blocking load fail", "", SString("%d (%s)", m_dwModelID, szTag)); dassert(0); } else { - AddReportLog(6642, SString("Blocking load: %d (%s) (Took %d attempts)", m_dwModelID, szTag, iCount)); + AddReportLog(ReportLogID::MODEL_INFO_LOAD_SUCCESS, SString("Blocking load: %d (%s) (Took %d attempts)", m_dwModelID, szTag, iCount)); LogEvent(642, "Blocking load", "", SString("%d (%s) (Took %d attempts)", m_dwModelID, szTag, iCount)); } } diff --git a/Client/game_sa/CRenderWareSA.TxdRightSizing.cpp b/Client/game_sa/CRenderWareSA.TxdRightSizing.cpp index a44da2050bf..2e4d964f0ba 100644 --- a/Client/game_sa/CRenderWareSA.TxdRightSizing.cpp +++ b/Client/game_sa/CRenderWareSA.TxdRightSizing.cpp @@ -84,7 +84,7 @@ bool CRenderWareSA::RightSizeTxd(const SString& strInTxdFilename, const SString& // Log last error if (!strError.empty()) { - AddReportLog(8430, SString("RightSizeTxd problem %s with '%s'", *strError, *strInTxdFilename), 10); + AddReportLog(ReportLogID::TXD_RIGHTSIZE_ERROR, SString("RightSizeTxd problem %s with '%s'", *strError, *strInTxdFilename), 10); } // diff --git a/Client/game_sa/CRenderWareSA.cpp b/Client/game_sa/CRenderWareSA.cpp index 26d543ef2bf..41f6d8051a6 100644 --- a/Client/game_sa/CRenderWareSA.cpp +++ b/Client/game_sa/CRenderWareSA.cpp @@ -432,7 +432,7 @@ bool CRenderWareSA::ReplacePedModel(RpClump* pNew, unsigned short usModelID) // otherwise it will crash (offset 0x3c51a8). if (!GetAnimHierarchyFromClump(pNew)) { - LogEvent(851, "Model not replaced", "CRenderWareSA::ReplacePedModel", SString("No anim hierarchy for ped model:%d", usModelID), 5421); + LogEvent(851, "Model not replaced", "CRenderWareSA::ReplacePedModel", SString("No anim hierarchy for ped model:%d", usModelID), ReportLogID::PED_NO_ANIM_HIERARCHY); return false; } diff --git a/Client/game_sa/gamesa_init.cpp b/Client/game_sa/gamesa_init.cpp index f071433a349..bb03a34fbeb 100644 --- a/Client/game_sa/gamesa_init.cpp +++ b/Client/game_sa/gamesa_init.cpp @@ -64,7 +64,7 @@ bool GetDebugIdEnabled(uint uiDebugId) return g_pCore->GetDebugIdEnabled(uiDebugId); } -void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, uint uiAddReportLogId) +void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, ReportLogID addReportLogId) { - g_pCore->LogEvent(uiDebugId, szType, szContext, szBody, uiAddReportLogId); + g_pCore->LogEvent(uiDebugId, szType, szContext, szBody, addReportLogId); } diff --git a/Client/game_sa/gamesa_init.h b/Client/game_sa/gamesa_init.h index be6e94773a5..1d1f42b8133 100644 --- a/Client/game_sa/gamesa_init.h +++ b/Client/game_sa/gamesa_init.h @@ -103,4 +103,4 @@ void MemOrFast(U ptr, const T value) } bool GetDebugIdEnabled(uint uiDebugId); -void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, uint uiAddReportLogId = 0); +void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, ReportLogID addReportLogId = ReportLogID::NONE); diff --git a/Client/launch/Main.cpp b/Client/launch/Main.cpp index 57ad6b5d4fb..1af7066a7dd 100644 --- a/Client/launch/Main.cpp +++ b/Client/launch/Main.cpp @@ -146,16 +146,6 @@ namespace SecurityConstants #endif constexpr size_t STACK_ALLOC_LIMIT = 65536U; // Stack allocation limit - - // Report log codes - constexpr UINT REPORT_CODE_INVALID_PATH = 5716U; - constexpr UINT REPORT_CODE_FILE_NOT_EXIST = 5717U; - constexpr UINT REPORT_CODE_INVALID_SIGNATURE = 5718U; - constexpr UINT REPORT_CODE_LOAD_FAILED = 5719U; - constexpr UINT REPORT_CODE_ELEVATED_PRIVILEGE = 5750U; - constexpr UINT REPORT_CODE_LOAD_ERROR = 5711U; - constexpr UINT REPORT_CODE_MISSING_EXPORT = 5714U; - constexpr UINT REPORT_CODE_EXCEPTION = 5751U; } // namespace SecurityConstants // Critical section for thread safety @@ -670,14 +660,14 @@ namespace Security if (!IsValidPath(strDllPath) || !IsValidDllName(strDllName)) { SString strError = "SecureLoadLibrary: Invalid path or DLL name"; - AddReportLog(SecurityConstants::REPORT_CODE_INVALID_PATH, strError); + AddReportLog(ReportLogID::LOADER_INVALID_DLL_PATH, strError); return nullptr; } if (!FileExists(strDllPath)) { SString strError = "SecureLoadLibrary: DLL file does not exist"; - AddReportLog(SecurityConstants::REPORT_CODE_FILE_NOT_EXIST, strError); + AddReportLog(ReportLogID::LOADER_DLL_NOT_EXISTS, strError); return nullptr; } @@ -685,7 +675,7 @@ namespace Security if (!VerifyFileSignature(strDllPath)) { SString strError = "SecureLoadLibrary: Invalid or missing digital signature"; - AddReportLog(SecurityConstants::REPORT_CODE_INVALID_SIGNATURE, strError); + AddReportLog(ReportLogID::LOADER_DLL_INVALID_SIGNATURE, strError); return nullptr; } @@ -732,7 +722,7 @@ namespace Security SString strError; if (!strError.Format("SecureLoadLibrary: LoadLibrary failed with error %lu", dwError).empty()) { - AddReportLog(SecurityConstants::REPORT_CODE_LOAD_FAILED, strError); + AddReportLog(ReportLogID::LOADER_LOADLIBRARY_FAIL, strError); } } @@ -761,7 +751,7 @@ namespace Security if (bIsElevated) { SString strWarning = "Warning: Running with elevated privileges"; - AddReportLog(SecurityConstants::REPORT_CODE_ELEVATED_PRIVILEGE, strWarning); + AddReportLog(ReportLogID::LOADER_ELEVATED_PRIVILEGE, strWarning); } } @@ -974,7 +964,7 @@ int WINAPI WinMain(HINSTANCE hInstance, [[maybe_unused]] HINSTANCE hPrevInstance strMessage = "Install Windows Update KB2533623 for improved security"; } - AddReportLog(SecurityConstants::REPORT_CODE_LOAD_ERROR, strMessage); + AddReportLog(ReportLogID::LOADER_MODULE_LOAD_FAIL, strMessage); BrowseToSolution("loader-dll-not-loadable", ASK_GO_ONLINE, strMessage); Security::CleanupSecurity(); return 1; @@ -1001,7 +991,7 @@ int WINAPI WinMain(HINSTANCE hInstance, [[maybe_unused]] HINSTANCE hPrevInstance if (iResult == -1) { SString strError = "Exception in DoWinMain"; - AddReportLog(SecurityConstants::REPORT_CODE_EXCEPTION, strError); + AddReportLog(ReportLogID::LOADER_EXCEPTION, strError); iReturnCode = 1; } else @@ -1019,7 +1009,7 @@ int WINAPI WinMain(HINSTANCE hInstance, [[maybe_unused]] HINSTANCE hPrevInstance else { SString strError = "Failed to find DoWinMain in loader DLL"; - AddReportLog(SecurityConstants::REPORT_CODE_MISSING_EXPORT, strError); + AddReportLog(ReportLogID::LOADER_MODULE_MAIN_FAIL, strError); BrowseToSolution("loader-dll-missing-export", ASK_GO_ONLINE, strError); iReturnCode = 1; } diff --git a/Client/loader-proxy/main.cpp b/Client/loader-proxy/main.cpp index 393cc895c6c..99c75cd9c35 100644 --- a/Client/loader-proxy/main.cpp +++ b/Client/loader-proxy/main.cpp @@ -734,7 +734,7 @@ void AddLaunchLog(const char* format, ...) message.vFormat(format, arguments); va_end(arguments); - AddReportLog(5720, message); + AddReportLog(ReportLogID::LOADER_PROXY_LAUNCH_LOG, message); } /** diff --git a/Client/loader/CInstallManager.cpp b/Client/loader/CInstallManager.cpp index 9833479984a..c3f9af3557a 100644 --- a/Client/loader/CInstallManager.cpp +++ b/Client/loader/CInstallManager.cpp @@ -257,7 +257,7 @@ SString CInstallManager::Continue() // Initial report line DWORD dwProcessId = GetCurrentProcessId(); SString GotPathFrom = (m_pSequencer->GetVariable(INSTALL_LOCATION) == "far") ? "registry" : "module location"; - AddReportLog(1041, SString("* Launch * pid:%d '%s' MTASAPath set from %s '%s'", dwProcessId, GetLaunchPathFilename().c_str(), GotPathFrom.c_str(), + AddReportLog(ReportLogID::INSTALL_MGR_LAUNCH, SString("* Launch * pid:%d '%s' MTASAPath set from %s '%s'", dwProcessId, GetLaunchPathFilename().c_str(), GotPathFrom.c_str(), GetMTASAPath().c_str())); // Run sequencer @@ -272,7 +272,7 @@ SString CInstallManager::Continue() for (int i = 0; i < m_pSequencer->GetVariableInt("_argc"); i++) strCommandLineOut += m_pSequencer->GetVariable(SString("_arg_%d", i)) + " "; - AddReportLog(1060, SString("CInstallManager::Continue - return %s", *strCommandLineOut)); + AddReportLog(ReportLogID::INSTALL_MGR_LAUNCH_FINISH, SString("CInstallManager::Continue - return %s", *strCommandLineOut)); return *strCommandLineOut.TrimEnd(" "); } @@ -285,7 +285,7 @@ SString CInstallManager::Continue() ////////////////////////////////////////////////////////// void CInstallManager::RestoreSequencerFromSnapshot(const SString& strText) { - AddReportLog(1061, SString("CInstallManager::RestoreSequencerState %s", *strText)); + AddReportLog(ReportLogID::INSTALL_MGR_SEQ_STATE, SString("CInstallManager::RestoreSequencerState %s", *strText)); std::vector parts; strText.Split(" ", parts); @@ -338,7 +338,7 @@ SString CInstallManager::GetLauncherPathFilename() { SString strLocation = m_pSequencer->GetVariable(INSTALL_LOCATION); SString strResult = PathJoin(strLocation == "far" ? GetSystemCurrentDirectory() : GetMTASAPath(), MTA_EXE_NAME); - AddReportLog(1062, SString("GetLauncherPathFilename %s", *strResult)); + AddReportLog(ReportLogID::INSTALL_MGR_GET_PATH, SString("GetLauncherPathFilename %s", *strResult)); return strResult; } @@ -392,7 +392,7 @@ SString CInstallManager::_ChangeFromAdmin() if (IsUserAdmin() && IsBlockingUserProcess()) { SendStringToUserProcess(GetSequencerSnapshot()); - AddReportLog(1003, SString("CInstallManager::_ChangeToAdmin - exit(0) %s", "")); + AddReportLog(ReportLogID::INSTALL_MGR_CHANGEFROMADMIN, SString("CInstallManager::_ChangeToAdmin - exit(0) %s", "")); ClearIsBlockingUserProcess(); ExitProcess(0); } @@ -471,7 +471,7 @@ SString CInstallManager::_CheckOnRestartCommand() } else if (!strResult.Contains("no update")) { - AddReportLog(4047, SString("_CheckOnRestartCommand: CheckOnRestartCommand returned %s", strResult.c_str())); + AddReportLog(ReportLogID::ON_RESTART_CMD_RESULT, SString("_CheckOnRestartCommand: CheckOnRestartCommand returned %s", strResult.c_str())); } return "no_action"; @@ -536,9 +536,9 @@ SString CInstallManager::_InstallFiles() if (!InstallFiles(m_pSequencer->GetVariable(HIDE_PROGRESS) != "yes")) { if (!IsUserAdmin()) - AddReportLog(3048, SString("_InstallFiles: Install - trying as admin %s", "")); + AddReportLog(ReportLogID::INSTALL_MGR_AS_ADMIN, SString("_InstallFiles: Install - trying as admin %s", "")); else - AddReportLog(5049, SString("_InstallFiles: Couldn't install files %s", "")); + AddReportLog(ReportLogID::INSTALL_MGR_FAIL, SString("_InstallFiles: Couldn't install files %s", "")); m_strAdminReason = _("Install updated MTA:SA files"); return "fail"; @@ -546,7 +546,7 @@ SString CInstallManager::_InstallFiles() else { UpdateMTAVersionApplicationSetting(); - AddReportLog(2050, SString("_InstallFiles: ok %s", "")); + AddReportLog(ReportLogID::INSTALL_MGR_INSTALL_SUCCESS, SString("_InstallFiles: ok %s", "")); return "ok"; } } @@ -639,7 +639,7 @@ SString CInstallManager::_PrepareLaunchLocation() { const uintmax_t sourceSize = GetFileSize(sourcePath); const uintmax_t targetSize = GetFileSize(targetPath); - AddReportLog(3052, SString("_PrepareLaunchLocation: Copying '%s' failed (err: %d, size: %ju <=> %ju, admin: %d)", fileName, ec.value(), + AddReportLog(ReportLogID::INSTALL_MGR_GTA_DLL, SString("_PrepareLaunchLocation: Copying '%s' failed (err: %d, size: %ju <=> %ju, admin: %d)", fileName, ec.value(), sourceSize, targetSize, isAdmin)); } } @@ -657,7 +657,7 @@ SString CInstallManager::_PrepareLaunchLocation() { const uintmax_t sourceSize = GetFileSize(sourcePath); const uintmax_t targetSize = GetFileSize(targetPath); - AddReportLog(3052, SString("_PrepareLaunchLocation: Copying '%s' failed (err: %d, size: %ju <=> %ju, admin: %d)", fileName, ec.value(), + AddReportLog(ReportLogID::INSTALL_MGR_GTA_DLL, SString("_PrepareLaunchLocation: Copying '%s' failed (err: %d, size: %ju <=> %ju, admin: %d)", fileName, ec.value(), sourceSize, targetSize, isAdmin)); } @@ -775,7 +775,7 @@ SString CInstallManager::_ProcessGtaDllCheck() if (IsErrorCodeLoggable(ec1) || IsErrorCodeLoggable(ec2)) { const uintmax_t fileSize = GetFileSize(dependecyPath); - AddReportLog(3052, SString("_ProcessGtaDllCheck: GenerateFile failed (err-1: %d, err-2: %d, size: %ju, admin: %d)", ec1.value(), ec2.value(), + AddReportLog(ReportLogID::INSTALL_MGR_GTA_DLL, SString("_ProcessGtaDllCheck: GenerateFile failed (err-1: %d, err-2: %d, size: %ju, admin: %d)", ec1.value(), ec2.value(), fileSize, isAdmin)); } @@ -820,7 +820,7 @@ SString CInstallManager::_ProcessGtaVersionCheck() if (IsErrorCodeLoggable(ec)) { const uintmax_t fileSize = GetFileSize(gtaExePath); - AddReportLog(3052, SString("_ProcessGtaVersionCheck: Loading #1 failed (err: %d, size: %ju, admin: %d)", ec.value(), fileSize, isAdmin)); + AddReportLog(ReportLogID::INSTALL_MGR_GTA_DLL, SString("_ProcessGtaVersionCheck: Loading #1 failed (err: %d, size: %ju, admin: %d)", ec.value(), fileSize, isAdmin)); } ec.clear(); @@ -831,7 +831,7 @@ SString CInstallManager::_ProcessGtaVersionCheck() if (IsErrorCodeLoggable(ec)) { const uintmax_t fileSize = GetFileSize(gtaExePath); - AddReportLog(3052, SString("_ProcessGtaVersionCheck: GenerateFile failed (err: %d, size: %ju, admin: %d)", ec.value(), fileSize, isAdmin)); + AddReportLog(ReportLogID::INSTALL_MGR_GTA_DLL, SString("_ProcessGtaVersionCheck: GenerateFile failed (err: %d, size: %ju, admin: %d)", ec.value(), fileSize, isAdmin)); } if (isAdmin) @@ -856,7 +856,7 @@ SString CInstallManager::_ProcessGtaVersionCheck() if (IsErrorCodeLoggable(ec)) { const uintmax_t fileSize = GetFileSize(gtaExePath); - AddReportLog(3052, SString("_ProcessGtaVersionCheck: Loading #2 failed (err: %d, size: %ju, admin: %d)", ec.value(), fileSize, isAdmin)); + AddReportLog(ReportLogID::INSTALL_MGR_GTA_DLL, SString("_ProcessGtaVersionCheck: Loading #2 failed (err: %d, size: %ju, admin: %d)", ec.value(), fileSize, isAdmin)); } if (isAdmin) @@ -879,7 +879,7 @@ SString CInstallManager::_ProcessGtaVersionCheck() if (IsErrorCodeLoggable(ec)) { const uintmax_t fileSize = GetFileSize(gtaExePath); - AddReportLog(3052, SString("_ProcessGtaVersionCheck: ApplyPatches failed (err: %d, size: %ju, admin: %d)", ec.value(), fileSize, isAdmin)); + AddReportLog(ReportLogID::INSTALL_MGR_GTA_DLL, SString("_ProcessGtaVersionCheck: ApplyPatches failed (err: %d, size: %ju, admin: %d)", ec.value(), fileSize, isAdmin)); } if (isAdmin) @@ -1367,11 +1367,11 @@ SString CInstallManager::_InstallNewsItems() if (FileExists(PathJoin(strTargetDir, "files.xml"))) { SetApplicationSettingInt("news-updated", 1); - AddReportLog(2051, SString("InstallNewsItems ok for '%s'", *strDate)); + AddReportLog(ReportLogID::INSTALL_MGR_INSTALL_NEWS_SUCCESS, SString("InstallNewsItems ok for '%s'", *strDate)); } else { - AddReportLog(4048, SString("InstallNewsItems failed with '%s' '%s' '%s'", *strDate, *strFileLocation, *strTargetDir)); + AddReportLog(ReportLogID::INSTALL_MGR_INSTALL_NEWS_FAIL, SString("InstallNewsItems failed with '%s' '%s' '%s'", *strDate, *strFileLocation, *strTargetDir)); } } return "ok"; diff --git a/Client/loader/CSequencer.h b/Client/loader/CSequencer.h index d679a44ad57..c88fdc2f7fe 100644 --- a/Client/loader/CSequencer.h +++ b/Client/loader/CSequencer.h @@ -82,14 +82,14 @@ class CBadLang } // Debug - void Log(const SString& strMessage) { AddReportLog(1071, strMessage); } + void Log(const SString& strMessage) { AddReportLog(ReportLogID::SEQUENCER_LOG, strMessage); } // Functions void AddFunction(const SString& strName, PFNVOIDVOID pfnCmdFunc) { MapSet(m_FunctionMap, strName, pfnCmdFunc); } void CallFunction(const SString& strName) { - AddReportLog(1070, SString("CallFunction: %s", *strName)); + AddReportLog(ReportLogID::SEQUENCER_CALL_FUNC, SString("CallFunction: %s", *strName)); if (PFNVOIDVOID* pfnCmdFunc = MapFind(m_FunctionMap, strName)) SetVariable("LastResult", (m_pOuter->**pfnCmdFunc)()); else diff --git a/Client/loader/D3DStuff.cpp b/Client/loader/D3DStuff.cpp index 988a74d9024..413ecef4bbd 100644 --- a/Client/loader/D3DStuff.cpp +++ b/Client/loader/D3DStuff.cpp @@ -80,7 +80,7 @@ bool NvOptimusDetect() NvAPI_GetInterfaceVersionString(szDesc); NvAPI_SYS_GetDriverAndBranchVersion(&uiDriverVersion, szBuildBranchString); - WriteDebugEventAndReport(7460, SString("NvAPI - InterfaceVersion:'%s' DriverVersion:%d.%d Branch:'%s'", szDesc, uiDriverVersion / 100, + WriteDebugEventAndReport(ReportLogID::NVIDIA_OPTIMUS_DETECTED, SString("NvAPI - InterfaceVersion:'%s' DriverVersion:%d.%d Branch:'%s'", szDesc, uiDriverVersion / 100, uiDriverVersion % 100, szBuildBranchString)); // Get all the Physical GPU Handles @@ -108,7 +108,7 @@ bool NvOptimusDetect() bFoundOptimus = true; strStatus += " FoundOptimus"; } - WriteDebugEventAndReport(7461, strStatus); + WriteDebugEventAndReport(ReportLogID::NVIDIA_OPTIMUS_GPU_RESULT, strStatus); } return bFoundOptimus; diff --git a/Client/loader/FileGenerator.cpp b/Client/loader/FileGenerator.cpp index bd750803312..715543bfd79 100644 --- a/Client/loader/FileGenerator.cpp +++ b/Client/loader/FileGenerator.cpp @@ -183,7 +183,7 @@ bool FileGenerator::IsPatchBase(const fs::path& filePath) if (IsErrorCodeLoggable(ec)) { const uintmax_t fileSize = GetFileSize(filePath); - AddReportLog(5053, SString("IsPatchBase: Incorrect file '%ls' (err: %d, size: %ju, hash: %s)", filePath.wstring().c_str(), ec.value(), fileSize, + AddReportLog(ReportLogID::FILEGEN_PATCH_FAIL, SString("IsPatchBase: Incorrect file '%ls' (err: %d, size: %ju, hash: %s)", filePath.wstring().c_str(), ec.value(), fileSize, GetFileHashString(hash).c_str())); } @@ -201,7 +201,7 @@ bool FileGenerator::IsPatchDiff(const fs::path& filePath) if (IsErrorCodeLoggable(ec)) { const uintmax_t fileSize = GetFileSize(filePath); - AddReportLog(5053, SString("IsPatchDiff: Incorrect file '%ls' (err: %d, size: %ju, hash: %s)", filePath.wstring().c_str(), ec.value(), fileSize, + AddReportLog(ReportLogID::FILEGEN_PATCH_FAIL, SString("IsPatchDiff: Incorrect file '%ls' (err: %d, size: %ju, hash: %s)", filePath.wstring().c_str(), ec.value(), fileSize, GetFileHashString(hash).c_str())); } diff --git a/Client/loader/Install.Manifest.cpp b/Client/loader/Install.Manifest.cpp index d1fb986a227..ff18250b861 100644 --- a/Client/loader/Install.Manifest.cpp +++ b/Client/loader/Install.Manifest.cpp @@ -96,7 +96,7 @@ bool ParseManifestFile(const SString& sourceRoot, std::vector& fil else { SString message("ParseManifestFile: Version '%s' is not supported", version.c_str()); - AddReportLog(5055, message); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, message); return false; } } diff --git a/Client/loader/Install.cpp b/Client/loader/Install.cpp index 4a59fe7993a..3f4800d13c7 100644 --- a/Client/loader/Install.cpp +++ b/Client/loader/Install.cpp @@ -164,13 +164,13 @@ static bool ProcessArchive(const std::string& archivePath, std::vector std::vector& files) -> size_t if (disasterCounter <= 5) { bool exists = FileExists(file.targetFile.absolutePath); - AddReportLog(5055, SString("RunRollback: Unable to restore backup from '%s' to '%s' (exists: %d, attempts: %d, checksums: %d)", + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("RunRollback: Unable to restore backup from '%s' to '%s' (exists: %d, attempts: %d, checksums: %d)", file.backupFile.c_str(), file.targetFile.c_str(), exists, attempts, checksums)); } } @@ -481,7 +481,7 @@ static auto RunRollback(std::vector& files) -> size_t disasterCounter, files.size()), "MTA: San Andreas", MB_OK | MB_ICONERROR | MB_TOPMOST); - AddReportLog(5055, SString("RunRollback: Rollback failed for %zu out of %zu files", disasterCounter, files.size())); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("RunRollback: Rollback failed for %zu out of %zu files", disasterCounter, files.size())); OutputDebugLine(SString("RunRollback: Rollback failed for %zu out of %zu files", disasterCounter, files.size())); } @@ -503,12 +503,12 @@ static bool CompletePendingRollback(const SString& sourceRoot, const SString& ta if (FileExists(hintFile)) { - AddReportLog(5055, SString("CompletePendingRollback: Hint file was not deleted: '%s'", hintFile.c_str())); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("CompletePendingRollback: Hint file was not deleted: '%s'", hintFile.c_str())); } if (!DirectoryExists(backupRoot)) { - AddReportLog(5055, SString("CompletePendingRollback: Backup directory does not exist: '%s'", backupRoot.c_str())); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("CompletePendingRollback: Backup directory does not exist: '%s'", backupRoot.c_str())); return false; } @@ -540,7 +540,7 @@ static bool CompletePendingRollback(const SString& sourceRoot, const SString& ta if (files.empty()) { - AddReportLog(5055, SString("CompletePendingRollback: Rollback is obsolete (%zu files skipped)", backupFiles.size())); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("CompletePendingRollback: Rollback is obsolete (%zu files skipped)", backupFiles.size())); return true; } @@ -552,7 +552,7 @@ static bool CompletePendingRollback(const SString& sourceRoot, const SString& ta deleteBackupRoot.Release(); bool hasHint = FileSave(PathJoin(sourceRoot, ROLLBACK_NAME), backupRoot); - AddReportLog(5055, + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("CompletePendingRollback: %zu out of %zu files may be corrupt after rollback (hint: %d)", disasterCounter, files.size(), hasHint)); return false; } @@ -579,7 +579,7 @@ static int RunInstall() if (!FileExists(archivePath)) { - AddReportLog(5055, SString("RunInstall: Source archive does not exist: '%s' (source: '%s')", archivePath.c_str(), sourceRoot.c_str())); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("RunInstall: Source archive does not exist: '%s' (source: '%s')", archivePath.c_str(), sourceRoot.c_str())); archivePath = ""; } @@ -587,14 +587,14 @@ static int RunInstall() if (!DirectoryExists(targetRoot)) { - AddReportLog(5055, SString("RunInstall: MTA directory does not exist: '%s'", targetRoot.c_str())); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("RunInstall: MTA directory does not exist: '%s'", targetRoot.c_str())); return 1; } // Check if we have to complete a pending rollback. if (!CompletePendingRollback(sourceRoot, targetRoot)) { - AddReportLog(5055, SStringX("RunInstall: Rollback has failed")); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SStringX("RunInstall: Rollback has failed")); return 2; } @@ -609,7 +609,7 @@ static int RunInstall() if (backupRoot.empty()) { - AddReportLog(5055, SStringX("RunInstall: Unable to create writable backup directory")); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SStringX("RunInstall: Unable to create writable backup directory")); return 3; } @@ -656,7 +656,7 @@ static int RunInstall() { if (FileExists(file.targetFile.absolutePath)) { - AddReportLog(5055, SString("RunInstall: Target file '%s' exists but has no checksum", file.targetFile.absolutePath.c_str())); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("RunInstall: Target file '%s' exists but has no checksum", file.targetFile.absolutePath.c_str())); return 5; } @@ -683,7 +683,7 @@ static int RunInstall() { if (!FileExists(file.targetFile.absolutePath)) { - AddReportLog(5055, SString("RunInstall: Target file '%s' is missing (attempts: %d)", file.relativePath.c_str(), attempts)); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("RunInstall: Target file '%s' is missing (attempts: %d)", file.relativePath.c_str(), attempts)); break; } @@ -704,7 +704,7 @@ static int RunInstall() uint64_t targetSize = FileSize(file.targetFile.absolutePath); bool backupExists = FileExists(file.backupFile.absolutePath); uint64_t backupSize = FileSize(file.backupFile.absolutePath); - AddReportLog(5055, SString("RunInstall: Unable to create backup of '%s' (attempts: %d, checksums: %d, target: %d [size:%llu hash:%08x], backup: %d " + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("RunInstall: Unable to create backup of '%s' (attempts: %d, checksums: %d, target: %d [size:%llu hash:%08x], backup: %d " "[size:%llu hash:%08x])", file.relativePath.c_str(), attempts, checksums, targetExists, targetSize, file.targetFile.checksum.value_or(0), backupExists, backupSize, file.backupFile.checksum.value_or(0))); @@ -756,7 +756,7 @@ static int RunInstall() { if (!FileExists(file.sourceFile.absolutePath)) { - AddReportLog(5055, SString("RunInstall: Source file '%s' is missing (attempts: %d)", file.relativePath.c_str(), attempts)); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("RunInstall: Source file '%s' is missing (attempts: %d)", file.relativePath.c_str(), attempts)); break; } @@ -791,7 +791,7 @@ static int RunInstall() file.targetFile.ComputeChecksum(); bool exists = FileExists(file.sourceFile.absolutePath); - AddReportLog(5055, SString("RunInstall: Unable to install '%s' (exists: %d, attempts: %d, checksums: %d)", file.relativePath.c_str(), exists, + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("RunInstall: Unable to install '%s' (exists: %d, attempts: %d, checksums: %d)", file.relativePath.c_str(), exists, attempts, checksums)); requiresRollback = true; break; @@ -810,7 +810,7 @@ static int RunInstall() deleteBackupRoot.Release(); bool hasHint = FileSave(PathJoin(sourceRoot, ROLLBACK_NAME), backupRoot); - AddReportLog(5055, SString("RunInstall: %zu out of %zu files may be corrupt after rollback (hint: %d)", disasterCounter, files.size(), hasHint)); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("RunInstall: %zu out of %zu files may be corrupt after rollback (hint: %d)", disasterCounter, files.size(), hasHint)); } }; @@ -830,7 +830,7 @@ static int RunInstall() if (!exists || !checksum) { - AddReportLog(5055, SString("RunInstall: Verification failed for '%s' (exists: %d, checksum: %d)", file.targetFile.c_str(), exists, checksum)); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("RunInstall: Verification failed for '%s' (exists: %d, checksum: %d)", file.targetFile.c_str(), exists, checksum)); requiresRollback = true; break; } @@ -855,7 +855,7 @@ bool InstallFiles(bool showProgressWindow) if (int failureStep = RunInstall(); failureStep > 0) { - AddReportLog(5055, SString("InstallFiles: Installation ended on step %d", failureStep)); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("InstallFiles: Installation ended on step %d", failureStep)); OutputDebugLine(SString("InstallFiles: Installation ended on step %d", failureStep)); } else @@ -877,20 +877,20 @@ bool ExtractFiles(const std::string& archivePath, bool withManifest) if (!ExtractArchiveFiles(archivePath, files, ARCHIVE_PASSWORD)) { - AddReportLog(5055, SString("ExtractFiles: Failed to extract '%s'", archivePath.c_str())); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SString("ExtractFiles: Failed to extract '%s'", archivePath.c_str())); return false; } if (files.empty()) { - AddReportLog(5055, SStringX("ExtractFiles: File extraction yielded zero files")); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SStringX("ExtractFiles: File extraction yielded zero files")); return false; } if (withManifest && !GenerateManifestFile(".", files)) { // This is not a fatal error. We have fallback methods to work without a manifest. - AddReportLog(5055, SStringX("ExtractFiles: Failed to generate manifest")); + AddReportLog(ReportLogID::LOADER_INSTALL_FAIL, SStringX("ExtractFiles: Failed to generate manifest")); } return true; @@ -960,7 +960,7 @@ SString CheckOnRestartCommand() } else { - AddReportLog(5052, SString("CheckOnRestartCommand: Unknown restart command %s", strOperation.c_str())); + AddReportLog(ReportLogID::CHECK_ON_RESTART_CMD_UNKNOWN, SString("CheckOnRestartCommand: Unknown restart command %s", strOperation.c_str())); } } diff --git a/Client/loader/Main.cpp b/Client/loader/Main.cpp index 01901a2ae39..6c39a558d0a 100644 --- a/Client/loader/Main.cpp +++ b/Client/loader/Main.cpp @@ -43,11 +43,6 @@ namespace { // Command line constants constexpr size_t MAX_CMD_LINE_LENGTH = 4096; - // Report log IDs - constexpr int LOG_ID_END = 1044; - constexpr int LOG_ID_CONTINUE_EXCEPTION = 1045; - constexpr int LOG_ID_LAUNCH_EXCEPTION = 1046; - // Compile-time checks static_assert(MAX_CMD_LINE_LENGTH > 0, "Command line buffer size must be positive"); static_assert(MAX_CMD_LINE_LENGTH <= 65536, "Command line buffer size seems unreasonably large"); @@ -151,7 +146,7 @@ namespace { return pInstallManager->Continue(); } catch (...) { - AddReportLog(LOG_ID_CONTINUE_EXCEPTION, "Exception in InstallManager::Continue()"); + AddReportLog(ReportLogID::INSTALL_MGR_CONTINUE_EXCEPTION, "Exception in InstallManager::Continue()"); return SString(); } } @@ -162,7 +157,7 @@ namespace { return LaunchGame(strCmdLine); } catch (...) { - AddReportLog(LOG_ID_LAUNCH_EXCEPTION, "Exception in LaunchGame()"); + AddReportLog(ReportLogID::INSTALL_MGR_LAUNCHGAME_EXCEPTION, "Exception in LaunchGame()"); return static_cast(ERROR_LAUNCH_EXCEPTION); } } @@ -279,7 +274,7 @@ MTAEXPORT int DoWinMain(HINSTANCE hLauncherInstance, MAYBE_UNUSED HINSTANCE hPre // Get current process ID for logging DWORD currentPid = GetSafeProcessId(); - AddReportLog(LOG_ID_END, SString("* End (0x%X)* pid:%d", iReturnCode, currentPid)); + AddReportLog(ReportLogID::LOADER_DOMAIN_FINISH, SString("* End (0x%X)* pid:%d", iReturnCode, currentPid)); return iReturnCode; } diff --git a/Client/loader/MainFunctions.cpp b/Client/loader/MainFunctions.cpp index 582d1807f2e..afcee446dde 100644 --- a/Client/loader/MainFunctions.cpp +++ b/Client/loader/MainFunctions.cpp @@ -340,12 +340,12 @@ void HandleResetSettings() if (!FileExists(strSettingsFilename)) { - AddReportLog(4053, "Deleted gta_sa.set"); + AddReportLog(ReportLogID::LOADER_DELETED_GTA_SETTINGS, "Deleted gta_sa.set"); MessageBoxUTF8(NULL, _("GTA settings have been reset.\n\nPress OK to continue."), "MTA: San Andreas", MB_OK | MB_ICONINFORMATION | MB_TOPMOST); } else { - AddReportLog(5054, SString("Delete gta_sa.set failed with '%s'", *strSettingsFilename)); + AddReportLog(ReportLogID::LOADER_DELETE_GTA_SETTINGS_FAIL, SString("Delete gta_sa.set failed with '%s'", *strSettingsFilename)); MessageBoxUTF8(NULL, SString(_("File could not be deleted: '%s'"), *strSettingsFilename), "Error" + _E("CL09"), MB_OK | MB_ICONWARNING | MB_TOPMOST); } @@ -372,7 +372,7 @@ void HandleResetSettings() ////////////////////////////////////////////////////////// void HandleNotUsedMainMenu() { - AddReportLog(9310, "Loader - HandleNotUsedMainMenu"); + AddReportLog(ReportLogID::LOADER_HANDLE_NOTUSED_MAINMENU, "Loader - HandleNotUsedMainMenu"); // Check current display mode in coreconfig.xml { @@ -384,7 +384,7 @@ void HandleNotUsedMainMenu() if (strFullscreenStyle == "1") { - AddReportLog(9315, "Loader - HandleNotUsedMainMenu - Already Borderless window"); + AddReportLog(ReportLogID::LOADER_HANDLE_NOTUSED_MAINMENU_BORDERLESS_IS, "Loader - HandleNotUsedMainMenu - Already Borderless window"); } else if (!strWindowed.empty() && !strFullscreenStyle.empty()) { @@ -400,16 +400,16 @@ void HandleNotUsedMainMenu() // Change to borderless window mode strCoreConfig = strCoreConfig.Replace("0", "1"); FileSave(strCoreConfigFilename, strCoreConfig); - AddReportLog(9311, "Loader - HandleNotUsedMainMenu - User change to Borderless window"); + AddReportLog(ReportLogID::LOADER_HANDLE_NOTUSED_MAINMENU_CHANGE, "Loader - HandleNotUsedMainMenu - User change to Borderless window"); } else { - AddReportLog(9313, "Loader - HandleNotUsedMainMenu - User said no"); + AddReportLog(ReportLogID::LOADER_HANDLE_NOTUSED_MAINMENU_USER_NO, "Loader - HandleNotUsedMainMenu - User said no"); } } else { - AddReportLog(9314, "Loader - HandleNotUsedMainMenu - Mode not fullscreen standard"); + AddReportLog(ReportLogID::LOADER_HANDLE_NOTUSED_MAINMENU_NOT_FSCREEN, "Loader - HandleNotUsedMainMenu - Mode not fullscreen standard"); } } else @@ -417,7 +417,7 @@ void HandleNotUsedMainMenu() // If no valid settings file yet, do the change without asking strCoreConfig = "1"; FileSave(strCoreConfigFilename, strCoreConfig); - AddReportLog(9312, "Loader - HandleNotUsedMainMenu - Set Borderless window"); + AddReportLog(ReportLogID::LOADER_HANDLE_NOTUSED_MAINMENU_BORDERLESS_SET, "Loader - HandleNotUsedMainMenu - Set Borderless window"); } } @@ -1461,18 +1461,32 @@ int LaunchGame(SString strCmdLine) // If core is closing and gta_sa.exe process memory usage is not changing, terminate CStuckProcessDetector detector(piLoadee.hProcess, 5000); - while (status == WAIT_TIMEOUT && WatchDogIsSectionOpen("Q0")) // Gets closed when quit is detected as frozen + while (status == WAIT_TIMEOUT) { - if (detector.UpdateIsStuck()) + status = WaitForSingleObject(piLoadee.hProcess, 1500); + + // If core is closing and gta_sa.exe process memory usage is not changing, terminate + CStuckProcessDetector detector(piLoadee.hProcess, 5000); + while (status == WAIT_TIMEOUT && WatchDogIsSectionOpen("Q0")) // Gets closed when quit is detected as frozen { - WriteDebugEvent("Detected stuck process at quit"); - #ifndef MTA_DEBUG - TerminateProcess(piLoadee.hProcess, 1); - status = WAIT_FAILED; - break; - #endif + if (detector.UpdateIsStuck()) + { + WriteDebugEvent("Detected stuck process at quit"); +#ifndef MTA_DEBUG + TerminateProcess(piLoadee.hProcess, 1); + status = WAIT_FAILED; + break; +#endif + } + status = WaitForSingleObject(piLoadee.hProcess, 1000); } - status = WaitForSingleObject(piLoadee.hProcess, 1000); + } + + BsodDetectionOnGameEnd(); + + if (!GetExitCodeProcess(piLoadee.hProcess, &dwExitCode)) + { + dwExitCode = static_cast(-1); } } @@ -1484,7 +1498,7 @@ int LaunchGame(SString strCmdLine) } } - AddReportLog(7104, "Loader - Finishing"); + AddReportLog(ReportLogID::LOADER_FINISH, "Loader - Finishing"); WriteDebugEvent("Loader - Finishing"); EndD3DStuff(); diff --git a/Client/loader/Utils.cpp b/Client/loader/Utils.cpp index 995dfc8b384..2a503997355 100644 --- a/Client/loader/Utils.cpp +++ b/Client/loader/Utils.cpp @@ -961,7 +961,7 @@ Return Value: void RelaunchAsAdmin(const SString& strCmdLine, const SString& strReason) { HideSplash(); - AddReportLog(7115, SString("Loader - Request to elevate privileges (%s)", *strReason)); + AddReportLog(ReportLogID::LOADER_ELEVATED_PRIVILEGE_REQUEST, SString("Loader - Request to elevate privileges (%s)", *strReason)); MessageBoxUTF8(NULL, SString(_("MTA:SA needs Administrator access for the following task:\n\n '%s'\n\nPlease confirm in the next window."), *strReason), "Multi Theft Auto: San Andreas", MB_OK | MB_ICONINFORMATION | MB_TOPMOST); ReleaseSingleInstanceMutex(); @@ -1164,7 +1164,7 @@ bool TerminateProcess(DWORD dwProcessID, uint uiExitCode) if (NtTerminateProcess_) { success = NtTerminateProcess_(dwProcessID, uiExitCode); - AddReportLog(8070, SString("TerminateProcess %d result: %d", dwProcessID, success)); + AddReportLog(ReportLogID::TERMINATE_PROCESS_CHECKSERVICE, SString("TerminateProcess %d result: %d", dwProcessID, success)); } } @@ -1262,7 +1262,7 @@ bool CheckService(uint uiStage) if (pfnCheckService) { bool bResult = pfnCheckService(uiStage); - AddReportLog(8070, SString("CheckService %d result: %d", uiStage, bResult)); + AddReportLog(ReportLogID::TERMINATE_PROCESS_CHECKSERVICE, SString("CheckService %d result: %d", uiStage, bResult)); return bResult; } } @@ -1779,7 +1779,7 @@ void ForbodenProgramsMessage() strMessage += "\n\n"; strMessage += SString::Join("\n", foundList); DisplayErrorMessageBox(strMessage, _E("CL39"), "forboden-programs"); - WriteDebugEventAndReport(6550, SString("Showed forboden programs list (%s)", *SString::Join(",", foundList))); + WriteDebugEventAndReport(ReportLogID::FORBODEN_PROGRAM_DETECTED, SString("Showed forboden programs list (%s)", *SString::Join(",", foundList))); } } @@ -1890,10 +1890,10 @@ void LogSettings() // Write to logile.txt and report.log // ////////////////////////////////////////////////////////// -void WriteDebugEventAndReport(uint uiId, const SString& strText) +void WriteDebugEventAndReport(ReportLogID id, const SString& strText) { WriteDebugEvent(strText); - AddReportLog(uiId, strText); + AddReportLog(id, strText); } ////////////////////////////////////////////////////////// diff --git a/Client/loader/Utils.h b/Client/loader/Utils.h index be0685a83cc..cd5e898f924 100644 --- a/Client/loader/Utils.h +++ b/Client/loader/Utils.h @@ -129,7 +129,7 @@ bool IsDeviceSelectionDialogOpen(DWORD processID); std::vector MyEnumProcesses(bool bInclude64bit = false, bool bIncludeCurrent = false); SString GetProcessPathFilename(DWORD processID); SString GetProcessFilename(DWORD processID); -void WriteDebugEventAndReport(uint uiId, const SString& strText); +void WriteDebugEventAndReport(ReportLogID id, const SString& strText); WString ReadCompatibilityEntries(const WString& strProgName, const WString& strSubKey, HKEY hKeyRoot, uint uiFlags); bool WriteCompatibilityEntries(const WString& strProgName, const WString& strSubKey, HKEY hKeyRoot, uint uiFlags, const WString& strNewData); std::vector GetProcessListUsingFile(const WString& filePath); diff --git a/Client/mods/deathmatch/ClientCommands.cpp b/Client/mods/deathmatch/ClientCommands.cpp index 84529b4c9d5..1fc1932b5fe 100644 --- a/Client/mods/deathmatch/ClientCommands.cpp +++ b/Client/mods/deathmatch/ClientCommands.cpp @@ -149,7 +149,7 @@ void COMMAND_Help(const char* szCmdLine) void COMMAND_Disconnect(const char* szCmdLine) { g_pCore->RemoveMessageBox(); - AddReportLog(7110, "Game - COMMAND_Disconnect"); + AddReportLog(ReportLogID::GAME_CMD_DISCONNECT, "Game - COMMAND_Disconnect"); g_pCore->GetModManager()->RequestUnload(); } diff --git a/Client/mods/deathmatch/logic/CClientGame.cpp b/Client/mods/deathmatch/logic/CClientGame.cpp index 33841956baa..41ae07a78d6 100644 --- a/Client/mods/deathmatch/logic/CClientGame.cpp +++ b/Client/mods/deathmatch/logic/CClientGame.cpp @@ -1161,7 +1161,7 @@ void CClientGame::DoPulses() SString strPrefix = (uiInform == 2) ? "AC" : (uiInform == 1) ? "VF" : "SD"; SString strMessageCombo = SString("%s #%d %s", *strPrefix, uiLevel, strMessage.c_str()).TrimEnd(" "); m_llLastTransgressionTime = GetTickCount64_(); - AddReportLog(3100, strMessageCombo + SString(" (%d)", uiInform)); + AddReportLog(ReportLogID::GAME_PLAYER_TRANSGRESSION, strMessageCombo + SString(" (%d)", uiInform)); if (uiInform > 0) { @@ -1175,7 +1175,7 @@ void CClientGame::DoPulses() else { // Otherwise, disconnect here - AddReportLog(7105, SString("Core - Kicked (%s)", *strMessageCombo)); + AddReportLog(ReportLogID::GAME_KICKED, SString("Core - Kicked (%s)", *strMessageCombo)); g_pCore->ShowMessageBox(_("Error") + _E("CD05"), SString(_("You were kicked from the game ( %s )"), *strMessageCombo), MB_BUTTON_OK | MB_ICON_ERROR); g_pCore->GetModManager()->RequestUnload(); @@ -3977,7 +3977,7 @@ bool CClientGame::AssocGroupCopyAnimationHandler(CAnimBlendAssociationSAInterfac if ((DWORD)pAnimAssocGroupInterface < 0x250) { g_pCore->LogEvent(542, "AssocGroupCopyAnimationHandler", "Interface is corrupt", - SString("pAnimAssocGroupInterface = %p | AnimID = %d", pAnimAssocGroupInterface, animID), 542); + SString("pAnimAssocGroupInterface = %p | AnimID = %d", pAnimAssocGroupInterface, animID), ReportLogID::CORRUPT_ANIM_ASSOC_GROUP_INTERFACE); } auto pAnimAssocGroup = pAnimationManager->GetAnimBlendAssocGroup(pAnimAssocGroupInterface); @@ -3985,7 +3985,7 @@ bool CClientGame::AssocGroupCopyAnimationHandler(CAnimBlendAssociationSAInterfac if ((DWORD)pAnimAssocGroup->GetInterface() < 0x250) { g_pCore->LogEvent(543, "AssocGroupCopyAnimationHandler", "GetAnimBlendAssocGroup corrupted the interface", - SString("pAnimAssocGroupInterface = %p | AnimID = %d", pAnimAssocGroup->GetInterface(), animID), 543); + SString("pAnimAssocGroupInterface = %p | AnimID = %d", pAnimAssocGroup->GetInterface(), animID), ReportLogID::INVALID_ANIM_ASSOC_GROUP_INTERFACE); } eAnimGroup iGroupID = pAnimAssocGroup->GetGroupID(); @@ -3993,7 +3993,7 @@ bool CClientGame::AssocGroupCopyAnimationHandler(CAnimBlendAssociationSAInterfac if (iGroupID == eAnimGroup::ANIM_GROUP_NONE || pAnimAssocGroup->GetAnimBlock() == nullptr) { g_pCore->LogEvent(544, "AssocGroupCopyAnimationHandler", "pAnimAssocGroupInterface was invalid (animation block is null?)", - SString("GetAnimBlock() = %p | GroupID = %d", pAnimAssocGroup->GetAnimBlock(), iGroupID), 544); + SString("GetAnimBlock() = %p | GroupID = %d", pAnimAssocGroup->GetAnimBlock(), iGroupID), ReportLogID::ANIM_ASSOC_GROUP_INTERFACE_NULL_BLOCK); return false; } @@ -4300,13 +4300,13 @@ bool CClientGame::DamageHandler(CPed* pDamagePed, CEventDamage* pEvent) { if (g_iDamageEventLimit == 0) { - AddReportLog(5501, SString("2nd pass 1 for BulletSyncShot damage. weaponUsed:%d", weaponUsed)); + AddReportLog(ReportLogID::BULLETSYNC_DMG, SString("2nd pass 1 for BulletSyncShot damage. weaponUsed:%d", weaponUsed)); return false; } g_iDamageEventLimit--; if (!bBulletSyncWeapon) { - AddReportLog(5502, SString("BulletSyncShot but not bBulletSyncWeapon. weaponUsed:%d", weaponUsed)); + AddReportLog(ReportLogID::BULLETSYNC_NOWEAPON, SString("BulletSyncShot but not bBulletSyncWeapon. weaponUsed:%d", weaponUsed)); return false; } } @@ -4314,7 +4314,7 @@ bool CClientGame::DamageHandler(CPed* pDamagePed, CEventDamage* pEvent) { if (bBulletSyncWeapon) { - AddReportLog(5503, SString("not BulletSyncShot but bBulletSyncWeapon. weaponUsed:%d", weaponUsed)); + AddReportLog(ReportLogID::BULLETSYNC_WEAPON_NOSYNC, SString("not BulletSyncShot but bBulletSyncWeapon. weaponUsed:%d", weaponUsed)); return false; } } @@ -6613,20 +6613,20 @@ void CClientGame::OutputServerInfo() // Report misc important warnings/errors to the current server // ////////////////////////////////////////////////////////////////// -void CClientGame::TellServerSomethingImportant(uint uiId, const SString& strMessage, uint uiSendLimitForThisId) +void CClientGame::TellServerSomethingImportant(ReportLogID id, const SString& strMessage, uint uiSendLimitForThisId) { g_pCore->GetConsole()->Print(strMessage); - AddReportLog(3400 + uiId, strMessage + g_pNet->GetConnectedServer(true), 10); + AddReportLog(static_cast(std::to_underlying(ReportLogID::SERVER_IMPORTANT_MSG) + std::to_underlying(id)), strMessage + g_pNet->GetConnectedServer(true), 10); if (uiSendLimitForThisId) { - uint& uiCount = MapGet(m_SentMessageIds, uiId); + uint& uiCount = MapGet(m_SentMessageIds, id); if (uiCount++ >= uiSendLimitForThisId) return; } NetBitStreamInterface* pBitStream = g_pNet->AllocateNetBitStream(); - pBitStream->WriteString(SString("%d,%s", uiId, *strMessage)); + pBitStream->WriteString(SString("%d,%s", id, *strMessage)); g_pNet->SendPacket(PACKET_ID_PLAYER_DIAGNOSTIC, pBitStream, PACKET_PRIORITY_MEDIUM, PACKET_RELIABILITY_UNRELIABLE); g_pNet->DeallocateNetBitStream(pBitStream); } @@ -6698,7 +6698,7 @@ void CClientGame::SetFileCacheRoot() { // Not sharing, so use current mod directory m_strFileCacheRoot = GetModRoot(); - AddReportLog(7410, SString("CClientGame::SetFileCacheRoot - Not shared '%s'", *m_strFileCacheRoot)); + AddReportLog(ReportLogID::GAME_FILECACHE_ROOT_NOSHARED, SString("CClientGame::SetFileCacheRoot - Not shared '%s'", *m_strFileCacheRoot)); } else { @@ -6718,7 +6718,7 @@ void CClientGame::SetFileCacheRoot() FileDelete(strTestFileName); // Use shared directory m_strFileCacheRoot = strFileCachePath; - AddReportLog(7411, SString("CClientGame::SetFileCacheRoot - Is shared '%s'", *m_strFileCacheRoot)); + AddReportLog(ReportLogID::GAME_FILECACHE_ROOT_SHARED, SString("CClientGame::SetFileCacheRoot - Is shared '%s'", *m_strFileCacheRoot)); return; } } @@ -6729,9 +6729,9 @@ void CClientGame::SetFileCacheRoot() SetCommonRegistryValue("", "File Cache Path", m_strFileCacheRoot); if (strFileCachePath.empty()) - AddReportLog(7412, SString("CClientGame::SetFileCacheRoot - Initial setting '%s'", *m_strFileCacheRoot)); + AddReportLog(ReportLogID::GAME_FILECACHE_ROOT_INIT, SString("CClientGame::SetFileCacheRoot - Initial setting '%s'", *m_strFileCacheRoot)); else - AddReportLog(7413, SString("CClientGame::SetFileCacheRoot - Change shared from '%s' to '%s'", *strFileCachePath, *m_strFileCacheRoot)); + AddReportLog(ReportLogID::GAME_FILECACHE_ROOT_MODIFY, SString("CClientGame::SetFileCacheRoot - Change shared from '%s' to '%s'", *strFileCachePath, *m_strFileCacheRoot)); } } diff --git a/Client/mods/deathmatch/logic/CClientGame.h b/Client/mods/deathmatch/logic/CClientGame.h index 84c10099171..9c63870f298 100644 --- a/Client/mods/deathmatch/logic/CClientGame.h +++ b/Client/mods/deathmatch/logic/CClientGame.h @@ -461,7 +461,7 @@ class CClientGame void ProjectileInitiateHandler(CClientProjectile* pProjectile); void IdleHandler(); void OutputServerInfo(); - void TellServerSomethingImportant(uint uiId, const SString& strMessage, uint uiSendLimitForThisId = 0); + void TellServerSomethingImportant(ReportLogID id, const SString& strMessage, uint uiSendLimitForThisId = 0); void ChangeFloatPrecision(bool bHigh); bool IsHighFloatPrecision() const; @@ -859,7 +859,7 @@ class CClientGame SMiscGameSettings m_MiscGameSettings; uint m_uiAltPulseOrderCounter; SString m_strACInfo; - std::map m_SentMessageIds; + std::map m_SentMessageIds; bool m_bLastKeyWasEscapeCancelled; std::set m_AllowKeyUpMap; diff --git a/Client/mods/deathmatch/logic/CClientObjectManager.cpp b/Client/mods/deathmatch/logic/CClientObjectManager.cpp index c59483b4db2..a580533fca2 100644 --- a/Client/mods/deathmatch/logic/CClientObjectManager.cpp +++ b/Client/mods/deathmatch/logic/CClientObjectManager.cpp @@ -275,7 +275,7 @@ bool CClientObjectManager::IsHardObjectLimitReached() m_iEntryInfoNodeEntries, MAX_ENTRY_INFO_NODES_MTA, m_iPointerNodeDoubleLinkEntries, MAX_POINTER_DOUBLE_LINKS_MTA); g_pCore->GetConsole()->Echo(strMessage); - AddReportLog(7430, strMessage); + AddReportLog(ReportLogID::OBJECTS_LIMIT_REACHED, strMessage); } return true; } diff --git a/Client/mods/deathmatch/logic/CClientPed.cpp b/Client/mods/deathmatch/logic/CClientPed.cpp index 9893a060184..929dd39de7d 100644 --- a/Client/mods/deathmatch/logic/CClientPed.cpp +++ b/Client/mods/deathmatch/logic/CClientPed.cpp @@ -2389,7 +2389,7 @@ void CClientPed::ValidateRemoteWeapons() if (m_WeaponTypes[i] != slotWeaponType) { SString strPlayerName = ((CClientPlayer*)this)->GetNick(); - AddReportLog(5430, SString("Mismatch in slot %d Wanted type:%d Got type:%d (%s)", i, m_WeaponTypes[i], slotWeaponType, *strPlayerName), 30); + AddReportLog(ReportLogID::REMOTE_WEAPON_SLOT_MISMATCH, SString("Mismatch in slot %d Wanted type:%d Got type:%d (%s)", i, m_WeaponTypes[i], slotWeaponType, *strPlayerName), 30); bMismatch = true; } } @@ -5845,7 +5845,7 @@ void CClientPed::RunNamedAnimation(std::unique_ptr& pBlock, const ch { SString strMessage("%s %d (%s)", pBlock->GetName(), pBlock->GetIndex(), szAnimName); g_pCore->LogEvent(543, "Blocking anim load fail", "", strMessage); - AddReportLog(5431, SString("Failed to load animation %s", *strMessage)); + AddReportLog(ReportLogID::LOAD_ANIMATION_FAIL, SString("Failed to load animation %s", *strMessage)); /* // TODO: unload unreferenced blocks later on g_pGame->GetStreaming ()->RequestAnimations ( pBlock->GetIndex (), 8 ); diff --git a/Client/mods/deathmatch/logic/CClientPlayer.cpp b/Client/mods/deathmatch/logic/CClientPlayer.cpp index 4669e2ef715..0001c90a3e9 100644 --- a/Client/mods/deathmatch/logic/CClientPlayer.cpp +++ b/Client/mods/deathmatch/logic/CClientPlayer.cpp @@ -269,7 +269,7 @@ void CClientPlayer::DischargeWeapon(eWeaponType weaponType, const CVector& vecSt if (weaponType != GetCurrentWeaponType()) { GiveWeapon(weaponType, 99, true); - AddReportLog(5432, SString("DischargeWeapon adding missing weapon %d (%s)", weaponType, GetNick()), 30); + AddReportLog(ReportLogID::REMOT_WEAPON_TYPE_MISMATCH, SString("DischargeWeapon adding missing weapon %d (%s)", weaponType, GetNick()), 30); } // Check weapon matches and is enabled for bullet sync @@ -328,7 +328,7 @@ void CClientPlayer::DischargeWeapon(eWeaponType weaponType, const CVector& vecSt SString strMessage("Applied %0.2f damage to %s (from %s) due to network interruption", fBackupDamage, pBackupDamagedPlayer->GetNick(), GetNick()); - g_pClientGame->TellServerSomethingImportant(1010, strMessage); + g_pClientGame->TellServerSomethingImportant(ReportLogID::APPLY_DAMAGE_NET_FIX, strMessage); } } } diff --git a/Client/mods/deathmatch/logic/CClientTXD.cpp b/Client/mods/deathmatch/logic/CClientTXD.cpp index b619586c917..95da602a7ff 100644 --- a/Client/mods/deathmatch/logic/CClientTXD.cpp +++ b/Client/mods/deathmatch/logic/CClientTXD.cpp @@ -243,7 +243,7 @@ bool CClientTXD::GetFilenameToUse(SString& strOutFilename) strOutFilename = strShrunkFilename; FileAppend(strShrunkFilename, SStringX("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 12)); FileAppend(strShrunkFilename, GenerateSha256HexStringFromFile(strShrunkFilename)); - AddReportLog(9400, SString("RightSized %s(%s) from %d KB => %d KB", *ExtractFilename(m_strFilename), *strLargeSha256.Left(8), + AddReportLog(ReportLogID::TXD_SHRUNK, SString("RightSized %s(%s) from %d KB => %d KB", *ExtractFilename(m_strFilename), *strLargeSha256.Left(8), (uint)FileSize(m_strFilename) / 1024, (uint)FileSize(strShrunkFilename) / 1024)); } else diff --git a/Client/mods/deathmatch/logic/CPacketHandler.cpp b/Client/mods/deathmatch/logic/CPacketHandler.cpp index 7dace41f4fa..f38db4a7d81 100644 --- a/Client/mods/deathmatch/logic/CPacketHandler.cpp +++ b/Client/mods/deathmatch/logic/CPacketHandler.cpp @@ -667,7 +667,7 @@ void CPacketHandler::Packet_ServerDisconnected(NetBitStreamInterface& bitStream) g_pCore->ShowErrorMessageBox(_("Disconnected") + strErrorCode, strReason, strTroubleLink); } - AddReportLog(7107, SString("Game - Disconnected (%s) (%s)", *strErrorCode, *strReason.Replace("\n", " "))); + AddReportLog(ReportLogID::GAME_DISCONNECT, SString("Game - Disconnected (%s) (%s)", *strErrorCode, *strReason.Replace("\n", " "))); // Terminate the mod (disconnect first in case there were more packets after this one) g_pClientGame->m_bGracefulDisconnect = true; @@ -5180,7 +5180,7 @@ void CPacketHandler::Packet_ResourceStart(NetBitStreamInterface& bitStream) if (strChunkData.empty()) { bFatalError = true; - AddReportLog(2081, "Empty"); + AddReportLog(ReportLogID::RESOURCESTART_FATAL_ERROR, "Empty"); break; } const char* szParsedChunkData = strChunkData.c_str(); @@ -5199,7 +5199,7 @@ void CPacketHandler::Packet_ResourceStart(NetBitStreamInterface& bitStream) if (strResFilePath.rfind(strResPath, 0) != 0) { bFatalError = true; - AddReportLog(2081, SString("Path %s (expected %s)", strResFilePath.c_str(), strResPath.c_str())); + AddReportLog(ReportLogID::RESOURCESTART_FATAL_ERROR, SString("Path %s (expected %s)", strResFilePath.c_str(), strResPath.c_str())); } else { @@ -5249,7 +5249,7 @@ void CPacketHandler::Packet_ResourceStart(NetBitStreamInterface& bitStream) if (FileExists(strName)) { SString strMessage("Unable to delete old file %s", *ConformResourcePath(strName)); - g_pClientGame->TellServerSomethingImportant(1009, strMessage); + g_pClientGame->TellServerSomethingImportant(ReportLogID::RESOURCESTART_DELETE_FILE_FAIL, strMessage); } // Is it downloadable now? @@ -5609,7 +5609,7 @@ void CPacketHandler::RaiseEntityAddError(uint uiCode) { SString strLine("ProtocolError %d", uiCode); WriteDebugEvent(strLine); - AddReportLog(8331, strLine); + AddReportLog(ReportLogID::ENTITY_ADD_PROTOCOL_ERROR, strLine); NetBitStreamInterface& bitStream = *m_pEntityAddBitStream; for (uint i = std::max(0, (int)m_EntityAddReadOffsetStore.size() - 5); i < m_EntityAddReadOffsetStore.size(); i++) @@ -5619,7 +5619,7 @@ void CPacketHandler::RaiseEntityAddError(uint uiCode) SString strLine("%d/%d Offset:%-6d %s", i, m_uiEntityAddNumEntities, m_EntityAddReadOffsetStore[i], *strStatus); WriteDebugEvent(strLine); - AddReportLog(8332, strLine); + AddReportLog(ReportLogID::ENTITY_ADD_ERROR_OFFSET, strLine); } RaiseProtocolError(uiCode); } diff --git a/Client/mods/deathmatch/logic/CResource.cpp b/Client/mods/deathmatch/logic/CResource.cpp index 57a6d61d6c1..5e7548c265e 100644 --- a/Client/mods/deathmatch/logic/CResource.cpp +++ b/Client/mods/deathmatch/logic/CResource.cpp @@ -518,6 +518,6 @@ void CResource::HandleDownloadedFileTrouble(CResourceFile* pResourceFile, bool b SString strMessage = SString("HTTP server file mismatch! (%s) %s [%s]", GetName(), *strFilename, *errorMessage); // Log to the server & client console - g_pClientGame->TellServerSomethingImportant(bScript ? 1002 : 1013, strMessage, 4); + g_pClientGame->TellServerSomethingImportant(bScript ? ReportLogID::DOWNLOAD_SCRIPT_ERROR : ReportLogID::DOWNLOAD_FILE_ERROR, strMessage, 4); g_pCore->GetConsole()->Printf("Download error: %s", *strMessage); } diff --git a/Client/mods/deathmatch/logic/CResourceFileDownloadManager.cpp b/Client/mods/deathmatch/logic/CResourceFileDownloadManager.cpp index f10ef66ed2f..11fcd2ccef2 100644 --- a/Client/mods/deathmatch/logic/CResourceFileDownloadManager.cpp +++ b/Client/mods/deathmatch/logic/CResourceFileDownloadManager.cpp @@ -139,7 +139,7 @@ void CResourceFileDownloadManager::DoPulse() { // Throw the error and disconnect g_pCore->GetConsole()->Printf(_("Download error: %s"), *m_strLastHTTPError); - AddReportLog(7106, SString("Game - HTTPError (%s)", *m_strLastHTTPError)); + AddReportLog(ReportLogID::GAME_HTTPERROR, SString("Game - HTTPError (%s)", *m_strLastHTTPError)); g_pCore->GetModManager()->RequestUnload(); g_pCore->ShowMessageBox(_("Error") + _E("CD20"), *m_strLastHTTPError, MB_BUTTON_OK | MB_ICON_ERROR); // HTTP Error @@ -318,7 +318,7 @@ void CResourceFileDownloadManager::DownloadFinished(const SHttpDownloadResult& r // Was re-added - Add size again to total. AddDownloadSize(pResourceFile->GetDownloadSize()); SString strMessage("External HTTP file mismatch (Retrying this file with internal HTTP) [%s]", *ConformResourcePath(pResourceFile->GetName())); - g_pClientGame->TellServerSomethingImportant(1011, strMessage, 3); + g_pClientGame->TellServerSomethingImportant(ReportLogID::HTTP_FILE_MISMATCH, strMessage, 3); return; } } @@ -343,7 +343,7 @@ void CResourceFileDownloadManager::DownloadFinished(const SHttpDownloadResult& r AddDownloadSize(pResourceFile->GetDownloadSize()); SString strMessage("External HTTP file download error:[%d] %s (Disabling External HTTP) [%s]", result.iErrorCode, *strHTTPError, *ConformResourcePath(pResourceFile->GetName())); - g_pClientGame->TellServerSomethingImportant(1012, strMessage, 3); + g_pClientGame->TellServerSomethingImportant(ReportLogID::HTTP_DOWNLOAD_ERROR, strMessage, 3); return; } } diff --git a/Client/mods/deathmatch/logic/CResourceManager.cpp b/Client/mods/deathmatch/logic/CResourceManager.cpp index 9d0b55d3e08..9e8de657e82 100644 --- a/Client/mods/deathmatch/logic/CResourceManager.cpp +++ b/Client/mods/deathmatch/logic/CResourceManager.cpp @@ -242,7 +242,7 @@ void CResourceManager::OnFileModifedByScript(const SString& strInFilename, const { pResourceFile->SetModifedByScript(true); SString strMessage("Resource file modifed by script (%s): %s ", *strReason, *ConformResourcePath(strInFilename)); - AddReportLog(7059, strMessage + g_pNet->GetConnectedServer(true), 10); + AddReportLog(ReportLogID::RESOURCE_FILE_MODIFY, strMessage + g_pNet->GetConnectedServer(true), 10); } } @@ -277,13 +277,13 @@ void CResourceManager::ValidateResourceFile(const SString& strInFilename, const if (pResourceFile->IsDownloaded()) { strMessage = "Resource file unexpected change: " + strMessage; - g_pClientGame->TellServerSomethingImportant(1007, strMessage); + g_pClientGame->TellServerSomethingImportant(ReportLogID::RESOURCE_LOAD_FAIL, strMessage); g_pClientGame->GetScriptDebugging()->LogWarning(NULL, strMessage); } else if (pResourceFile->IsAutoDownload()) { strMessage = "Attempt to load resource file before it is ready: " + strMessage; - g_pClientGame->TellServerSomethingImportant(1008, strMessage); + g_pClientGame->TellServerSomethingImportant(ReportLogID::RESOURCE_NOT_READY_LOAD, strMessage); } } } diff --git a/Client/mods/deathmatch/logic/lua/CLuaMain.cpp b/Client/mods/deathmatch/logic/lua/CLuaMain.cpp index 4db16040937..7285678cdde 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaMain.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaMain.cpp @@ -222,7 +222,7 @@ bool CLuaMain::LoadScriptFromBuffer(const char* cpInBuffer, unsigned int uiInSiz { SString strMessage("%s is invalid. Please re-compile at https://luac.multitheftauto.com/", *strNiceFilename); g_pClientGame->GetScriptDebugging()->LogError(m_luaVM, "Loading script failed: %s", *strMessage); - g_pClientGame->TellServerSomethingImportant(1003, SString("CLIENT SCRIPT ERROR: %s", *strMessage)); + g_pClientGame->TellServerSomethingImportant(ReportLogID::INSTALL_MGR_CHANGEFROMADMIN, SString("CLIENT SCRIPT ERROR: %s", *strMessage)); return false; } @@ -564,7 +564,7 @@ int CLuaMain::OnUndump(const char* p, size_t n) if (strExpectedHash != strGotHash) { // I was not expecting that - AddReportLog(7555, SString("Unexpected undump hash for buffer size %d. Got:%s Expected:%s", n, *strExpectedHash, *strGotHash)); + AddReportLog(ReportLogID::LUA_UNDUMP_HASH_FAIL, SString("Unexpected undump hash for buffer size %d. Got:%s Expected:%s", n, *strExpectedHash, *strGotHash)); return 0; } return 1; diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp index 265c6383b1f..28765780d4b 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp @@ -435,7 +435,7 @@ int CLuaResourceDefs::LoadString(lua_State* luaVM) SString strMessage("argument 1 is invalid. Please re-compile at https://luac.multitheftauto.com/", 0); argStream.SetCustomError(strMessage); cpBuffer = NULL; - g_pClientGame->TellServerSomethingImportant(1004, argStream.GetFullErrorMessage(), 3); + g_pClientGame->TellServerSomethingImportant(ReportLogID::DEOBFUSCATION_LOADSTRING_FAIL, argStream.GetFullErrorMessage(), 3); } if (!argStream.HasErrors()) @@ -515,7 +515,7 @@ int CLuaResourceDefs::Load(lua_State* luaVM) SString strMessage("argument 2 is invalid. Please re-compile at https://luac.multitheftauto.com/", 0); argStream.SetCustomError(strMessage); cpBuffer = NULL; - g_pClientGame->TellServerSomethingImportant(1005, argStream.GetFullErrorMessage(), 3); + g_pClientGame->TellServerSomethingImportant(ReportLogID::DEOBFUSCATION_LOAD_FAIL, argStream.GetFullErrorMessage(), 3); } if (!argStream.HasErrors()) diff --git a/Client/multiplayer_sa/CMultiplayerSA.cpp b/Client/multiplayer_sa/CMultiplayerSA.cpp index 1b96f78be9d..d526fb935c7 100644 --- a/Client/multiplayer_sa/CMultiplayerSA.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA.cpp @@ -5144,7 +5144,7 @@ void __cdecl HandleIdle() bAnimGroupArrayAddressLogged = true; DWORD dwAnimGroupArrayAddress = 0xb4ea34; LogEvent(567, "aAnimAssocGroups", "CAnimManager::ms_aAnimAssocGroups Address", - SString("CAnimManager::ms_aAnimAssocGroups = %#.8x", *(DWORD*)dwAnimGroupArrayAddress), 567); + SString("CAnimManager::ms_aAnimAssocGroups = %#.8x", *(DWORD*)dwAnimGroupArrayAddress), ReportLogID::ASSOC_GROUPS_ADDRESS_LOG); } m_pIdleHandler(); } diff --git a/Client/multiplayer_sa/CMultiplayerSA_ClothesCache.cpp b/Client/multiplayer_sa/CMultiplayerSA_ClothesCache.cpp index 48d5f8381f5..73a6565012e 100644 --- a/Client/multiplayer_sa/CMultiplayerSA_ClothesCache.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA_ClothesCache.cpp @@ -145,7 +145,7 @@ class CClumpStore #ifdef CLOTHES_REF_TEST if (pGeometry->refs < 21) { - AddReportLog(7521, SString("Clothes geometry refs below expected value: %d", pGeometry->refs)); + AddReportLog(ReportLogID::CLOTHES_GEOM_REFS_BELOW, SString("Clothes geometry refs below expected value: %d", pGeometry->refs)); pGeometry->refs = 21; } if (pGeometry->refs == 21) diff --git a/Client/multiplayer_sa/CMultiplayerSA_CrashFixHacks.cpp b/Client/multiplayer_sa/CMultiplayerSA_CrashFixHacks.cpp index 31aa95cbe51..568b20c152a 100644 --- a/Client/multiplayer_sa/CMultiplayerSA_CrashFixHacks.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA_CrashFixHacks.cpp @@ -447,7 +447,7 @@ void _cdecl DoWait(HANDLE hHandle) DWORD dwResult = WaitForSingleObject(hHandle, dwWait); if (dwResult == WAIT_TIMEOUT) { - AddReportLog(6211, SString("WaitForSingleObject timed out with %08x and %dms", hHandle, dwWait)); + AddReportLog(ReportLogID::WAIT_FOR_SINGLE_OBJECT_TIMED_OUT, SString("WaitForSingleObject timed out with %08x and %dms", hHandle, dwWait)); // This thread lock bug in GTA will have to be fixed one day. // Until then, a 5 second freeze should be long enough for the loading thread to have finished it's job. #if 0 @@ -650,7 +650,7 @@ bool IsTaskSimpleCarFallOutValid(CAnimBlendAssociationSAInterface* pAnimBlendAss { if (pTask->VTBL != (TaskVTBL*)VTBL_CTaskSimpleCarFallOut) { - AddReportLog(8530, SString("IsTaskSimpleCarFallOutValid fail - pTask->VTBL: %08x", pTask->VTBL), 5); + AddReportLog(ReportLogID::TASK_SIMPLE_FALLOUT_VFTBL, SString("IsTaskSimpleCarFallOutValid fail - pTask->VTBL: %08x", pTask->VTBL), 5); return false; } @@ -661,7 +661,7 @@ bool IsTaskSimpleCarFallOutValid(CAnimBlendAssociationSAInterface* pAnimBlendAss if (!pVehicle) { // Task looks valid, but vehicle is not recognised by MTA - AddReportLog(8531, SString("IsTaskSimpleCarFallOutValid invalid vehicle ptr - pTask->pVehicle: %08x", pTask->pVehicle), 5); + AddReportLog(ReportLogID::TASK_SIMPLE_FALLOUT_VEHPTR, SString("IsTaskSimpleCarFallOutValid invalid vehicle ptr - pTask->pVehicle: %08x", pTask->pVehicle), 5); pTask->pVehicle = NULL; return true; } @@ -1072,7 +1072,7 @@ RwFrame* OnMY_CClumpModelInfo_GetFrameFromId_Post(RwFrame* pFrameResult, DWORD _ if (pNewFrameResult) { SString strMsg("No frame for vehicle:%d frameId:%d (replaced with:%d calledfrom:%08x)", iModelId, id, uiNewId, calledFrom); - AddReportLog(5412, SString("GetFrameFromId - %s", *strMsg)); + AddReportLog(ReportLogID::VEHICLE_MODEL_FRAME_FIX, SString("GetFrameFromId - %s", *strMsg)); LogEvent(5412, "Model frame warning", "GetFrameFromId", strMsg); return pNewFrameResult; } @@ -1080,7 +1080,7 @@ RwFrame* OnMY_CClumpModelInfo_GetFrameFromId_Post(RwFrame* pFrameResult, DWORD _ // Couldn't find a replacement frame id SString strMsg("No frame for vehicle:%d frameId:%d (calledfrom:%08x)", iModelId, id, calledFrom); - AddReportLog(5413, SString("GetFrameFromId - %s", *strMsg)); + AddReportLog(ReportLogID::VEHICLE_MODEL_FRAME_FAIL, SString("GetFrameFromId - %s", *strMsg)); LogEvent(5413, "Model frame error", "GetFrameFromId", strMsg); return NULL; @@ -1141,7 +1141,7 @@ void OnMY_CEntity_GetBoundRect(CEntitySAInterface* pEntity) if (!pModelInfo) { // Crash will occur at offset 00134131 - LogEvent(814, "Model info missing", "CEntity_GetBoundRect", SString("No info for model:%d", usModelId), 5414); + LogEvent(814, "Model info missing", "CEntity_GetBoundRect", SString("No info for model:%d", usModelId), ReportLogID::MODEL_NO_MODEL_INFO); CArgMap argMap; argMap.Set("id", usModelId); argMap.Set("reason", "info"); @@ -1157,7 +1157,7 @@ void OnMY_CEntity_GetBoundRect(CEntitySAInterface* pEntity) SString strDetails("refs:%d txd:%d RwObj:%08x bOwn:%d flg:%d off:%d size:%d loadState:%d", pModelInfo->usNumberOfRefs, pModelInfo->usTextureDictionary, pModelInfo->pRwObject, pModelInfo->bDoWeOwnTheColModel, pStreamingInfo->flg, pStreamingInfo->offsetInBlocks, pStreamingInfo->sizeInBlocks, pStreamingInfo->loadState); - LogEvent(815, "Model collision missing", "CEntity_GetBoundRect", SString("No collision for model:%d %s", usModelId, *strDetails), 5415); + LogEvent(815, "Model collision missing", "CEntity_GetBoundRect", SString("No collision for model:%d %s", usModelId, *strDetails), ReportLogID::MODEL_NO_COL_INFO); CArgMap argMap; argMap.Set("id", usModelId); argMap.Set("reason", "collision"); @@ -1407,7 +1407,7 @@ void OnMY_CAnimManager_CreateAnimAssocGroups(uint uiModelId) if (pModelInfo->GetInterface()->pRwObject == NULL) { // Crash will occur at offset 00349b7b - LogEvent(816, "Model not loaded", "CAnimManager_CreateAnimAssocGroups", SString("No RwObject for model:%d", uiModelId), 5416); + LogEvent(816, "Model not loaded", "CAnimManager_CreateAnimAssocGroups", SString("No RwObject for model:%d", uiModelId), ReportLogID::MODEL_NOT_LOADED); CArgMap argMap; argMap.Set("id", uiModelId); argMap.Set("reason", "createanim"); @@ -1493,7 +1493,7 @@ void _cdecl OnMY_printf(DWORD dwCalledFrom, const char* szMessage) } SString strContext("GTALOG Called from 0x%08x", dwCalledFrom); - LogEvent(6311, "printf", strContext, strMessage, 6311); + LogEvent(6311, "printf", strContext, strMessage, ReportLogID::GTA_PRINTF); // Check for known issues if (strMessage == "Error subrastering") @@ -1596,7 +1596,7 @@ void OnMY_CAnimBlendNode_GetCurrentTranslation(CAnimBlendNodeSAInterface* pInter pAnimHier = %p | HierHash = %u | SequenceExistsInHierarchy: %s", pInterface->m_endKeyFrameId, pAnimAssoc, pAnimAssoc->sAnimGroup, pAnimAssoc->sAnimID, pAnimSequence, pAnimSequence->m_boneId, pAnimSequence->m_hash, pAnimHierarchy, pAnimHierarchy->uiHashKey, bSequenceExistsInHierarchy ? "Yes" : "No"), - 588); + ReportLogID::ANIM_TRANSLATION_FAIL); } // Hook info @@ -1914,13 +1914,13 @@ static void LOG_CWorld__FindObjectsKindaCollidingSectorList(unsigned int modelId CBaseModelInfoSAInterface* pModelInfo = ((CBaseModelInfoSAInterface**)ARRAY_ModelInfo)[modelId]; if (!pModelInfo) { - LogEvent(840, "Model info missing", "CWorld__FindObjectsKindaCollidingSectorList", SString("Corrupt model: %d", modelId), 5601); + LogEvent(840, "Model info missing", "CWorld__FindObjectsKindaCollidingSectorList", SString("Corrupt model: %d", modelId), ReportLogID::OBJECT_MODEL_NO_COL_OR_INFO); return; } if (!pModelInfo->pColModel) { - LogEvent(840, "Col model missing", "CWorld__FindObjectsKindaCollidingSectorList", SString("Corrupt col model: %d", modelId), 5601); + LogEvent(840, "Col model missing", "CWorld__FindObjectsKindaCollidingSectorList", SString("Corrupt col model: %d", modelId), ReportLogID::OBJECT_MODEL_NO_COL_OR_INFO); } } diff --git a/Client/multiplayer_sa/CMultiplayerSA_Files.cpp b/Client/multiplayer_sa/CMultiplayerSA_Files.cpp index 96c881d2293..9daad0b2ebd 100644 --- a/Client/multiplayer_sa/CMultiplayerSA_Files.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA_Files.cpp @@ -39,7 +39,7 @@ void OnMY_Rtl_fopen_Post(FILE* fh, DWORD calledFrom, const char* szFilename, con return; } - AddReportLog(5321, SString("Rtl_fopen failed: called from:%08x mode:%s name:%s", calledFrom, szMode, *strFilename)); + AddReportLog(ReportLogID::RTL_FOPEN_FAIL, SString("Rtl_fopen failed: called from:%08x mode:%s name:%s", calledFrom, szMode, *strFilename)); SetApplicationSetting("diagnostics", "gta-fopen-fail", strFilename); } } diff --git a/Client/multiplayer_sa/CMultiplayerSA_FixBadAnimId.cpp b/Client/multiplayer_sa/CMultiplayerSA_FixBadAnimId.cpp index b4f9979affc..27c1772075d 100644 --- a/Client/multiplayer_sa/CMultiplayerSA_FixBadAnimId.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA_FixBadAnimId.cpp @@ -25,7 +25,7 @@ eAnimID _cdecl OnCAnimBlendAssocGroupCopyAnimation_FixBadAnim(eAnimGroup* pAnimG { if (*pAnimGroup < eAnimGroup::ANIM_GROUP_PYTHON || *pAnimGroup > eAnimGroup::ANIM_GROUP_GOGGLES) { - LogEvent(533, "CopyAnimation", "Incorrect Group ID", SString("GroupID = %d | AnimID = %d", *pAnimGroup, *pAnimId), 533); + LogEvent(533, "CopyAnimation", "Incorrect Group ID", SString("GroupID = %d | AnimID = %d", *pAnimGroup, *pAnimId), ReportLogID::WEAPON_FIRE_ANIM_CRASH_FIX_GROUP); // switch to python anim group as it has 224 anim *pAnimGroup = eAnimGroup::ANIM_GROUP_PYTHON; @@ -36,7 +36,7 @@ eAnimID _cdecl OnCAnimBlendAssocGroupCopyAnimation_FixBadAnim(eAnimGroup* pAnimG DWORD* pInterface = reinterpret_cast(pGroup); if (pInterface < (DWORD*)0x250) { - LogEvent(534, "CopyAnimation", "Incorrect Group Interface", SString("GroupID = %d | AnimID = %d", *pAnimGroup, *pAnimId), 534); + LogEvent(534, "CopyAnimation", "Incorrect Group Interface", SString("GroupID = %d | AnimID = %d", *pAnimGroup, *pAnimId), ReportLogID::WEAPON_FIRE_ANIM_CRASH_FIX_INTERFACE); // switch to idle animation *pAnimGroup = eAnimGroup::ANIM_GROUP_DEFAULT; @@ -84,7 +84,7 @@ void _cdecl OnGetAnimHierarchyFromSkinClump(RpClump* pRpClump, void* pRpHAnimHie { // Crash will occur at offset 003C51A8 uint uiModelId = pGameInterface->GetPools()->GetModelIdFromClump(pRpClump); - LogEvent(818, "Model bad anim hierarchy", "GetAnimHierarchyFromSkinClump", SString("Corrupt model:%d", uiModelId), 5418); + LogEvent(818, "Model bad anim hierarchy", "GetAnimHierarchyFromSkinClump", SString("Corrupt model:%d", uiModelId), ReportLogID::MODEL_BAD_ANIM_HIERARCHY); CArgMap argMap; argMap.Set("id", uiModelId); argMap.Set("reason", "anim_hierarchy"); diff --git a/Client/multiplayer_sa/CMultiplayerSA_HookDestructors.cpp b/Client/multiplayer_sa/CMultiplayerSA_HookDestructors.cpp index 4535aa65272..d74cfafb2a2 100644 --- a/Client/multiplayer_sa/CMultiplayerSA_HookDestructors.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA_HookDestructors.cpp @@ -302,7 +302,7 @@ void _cdecl OnCPhysicalDestructor(DWORD calledFrom, CPhysicalSAInterface* pEntit // This should be null if (pEntity->m_pMovingList) { - AddReportLog(8640, SString("Removing CPhysical type %d from moving list", pEntity->nType)); + AddReportLog(ReportLogID::PHYSICAL_MOVINGLIST_FIX, SString("Removing CPhysical type %d from moving list", pEntity->nType)); DWORD dwFunc = FUNC_CPhysical_RemoveFromMovingList; __asm { diff --git a/Client/multiplayer_sa/CMultiplayerSA_Rendering.cpp b/Client/multiplayer_sa/CMultiplayerSA_Rendering.cpp index 7ca28580a80..23e1bea2271 100644 --- a/Client/multiplayer_sa/CMultiplayerSA_Rendering.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA_Rendering.cpp @@ -83,7 +83,7 @@ bool IsEntityRenderable(CEntitySAInterface* pEntity) bool bHasRwObject = (pEntity->m_pRwObject != nullptr); if (bIsPlaceable || !bHasRwObject) { - AddReportLog(8645, SString("Error in render list: IsPlaceable:%d HasRwObject:%d", bIsPlaceable, bHasRwObject)); + AddReportLog(ReportLogID::ENTITY_RENDER_NO_RWOBJECT, SString("Error in render list: IsPlaceable:%d HasRwObject:%d", bIsPlaceable, bHasRwObject)); } return !bIsPlaceable && bHasRwObject; } diff --git a/Client/multiplayer_sa/multiplayer_hooksystem.cpp b/Client/multiplayer_sa/multiplayer_hooksystem.cpp index b22a6ff2eaf..1df188319be 100644 --- a/Client/multiplayer_sa/multiplayer_hooksystem.cpp +++ b/Client/multiplayer_sa/multiplayer_hooksystem.cpp @@ -61,5 +61,5 @@ VOID HookCheckOriginalByte(DWORD dwInstallAddress, uchar ucExpectedValue) uchar ucValue = *(uchar*)dwInstallAddress; dassert(ucValue == ucExpectedValue); if (ucValue != ucExpectedValue) - AddReportLog(8423, SString("HookCheckOriginalByte failed at %08x - Got %02x - expected %02x", dwInstallAddress, ucValue, ucExpectedValue)); + AddReportLog(ReportLogID::HOOKSYSTEM_ORIGINAL_BYTE_FAIL, SString("HookCheckOriginalByte failed at %08x - Got %02x - expected %02x", dwInstallAddress, ucValue, ucExpectedValue)); } diff --git a/Client/multiplayer_sa/multiplayersa_init.cpp b/Client/multiplayer_sa/multiplayersa_init.cpp index 015b041d71a..9233520cb3e 100644 --- a/Client/multiplayer_sa/multiplayersa_init.cpp +++ b/Client/multiplayer_sa/multiplayersa_init.cpp @@ -78,9 +78,9 @@ bool GetDebugIdEnabled(uint uiDebugId) return g_pCore->GetDebugIdEnabled(uiDebugId); } -void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, uint uiAddReportLogId) +void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, ReportLogID addReportLogId) { - g_pCore->LogEvent(uiDebugId, szType, szContext, szBody, uiAddReportLogId); + g_pCore->LogEvent(uiDebugId, szType, szContext, szBody, addReportLogId); } void CallGameEntityRenderHandler(CEntitySAInterface* pEntity) diff --git a/Client/multiplayer_sa/multiplayersa_init.h b/Client/multiplayer_sa/multiplayersa_init.h index 36361960ccf..cab425dc135 100644 --- a/Client/multiplayer_sa/multiplayersa_init.h +++ b/Client/multiplayer_sa/multiplayersa_init.h @@ -139,6 +139,6 @@ void MemSubFast(U ptr, const T value) } bool GetDebugIdEnabled(uint uiDebugId); -void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, uint uiAddReportLogId = 0); +void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, ReportLogID addReportLogId = ReportLogID::NONE); void CallGameEntityRenderHandler(CEntitySAInterface* pEntity); extern GameEntityRenderHandler* pGameEntityRenderHandler; diff --git a/Client/sdk/core/CCoreInterface.h b/Client/sdk/core/CCoreInterface.h index bfc30328271..bafca8ae10a 100644 --- a/Client/sdk/core/CCoreInterface.h +++ b/Client/sdk/core/CCoreInterface.h @@ -155,7 +155,7 @@ class CCoreInterface virtual uint GetMaxStreamingMemory() = 0; virtual void OnCrashAverted(uint uiId) = 0; virtual void OnEnterCrashZone(uint uiId) = 0; - virtual void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, uint uiAddReportLogId = 0) = 0; + virtual void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, ReportLogID addReportLogId = ReportLogID::NONE) = 0; virtual bool GetDebugIdEnabled(uint uiDebugId) = 0; virtual EDiagnosticDebugType GetDiagnosticDebug() = 0; virtual void SetDiagnosticDebug(EDiagnosticDebugType value) = 0; diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp index a274604f61a..6b3bd66de02 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp @@ -66,28 +66,28 @@ std::variant CLuaBlipDefs::CreateBlipAttachedTo(lua_State* luaVM, return radarMarker; } -auto CLuaBlipDefs::GetBlipIcon(CBlip* radarMarker) +auto CLuaBlipDefs::GetBlipIcon(CBlip* radarMarker) noexcept { return radarMarker->m_ucIcon; } -auto CLuaBlipDefs::GetBlipSize(CBlip* radarMarker) +auto CLuaBlipDefs::GetBlipSize(CBlip* radarMarker) noexcept { return radarMarker->m_ucSize; } -auto CLuaBlipDefs::GetBlipColor(CBlip* radarMarker) +auto CLuaBlipDefs::GetBlipColor(CBlip* radarMarker) noexcept { SColor color = radarMarker->GetColor(); return CLuaMultiReturn{color.R, color.G, color.B, color.A}; } -auto CLuaBlipDefs::GetBlipOrdering(CBlip* radarMarker) +auto CLuaBlipDefs::GetBlipOrdering(CBlip* radarMarker) noexcept { return radarMarker->m_sOrdering; } -auto CLuaBlipDefs::GetBlipVisibleDistance(CBlip* radarMarker) +auto CLuaBlipDefs::GetBlipVisibleDistance(CBlip* radarMarker) noexcept { return radarMarker->m_usVisibleDistance; } diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.h b/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.h index 75b9eb3a510..298486ef814 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.h +++ b/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.h @@ -24,11 +24,11 @@ class CLuaBlipDefs : public CLuaDefs static std::variant CreateBlipAttachedTo(lua_State* luaVM, CElement* entity, std::optional icon, std::optional size, std::optional r, std::optional g, std::optional b, std::optional a, std::optional ordering, std::optional visibleDistance, std::optional visibleTo); // Get functions - static auto GetBlipIcon(CBlip* radarMarker); - static auto GetBlipSize(CBlip* radarMarker); - static auto GetBlipColor(CBlip* radarMarker); - static auto GetBlipOrdering(CBlip* radarMarker); - static auto GetBlipVisibleDistance(CBlip* radarMarker); + static auto GetBlipIcon(CBlip* radarMarker) noexcept; + static auto GetBlipSize(CBlip* radarMarker) noexcept; + static auto GetBlipColor(CBlip* radarMarker) noexcept; + static auto GetBlipOrdering(CBlip* radarMarker) noexcept; + static auto GetBlipVisibleDistance(CBlip* radarMarker) noexcept; // Set functions static bool SetBlipIcon(CElement* radarMarker, std::uint8_t icon); diff --git a/Shared/mods/deathmatch/logic/Utils.cpp b/Shared/mods/deathmatch/logic/Utils.cpp index e3107c77a68..e041041cccc 100644 --- a/Shared/mods/deathmatch/logic/Utils.cpp +++ b/Shared/mods/deathmatch/logic/Utils.cpp @@ -129,7 +129,7 @@ void RaiseFatalError(unsigned int uiCode) g_pCore->ShowErrorMessageBox(_("Fatal error") + _E("CD62"), strBuffer, strTroubleLink); // Request the mod unload - AddReportLog(7108, SString("Game - RaiseFatalError %d", uiCode)); + AddReportLog(ReportLogID::GAME_FATAL_ERROR, SString("Game - RaiseFatalError %d", uiCode)); g_pCore->GetModManager()->RequestUnload(); } @@ -146,7 +146,7 @@ void RaiseProtocolError(unsigned int uiCode) // Request the mod unload g_pCore->GetModManager()->RequestUnload(); - AddReportLog(7109, SString("Game - RaiseProtocolError %d", uiCode)); + AddReportLog(ReportLogID::GAME_PROTOCOL_ERROR, SString("Game - RaiseProtocolError %d", uiCode)); } void RotateVector(CVector& vecLine, const CVector& vecRotation) diff --git a/Shared/sdk/SharedUtil.Misc.h b/Shared/sdk/SharedUtil.Misc.h index 7a2218cc293..18bfa4c7517 100644 --- a/Shared/sdk/SharedUtil.Misc.h +++ b/Shared/sdk/SharedUtil.Misc.h @@ -22,6 +22,8 @@ #include "SharedUtil.Defines.h" #include "SharedUtil.Map.h" +#include "enums/ReportLogID.h" + #if __cplusplus >= 201703L // C++17 #ifndef __GLIBCXX__ namespace std @@ -125,7 +127,7 @@ namespace SharedUtil // // For tracking results of new features // - void AddReportLog(uint uiId, const SString& strText, uint uiAmountLimit = 0); + void AddReportLog(ReportLogID id, const SString& strText, uint uiAmountLimit = 0); void AddExceptionReportLog(uint uiId, const char* szExceptionName, const char* szExceptionText); void SetReportLogContents(const SString& strText); SString GetReportLogContents(); diff --git a/Shared/sdk/SharedUtil.Misc.hpp b/Shared/sdk/SharedUtil.Misc.hpp index 0998adfe3ee..67ec5d566ad 100644 --- a/Shared/sdk/SharedUtil.Misc.hpp +++ b/Shared/sdk/SharedUtil.Misc.hpp @@ -46,7 +46,7 @@ #endif CCriticalSection CRefCountable::ms_CS; -std::map ms_ReportAmountMap; +std::map ms_ReportAmountMap; SString ms_strProductRegistryPath; SString ms_strProductCommonDataDir; SString ms_strProductVersion; @@ -54,9 +54,9 @@ SString ms_strProductVersion; struct SReportLine { SString strText; - uint uiId; + ReportLogID id; void operator+=(const char* szAppend) { strText += szAppend; } - bool operator==(const SReportLine& other) const { return strText == other.strText && uiId == other.uiId; } + bool operator==(const SReportLine& other) const { return strText == other.strText && id == other.id; } }; CDuplicateLineFilter ms_ReportLineFilter; @@ -352,7 +352,7 @@ bool SharedUtil::GetOnRestartCommand(SString& strOperation, SString& strFile, SS strShowCmd = vecParts[4]; return true; } - AddReportLog(4000, SString("OnRestartCommand disregarded due to version change %s -> %s", vecParts[5].c_str(), strVersion.c_str())); + AddReportLog(ReportLogID::ON_RESTART_CMD_FAIL, SString("OnRestartCommand disregarded due to version change %s -> %s", vecParts[5].c_str(), strVersion.c_str())); } return false; } @@ -680,7 +680,7 @@ SString SharedUtil::GetClipboardText() // void SharedUtil::BrowseToSolution(const SString& strType, int iFlags, const SString& strMessageBoxMessage, const SString& strErrorCode) { - AddReportLog(3200, SString("Trouble %s", *strType)); + AddReportLog(ReportLogID::TROUBLE, SString("Trouble %s", *strType)); // Put args into a string and save in the registry CArgMap argMap; @@ -796,28 +796,28 @@ static SString GetReportLogHeaderText() return strResult.TrimEnd(" ") + "]"; } -void SharedUtil::AddReportLog(uint uiId, const SString& strText, uint uiAmountLimit) +void SharedUtil::AddReportLog(ReportLogID id, const SString& strText, uint uiAmountLimit) { if (uiAmountLimit) { - uint& uiAmount = MapGet(ms_ReportAmountMap, uiId); + uint& uiAmount = MapGet(ms_ReportAmountMap, id); if (uiAmount++ >= uiAmountLimit) return; } - ms_ReportLineFilter.AddLine({strText, uiId}); + ms_ReportLineFilter.AddLine({strText, id}); SReportLine line; while (ms_ReportLineFilter.PopOutputLine(line)) { const SString& strText = line.strText; - uint uiId = line.uiId; + ReportLogID id = line.id; SString strPathFilename = PathJoin(GetMTADataPath(), "report.log"); MakeSureDirExists(strPathFilename); SString strMessage; - strMessage.Format("%u: %s %s [%s] - ", uiId, GetTimeString(true, false).c_str(), GetReportLogHeaderText().c_str(), + strMessage.Format("%u: %s %s [%s] - ", id, GetTimeString(true, false).c_str(), GetReportLogHeaderText().c_str(), GetReportLogProcessTag().c_str()); strMessage += strText; strMessage += "\n"; diff --git a/Shared/sdk/SharedUtil.SysInfo.hpp b/Shared/sdk/SharedUtil.SysInfo.hpp index e79751ca4f1..0eebaf09005 100644 --- a/Shared/sdk/SharedUtil.SysInfo.hpp +++ b/Shared/sdk/SharedUtil.SysInfo.hpp @@ -118,7 +118,7 @@ bool SharedUtil::QueryWMI(SQueryWMIResult& outResult, const SString& strQuery, c if (FAILED(hres)) { - AddReportLog(9130, SString("QueryWMI - Failed to create IWbemLocator object. Error code = %x (%s)", hres, *strQuery)); + AddReportLog(ReportLogID::QUERYWMI_FAIL, SString("QueryWMI - Failed to create IWbemLocator object. Error code = %x (%s)", hres, *strQuery)); return false; } @@ -144,7 +144,7 @@ bool SharedUtil::QueryWMI(SQueryWMIResult& outResult, const SString& strQuery, c if (FAILED(hres)) { pLoc->Release(); - AddReportLog(9135, SString("QueryWMI - Could not connect. Error code = %x (%s)", hres, *strQuery)); + AddReportLog(ReportLogID::QUERYWMI_CONNECT_FAIL, SString("QueryWMI - Could not connect. Error code = %x (%s)", hres, *strQuery)); return false; } @@ -165,7 +165,7 @@ bool SharedUtil::QueryWMI(SQueryWMIResult& outResult, const SString& strQuery, c { pSvc->Release(); pLoc->Release(); - AddReportLog(9136, SString("QueryWMI - Could not set proxy blanket. Error code = %x (%s)", hres, *strQuery)); + AddReportLog(ReportLogID::QUERYWMI_PROXY_FAIL, SString("QueryWMI - Could not set proxy blanket. Error code = %x (%s)", hres, *strQuery)); return false; } @@ -179,7 +179,7 @@ bool SharedUtil::QueryWMI(SQueryWMIResult& outResult, const SString& strQuery, c { pSvc->Release(); pLoc->Release(); - AddReportLog(9137, SString("QueryWMI - Query failed. Error code = %x (%s)", hres, *strQuery)); + AddReportLog(ReportLogID::QUERYWMI_QUERY_FAIL, SString("QueryWMI - Query failed. Error code = %x (%s)", hres, *strQuery)); return false; } @@ -203,7 +203,7 @@ bool SharedUtil::QueryWMI(SQueryWMIResult& outResult, const SString& strQuery, c if (hr == STATUS_ACCESS_VIOLATION) { - AddReportLog(9130, SString("QueryWMI pEnumerator->Next returned STATUS_ACCESS_VIOLATION for %s", *strQuery)); + AddReportLog(ReportLogID::QUERYWMI_FAIL, SString("QueryWMI pEnumerator->Next returned STATUS_ACCESS_VIOLATION for %s", *strQuery)); break; } @@ -214,13 +214,13 @@ bool SharedUtil::QueryWMI(SQueryWMIResult& outResult, const SString& strQuery, c if (hr != WBEM_S_NO_ERROR) { - AddReportLog(9131, SString("QueryWMI pEnumerator->Next returned %08x for %s", hr, *strQuery)); + AddReportLog(ReportLogID::QUERYWMI_ENUMERATOR_FAIL, SString("QueryWMI pEnumerator->Next returned %08x for %s", hr, *strQuery)); break; } if (pclsObj == NULL) { - AddReportLog(9132, SString("QueryWMI pclsObj == NULL returned %08x for %s", hr, *strQuery)); + AddReportLog(ReportLogID::QUERYWMI_PCLSOBJ_FAIL, SString("QueryWMI pclsObj == NULL returned %08x for %s", hr, *strQuery)); break; } @@ -248,7 +248,7 @@ bool SharedUtil::QueryWMI(SQueryWMIResult& outResult, const SString& strQuery, c } else { - AddReportLog(9133, SString("QueryWMI pclsObj->Get returned %08x for key %d in %s", hr, i, *strQuery)); + AddReportLog(ReportLogID::QUERYWMI_PCLSOBJ_RESULT, SString("QueryWMI pclsObj->Get returned %08x for key %d in %s", hr, i, *strQuery)); } outResult.back().insert(outResult.back().end(), strValue); diff --git a/Shared/sdk/enums/ReportLogID.h b/Shared/sdk/enums/ReportLogID.h new file mode 100644 index 00000000000..1ccfabda294 --- /dev/null +++ b/Shared/sdk/enums/ReportLogID.h @@ -0,0 +1,240 @@ +/***************************************************************************** + * + * PROJECT: Multi Theft Auto + * LICENSE: See LICENSE in the top level directory + * FILE: sdk/ReportLogID.h + * PURPOSE: Header for common definitions + * + * Multi Theft Auto is available from https://www.multitheftauto.com/ + * + *****************************************************************************/ + +#pragma once + +enum class ReportLogID +{ + NONE = 0, + + WEAPON_FIRE_ANIM_CRASH_FIX_GROUP = 533, + WEAPON_FIRE_ANIM_CRASH_FIX_INTERFACE = 534, + + CORRUPT_ANIM_ASSOC_GROUP_INTERFACE = 542, + INVALID_ANIM_ASSOC_GROUP_INTERFACE = 543, + ANIM_ASSOC_GROUP_INTERFACE_NULL_BLOCK = 544, + + ASSOC_GROUPS_ADDRESS_LOG = 567, + + ANIM_TRANSLATION_FAIL = 588, + + DOWNLOAD_SCRIPT_ERROR = 1002, + INSTALL_MGR_CHANGEFROMADMIN = 1003, + DEOBFUSCATION_LOADSTRING_FAIL = 1004, + DEOBFUSCATION_LOAD_FAIL = 1005, + + RESOURCE_LOAD_FAIL = 1007, + RESOURCE_NOT_READY_LOAD = 1008, + RESOURCESTART_DELETE_FILE_FAIL = 1009, + + APPLY_DAMAGE_NET_FIX = 1010, + + HTTP_FILE_MISMATCH = 1011, + HTTP_DOWNLOAD_ERROR = 1012, + DOWNLOAD_FILE_ERROR = 1013, + + INSTALL_MGR_LAUNCH = 1041, + LOADER_DOMAIN_FINISH = 1044, + INSTALL_MGR_CONTINUE_EXCEPTION = 1045, + INSTALL_MGR_LAUNCHGAME_EXCEPTION = 1046, + INSTALL_MGR_LAUNCH_FINISH = 1060, + INSTALL_MGR_SEQ_STATE = 1061, // CInstallManager::RestoreSequencerState + INSTALL_MGR_GET_PATH = 1062, + + SEQUENCER_CALL_FUNC = 1070, + SEQUENCER_LOG = 1071, + + VER_UPD_POLLDOWNLOAD_RESPONSE = 2005, // DoPollDownload: Downloaded X bytes + VER_UPD_POLLDOWNLOAD_SUCCESS = 2007, // DoPollDownload: Downloaded + + INSTALL_MGR_INSTALL_SUCCESS = 2050, + INSTALL_MGR_INSTALL_NEWS_SUCCESS = 2051, + + RESOURCESTART_FATAL_ERROR = 2081, + + VER_UPD_XML_SAVE_FAIL = 2501, // CXMLBuffer::SetFromBuffer: Could not save file + VER_UPD_XML_CREATE_FAIL = 2502, // CXMLBuffer::SetFromBuffer: Could not CreateXML + VER_UPD_XML_PARSE_FAIL = 2503, // CXMLBuffer::SetFromBuffer: Could not parse file + VER_UPD_XML_MISSING_ROOT = 2504, // CXMLBuffer::SetFromBuffer: No root node in file + + INSTALL_MGR_AS_ADMIN = 3048, + INSTALL_MGR_GTA_DLL = 3052, // _PrepareLaunchLocation: Copying + + GAME_PLAYER_TRANSGRESSION = 3100, // + + DLL_DIR_FAIL = 3119, // DllDirectory path invalid + CRASH_INFO = 3120, + + TROUBLE = 3200, + + NEWS_LAYOUT_FAIL = 3302, // CNewsBrowser::LoadLayout problem loading file + NEWS_LAYOUT_IMAGESET_FAIL = 3303, // CNewsBrowser::LoadLayout: Problem with LoadImageset + NEW_LAYOUT_LOAD_FAIL = 3304, // CNewsBrowser::LoadLayout: Problem with LoadLayout + + SERVER_IMPORTANT_MSG = 3400, + + ON_RESTART_CMD_FAIL = 4000, // OnRestartCommand disregarded due to version change + ON_RESTART_CMD_RESULT = 4047, + + INSTALL_MGR_INSTALL_NEWS_FAIL = 4048, + + LOADER_DELETED_GTA_SETTINGS = 4053, + + VER_UPD_POLLDOWNLOAD_FAIL = 4002, // DoPollDownload: Regular fail + VER_UPD_POLLDOWNLOAD_CHECKSUM_FAIL = 5003, // DoPollDownload: Checksum wrong + VER_UPD_POLLDOWNLOAD_PATH_FAIL = 5004, // DoPollDownload: Unable to use the path + VER_UPD_POLLDOWNLOAD_SAVE_FAIL = 5005, // DoPollDownload: Unable to save the file + VER_UPD_POLLDOWNLOAD_SIGNATURE_FAIL = 5006, // DoPollDownload: Signature wrong + VER_UPD_RESUMABLE_EXISTS = 5008, // Found existing file to resume download + VER_UPD_POLLDOWNLOAD_URL_FAIL = 5007, // DoPollDownload: Fail for URL + VER_UPD_RESUMABLE_NEW = 5009, // Save new file + INSTALL_MGR_FAIL = 5049, + CHECK_ON_RESTART_CMD_UNKNOWN = 5052, // CheckOnRestartCommand: Unknown restart command + FILEGEN_PATCH_FAIL = 5053, // IsPatchBase: Incorrect file & IsPatchDiff: Incorrect file + LOADER_DELETE_GTA_SETTINGS_FAIL = 5054, + LOADER_INSTALL_FAIL = 5055, // Install.cpp for Loader project + VER_UPD_RESPONSE = 5061, // Processing patch file + VER_UPD_STARTDOWNLOAD_CHECKSUM_FAIL = 5807, // StartDownload: Cached file reuse - Size correct, but md5 did not match + VER_UPD_STARTDOWNLOAD_SIGNATURE_FAIL = 5808, // StartDownload: Cached file reuse - Size and md5 correct, but signature incorrect + VER_UPD_STARTDOWNLOAD_SUCCESS = 5809, // StartDownload: Cached file reuse - Size, md5 and signature correct + + RTL_FOPEN_FAIL = 5321, + + VEHICLE_MODEL_FRAME_FIX = 5412, + VEHICLE_MODEL_FRAME_FAIL = 5413, + MODEL_NO_MODEL_INFO = 5414, + MODEL_NO_COL_INFO = 5415, + MODEL_NOT_LOADED = 5416, + MODEL_BAD_ANIM_HIERARCHY = 5418, + PED_NO_ANIM_HIERARCHY = 5421, + + REMOTE_WEAPON_SLOT_MISMATCH = 5430, // CClientPed::ValidateRemoteWeapons + LOAD_ANIMATION_FAIL = 5431, // Failed to load animation + REMOT_WEAPON_TYPE_MISMATCH = 5432, // DischargeWeapon adding missing weapon + + BULLETSYNC_DMG = 5501, // 2nd pass 1 for BulletSyncShot damage + BULLETSYNC_NOWEAPON = 5502, // BulletSyncShot but not bBulletSyncWeapon + BULLETSYNC_WEAPON_NOSYNC = 5503, // not BulletSyncShot but bBulletSyncWeapon + + OBJECT_MODEL_NO_COL_OR_INFO = 5601, + + LOADER_MODULE_LOAD_FAIL = 5711, + LOADER_MODULE_MAIN_FAIL = 5714, // Failed to find DoWinMain in loader DLL + LOADER_INVALID_DLL_PATH = 5716, + LOADER_DLL_NOT_EXISTS = 5717, + LOADER_DLL_INVALID_SIGNATURE = 5718, + LOADER_LOADLIBRARY_FAIL = 5719, + LOADER_PROXY_LAUNCH_LOG = 5720, + LOADER_ELEVATED_PRIVILEGE = 5750, + LOADER_EXCEPTION = 5751, // Exception in DoWinMain + + WAIT_FOR_SINGLE_OBJECT_TIMED_OUT = 6211, + + GTA_PRINTF = 6311, + + CHAT_RT_FAIL = 6532, // Chat rendertarget creation fail + FORBODEN_PROGRAM_DETECTED = 6550, + + MODEL_INFO_LOAD_FAIL = 6641, // Blocking load fail + MODEL_INFO_LOAD_SUCCESS = 6642, // Blocking load + + RESOURCE_FILE_MODIFY = 7059, // Resource file modifed by script + + CORE_NET_ERROR = 7100, + CORE_QUIT = 7101, + CORE_PROCESS_DETACH = 7102, + + LOADER_FINISH = 7104, + GAME_KICKED = 7105, + GAME_HTTPERROR = 7106, + GAME_DISCONNECT = 7107, + GAME_FATAL_ERROR = 7108, + GAME_PROTOCOL_ERROR = 7109, + GAME_CMD_DISCONNECT = 7110, // Game - COMMAND_Disconnect + LOADER_ELEVATED_PRIVILEGE_REQUEST = 7115, + + VIDEO_ENUMSETTINGS_FAIL = 7340, // EnumDisplaySettings failed + VIDEO_DISPLAYSETTINGS_FAIL = 7341, // ChangeDisplaySettingsEx failed + + GAME_FILECACHE_ROOT_NOSHARED = 7410, // CClientGame::SetFileCacheRoot - Not shared + GAME_FILECACHE_ROOT_SHARED = 7411, // CClientGame::SetFileCacheRoot - Is shared + GAME_FILECACHE_ROOT_INIT = 7412, // CClientGame::SetFileCacheRoot - Initial setting + GAME_FILECACHE_ROOT_MODIFY = 7413, // CClientGame::SetFileCacheRoot - Change shared + + OBJECTS_LIMIT_REACHED = 7430, // CClientObjectManager reached limit + + NVIDIA_OPTIMUS_DETECTED = 7460, // NvAPI NvOptimusDetect + NVIDIA_OPTIMUS_GPU_RESULT = 7461, + + CLOTHES_GEOM_REFS_BELOW = 7521, + + D3D_EFFECT_TEMPLATE_CREATED = 7544, // NewEffectTemplate + LUA_UNDUMP_HASH_FAIL = 7555, // Unexpected undump hash for buffer + + TERMINATE_PROCESS_CHECKSERVICE = 8070, // Utils.cpp - TerminateProcess & CheckService + + ENTITY_ADD_PROTOCOL_ERROR = 8331, // RaiseEntityAddError + ENTITY_ADD_ERROR_OFFSET = 8332, // RaiseEntityAddError + + TXD_RIGHTSIZE_ERROR = 8430, + + TASK_SIMPLE_FALLOUT_VFTBL = 8530, // IsTaskSimpleCarFallOutValid fail + TASK_SIMPLE_FALLOUT_VEHPTR = 8531, // IsTaskSimpleCarFallOutValid invalid vehicle ptr + + PRELOAD_UPGRADE_FALLEN = 8544, // Report if LowestUnsafeUpgrade has fallen + PRELOAD_UPGRADE_CACHE_CRASH = 8545, // Auto crash fix for crash in CModelCacheManagerImpl::PreLoad + + D3D_VERTEXBUFFER_FAIL = 8610, // CreateVertexBuffer fail + D3D_INDEXBUFFER_FAIL = 8611, // CreateIndexBuffer fail + D3D_TEXTURE_FAIL = 8612, // CreateTexture fail + D3D_VERTEXDECL_FAIL = 8613, // CreateVertexDecl fail + D3D_LOCK_VERTEXBUFFER_FAIL = 8620, // Lock VertexBuffer fail + D3D_LOCK_VERTEXBUFFER_NULL = 8621, // Lock VertexBuffer result NULL + D3D_LOCK_VERTEXBUFFER_OOR = 8622, // Offset out of range + D3D_LOCK_VERTEXBUFFER_AV = 8623, // Access violation + D3D_LOCK_INDEXBUFFER_FAIL = 8625, // Lock IndexBuffer fail + D3D_LOCK_INDEXBUFFER_NULL = 8626, // Lock IndexBuffer result NULL + D3D_CREATEDEVICE_OTHER_THREAD = 8627, // Check for calls to CreateDevice from other threads + + HOOKSYSTEM_ORIGINAL_BYTE_FAIL = 8423, + + PHYSICAL_MOVINGLIST_FIX = 8640, + ENTITY_RENDER_NO_RWOBJECT = 8645, + + QUESTIONBOX_SHOW = 9100, + + QUERYWMI_FAIL = 9130, + QUERYWMI_ENUMERATOR_FAIL = 9131, + QUERYWMI_PCLSOBJ_FAIL = 9132, + QUERYWMI_PCLSOBJ_RESULT = 9133, + QUERYWMI_CONNECT_FAIL = 9135, + QUERYWMI_PROXY_FAIL = 9136, + QUERYWMI_QUERY_FAIL = 9137, + + DBGHELP_FAIL = 9201, // Could not load DBGHELP.DLL + DBGHELP_MINIDUMPWRITEDUMP_FAIL = 9202, // Could not find MiniDumpWriteDump function in DBGHELP.DLL + CREATE_DMP_FAIL = 9203, // CCrashDumpWriter::DumpMiniDump - Could not create core.dmp file + DMP_MINIDUMPWRITEDUMP_FAIL = 9204, // MiniDumpWriteDump function in DBGHELP.DLL fail + DISABLE_VOLUMETRIC_SHADOWS = 9205, // Auto crash fix if last crash was in volumetric shadow code + INVALID_PARAMETER_COUNT = 9206, // CCrashDumpWriter invalid parameter (CCrashDumpWriter::UpdateCounters) + + LOADER_HANDLE_NOTUSED_MAINMENU = 9310, + LOADER_HANDLE_NOTUSED_MAINMENU_CHANGE = 9311, + LOADER_HANDLE_NOTUSED_MAINMENU_BORDERLESS_SET = 9312, + LOADER_HANDLE_NOTUSED_MAINMENU_USER_NO = 9313, + LOADER_HANDLE_NOTUSED_MAINMENU_NOT_FSCREEN = 9314, + LOADER_HANDLE_NOTUSED_MAINMENU_BORDERLESS_IS = 9315, + + TXD_SHRUNK = 9400, // CClientTXD::GetFilenameToUse + GRAPHICS_FONTRESOURCE_EX_FAIL = 9442, // Problem with AddFontResourceEx + + D3D_VERSION_FAIL = 9640, // D3DXCheckVersion FAILED +}; From 19ba79474d143ffd87b1536a00fd59777072c958 Mon Sep 17 00:00:00 2001 From: FileEX Date: Mon, 1 Sep 2025 21:34:30 +0200 Subject: [PATCH 2/3] Delete unnecessary include --- Client/core/CCore.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Client/core/CCore.h b/Client/core/CCore.h index 137c9ab21af..b266ff95eaa 100644 --- a/Client/core/CCore.h +++ b/Client/core/CCore.h @@ -42,8 +42,6 @@ class CDiscordInterface; #include #include "CTrayIcon.h" -#include - #define DIRECTINPUT_VERSION 0x0800 #include From d9591056f033e6064a81de26dfc409a6eff0470b Mon Sep 17 00:00:00 2001 From: FileEX Date: Mon, 1 Sep 2025 21:36:42 +0200 Subject: [PATCH 3/3] Clean up the mess --- Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp | 10 +++++----- Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.h | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp index 6b3bd66de02..a274604f61a 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp @@ -66,28 +66,28 @@ std::variant CLuaBlipDefs::CreateBlipAttachedTo(lua_State* luaVM, return radarMarker; } -auto CLuaBlipDefs::GetBlipIcon(CBlip* radarMarker) noexcept +auto CLuaBlipDefs::GetBlipIcon(CBlip* radarMarker) { return radarMarker->m_ucIcon; } -auto CLuaBlipDefs::GetBlipSize(CBlip* radarMarker) noexcept +auto CLuaBlipDefs::GetBlipSize(CBlip* radarMarker) { return radarMarker->m_ucSize; } -auto CLuaBlipDefs::GetBlipColor(CBlip* radarMarker) noexcept +auto CLuaBlipDefs::GetBlipColor(CBlip* radarMarker) { SColor color = radarMarker->GetColor(); return CLuaMultiReturn{color.R, color.G, color.B, color.A}; } -auto CLuaBlipDefs::GetBlipOrdering(CBlip* radarMarker) noexcept +auto CLuaBlipDefs::GetBlipOrdering(CBlip* radarMarker) { return radarMarker->m_sOrdering; } -auto CLuaBlipDefs::GetBlipVisibleDistance(CBlip* radarMarker) noexcept +auto CLuaBlipDefs::GetBlipVisibleDistance(CBlip* radarMarker) { return radarMarker->m_usVisibleDistance; } diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.h b/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.h index 298486ef814..75b9eb3a510 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.h +++ b/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.h @@ -24,11 +24,11 @@ class CLuaBlipDefs : public CLuaDefs static std::variant CreateBlipAttachedTo(lua_State* luaVM, CElement* entity, std::optional icon, std::optional size, std::optional r, std::optional g, std::optional b, std::optional a, std::optional ordering, std::optional visibleDistance, std::optional visibleTo); // Get functions - static auto GetBlipIcon(CBlip* radarMarker) noexcept; - static auto GetBlipSize(CBlip* radarMarker) noexcept; - static auto GetBlipColor(CBlip* radarMarker) noexcept; - static auto GetBlipOrdering(CBlip* radarMarker) noexcept; - static auto GetBlipVisibleDistance(CBlip* radarMarker) noexcept; + static auto GetBlipIcon(CBlip* radarMarker); + static auto GetBlipSize(CBlip* radarMarker); + static auto GetBlipColor(CBlip* radarMarker); + static auto GetBlipOrdering(CBlip* radarMarker); + static auto GetBlipVisibleDistance(CBlip* radarMarker); // Set functions static bool SetBlipIcon(CElement* radarMarker, std::uint8_t icon);