1 |
bearsoft |
1.1 |
/*==========================================================================;
|
2 |
|
|
*
|
3 |
|
|
*
|
4 |
|
|
* File: dxerr8.h
|
5 |
|
|
* Content: DirectX Error Library Include File
|
6 |
|
|
*
|
7 |
|
|
****************************************************************************/
|
8 |
|
|
|
9 |
|
|
#ifndef _DXERR8_H_
|
10 |
|
|
#define _DXERR8_H_
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
//
|
14 |
|
|
// DXGetErrorString8
|
15 |
|
|
//
|
16 |
|
|
// Desc: Converts an DirectX HRESULT to a string
|
17 |
|
|
//
|
18 |
|
|
// Args: HRESULT hr Can be any error code from
|
19 |
|
|
// DPLAY D3D8 D3DX8 DMUSIC DSOUND
|
20 |
|
|
//
|
21 |
|
|
// Return: Converted string
|
22 |
|
|
//
|
23 |
|
|
const char* __stdcall DXGetErrorString8A(HRESULT hr);
|
24 |
|
|
const WCHAR* __stdcall DXGetErrorString8W(HRESULT hr);
|
25 |
|
|
|
26 |
|
|
#ifdef UNICODE
|
27 |
|
|
#define DXGetErrorString8 DXGetErrorString8W
|
28 |
|
|
#else
|
29 |
|
|
#define DXGetErrorString8 DXGetErrorString8A
|
30 |
|
|
#endif
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
//
|
34 |
|
|
// DXTrace
|
35 |
|
|
//
|
36 |
|
|
// Desc: Outputs a formatted error message to the debug stream
|
37 |
|
|
//
|
38 |
|
|
// Args: CHAR* strFile The current file, typically passed in using the
|
39 |
|
|
// __FILE__ macro.
|
40 |
|
|
// DWORD dwLine The current line number, typically passed in using the
|
41 |
|
|
// __LINE__ macro.
|
42 |
|
|
// HRESULT hr An HRESULT that will be traced to the debug stream.
|
43 |
|
|
// CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
|
44 |
|
|
// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
|
45 |
|
|
//
|
46 |
|
|
// Return: The hr that was passed in.
|
47 |
|
|
//
|
48 |
|
|
HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox = FALSE );
|
49 |
|
|
HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox = FALSE );
|
50 |
|
|
|
51 |
|
|
#ifdef UNICODE
|
52 |
|
|
#define DXTrace DXTraceW
|
53 |
|
|
#else
|
54 |
|
|
#define DXTrace DXTraceA
|
55 |
|
|
#endif
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
//
|
59 |
|
|
// Helper macros
|
60 |
|
|
//
|
61 |
|
|
#if defined(DEBUG) | defined(_DEBUG)
|
62 |
|
|
#define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
|
63 |
|
|
#define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
|
64 |
|
|
#define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
|
65 |
|
|
#else
|
66 |
|
|
#define DXTRACE_MSG(str) (0L)
|
67 |
|
|
#define DXTRACE_ERR(str,hr) (hr)
|
68 |
|
|
#define DXTRACE_ERR_NOMSGBOX(str,hr) (hr)
|
69 |
|
|
#endif
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
#endif
|
73 |
|
|
|
74 |
|
|
|