Skip to content

Commit 6219985

Browse files
committed
Hook COM_TimestampedLog if the user passes '-timestamped' through cmd line
1 parent 3f93e70 commit 6219985

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

launcher/source/hooks/tier0.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#include "stdafx.hpp"
22

3-
#include "tier0/platform.h"
43
#include "hooks.hpp"
4+
#include "tier0/ICommandLine.h"
5+
#include "tier0/platform.h"
56

67
HOOK_EXPORT_DECLARE( hkCOM_TimestampedLog );
78

@@ -39,7 +40,7 @@ NOINLINE void hkCOM_TimestampedLog( char const* fmt, ... )
3940
HOOK_EXPORT_DECLARE( hkMsg );
4041

4142
NOINLINE void hkMsg( const tchar* pMsg, ... )
42-
{
43+
{
4344
va_list va;
4445
va_start( va, pMsg );
4546
vprintf( pMsg, va );
@@ -49,7 +50,7 @@ NOINLINE void hkMsg( const tchar* pMsg, ... )
4950
HOOK_EXPORT_DECLARE( hkWarning );
5051

5152
NOINLINE void hkWarning( const tchar* pMsg, ... )
52-
{
53+
{
5354
va_list va;
5455
va_start( va, pMsg );
5556
vprintf( pMsg, va );
@@ -71,7 +72,12 @@ void HookTier0()
7172
const uintptr_t dwTierBase = g_ModuleList.Get( "tier0.dll" );
7273
BytePatchTier( dwTierBase );
7374

74-
HOOK_EXPORT( "COM_TimestampedLog", L"tier0.dll", hkCOM_TimestampedLog );
75+
// only hook COM_TimestampedLog if we are actually going to use it
76+
if ( CommandLine()->CheckParm( "-timestamped", nullptr ) )
77+
{
78+
HOOK_EXPORT( "COM_TimestampedLog", L"tier0.dll", hkCOM_TimestampedLog );
79+
}
80+
7581
HOOK_EXPORT( "Msg", L"tier0.dll", hkMsg );
7682
HOOK_EXPORT( "Warning", L"tier0.dll", hkWarning );
7783
}

0 commit comments

Comments
 (0)