Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.1 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "engine/iblackbox.h"
  8. // memdbgon must be the last include file in a .cpp file!!!
  9. #include "tier0/memdbgon.h"
  10. extern IBlackBox *blackboxrecorder;
  11. void BlackBox_Record( const char *type, PRINTF_FORMAT_STRING const char *pFormat, ... )
  12. {
  13. static ConVarRef blackbox( "blackbox" );
  14. if ( IsX360() )
  15. return;
  16. if ( !blackbox.IsValid() || !blackbox.GetBool() )
  17. return;
  18. int type_num;
  19. for ( type_num = 0; type_num < blackboxrecorder->GetTypeCount(); type_num++ )
  20. {
  21. if ( !V_strcasecmp( blackboxrecorder->GetTypeName( type_num ), type ) )
  22. break;
  23. }
  24. if ( type_num >= blackboxrecorder->GetTypeCount() )
  25. {
  26. Msg( "Invalid blackbox type: %s\n", type );
  27. return;
  28. }
  29. char szMessage[1024];
  30. va_list marker;
  31. va_start( marker, pFormat);
  32. Q_vsnprintf( szMessage, sizeof( szMessage ), pFormat, marker);
  33. va_end( marker );
  34. //Msg( "Record: %s: %s\n", type, szMessage );
  35. blackboxrecorder->Record( type_num, szMessage );
  36. }