Skip to content

Commit 30cd69d

Browse files
committed
ReportLogID enum
1 parent 2994b28 commit 30cd69d

File tree

68 files changed

+512
-269
lines changed

Some content is hidden

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

68 files changed

+512
-269
lines changed

Client/core/CChat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ void CChat::Draw(bool bUseCacheTexture, bool bAllowOutline)
222222
if (m_iReportCount < 5)
223223
{
224224
m_iReportCount++;
225-
AddReportLog(6532, SString("Chat rt chatSize:%2.0f %2.0f rtsize:%d %d card:%s", chatSize.fX, chatSize.fY, iRenderTargetSizeX,
225+
AddReportLog(ReportLogID::CHAT_RT_FAIL, SString("Chat rt chatSize:%2.0f %2.0f rtsize:%d %d card:%s", chatSize.fX, chatSize.fY, iRenderTargetSizeX,
226226
iRenderTargetSizeY, g_pDeviceState->AdapterState.Name.c_str()));
227227
}
228228
}

Client/core/CCore.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ void CCore::ShowNetErrorMessageBox(const SString& strTitle, SString strMessage,
779779
else if (bLinkRequiresErrorCode)
780780
strTroubleLink = ""; // No link if no error code
781781

782-
AddReportLog(7100, SString("Core - NetError (%s) (%s)", *strTitle, *strMessage));
782+
AddReportLog(ReportLogID::CORE_NET_ERROR, SString("Core - NetError (%s) (%s)", *strTitle, *strMessage));
783783
ShowErrorMessageBox(strTitle, strMessage, strTroubleLink);
784784
}
785785

@@ -906,7 +906,7 @@ void LoadModule(CModuleLoader& m_Loader, const SString& strName, const SString&
906906
SString strDllDirectory = GetSystemDllDirectory();
907907
if (CalcMTASAPath("mta").CompareI(strDllDirectory) == false)
908908
{
909-
AddReportLog(3119, SString("DllDirectory wrong: DllDirectory:'%s' Path:'%s'", *strDllDirectory, *CalcMTASAPath("mta")));
909+
AddReportLog(ReportLogID::DLL_DIR_FAIL, SString("DllDirectory wrong: DllDirectory:'%s' Path:'%s'", *strDllDirectory, *CalcMTASAPath("mta")));
910910
SetDllDirectory(CalcMTASAPath("mta"));
911911
}
912912

@@ -1457,7 +1457,7 @@ void CCore::Quit(bool bInstantly)
14571457
{
14581458
if (bInstantly)
14591459
{
1460-
AddReportLog(7101, "Core - Quit");
1460+
AddReportLog(ReportLogID::CORE_QUIT, "Core - Quit");
14611461
// Show that we are quiting (for the crash dump filename)
14621462
SetApplicationSettingInt("last-server-ip", 1);
14631463

@@ -2155,10 +2155,10 @@ void CCore::OnEnterCrashZone(uint uiId)
21552155
//
21562156
// LogEvent
21572157
//
2158-
void CCore::LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, uint uiAddReportLogId)
2158+
void CCore::LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, ReportLogID addReportLogId)
21592159
{
2160-
if (uiAddReportLogId)
2161-
AddReportLog(uiAddReportLogId, SString("%s - %s", szContext, szBody));
2160+
if (addReportLogId != ReportLogID::NONE)
2161+
AddReportLog(addReportLogId, SString("%s - %s", szContext, szBody));
21622162

21632163
if (GetDebugIdEnabled(uiDebugId))
21642164
{

Client/core/CCore.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ class CDiscordInterface;
4242
#include <core/CWebCoreInterface.h>
4343
#include "CTrayIcon.h"
4444

45+
#include <enums/ReportLogID.h>
46+
4547
#define DIRECTINPUT_VERSION 0x0800
4648
#include <dinput.h>
4749

@@ -252,7 +254,7 @@ class CCore : public CCoreInterface, public CSingleton<CCore>
252254
void OnDeviceRestore();
253255
void OnCrashAverted(uint uiId);
254256
void OnEnterCrashZone(uint uiId);
255-
void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, uint uiAddReportLogId = 0);
257+
void LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, ReportLogID addReportLogId = ReportLogID::NONE);
256258
bool GetDebugIdEnabled(uint uiDebugId);
257259
EDiagnosticDebugType GetDiagnosticDebug();
258260
void SetDiagnosticDebug(EDiagnosticDebugType value);

Client/core/CCrashDumpWriter.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void CCrashDumpWriter::UpdateCounters()
138138
{
139139
if (ms_uiInvalidParameterCount > ms_uiInvalidParameterCountLogged && ms_uiInvalidParameterCountLogged < 10)
140140
{
141-
AddReportLog(9206, SString("InvalidParameterCount changed from %d to %d", ms_uiInvalidParameterCountLogged, ms_uiInvalidParameterCount));
141+
AddReportLog(ReportLogID::INVALID_PARAMETER_COUNT, SString("InvalidParameterCount changed from %d to %d", ms_uiInvalidParameterCountLogged, ms_uiInvalidParameterCount));
142142
ms_uiInvalidParameterCountLogged = ms_uiInvalidParameterCount;
143143
}
144144
}
@@ -321,22 +321,22 @@ void CCrashDumpWriter::DumpMiniDump(_EXCEPTION_POINTERS* pException, CExceptionI
321321
}
322322

323323
if (!hDll)
324-
AddReportLog(9201, "CCrashDumpWriter::DumpMiniDump - Could not load DBGHELP.DLL");
324+
AddReportLog(ReportLogID::DBGHELP_FAIL, "CCrashDumpWriter::DumpMiniDump - Could not load DBGHELP.DLL");
325325

326326
// We could load a dll?
327327
if (hDll)
328328
{
329329
// Grab the MiniDumpWriteDump proc address
330330
auto pDump = reinterpret_cast<MINIDUMPWRITEDUMP>(static_cast<void*>(GetProcAddress(hDll, "MiniDumpWriteDump")));
331331
if (!pDump)
332-
AddReportLog(9202, "CCrashDumpWriter::DumpMiniDump - Could not find MiniDumpWriteDump");
332+
AddReportLog(ReportLogID::DBGHELP_MINIDUMPWRITEDUMP_FAIL, "CCrashDumpWriter::DumpMiniDump - Could not find MiniDumpWriteDump");
333333

334334
if (pDump)
335335
{
336336
// Create the file
337337
HANDLE hFile = CreateFile(CalcMTASAPath("mta\\core.dmp"), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
338338
if (hFile == INVALID_HANDLE_VALUE)
339-
AddReportLog(9203, SString("CCrashDumpWriter::DumpMiniDump - Could not create '%s'", *CalcMTASAPath("mta\\core.dmp")));
339+
AddReportLog(ReportLogID::CREATE_DMP_FAIL, SString("CCrashDumpWriter::DumpMiniDump - Could not create '%s'", *CalcMTASAPath("mta\\core.dmp")));
340340

341341
if (hFile != INVALID_HANDLE_VALUE)
342342
{
@@ -351,7 +351,7 @@ void CCrashDumpWriter::DumpMiniDump(_EXCEPTION_POINTERS* pException, CExceptionI
351351
(MINIDUMP_TYPE)(MiniDumpNormal | MiniDumpWithIndirectlyReferencedMemory), &ExInfo, NULL, NULL);
352352

353353
if (!bResult)
354-
AddReportLog(9204, SString("CCrashDumpWriter::DumpMiniDump - MiniDumpWriteDump failed (%08x)", GetLastError()));
354+
AddReportLog(ReportLogID::DMP_MINIDUMPWRITEDUMP_FAIL, SString("CCrashDumpWriter::DumpMiniDump - MiniDumpWriteDump failed (%08x)", GetLastError()));
355355
else
356356
WriteDebugEvent("CCrashDumpWriter::DumpMiniDump - MiniDumpWriteDump succeeded");
357357

@@ -498,7 +498,7 @@ void CCrashDumpWriter::DumpMiniDump(_EXCEPTION_POINTERS* pException, CExceptionI
498498
{
499499
CVARS_SET("volumetric_shadows", false);
500500
CCore::GetSingleton().SaveConfig();
501-
AddReportLog(9205, "Disabled volumetric shadows");
501+
AddReportLog(ReportLogID::DISABLE_VOLUMETRIC_SHADOWS, "Disabled volumetric shadows");
502502
}
503503

504504
CNet* pNet = CCore::GetSingleton().GetNetwork();
@@ -529,7 +529,7 @@ void CCrashDumpWriter::RunErrorTool(CExceptionInformation* pExceptionInformation
529529
pExceptionInformation->GetEIP(), pExceptionInformation->GetEFlags(), pExceptionInformation->GetCS(), pExceptionInformation->GetDS(),
530530
pExceptionInformation->GetSS(), pExceptionInformation->GetES(), pExceptionInformation->GetFS(), pExceptionInformation->GetGS());
531531

532-
AddReportLog(3120, strMessage);
532+
AddReportLog(ReportLogID::CRASH_INFO, strMessage);
533533

534534
// Try relaunch with crashed flag
535535
SString strMTASAPath = GetMTASABaseDir();

Client/core/CModManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ bool CModManager::TryStart()
148148

149149
if (CalcMTASAPath("mta").CompareI(dllSearchPath) == false)
150150
{
151-
AddReportLog(3119, SString("DllDirectory wrong: DllDirectory:'%s' Path:'%s'", *dllSearchPath, *CalcMTASAPath("mta")));
151+
AddReportLog(ReportLogID::DLL_DIR_FAIL, SString("DllDirectory wrong: DllDirectory:'%s' Path:'%s'", *dllSearchPath, *CalcMTASAPath("mta")));
152152
SetDllDirectory(CalcMTASAPath("mta"));
153153
}
154154

Client/core/CModelCacheManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void CModelCacheManagerImpl::PreLoad()
159159
// Crashed during previous PreLoad?
160160
if (WatchDogIsSectionOpen(WD_SECTION_PRELOAD_UPGRADES))
161161
{
162-
AddReportLog(8545, SString("PreLoad Upgrades - Crash detect - bSlowMethod:%d iLowestUnsafeUpgrade:%d", bSlowMethod, iLowestUnsafeUpgrade));
162+
AddReportLog(ReportLogID::PRELOAD_UPGRADE_CACHE_CRASH, SString("PreLoad Upgrades - Crash detect - bSlowMethod:%d iLowestUnsafeUpgrade:%d", bSlowMethod, iLowestUnsafeUpgrade));
163163
iLowestUnsafeUpgrade = GetApplicationSettingInt(DIAG_PRELOAD_UPGRADE_ATTEMPT_ID);
164164
bSlowMethod = 1;
165165
SetApplicationSettingInt(DIAG_PRELOAD_UPGRADES_LOWEST_UNSAFE, iLowestUnsafeUpgrade);
@@ -193,7 +193,7 @@ void CModelCacheManagerImpl::PreLoad()
193193
int iPrevHiScore = GetApplicationSettingInt(DIAG_PRELOAD_UPGRADES_HISCORE);
194194
SetApplicationSettingInt(DIAG_PRELOAD_UPGRADES_HISCORE, iLowestUnsafeUpgrade);
195195
if (iPrevHiScore > iLowestUnsafeUpgrade)
196-
AddReportLog(8544, SString("PreLoad Upgrades - LowestUnsafeUpgrade fallen from %d to %d", iPrevHiScore, iLowestUnsafeUpgrade));
196+
AddReportLog(ReportLogID::PRELOAD_UPGRADE_FALLEN, SString("PreLoad Upgrades - LowestUnsafeUpgrade fallen from %d to %d", iPrevHiScore, iLowestUnsafeUpgrade));
197197

198198
CTickCount deltaTicks = CTickCount::Now() - startTicks;
199199
OutputDebugLine(SString("CModelCacheManagerImpl::PreLoad completed in %d ms", deltaTicks.ToInt()));

Client/core/CNewsBrowser.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ CGUIWindow* CNewsBrowser::LoadLayoutAndImages(CGUIElement* pParent, const SNewsI
281281
// Make sure we have the layout filename
282282
if (newsItem.strLayoutFilename.empty())
283283
{
284-
AddReportLog(3302, SString("CNewsBrowser::LoadLayout: Problem loading %s", *newsItem.strContentFullDir));
284+
AddReportLog(ReportLogID::NEWS_LAYOUT_FAIL, SString("CNewsBrowser::LoadLayout: Problem loading %s", *newsItem.strContentFullDir));
285285
return NULL;
286286
}
287287

@@ -290,8 +290,8 @@ CGUIWindow* CNewsBrowser::LoadLayoutAndImages(CGUIElement* pParent, const SNewsI
290290
{
291291
if (!pManager->LoadImageset(newsItem.imagesetFilenameList[i]))
292292
{
293-
AddReportLog(
294-
3303, SString("CNewsBrowser::LoadLayout: Problem with LoadImageset [%s] %s", *newsItem.strContentFullDir, *newsItem.imagesetFilenameList[i]));
293+
AddReportLog(ReportLogID::NEWS_LAYOUT_IMAGESET_FAIL, SString("CNewsBrowser::LoadLayout: Problem with LoadImageset [%s] %s",
294+
*newsItem.strContentFullDir, *newsItem.imagesetFilenameList[i]));
295295
return NULL;
296296
}
297297
}
@@ -300,7 +300,7 @@ CGUIWindow* CNewsBrowser::LoadLayoutAndImages(CGUIElement* pParent, const SNewsI
300300
CGUIWindow* pWindow = pManager->LoadLayout(pParent, newsItem.strLayoutFilename);
301301
if (!pWindow)
302302
{
303-
AddReportLog(3304, SString("CNewsBrowser::LoadLayout: Problem with LoadLayout [%s] %s", *newsItem.strContentFullDir, *newsItem.strLayoutFilename));
303+
AddReportLog(ReportLogID::NEW_LAYOUT_LOAD_FAIL, SString("CNewsBrowser::LoadLayout: Problem with LoadLayout [%s] %s", *newsItem.strContentFullDir, *newsItem.strLayoutFilename));
304304
return NULL;
305305
}
306306
return pWindow;

Client/core/CQuestionBox.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void CQuestionBox::Show()
102102
m_pWindow->BringToFront();
103103
g_pCore->RemoveMessageBox();
104104

105-
AddReportLog(9100, SString("QuestionBox::Show [%s] %s", m_pWindow->GetText().c_str(), *m_strMsg.Left(200).Replace("\n", "|")));
105+
AddReportLog(ReportLogID::QUESTIONBOX_SHOW, SString("QuestionBox::Show [%s] %s", m_pWindow->GetText().c_str(), *m_strMsg.Left(200).Replace("\n", "|")));
106106
}
107107

108108
void CQuestionBox::Reset()

Client/core/CVersionUpdater.Util.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,25 +356,25 @@ namespace
356356
m_strTempFileName = MakeUniquePath(PathJoin(GetMTADataPath(), "temp", "buffer.xml"));
357357
if (!FileSave(m_strTempFileName, &data[0], uiSize))
358358
{
359-
AddReportLog(2501, SString("CXMLBuffer::SetFromBuffer: Could not save %s", m_strTempFileName.c_str()));
359+
AddReportLog(ReportLogID::VER_UPD_XML_SAVE_FAIL, SString("CXMLBuffer::SetFromBuffer: Could not save %s", m_strTempFileName.c_str()));
360360
return NULL;
361361
}
362362

363363
m_pXMLFile = CCore::GetSingleton().GetXML()->CreateXML(m_strTempFileName);
364364
if (!m_pXMLFile)
365365
{
366-
AddReportLog(2502, SString("CXMLBuffer::SetFromBuffer: Could not CreateXML %s", m_strTempFileName.c_str()));
366+
AddReportLog(ReportLogID::VER_UPD_XML_CREATE_FAIL, SString("CXMLBuffer::SetFromBuffer: Could not CreateXML %s", m_strTempFileName.c_str()));
367367
return NULL;
368368
}
369369
if (!m_pXMLFile->Parse())
370370
{
371-
AddReportLog(2503, SString("CXMLBuffer::SetFromBuffer: Could not parse %s", m_strTempFileName.c_str()));
371+
AddReportLog(ReportLogID::VER_UPD_XML_PARSE_FAIL, SString("CXMLBuffer::SetFromBuffer: Could not parse %s", m_strTempFileName.c_str()));
372372
return NULL;
373373
}
374374
m_pRoot = m_pXMLFile->GetRootNode();
375375
if (!m_pRoot)
376376
{
377-
AddReportLog(2504, SString("CXMLBuffer::SetFromBuffer: No root node in %s", m_strTempFileName.c_str()));
377+
AddReportLog(ReportLogID::VER_UPD_XML_MISSING_ROOT, SString("CXMLBuffer::SetFromBuffer: No root node in %s", m_strTempFileName.c_str()));
378378
return NULL;
379379
}
380380

0 commit comments

Comments
 (0)