Team Fortress 2 Source Code as on 22/4/2020
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.

118 lines
5.2 KiB

  1. //========= Copyright 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. #endif
  29. class IXboxConsole
  30. {
  31. public:
  32. virtual void SendRemoteCommand( const char* dbgCommand, bool bAsync ) = 0;
  33. virtual void DebugString( unsigned int color, const char* format, ... ) = 0;
  34. virtual bool IsConsoleConnected() = 0;
  35. virtual void InitConsoleMonitor( bool bWaitForConnect = false ) = 0;
  36. virtual void DisconnectConsoleMonitor() = 0;
  37. virtual void FlushDebugOutput() = 0;
  38. virtual bool GetXboxName(char *, unsigned *) = 0;
  39. virtual void CrashDump( bool ) = 0;
  40. virtual void DumpDllInfo( const char *pBasePath ) = 0;
  41. virtual void OutputDebugString( const char * ) = 0;
  42. virtual bool IsDebuggerPresent() = 0;
  43. virtual int SetProfileAttributes( const char *pProfileName, int numCounters, const char *names[], unsigned int colors[] ) = 0;
  44. virtual void SetProfileData( const char *pProfileName, int numCounters, unsigned int *counters ) = 0;
  45. virtual int MemDump( const char *pDumpFileName ) = 0;
  46. virtual int TimeStampLog( float time, const char *pString ) = 0;
  47. virtual int MaterialList( int nMaterials, const xMaterialList_t* pXMaterialList ) = 0;
  48. virtual int TextureList( int nTextures, const xTextureList_t* pXTextureList ) = 0;
  49. virtual int SoundList( int nSounds, const xSoundList_t* pXSoundList ) = 0;
  50. virtual int MapInfo( const xMapInfo_t *pXMapInfo ) = 0;
  51. virtual int AddCommands( int numCommands, const char* commands[], const char* help[] ) = 0;
  52. };
  53. class CXboxConsole : public IXboxConsole
  54. {
  55. public:
  56. void SendRemoteCommand( const char* dbgCommand, bool bAsync );
  57. void DebugString( unsigned int color, const char* format, ... );
  58. bool IsConsoleConnected();
  59. void InitConsoleMonitor( bool bWaitForConnect = false );
  60. void DisconnectConsoleMonitor();
  61. void FlushDebugOutput();
  62. bool GetXboxName(char *, unsigned *);
  63. void CrashDump( bool );
  64. int DumpModuleSize( const char *pName );
  65. void DumpDllInfo( const char *pBasePath );
  66. void OutputDebugString( const char * );
  67. bool IsDebuggerPresent();
  68. int SetProfileAttributes( const char *pProfileName, int numCounters, const char *names[], unsigned int colors[] );
  69. void SetProfileData( const char *pProfileName, int numCounters, unsigned int *counters );
  70. int MemDump( const char *pDumpFileName );
  71. int TimeStampLog( float time, const char *pString );
  72. int MaterialList( int nMaterials, const xMaterialList_t* pXMaterialList );
  73. int TextureList( int nTextures, const xTextureList_t* pXTextureList );
  74. int SoundList( int nSounds, const xSoundList_t* pXSoundList );
  75. int MapInfo( const xMapInfo_t *pXMapInfo );
  76. int AddCommands( int numCommands, const char* commands[], const char* help[] );
  77. };
  78. XBXCONSOLE_INTERFACE IXboxConsole *g_pXboxConsole;
  79. XBXCONSOLE_INTERFACE void XboxConsoleInit();
  80. #define XBX_SendRemoteCommand if ( !g_pXboxConsole ) ; else g_pXboxConsole->SendRemoteCommand
  81. #define XBX_DebugString if ( !g_pXboxConsole ) ; else g_pXboxConsole->DebugString
  82. #define XBX_IsConsoleConnected ( !g_pXboxConsole ) ? false : g_pXboxConsole->IsConsoleConnected
  83. #define XBX_InitConsoleMonitor if ( !g_pXboxConsole ) ; else g_pXboxConsole->InitConsoleMonitor
  84. #define XBX_DisconnectConsoleMonitor if ( !g_pXboxConsole ) ; else g_pXboxConsole->DisconnectConsoleMonitor
  85. #define XBX_FlushDebugOutput if ( !g_pXboxConsole ) ; else g_pXboxConsole->FlushDebugOutput
  86. #define XBX_GetXboxName ( !g_pXboxConsole ) ? false : g_pXboxConsole->GetXboxName
  87. #define XBX_CrashDump if ( !g_pXboxConsole ) ; else g_pXboxConsole->CrashDump
  88. #define XBX_DumpDllInfo if ( !g_pXboxConsole ) ; else g_pXboxConsole->DumpDllInfo
  89. #define XBX_OutputDebugString if ( !g_pXboxConsole ) ; else g_pXboxConsole->OutputDebugString
  90. #define XBX_IsDebuggerPresent ( !g_pXboxConsole ) ? false : g_pXboxConsole->IsDebuggerPresent
  91. #define XBX_rSetProfileAttributes ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->SetProfileAttributes
  92. #define XBX_rSetProfileData if ( !g_pXboxConsole ) ; else g_pXboxConsole->SetProfileData
  93. #define XBX_rMemDump ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->MemDump
  94. #define XBX_rTimeStampLog ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->TimeStampLog
  95. #define XBX_rMaterialList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->MaterialList
  96. #define XBX_rTextureList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->TextureList
  97. #define XBX_rSoundList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->SoundList
  98. #define XBX_rMapInfo ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->MapInfo
  99. #define XBX_rAddCommands ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->AddCommands