Skip to content

Commit 9a5b9ae

Browse files
committed
Added verbose logging flag
1 parent e6e09e2 commit 9a5b9ae

4 files changed

Lines changed: 36 additions & 6 deletions

File tree

GeneralsMD/Code/GameEngine/Include/GameNetwork/GeneralsOnline/GeneralsOnline_Settings.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class GenOnlineSettings
2626
bool Graphics_LimitFramerate() const { return m_Render_LimitFramerate; }
2727
int Graphics_GetFPSLimit() const { return std::clamp<int>(m_Render_FramerateLimit_FPSVal, 60, 240); }
2828

29+
bool Debug_VerboseLogging() const { return m_bVerbose; }
30+
2931
int GetChatLifeSeconds() const { return std::max<int>(m_Chat_LifeSeconds, 10); }
3032

3133
void Initialize()
@@ -52,6 +54,8 @@ class GenOnlineSettings
5254

5355
bool m_bInitialized = false;
5456

57+
bool m_bVerbose = false;
58+
5559
bool m_Render_DrawStatsOverlay = true;
5660
bool m_Render_LimitFramerate = true;
5761
int m_Render_FramerateLimit_FPSVal = 60;

GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/GeneralsOnline_Settings.cpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#define SETTINGS_KEY_CHAT "chat"
2020
#define SETTINGS_KEY_CHAT_LIFE_SECONDS "duration_seconds_until_fade_out"
2121

22+
#define SETTINGS_KEY_DEBUG "debug"
23+
#define SETTINGS_KEY_DEBUG_VERBOSE_LOGGING "verbose_logging"
24+
25+
2226
#define SETTINGS_FILENAME_LEGACY "GeneralsOnline_settings.json"
2327
#define SETTINGS_FILENAME "settings.json"
2428

@@ -156,6 +160,17 @@ void GenOnlineSettings::Load(void)
156160
}
157161
}
158162

163+
if (jsonSettings.contains(SETTINGS_KEY_DEBUG))
164+
{
165+
auto debugSettings = jsonSettings[SETTINGS_KEY_DEBUG];
166+
167+
if (debugSettings.contains(SETTINGS_KEY_DEBUG_VERBOSE_LOGGING))
168+
{
169+
m_bVerbose = debugSettings[SETTINGS_KEY_DEBUG_VERBOSE_LOGGING];
170+
}
171+
}
172+
173+
159174
if (jsonSettings.contains(SETTINGS_KEY_CHAT))
160175
{
161176
auto chatSettings = jsonSettings[SETTINGS_KEY_CHAT];
@@ -178,6 +193,7 @@ void GenOnlineSettings::Load(void)
178193
m_Camera_MinHeight = m_Camera_MinHeight_default;
179194
m_Camera_MaxHeight_LobbyHost = m_Camera_MaxHeight_LobbyHost;
180195
m_Input_LockCursorToGameWindow = true;
196+
m_bVerbose = false;
181197
m_Render_LimitFramerate = true;
182198
m_Render_FramerateLimit_FPSVal = 60;
183199
m_Render_DrawStatsOverlay = true;
@@ -226,7 +242,14 @@ void GenOnlineSettings::Save()
226242
{
227243
{SETTINGS_KEY_CHAT_LIFE_SECONDS, m_Chat_LifeSeconds}
228244
}
229-
}
245+
},
246+
247+
{
248+
SETTINGS_KEY_DEBUG,
249+
{
250+
{SETTINGS_KEY_DEBUG_VERBOSE_LOGGING, m_bVerbose},
251+
}
252+
},
230253
};
231254

232255
std::string strData = root.dump(1);

GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/NGMP_Helpers.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33
#include <mutex>
44
#include "libsodium/sodium/crypto_aead_xchacha20poly1305.h"
55
#include "libsodium/sodium/randombytes.h"
6+
#include "../OnlineServices_Init.h"
67

78
std::string m_strNetworkLogFileName;
89
std::mutex m_logMutex;
910

1011
void NetworkLog(ELogVerbosity logVerbosity, const char* fmt, ...)
1112
{
12-
if (logVerbosity < g_LogVerbosity)
13+
if (!NGMP_OnlineServicesManager::Settings.Debug_VerboseLogging())
1314
{
14-
return;
15+
if (logVerbosity < g_LogVerbosity)
16+
{
17+
return;
18+
}
1519
}
1620

1721
std::scoped_lock scopedLock { m_logMutex };

GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/NetworkMesh.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,8 @@ NetworkMesh::NetworkMesh()
528528
#if defined(_DEBUG)
529529
ESteamNetworkingSocketsDebugOutputType::k_ESteamNetworkingSocketsDebugOutputType_Debug
530530
#else
531-
ESteamNetworkingSocketsDebugOutputType::k_ESteamNetworkingSocketsDebugOutputType_Msg
532-
#endif
533-
;
531+
NGMP_OnlineServicesManager::Settings.Debug_VerboseLogging() ? ESteamNetworkingSocketsDebugOutputType::k_ESteamNetworkingSocketsDebugOutputType_Debug : ESteamNetworkingSocketsDebugOutputType::k_ESteamNetworkingSocketsDebugOutputType_Msg
532+
#endif;
534533

535534
SteamNetworkingUtils()->SetGlobalConfigValueInt32(k_ESteamNetworkingConfig_LogLevel_P2PRendezvous, logType);
536535
SteamNetworkingUtils()->SetDebugOutputFunction(logType, [](ESteamNetworkingSocketsDebugOutputType nType, const char* pszMsg)

0 commit comments

Comments
 (0)