Subversion Repositories pentevo

Rev

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