- Fix build.
[reactos.git] / reactos / dll / directx / ddraw / rosdraw.h
1 #ifndef __DDRAW_PRIVATE
2 #define __DDRAW_PRIVATE
3
4 /********* Includes *********/
5
6 #include <windows.h>
7 #include <stdio.h>
8 #include <ddraw.h>
9 #include <ddrawi.h>
10 #include <d3dhal.h>
11 #include <ddrawgdi.h>
12
13
14 /* this sturct are not longer in DDK
15 I did recrate it by looking diffent betwin DD_xx struct and _DDHAL strucrt
16 only diffent I found was the global pointer have been change from LPDDRAWI_DDRAWSURFACE_GBL
17 to DD_DIRECTDRAW_GLOBAL
18 */
19
20 typedef struct _DDHAL_MAPMEMORYDATA
21 {
22 LPDDRAWI_DDRAWSURFACE_GBL lpDD;
23 BOOL bMap;
24 HANDLE hProcess;
25 FLATPTR fpProcess;
26 HRESULT ddRVal;
27 } DDHAL_MAPMEMORYDATA;
28
29 /* own macro to alloc memmory */
30 #define DxHeapMemAlloc(m) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, m)
31 #define DxHeapMemFree(p) HeapFree(GetProcessHeap(), 0, p);
32 /******** Main Object ********/
33
34 typedef struct
35 {
36 /* Setup the Vtbl COM table */
37 IDirectDraw7Vtbl* lpVtbl;
38 IDirectDraw4Vtbl* lpVtbl_v4;
39 IDirectDraw2Vtbl* lpVtbl_v2;
40 IDirectDrawVtbl* lpVtbl_v1;
41
42 /* The main struct that contain all info from the HAL and HEL */
43 HDC hdc;
44 DDRAWI_DIRECTDRAW_GBL mDDrawGlobal;
45 DDRAWI_DIRECTDRAW_LCL mDDrawLocal;
46 DDHALINFO mHALInfo;
47
48 DDHAL_CALLBACKS mCallbacks;
49 DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks;
50 D3DHAL_CALLBACKS mD3dCallbacks;
51 D3DHAL_GLOBALDRIVERDATA mD3dDriverData;
52
53 UINT mcModeInfos;
54 DDHALMODEINFO *mpModeInfos;
55
56 UINT mcvmList;
57 VIDMEM *mpvmList;
58
59 UINT mcFourCC;
60 DWORD *mpFourCC;
61
62 UINT mcTextures;
63 DDSURFACEDESC *mpTextures;
64
65
66
67
68 /* ExclusiveOwner */
69
70 DWORD cooperative_level;
71
72
73 BOOL InitializeDraw;
74
75 /* HEL stuff */
76 DWORD HELMemoryAvilable;
77
78 /* internal counter */
79 ULONG ref;
80
81 /* Callbacks info */
82 DDHAL_CREATESURFACEDATA mDdCreateSurface;
83 DDHAL_CANCREATESURFACEDATA mDdCanCreateSurface;
84
85 /* Primarey surface we must reach it from every where */
86 DDRAWI_DDRAWSURFACE_GBL mPrimaryGlobal;
87 DDRAWI_DDRAWSURFACE_MORE mPrimaryMore;
88 DDRAWI_DDRAWSURFACE_LCL mPrimaryLocal;
89 DDRAWI_DDRAWSURFACE_LCL *mpPrimaryLocals[1];
90 DDRAWI_DDRAWCLIPPER_LCL mPrimaryClipperLocal;
91 DDRAWI_DDRAWCLIPPER_GBL mPrimaryClipperGlobal;
92
93 DDSURFACEDESC mddsdPrimary;
94
95 } IDirectDrawImpl;
96
97 /******** Surface Object ********/
98 typedef struct
99 {
100
101 DDRAWI_DDRAWSURFACE_LCL *mpInUseSurfaceLocals[1];
102
103 DDRAWI_DDRAWSURFACE_GBL mSurfGlobal;
104 DDRAWI_DDRAWSURFACE_MORE mSurfMore;
105 DDRAWI_DDRAWSURFACE_LCL mSurfLocal;
106 DDRAWI_DDRAWSURFACE_LCL *mpSurfLocals[1];
107 DDRAWI_DDRAWCLIPPER_LCL mSurfClipperLocal;
108 DDRAWI_DDRAWCLIPPER_GBL mSurfClipperGlobal;
109
110 DDRAWI_DDRAWSURFACE_GBL mOverlayGlobal;
111 DDRAWI_DDRAWSURFACE_LCL mOverlayLocal[6];
112 DDRAWI_DDRAWSURFACE_LCL *mpOverlayLocals[6];
113 DDRAWI_DDRAWSURFACE_MORE mOverlayMore[6];
114
115 DDSURFACEDESC mddsdOverlay;
116
117 } DxSurf;
118
119 typedef struct
120 {
121 IDirectDrawSurface7Vtbl* lpVtbl;
122 IDirectDrawSurface3Vtbl* lpVtbl_v3;
123
124 IDirectDrawImpl* Owner;
125
126 DDRAWI_DDRAWSURFACE_GBL Global;
127 DDRAWI_DDRAWSURFACE_MORE More;
128 DDRAWI_DDRAWSURFACE_LCL Local;
129 DDRAWI_DDRAWSURFACE_LCL *pLocal[2];
130 DDSURFACEDESC ddsd;
131
132 DxSurf *Surf;
133
134 } IDirectDrawSurfaceImpl;
135
136
137
138
139
140 /******** Clipper Object ********/
141
142 typedef struct
143 {
144 IDirectDrawClipperVtbl* lpVtbl;
145 LONG ref;
146
147 IDirectDrawImpl* owner;
148
149 } IDirectDrawClipperImpl;
150
151 /******** Palette Object ********/
152
153 typedef struct
154 {
155 IDirectDrawPaletteVtbl* lpVtbl;
156 LONG ref;
157
158 IDirectDrawImpl* owner;
159
160 } IDirectDrawPaletteImpl;
161
162 /******** Gamma Object ********/
163
164 typedef struct
165 {
166 IDirectDrawGammaControlVtbl* lpVtbl;
167 LONG ref;
168 IDirectDrawImpl* Owner;
169 IDirectDrawSurfaceImpl* Surf;
170
171
172 } IDirectDrawGammaImpl;
173
174 /******** Color Object ********/
175
176 typedef struct
177 {
178 IDirectDrawColorControlVtbl* lpVtbl;
179 LONG ref;
180 IDirectDrawImpl* Owner;
181 IDirectDrawSurfaceImpl* Surf;
182
183
184 } IDirectDrawColorImpl;
185
186 /******** Kernel Object ********/
187
188 typedef struct
189 {
190 IDirectDrawKernelVtbl* lpVtbl;
191 LONG ref;
192 IDirectDrawImpl* Owner;
193 IDirectDrawSurfaceImpl* Surf;
194
195 } IDirectDrawKernelImpl;
196
197 /******** SurfaceKernel Object ********/
198
199 typedef struct
200 {
201 IDirectDrawSurfaceKernelVtbl* lpVtbl;
202 LONG ref;
203 IDirectDrawImpl* Owner;
204 IDirectDrawSurfaceImpl* Surf;
205 IDirectDrawKernelImpl * Kernl;
206
207 } IDirectDrawSurfaceKernelImpl;
208
209
210 /*********** VTables ************/
211
212 extern IDirectDraw7Vtbl DirectDraw7_Vtable;
213 extern IDirectDrawVtbl DDRAW_IDirectDraw_VTable;
214 extern IDirectDraw2Vtbl DDRAW_IDirectDraw2_VTable;
215 extern IDirectDraw4Vtbl DDRAW_IDirectDraw4_VTable;
216
217 extern IDirectDrawSurface7Vtbl DirectDrawSurface7_Vtable;
218 extern IDirectDrawSurface3Vtbl DDRAW_IDDS3_Thunk_VTable;
219
220 extern IDirectDrawPaletteVtbl DirectDrawPalette_Vtable;
221 extern IDirectDrawClipperVtbl DirectDrawClipper_Vtable;
222 extern IDirectDrawColorControlVtbl DirectDrawColorControl_Vtable;
223 extern IDirectDrawGammaControlVtbl DirectDrawGammaControl_Vtable;
224 extern IDirectDrawKernelVtbl DirectDrawKernel_Vtable;
225 extern IDirectDrawSurfaceKernelVtbl DirectDrawSurfaceKernel_Vtable;
226
227 /********* Prototypes **********/
228
229 HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, LPDWORD total, LPDWORD free);
230
231 HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 );
232 HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 );
233 VOID Hal_DirectDraw_Release (LPDIRECTDRAW7 );
234 HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7, LPDDSCAPS2, LPDWORD, LPDWORD );
235 HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7, DWORD, HANDLE );
236 HRESULT Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 , LPDWORD );
237 HRESULT Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 );
238 HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7, DWORD, DWORD, DWORD, DWORD, DWORD );
239 HRESULT Hal_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7, LPRECT, LPDIRECTDRAWSURFACE7, LPRECT, DWORD, LPDDBLTFX );
240 HRESULT Hal_DDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface, LPRECT prect, LPDDSURFACEDESC2 pDDSD, DWORD flags, HANDLE event);
241 HRESULT Hal_DDrawSurface_Flip(LPDIRECTDRAWSURFACE7 iface, LPDIRECTDRAWSURFACE7 override, DWORD dwFlags);
242 HRESULT Hal_DDrawSurface_SetColorKey (LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags, LPDDCOLORKEY pCKey);
243 HRESULT Hal_DDrawSurface_Unlock(LPDIRECTDRAWSURFACE7 iface, LPRECT pRect);
244 HRESULT Hal_DDrawSurface_GetBltStatus(LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags);
245 HRESULT Hal_DDrawSurface_UpdateOverlayDisplay (LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags);
246
247 HRESULT Hel_DirectDraw_Initialize (LPDIRECTDRAW7 );
248 HRESULT Hel_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 );
249 VOID Hel_DirectDraw_Release (LPDIRECTDRAW7 );
250 HRESULT Hel_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 , LPDDSCAPS2 ddsaps, LPDWORD , LPDWORD );
251 HRESULT Hel_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7, DWORD, HANDLE );
252 HRESULT Hel_DirectDraw_GetScanLine(LPDIRECTDRAW7 , LPDWORD );
253 HRESULT Hel_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 );
254 HRESULT Hel_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 , DWORD , DWORD ,DWORD , DWORD , DWORD );
255 HRESULT Hel_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7, LPRECT, LPDIRECTDRAWSURFACE7, LPRECT, DWORD, LPDDBLTFX );
256 HRESULT Hel_DDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface, LPRECT prect, LPDDSURFACEDESC2 pDDSD, DWORD flags, HANDLE event);
257 HRESULT Hel_DDrawSurface_SetColorKey (LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags, LPDDCOLORKEY pCKey);
258 HRESULT Hel_DDrawSurface_Unlock(LPDIRECTDRAWSURFACE7 iface, LPRECT pRect);
259 HRESULT Hel_DDrawSurface_GetBltStatus(LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags);
260 HRESULT Hel_DDrawSurface_Flip(LPDIRECTDRAWSURFACE7 iface, LPDIRECTDRAWSURFACE7 override, DWORD dwFlags);
261 HRESULT Hel_DDrawSurface_UpdateOverlayDisplay (LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags);
262
263 /* HEL CALLBACK */
264 DWORD CALLBACK HelDdDestroyDriver(LPDDHAL_DESTROYDRIVERDATA lpDestroyDriver);
265 DWORD CALLBACK HelDdCreateSurface(LPDDHAL_CREATESURFACEDATA lpCreateSurface);
266 DWORD CALLBACK HelDdSetColorKey(LPDDHAL_SETCOLORKEYDATA lpSetColorKey);
267 DWORD CALLBACK HelDdSetMode(LPDDHAL_SETMODEDATA SetMode);
268 DWORD CALLBACK HelDdWaitForVerticalBlank(LPDDHAL_WAITFORVERTICALBLANKDATA lpWaitForVerticalBlank);
269 DWORD CALLBACK HelDdCanCreateSurface(LPDDHAL_CANCREATESURFACEDATA lpCanCreateSurface);
270 DWORD CALLBACK HelDdCreatePalette(LPDDHAL_CREATEPALETTEDATA lpCreatePalette);
271 DWORD CALLBACK HelDdGetScanLine(LPDDHAL_GETSCANLINEDATA lpGetScanLine);
272 DWORD CALLBACK HelDdSetExclusiveMode(LPDDHAL_SETEXCLUSIVEMODEDATA lpSetExclusiveMode);
273 DWORD CALLBACK HelDdFlipToGDISurface(LPDDHAL_FLIPTOGDISURFACEDATA lpFlipToGDISurface);
274
275
276 /* Setting for HEL should be move to ros special reg key ? */
277
278 /* setup how much graphic memory should hel be limit, set it now to 64MB */
279 #define HEL_GRAPHIC_MEMORY_MAX 67108864
280
281 /*********** Macros ***********/
282
283 #define DX_STUB \
284 static BOOL firstcall = TRUE; \
285 if (firstcall) \
286 { \
287 char buffer[1024]; \
288 sprintf ( buffer, "Function %s is not implemented yet (%s:%d)\n", __FUNCTION__,__FILE__,__LINE__ ); \
289 OutputDebugStringA(buffer); \
290 firstcall = FALSE; \
291 } \
292 return DDERR_UNSUPPORTED;
293
294 #define DX_STUB_DD_OK \
295 static BOOL firstcall = TRUE; \
296 if (firstcall) \
297 { \
298 char buffer[1024]; \
299 sprintf ( buffer, "Function %s is not implemented yet (%s:%d)\n", __FUNCTION__,__FILE__,__LINE__ ); \
300 OutputDebugStringA(buffer); \
301 firstcall = FALSE; \
302 } \
303 return DD_OK;
304
305
306 #define DX_STUB_str(x) \
307 { \
308 char buffer[1024]; \
309 sprintf ( buffer, "Function %s %s (%s:%d)\n", __FUNCTION__,x,__FILE__,__LINE__ ); \
310 OutputDebugStringA(buffer); \
311 }
312
313
314 //#define DX_WINDBG_trace()
315
316
317 #define DX_WINDBG_trace() \
318 static BOOL firstcallx = TRUE; \
319 if (firstcallx) \
320 { \
321 char buffer[1024]; \
322 sprintf ( buffer, "Enter Function %s (%s:%d)\n", __FUNCTION__,__FILE__,__LINE__ ); \
323 OutputDebugStringA(buffer); \
324 firstcallx = TRUE; \
325 }
326
327
328 #define DX_WINDBG_trace_res(width,height,bpp) \
329 static BOOL firstcallxx = TRUE; \
330 if (firstcallxx) \
331 { \
332 char buffer[1024]; \
333 sprintf ( buffer, "Setmode have been req width=%d, height=%d bpp=%d\n",width,height,bpp); \
334 OutputDebugStringA(buffer); \
335 firstcallxx = FALSE; \
336 }
337
338 #endif /* __DDRAW_PRIVATE */