Subversion Repositories pentevo

Rev

Rev 796 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed | ?url?

  1. /*==========================================================================;
  2.  *
  3.  *
  4.  *  File:   dxerr.h
  5.  *  Content:    DirectX Error Library Include File
  6.  *
  7.  ****************************************************************************/
  8.  
  9. #ifndef _DXERR_H_
  10. #define _DXERR_H_
  11.  
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif //__cplusplus
  15.  
  16. //
  17. //  DXGetErrorString
  18. //  
  19. //  Desc:  Converts a DirectX HRESULT to a string
  20. //
  21. //  Args:  HRESULT hr   Can be any error code from
  22. //                      XACT XAUDIO2 XAPO XINPUT DXGI D3D10 D3DX10 D3D9 D3DX9 DDRAW DSOUND DINPUT DSHOW
  23. //
  24. //  Return: Converted string
  25. //
  26. #ifdef __GNUC__
  27. const char*  WINAPI DXGetErrorString9A(HRESULT hr);
  28. const WCHAR* WINAPI DXGetErrorString9W(HRESULT hr);
  29. #define DXGetErrorStringW DXGetErrorString9W
  30. #define DXGetErrorStringA DXGetErrorString9A
  31. #else
  32. const char*  WINAPI DXGetErrorStringA(HRESULT hr);
  33. const WCHAR* WINAPI DXGetErrorStringW(HRESULT hr);
  34. #endif
  35.  
  36. #ifdef UNICODE
  37. #define DXGetErrorString DXGetErrorStringW
  38. #else
  39. #define DXGetErrorString DXGetErrorStringA
  40. #endif
  41.  
  42.  
  43. //
  44. //  DXGetErrorDescription
  45. //  
  46. //  Desc:  Returns a string description of a DirectX HRESULT
  47. //
  48. //  Args:  HRESULT hr   Can be any error code from
  49. //                      XACT XAUDIO2 XAPO XINPUT DXGI D3D10 D3DX10 D3D9 D3DX9 DDRAW DSOUND DINPUT DSHOW
  50. //
  51. //  Return: String description
  52. //
  53. const char*  WINAPI DXGetErrorDescriptionA(HRESULT hr);
  54. const WCHAR* WINAPI DXGetErrorDescriptionW(HRESULT hr);
  55.  
  56. #ifdef UNICODE
  57.     #define DXGetErrorDescription DXGetErrorDescriptionW
  58. #else
  59.     #define DXGetErrorDescription DXGetErrorDescriptionA
  60. #endif
  61.  
  62.  
  63. //
  64. //  DXTrace
  65. //
  66. //  Desc:  Outputs a formatted error message to the debug stream
  67. //
  68. //  Args:  CHAR* strFile   The current file, typically passed in using the
  69. //                         __FILE__ macro.
  70. //         DWORD dwLine    The current line number, typically passed in using the
  71. //                         __LINE__ macro.
  72. //         HRESULT hr      An HRESULT that will be traced to the debug stream.
  73. //         CHAR* strMsg    A string that will be traced to the debug stream (may be NULL)
  74. //         BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
  75. //
  76. //  Return: The hr that was passed in.  
  77. //
  78. HRESULT WINAPI DXTraceA(const char* strFile, DWORD dwLine, HRESULT hr, const char* strMsg, BOOL bPopMsgBox );
  79. HRESULT WINAPI DXTraceW(const char* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, BOOL bPopMsgBox );
  80.  
  81. #ifdef UNICODE
  82. #define DXTrace DXTraceW
  83. #else
  84. #define DXTrace DXTraceA
  85. #endif
  86.  
  87.  
  88. //
  89. // Helper macros
  90. //
  91. #if defined(DEBUG) | defined(_DEBUG)
  92. #define DXTRACE_MSG(str)              DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
  93. #define DXTRACE_ERR(str,hr)           DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
  94. #define DXTRACE_ERR_MSGBOX(str,hr)    DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
  95. #else
  96. #define DXTRACE_MSG(str)              (0L)
  97. #define DXTRACE_ERR(str,hr)           (hr)
  98. #define DXTRACE_ERR_MSGBOX(str,hr)    (hr)
  99. #endif
  100.  
  101.  
  102. #ifdef __cplusplus
  103. }
  104. #endif //__cplusplus
  105.  
  106. #endif // _DXERR_H_
  107.