Subversion Repositories pentevo

Rev

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