From 214c67a647313266dbd163e3885cac0441dfbb09 Mon Sep 17 00:00:00 2001 From: AconiteX <63141077+AconiteX@users.noreply.github.com> Date: Wed, 28 Apr 2021 12:11:48 -0400 Subject: [PATCH] Fix Crash Logging to txt & add verbosity --- .../src/win32/ConfigSharedFoundation.cpp | 39 +++++++++++++++++-- .../src/win32/ConfigSharedFoundation.h | 2 + .../SwgClient/src/win32/ClientMain.cpp | 8 ++-- .../src/win32/SwgClientSetup.cpp | 22 ++++++++--- .../SwgClientSetup/src/win32/SwgClientSetup.h | 4 +- 5 files changed, 60 insertions(+), 15 deletions(-) diff --git a/src/engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.cpp b/src/engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.cpp index e571ffb6a..0056b8fd5 100644 --- a/src/engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.cpp +++ b/src/engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.cpp @@ -10,7 +10,6 @@ #include "sharedFoundation/ConfigSharedFoundation.h" #include "sharedFoundation/ConfigFile.h" -#include "sharedFoundation/Production.h" // ====================================================================== @@ -22,7 +21,7 @@ // ====================================================================== const int c_defaultFatalCallStackDepth = 32; -const int c_defaultWarningCallStackDepth = PRODUCTION ? -1 : 8; +const int c_defaultWarningCallStackDepth = -1; // ====================================================================== @@ -65,6 +64,8 @@ namespace ConfigSharedFoundationNamespace bool ms_causeAccessViolation; float ms_debugReportLongFrameTime; + + bool ms_developmentMode; } using namespace ConfigSharedFoundationNamespace; @@ -103,7 +104,7 @@ void ConfigSharedFoundation::install (const Defaults &defaults) KEY_BOOL(memoryBlockManagerDebugDumpOnRemove, false); KEY_INT(fatalCallStackDepth, c_defaultFatalCallStackDepth); - KEY_INT(warningCallStackDepth, PRODUCTION ? -1 : c_defaultWarningCallStackDepth); + KEY_INT(warningCallStackDepth, c_defaultWarningCallStackDepth); KEY_BOOL(lookUpCallStackNames, true); KEY_INT(processPriority, 0); @@ -114,6 +115,8 @@ void ConfigSharedFoundation::install (const Defaults &defaults) KEY_BOOL(causeAccessViolation, false); KEY_FLOAT(debugReportLongFrameTime, 0.25f); + + KEY_BOOL(developmentMode, true); } // ---------------------------------------------------------------------- @@ -255,6 +258,10 @@ bool ConfigSharedFoundation::getMemoryBlockManagerDebugDumpOnRemove () int ConfigSharedFoundation::getFatalCallStackDepth() { + if(getDevelopmentMode()) + { + return c_defaultFatalCallStackDepth; + } return ms_fatalCallStackDepth; } @@ -262,6 +269,10 @@ int ConfigSharedFoundation::getFatalCallStackDepth() int ConfigSharedFoundation::getWarningCallStackDepth() { + if(getDevelopmentMode()) + { + return 12; + } return ms_warningCallStackDepth; } @@ -269,6 +280,10 @@ int ConfigSharedFoundation::getWarningCallStackDepth() bool ConfigSharedFoundation::getLookUpCallStackNames() { + if(getDevelopmentMode()) + { + return true; + } return ms_lookUpCallStackNames; } @@ -315,4 +330,22 @@ float ConfigSharedFoundation::getDebugReportLongFrameTime() return ms_debugReportLongFrameTime; } +// ---------------------------------------------------------------------- + +// This is an SWG Source addition we're using for the purposes of defaulting +// more verbose logging and development tools to ON but we're using a config +// option so players wanting a more live-like client to share don't have to +// recompile based on the PRODUCTION constant and can instead just set this +// [SharedFoundation] developmentMode=false if they want + +// ***** WARNING ****** +// This is a config toggle which anyone can change so obviously nothing +// related to access should be wrapped in this (read: things that should +// require god mode still need to use PlayerObject::isAdmin() not this) + +bool ConfigSharedFoundation::getDevelopmentMode() +{ + return ms_developmentMode; +} + // ====================================================================== diff --git a/src/engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.h b/src/engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.h index c89a5a761..60fa4af47 100644 --- a/src/engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.h +++ b/src/engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.h @@ -68,6 +68,8 @@ public: static bool getCauseAccessViolation(); static float getDebugReportLongFrameTime(); + + static bool getDevelopmentMode(); }; // ====================================================================== diff --git a/src/game/client/application/SwgClient/src/win32/ClientMain.cpp b/src/game/client/application/SwgClient/src/win32/ClientMain.cpp index 0a7f95720..aae825187 100644 --- a/src/game/client/application/SwgClient/src/win32/ClientMain.cpp +++ b/src/game/client/application/SwgClient/src/win32/ClientMain.cpp @@ -79,6 +79,7 @@ #include "swgClientUserInterface/SwgCuiG15Lcd.h" #include "swgClientUserInterface/SwgCuiManager.h" #include "swgSharedNetworkMessages/SetupSwgSharedNetworkMessages.h" +#include "sharedFoundation/ConfigSharedFoundation.h" #include "libMozilla/libMozilla.h" @@ -166,11 +167,8 @@ int ClientMain( #if PRODUCTION data.demoMode = true; #endif - if (ApplicationVersion::isPublishBuild() || ApplicationVersion::isBootlegBuild()) - { - data.writeMiniDumps = true; - } - + data.writeMiniDumps = true; // SWG Source Change - Just always write crash log .txt files, there's no reason not to + SetupSharedFoundation::install(data); REPORT_LOG(true, ("ClientMain: Command Line = \"%s\"\n", lpCmdLine)); diff --git a/src/game/client/application/SwgClientSetup/src/win32/SwgClientSetup.cpp b/src/game/client/application/SwgClientSetup/src/win32/SwgClientSetup.cpp index 88fa1cf7e..ded8cff37 100644 --- a/src/game/client/application/SwgClientSetup/src/win32/SwgClientSetup.cpp +++ b/src/game/client/application/SwgClientSetup/src/win32/SwgClientSetup.cpp @@ -7,6 +7,14 @@ // // ====================================================================== +// ********************************************************************** +// SWG Source 2021 - Aconite +// some modifications have been made to this to, for example, stop the +// application from sending emails to SOE but this needs some more work! +// todo this needs to be cleaned up +// todo this probably could use some new detection/setting support for operating systems made this decade +// ********************************************************************** + #include "FirstSwgClientSetup.h" #include "SwgClientSetup.h" @@ -50,8 +58,8 @@ namespace SwgClientSetupNamespace TCHAR const * const cms_lastRatingTimeRegistryKey = _T("LastRatingTime"); TCHAR const * const cms_machineRequirementsDisplayCountRegistryKey = _T("MachineRequirementsDisplayCount"); TCHAR const * const cms_applicationName = _T("SwgClient_r.exe"); - char const * const cms_fromEmailAddress = "swgbetatestcrashes@soe.sony.com"; - char const * const cms_toEmailAddress = "swgbetatestcrashes@soe.sony.com"; + //char const * const cms_fromEmailAddress = "swgbetatestcrashes@soe.sony.com"; + //char const * const cms_toEmailAddress = "swgbetatestcrashes@soe.sony.com"; TCHAR const * const cms_fileNameMask = _T("SwgClient_?.exe-*.*"); TCHAR const * const cms_languageStringJapanese = _T("ja"); @@ -389,8 +397,8 @@ BOOL SwgClientSetupApp::InitInstance() CloseHandle(semaphore); return FALSE; } - - detectAndSendMinidumps (); + + //detectAndSendMinidumps (); ClientMachine::install (); @@ -484,7 +492,7 @@ BOOL SwgClientSetupApp::InitInstance() Options::save (); - detectAndSendHardwareInformation (); + //detectAndSendHardwareInformation (); bool const displayMessage = (ClientMachine::getPhysicalMemorySize () < 500) || @@ -743,6 +751,7 @@ void SwgClientSetupApp::configure () // ---------------------------------------------------------------------- +/* void SwgClientSetupApp::detectAndSendMinidumps () { typedef std::vector StringList; @@ -852,9 +861,11 @@ void SwgClientSetupApp::detectAndSendMinidumps () AfxMessageBox (detectedStr, NULL, MB_ICONINFORMATION | MB_OK); } } +*/ // ---------------------------------------------------------------------- +/* void SwgClientSetupApp::detectAndSendHardwareInformation () { if (getAutomaticallySendHardwareInformation()) @@ -884,6 +895,7 @@ void SwgClientSetupApp::detectAndSendHardwareInformation () } } } +*/ // ---------------------------------------------------------------------- diff --git a/src/game/client/application/SwgClientSetup/src/win32/SwgClientSetup.h b/src/game/client/application/SwgClientSetup/src/win32/SwgClientSetup.h index fd8b447f8..37a5be2e3 100644 --- a/src/game/client/application/SwgClientSetup/src/win32/SwgClientSetup.h +++ b/src/game/client/application/SwgClientSetup/src/win32/SwgClientSetup.h @@ -59,8 +59,8 @@ public: DECLARE_MESSAGE_MAP() private: - void detectAndSendMinidumps (); - void detectAndSendHardwareInformation (); + //void detectAndSendMinidumps (); + //void detectAndSendHardwareInformation (); }; // ======================================================================