]> icculus.org git repositories - btb/d2x.git/blob - arch/win32/d3dframe/d3denum.h
copied from d1x
[btb/d2x.git] / arch / win32 / d3dframe / d3denum.h
1 //-----------------------------------------------------------------------------
2 // File: D3DEnum.h
3 //
4 // Desc: Functions which enumerate through the DirectDraw drivers, Direct3D
5 //       devices, and the display modes available to each device.
6 //
7 //
8 // Copyright (C) 1997 Microsoft Corporation. All rights reserved
9 //-----------------------------------------------------------------------------
10
11
12 #ifndef D3DENUM_H
13 #define D3DENUM_H
14
15 #include <ddraw.h>
16 #include <d3d.h>
17
18
19
20
21 //-----------------------------------------------------------------------------
22 // Name: D3DEnum_ModeInfo
23 // Desc: Linked-list structure to hold information about a display mode. This
24 //       info is stored as a width, height, bpp, and pixelformat within a 
25 //       DDSURFACEDESC2.
26 //-----------------------------------------------------------------------------
27 struct D3DEnum_ModeInfo
28 {
29     DDSURFACEDESC2    ddsd;
30         CHAR              strDesc[40];
31     D3DEnum_ModeInfo* pNext;
32 };
33
34
35
36
37 //-----------------------------------------------------------------------------
38 // Name: D3DEnum_DeviceInfo
39 // Desc: Linked-list structure to hold information about a Direct3D device. The
40 //       primary information recorded here is the D3DDEVICEDESC and a ptr to a
41 //       linked-list of valid display modes.
42 //-----------------------------------------------------------------------------
43 struct D3DEnum_DeviceInfo
44 {
45     GUID                guid;
46     GUID*               pGUID;
47     CHAR                strName[40];
48     D3DDEVICEDESC       ddDesc;
49     BOOL                bIsHardware;
50         BOOL                bCompatbileWithDesktop;
51         BOOL                bWindowed;
52
53     D3DEnum_ModeInfo*   pCurrentMode;
54     D3DEnum_ModeInfo*   pFirstMode;
55     D3DEnum_DeviceInfo* pNext;
56 };
57
58
59
60
61 //-----------------------------------------------------------------------------
62 // Name: D3DEnum_DriverInfo
63 // Desc: Linked-list structure to hold information about a DirectX driver. The
64 //       info stored is the capability bits for the driver plus a linked-list
65 //       of valid Direct3D devices for the driver. Note: most systems will only
66 //       have one driver. The exception are multi-monitor systems, and systems
67 //       with non-GDI 3D video cards.
68 //-----------------------------------------------------------------------------
69 struct D3DEnum_DriverInfo
70 {
71     GUID                 guid;
72     GUID*                pGUID;
73     CHAR                 strDesc[40];
74     CHAR                 strName[40];
75     DDCAPS               ddDriverCaps;
76     DDCAPS               ddHELCaps;
77         HANDLE               hMonitor;
78
79     D3DEnum_DeviceInfo*  pCurrentDevice;
80     D3DEnum_DeviceInfo*  pFirstDevice;
81     D3DEnum_DriverInfo*  pNext;
82 };
83
84
85
86
87 //-----------------------------------------------------------------------------
88 // Name: D3DEnum_EnumerateDevices()
89 // Desc: Enumerates all drivers, devices, and modes. The optional app-supplied
90 //       callback is called for each enumerated device, to confirm that the
91 //       device supports the feature set required by the app.
92 //-----------------------------------------------------------------------------
93 HRESULT D3DEnum_EnumerateDevices(
94                                                 HRESULT (*AppConfirmFn)(DDCAPS*, D3DDEVICEDESC*) );
95
96
97
98
99 //-----------------------------------------------------------------------------
100 // Name: D3DEnum_FreeResources()
101 // Desc: Frees all resources used for driver enumeration
102 //-----------------------------------------------------------------------------
103 VOID D3DEnum_FreeResources();
104
105
106
107
108 //-----------------------------------------------------------------------------
109 // Name: D3DEnum_SelectDefaultDriver()
110 // Desc: Picks a driver based on a set of passed in criteria.
111 //-----------------------------------------------------------------------------
112 HRESULT D3DEnum_SelectDefaultDriver( DWORD dwFlags );
113
114 #define D3DENUM_SOFTWAREONLY   0x00000001
115 #define D3DENUM_FULLSCREENONLY 0x00000002
116 #define D3DENUM_RGBEMULATION   0x00000004
117 #define D3DENUM_REFERENCERAST  0x00000008
118 #define D3DENUM_PRIMARYHAL     0x00000010
119 #define D3DENUM_SECONDARYHAL   0x00000020
120
121
122
123
124 //-----------------------------------------------------------------------------
125 // Name: D3DEnum_UserDlgSelectDriver()
126 // Desc: Prompts the user with a dialog box, from which to choose a DD driver,
127 //       D3D device, and compatible display mode. The function will return 
128 //       IDOK if a new driver/device/mode was selected, or IDCANCEL if not.
129 //       Any error will result in a -1 for a return code.
130 //-----------------------------------------------------------------------------
131 INT D3DEnum_UserDlgSelectDriver( HWND hwndParent, BOOL bCurrentlyWindowed );
132
133
134
135
136 //-----------------------------------------------------------------------------
137 // Name: D3DEnum_GetSelectedDriver()
138 // Desc: Returns the currently selected driver, device, and display mode.
139 //-----------------------------------------------------------------------------
140 HRESULT D3DEnum_GetSelectedDriver( LPGUID* ppDriverGUID, LPGUID* ppDeviceGuid,
141                                    LPDDSURFACEDESC2* pddsdDisplayMode = NULL,
142                                                                    BOOL* pbWindowed = NULL,
143                                                                    BOOL* pbIsHardware = NULL );
144
145
146
147
148 //-----------------------------------------------------------------------------
149 // Name: D3DEnum_GetSelectedDriver()
150 // Desc: Returns the currently selected driver, device, and display mode.
151 //-----------------------------------------------------------------------------
152 HRESULT D3DEnum_GetSelectedDriver( D3DEnum_DriverInfo** ppDriverInfo,
153                                                                    D3DEnum_DeviceInfo** ppDeviceInfo );
154
155
156
157
158 //-----------------------------------------------------------------------------
159 // Name: D3DEnum_GetFirstDriver()
160 // Desc: Returns a ptr to the first DriverInfo structure in the tree holding
161 //       the device/driver/mode enumeration information.
162 //-----------------------------------------------------------------------------
163 D3DEnum_DriverInfo* D3DEnum_GetFirstDriver();
164
165
166
167
168 //-----------------------------------------------------------------------------
169 // Error codes
170 //-----------------------------------------------------------------------------
171 #define D3DENUMERR_ENUMERATIONFAILED   0x81000001 // Enumeration failed
172 #define D3DENUMERR_SUGGESTREFRAST      0x81000002 // Suggest using the RefRast
173 #define D3DENUMERR_NOCOMPATIBLEDEVICES 0x81000003 // No devices were found that
174                                                   // meet the app's desired
175                                                   // capabilities
176 #define D3DENUMERR_NODIRECTDRAW        0x81000004 // DDraw couldn't initialize
177 #define D3DENUMERR_NOTFOUND            0x81000005 // Requested device not found
178
179 #endif // D3DENUM_H
180