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.

159 lines
7.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Xbox console
  4. //
  5. //=====================================================================================//
  6. #pragma once
  7. #include "tier0/platform.h"
  8. #ifndef STATIC_TIER0
  9. #ifdef TIER0_DLL_EXPORT
  10. #define XBXCONSOLE_INTERFACE DLL_EXPORT
  11. #define XBXCONSOLE_OVERLOAD DLL_GLOBAL_EXPORT
  12. #else
  13. #define XBXCONSOLE_INTERFACE DLL_IMPORT
  14. #define XBXCONSOLE_OVERLOAD DLL_GLOBAL_IMPORT
  15. #endif
  16. #else // BUILD_AS_DLL
  17. #define XBXCONSOLE_INTERFACE extern
  18. #define XBXCONSOLE_OVERLOAD
  19. #endif // BUILD_AS_DLL
  20. // all redirecting funneled here, stop redirecting in this module only
  21. #undef OutputDebugString
  22. #define XBX_MAX_PROFILE_COUNTERS 64
  23. #if !defined( _X360 )
  24. #define xMaterialList_t void
  25. #define xTextureList_t void
  26. #define xSoundList_t void
  27. #define xMapInfo_t void
  28. #define xModelList_t void
  29. #define xDataCacheItem_t void
  30. #define xVProfNodeItem_t void
  31. #define xBudgetInfo_t void
  32. #endif
  33. class IXboxConsole
  34. {
  35. public:
  36. virtual void SendRemoteCommand( const char *dbgCommand, bool bAsync ) = 0;
  37. virtual void SendArbitraryPrefixedTextMessage( const char *prefix, const char *message, bool async ) = 0;
  38. virtual void DebugString( unsigned int color, const char *format, ... ) = 0;
  39. virtual bool IsConsoleConnected() = 0;
  40. virtual void InitConsoleMonitor( bool bWaitForConnect = false ) = 0;
  41. virtual void DisconnectConsoleMonitor() = 0;
  42. virtual void FlushDebugOutput() = 0;
  43. virtual bool GetXboxName( char *, unsigned * ) = 0;
  44. virtual void CrashDump( bool ) = 0;
  45. virtual void CrashDumpFullHeap( bool ) = 0;
  46. virtual void DumpDllInfo( const char *pBasePath ) = 0;
  47. virtual void OutputDebugString( const char * ) = 0;
  48. virtual bool IsDebuggerPresent() = 0;
  49. virtual int SetProfileAttributes( const char *pProfileName, int numCounters, const char *names[], COLORREF colors[] ) = 0;
  50. virtual void SetProfileData( const char *pProfileName, int numCounters, unsigned int *counters ) = 0;
  51. virtual int MemDump( const char *pDumpFileName ) = 0;
  52. virtual int TimeStampLog( float time, const char *pString ) = 0;
  53. virtual int MaterialList( int nMaterials, const xMaterialList_t *pXMaterialList ) = 0;
  54. virtual int TextureList( int nTextures, const xTextureList_t *pXTextureList ) = 0;
  55. virtual int SoundList( int nSounds, const xSoundList_t *pXSoundList ) = 0;
  56. virtual int MapInfo( const xMapInfo_t *pXMapInfo ) = 0;
  57. virtual int BudgetInfo( const xBudgetInfo_t *pXBudgetInfo ) = 0;
  58. virtual int AddCommands( int numCommands, const char *commands[], const char* help[] ) = 0;
  59. virtual int ModelList( int nModels, const xModelList_t *pList ) = 0;
  60. virtual int DataCacheList( int nItems, const xDataCacheItem_t* pItems ) = 0;
  61. virtual int VProfNodeList( int nItems, const xVProfNodeItem_t *pItems ) = 0;
  62. virtual int TraceComplete( void ) = 0;
  63. virtual int BugReporter( void ) = 0;
  64. virtual bool SendBinaryData( const void *pData, int iDataSize, bool bAsync = true, DWORD dwSyncTimout = 15000 ) = 0; //returns false if sync call timed out or not connected. Otherwise true
  65. virtual int SyncDvdDevCache() = 0;
  66. virtual int SyncShaderCache() = 0;
  67. virtual int Version( int nVersion ) = 0;
  68. };
  69. class CXboxConsole : public IXboxConsole
  70. {
  71. public:
  72. void SendRemoteCommand( const char* dbgCommand, bool bAsync );
  73. void SendArbitraryPrefixedTextMessage( const char *prefix, const char *message, bool async );
  74. void DebugString( unsigned int color, const char* format, ... );
  75. bool IsConsoleConnected();
  76. void InitConsoleMonitor( bool bWaitForConnect = false );
  77. void DisconnectConsoleMonitor();
  78. void FlushDebugOutput();
  79. bool GetXboxName( char *, unsigned * );
  80. void CrashDump( bool );
  81. void CrashDumpFullHeap( bool );
  82. int DumpModuleSize( const char *pName );
  83. void DumpDllInfo( const char *pBasePath );
  84. void OutputDebugString( const char * );
  85. bool IsDebuggerPresent();
  86. int SetProfileAttributes( const char *pProfileName, int numCounters, const char *names[], COLORREF colors[] );
  87. void SetProfileData( const char *pProfileName, int numCounters, unsigned int *counters );
  88. int MemDump( const char *pDumpFileName );
  89. int TimeStampLog( float time, const char *pString );
  90. int MaterialList( int nMaterials, const xMaterialList_t *pXMaterialList );
  91. int TextureList( int nTextures, const xTextureList_t *pXTextureList );
  92. int SoundList( int nSounds, const xSoundList_t *pXSoundList );
  93. int MapInfo( const xMapInfo_t *pXMapInfo );
  94. int BudgetInfo( const xBudgetInfo_t *pXBudgetInfo );
  95. int AddCommands( int numCommands, const char *commands[], const char *help[] );
  96. int ModelList( int nModels, const xModelList_t *pList );
  97. int DataCacheList( int nItems, const xDataCacheItem_t *pItems );
  98. int VProfNodeList( int nItems, const xVProfNodeItem_t *pItems );
  99. int TraceComplete( void );
  100. int BugReporter( void );
  101. bool SendBinaryData( const void *pData, int iDataSize, bool bAsync, DWORD dwSyncTimout );
  102. int SyncDvdDevCache();
  103. int SyncShaderCache();
  104. int Version( int nVersion );
  105. };
  106. XBXCONSOLE_INTERFACE IXboxConsole *g_pXboxConsole;
  107. XBXCONSOLE_INTERFACE void XboxConsoleInit();
  108. #define XBX_SendRemoteCommand if ( !g_pXboxConsole ) ; else g_pXboxConsole->SendRemoteCommand
  109. #define XBX_SendPrefixedMsg if ( !g_pXboxConsole ) ; else g_pXboxConsole->SendArbitraryPrefixedTextMessage
  110. #define XBX_DebugString if ( !g_pXboxConsole ) ; else g_pXboxConsole->DebugString
  111. #define XBX_IsConsoleConnected ( !g_pXboxConsole ) ? false : g_pXboxConsole->IsConsoleConnected
  112. #define XBX_InitConsoleMonitor if ( !g_pXboxConsole ) ; else g_pXboxConsole->InitConsoleMonitor
  113. #define XBX_DisconnectConsoleMonitor if ( !g_pXboxConsole ) ; else g_pXboxConsole->DisconnectConsoleMonitor
  114. #define XBX_FlushDebugOutput if ( !g_pXboxConsole ) ; else g_pXboxConsole->FlushDebugOutput
  115. #define XBX_GetXboxName ( !g_pXboxConsole ) ? false : g_pXboxConsole->GetXboxName
  116. #define XBX_CrashDump if ( !g_pXboxConsole ) ; else g_pXboxConsole->CrashDump
  117. #define XBX_CrashDumpFullHeap if ( !g_pXboxConsole ) ; else g_pXboxConsole->CrashDumpFullHeap
  118. #define XBX_DumpDllInfo if ( !g_pXboxConsole ) ; else g_pXboxConsole->DumpDllInfo
  119. #define XBX_OutputDebugString if ( !g_pXboxConsole ) ; else g_pXboxConsole->OutputDebugString
  120. #define XBX_IsDebuggerPresent ( !g_pXboxConsole ) ? false : g_pXboxConsole->IsDebuggerPresent
  121. #define XBX_rSetProfileAttributes ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->SetProfileAttributes
  122. #define XBX_rSetProfileData if ( !g_pXboxConsole ) ; else g_pXboxConsole->SetProfileData
  123. #define XBX_rMemDump ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->MemDump
  124. #define XBX_rTimeStampLog ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->TimeStampLog
  125. #define XBX_rMaterialList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->MaterialList
  126. #define XBX_rTextureList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->TextureList
  127. #define XBX_rSoundList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->SoundList
  128. #define XBX_rMapInfo ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->MapInfo
  129. #define XBX_rBudgetInfo ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->BudgetInfo
  130. #define XBX_rAddCommands ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->AddCommands
  131. #define XBX_rModelList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->ModelList
  132. #define XBX_rDataCacheList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->DataCacheList
  133. #define XBX_rVProfNodeList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->VProfNodeList
  134. #define XBX_rTraceComplete ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->TraceComplete
  135. #define XBX_rBugReporter ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->BugReporter
  136. #define XBX_SendBinaryData ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->SendBinaryData
  137. #define XBX_rSyncDvdDevCache ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->SyncDvdDevCache
  138. #define XBX_rSyncShaderCache ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->SyncShaderCache
  139. #define XBX_rVersion ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->Version