adding more stuff for create surface right
[reactos.git] / reactos / lib / ddraw / hal / ddraw_hal.c
1 /* $Id$
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS
5 * FILE: lib/ddraw/hal/ddraw.c
6 * PURPOSE: DirectDraw HAL Implementation
7 * PROGRAMMER: Magnus Olsen, Maarten Bosma
8 *
9 */
10
11 #include "rosdraw.h"
12
13
14 HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 iface)
15 {
16 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
17
18
19 /* point to it self */
20 This->DirectDrawGlobal.lp16DD = &This->DirectDrawGlobal;
21
22 /* get the object */
23 if(!DdCreateDirectDrawObject (&This->DirectDrawGlobal, This->hdc))
24 return DDERR_INVALIDPARAMS;
25
26
27 /* alloc all the space */
28 This->DirectDrawGlobal.lpDDCBtmp = (LPDDHAL_CALLBACKS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DDHAL_CALLBACKS));
29 This->DirectDrawGlobal.lpD3DHALCallbacks = (ULONG_PTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY, sizeof(D3DHAL_CALLBACKS));
30 This->DirectDrawGlobal.lpD3DGlobalDriverData = (ULONG_PTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(D3DHAL_GLOBALDRIVERDATA));
31
32
33 /* Fill in some info */
34 This->HalInfo.lpD3DGlobalDriverData = This->DirectDrawGlobal.lpD3DGlobalDriverData;
35 This->HalInfo.lpD3DHALCallbacks = This->DirectDrawGlobal.lpD3DHALCallbacks;
36 This->HalInfo.lpDDCallbacks = &This->DirectDrawGlobal.lpDDCBtmp->HALDD;
37 This->HalInfo.lpDDExeBufCallbacks = &This->DirectDrawGlobal.lpDDCBtmp->HALDDExeBuf;
38 This->HalInfo.lpDDPaletteCallbacks = &This->DirectDrawGlobal.lpDDCBtmp->HALDDPalette;
39 This->HalInfo.lpDDSurfaceCallbacks = &This->DirectDrawGlobal.lpDDCBtmp->HALDDSurface;
40
41 /* FIXME The insate is not right we need the info that the three NULL return */
42
43 /* query all kinds of infos from the driver */
44 if(!DdQueryDirectDrawObject (
45 &This->DirectDrawGlobal,
46 &This->HalInfo,
47 This->HalInfo.lpDDCallbacks,
48 This->HalInfo.lpDDSurfaceCallbacks,
49 This->HalInfo.lpDDPaletteCallbacks,
50 (LPD3DHAL_CALLBACKS)This->DirectDrawGlobal.lpD3DHALCallbacks,
51 (LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData,
52 This->HalInfo.lpDDExeBufCallbacks,
53 NULL,
54 NULL,
55 NULL ))
56 {
57 OutputDebugString(L"First DdQueryDirectDrawObject failed");
58 return 1;
59 }
60
61 /* FIXME The insate is not right we need the info that the three NULL return and use it here*/
62
63 /* Fixme shall we selected the pixel type before we call the DdQueryDirectDrawObject second time
64 and fill in more info ?? */
65
66 This->HalInfo.vmiData.pvmList = HeapAlloc(GetProcessHeap(), 0, sizeof(VIDMEM) * This->HalInfo.vmiData.dwNumHeaps);
67 This->DirectDrawGlobal.lpdwFourCC = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) * This->HalInfo.ddCaps.dwNumFourCCCodes);
68 This->DirectDrawGlobal.lpZPixelFormats = HeapAlloc(GetProcessHeap(), 0, sizeof(DDPIXELFORMAT) * This->DirectDrawGlobal.dwNumZPixelFormats);
69 ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats = HeapAlloc(GetProcessHeap(), 0, sizeof(DDSURFACEDESC) * ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->dwNumTextureFormats);
70
71 if(!DdQueryDirectDrawObject (
72 &This->DirectDrawGlobal,
73 &This->HalInfo,
74 This->HalInfo.lpDDCallbacks,
75 This->HalInfo.lpDDSurfaceCallbacks,
76 This->HalInfo.lpDDPaletteCallbacks,
77 (LPD3DHAL_CALLBACKS)This->DirectDrawGlobal.lpD3DHALCallbacks,
78 (LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData,
79 This->HalInfo.lpDDExeBufCallbacks,
80 ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats,
81 This->DirectDrawGlobal.lpdwFourCC,
82 This->HalInfo.vmiData.pvmList
83 ))
84 {
85 OutputDebugString(L"Second DdQueryDirectDrawObject failed");
86 return 1;
87 }
88
89 /* Copy HalInfo to DirectDrawGlobal (Not complete)*/
90
91 RtlCopyMemory(&This->DirectDrawGlobal.vmiData,&This->HalInfo.vmiData,sizeof(VIDMEMINFO));
92 RtlCopyMemory(&This->DirectDrawGlobal.ddCaps,&This->HalInfo.ddCaps,sizeof(DDCORECAPS));
93 This->DirectDrawGlobal.dwMonitorFrequency = This->HalInfo.dwMonitorFrequency;
94
95 /* have not check where it should go into yet
96 This->HalInfo.GetDriverInfo datatype LPDDHAL_GETDRIVERINFO
97 */
98
99 This->DirectDrawGlobal.dwModeIndex = This->HalInfo.dwModeIndex;
100
101 /* have not check where it should go into yet
102 This->HalInfo.lpdwFourCC datatype LPDWORD
103 */
104
105 This->DirectDrawGlobal.dwNumModes = This->HalInfo.dwNumModes;
106 This->DirectDrawGlobal.lpModeInfo = This->HalInfo.lpModeInfo;
107
108 /* have not check where it should go into yet
109 This->HalInfo.dwFlags data type DWORD
110 */
111
112 /* Unsure which of these two for lpPDevice
113 This->DirectDrawGlobal.dwPDevice = This->HalInfo.lpPDevice;
114 This->lpDriverHandle = This->HalInfo.lpPDevice;
115 */
116
117 This->DirectDrawGlobal.hInstance = This->HalInfo.hInstance;
118
119 /* have not check where it should go into yet
120 This->lpD3DGlobalDriverData datatype ULONG_PTR
121 This->lpD3DHALCallbacks datatype ULONG_PTR
122 */
123 RtlCopyMemory(&This->DirectDrawGlobal.lpDDCBtmp->HALDDExeBuf,&This->HalInfo.lpDDExeBufCallbacks,sizeof(DDHAL_DDEXEBUFCALLBACKS));
124
125
126
127 /************************************************************************/
128 /* Set up the rest of the callbacks all callbacks we get back from */
129 /* gdi32.dll is user mode */
130 /************************************************************************/
131
132 /* Todo add a check see if HalInfo.GetDriverInfo is supported or not */
133
134 /* Do not trust msdn what it say about dwContext it is not in use for
135 windows nt, it is in use for all os, and it always pont to
136 DirectDrawGlobal.hDD */
137
138 /* FIXME add all callback that have been commect out to gpl */
139 /* FIXME free the memmor that being alloc when ddraw.dll exists */
140 /* FIXME add check for DriverInfo if the handle or not */
141
142 DDHAL_GETDRIVERINFODATA DriverInfo;
143 memset(&DriverInfo,0, sizeof(DDHAL_GETDRIVERINFODATA));
144 DriverInfo.dwSize = sizeof(DDHAL_GETDRIVERINFODATA);
145 DriverInfo.dwContext = This->DirectDrawGlobal.hDD;
146
147
148 /* Get ColorControlCallbacks */
149 DriverInfo.guidInfo = GUID_ColorControlCallbacks;
150 DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDColorControl;
151 DriverInfo.dwExpectedSize = sizeof(DDHAL_DDCOLORCONTROLCALLBACKS);
152 This->HalInfo.GetDriverInfo( &DriverInfo);
153
154
155 /* Get the GUID_D3DCallbacks callback */
156
157 /* Problem with include files
158 DDHAL_DDMISCELLANEOUSCALLBACKS misc;
159 DriverInfo.guidInfo = GUID_D3DCallbacks;
160 DriverInfo.lpvData = &misc;
161 DriverInfo.dwExpectedSize = sizeof();
162 This->HalInfo.GetDriverInfo( &DriverInfo);*/
163
164 /* Get the D3DCallbacks2 */
165 This->DirectDrawGlobal.lpD3DHALCallbacks2 = (ULONG_PTR)HeapAlloc(GetProcessHeap(), 0, sizeof(D3DHAL_CALLBACKS2));
166 DriverInfo.guidInfo = GUID_D3DCallbacks2;
167 DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks2;
168 DriverInfo.dwExpectedSize = sizeof(D3DHAL_CALLBACKS2);
169 This->HalInfo.GetDriverInfo( &DriverInfo);
170
171
172 /* Get the D3DCallbacks3 */
173 This->DirectDrawGlobal.lpD3DHALCallbacks = (ULONG_PTR)HeapAlloc(GetProcessHeap(), 0, sizeof(D3DHAL_CALLBACKS3));
174 DriverInfo.guidInfo = GUID_D3DCallbacks3;
175 DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks;
176 DriverInfo.dwExpectedSize = sizeof(D3DHAL_CALLBACKS3);
177 This->HalInfo.GetDriverInfo( &DriverInfo);
178
179
180 /* Get the misc callback */
181 /* Problem with include files
182 DriverInfo.guidInfo = GUID_D3DCaps;
183 DriverInfo.lpvData = &misc;
184 DriverInfo.dwExpectedSize = sizeof();
185 This->HalInfo.GetDriverInfo( &DriverInfo);
186 */
187
188 /* Get the D3DExtendedCaps */
189
190 This->DirectDrawGlobal.lpD3DExtendedCaps = (ULONG_PTR)HeapAlloc(GetProcessHeap(), 0, sizeof(D3DHAL_D3DEXTENDEDCAPS));
191 DriverInfo.guidInfo = GUID_D3DExtendedCaps;
192 DriverInfo.lpvData = (PVOID) This->DirectDrawGlobal.lpD3DExtendedCaps;
193 DriverInfo.dwExpectedSize = sizeof(D3DHAL_D3DEXTENDEDCAPS);
194 This->HalInfo.GetDriverInfo( &DriverInfo);
195
196
197 /* Get the D3DParseUnknownCommandCallback */
198 /* D3dDrawPrimitives2 callback where should it be fill in
199 DriverInfo.guidInfo = GUID_D3DParseUnknownCommandCallback;
200 DriverInfo.lpvData = &misc;
201 DriverInfo.dwExpectedSize = sizeof();
202 This->HalInfo.GetDriverInfo( &DriverInfo);
203 */
204
205 /* Get the GetHeapAlignment */
206 /* where should it be fill in
207 DriverInfo.guidInfo = GUID_GetHeapAlignment;
208 DriverInfo.lpvData = &misc;
209 DriverInfo.dwExpectedSize = sizeof();
210 This->HalInfo.GetDriverInfo( &DriverInfo);
211 */
212
213
214 /* Get the KernelCallbacks */
215 DriverInfo.guidInfo = GUID_KernelCallbacks;
216 DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDKernel;
217 DriverInfo.dwExpectedSize = sizeof(DDHAL_DDKERNELCALLBACKS);
218 This->HalInfo.GetDriverInfo( &DriverInfo);
219
220
221 /* Get the KernelCaps */
222 This->DirectDrawGlobal.lpDDKernelCaps = (LPDDKERNELCAPS)HeapAlloc(GetProcessHeap(), 0, sizeof(DDHAL_DDKERNELCALLBACKS));
223 DriverInfo.guidInfo = GUID_KernelCaps;
224 DriverInfo.lpvData = (PVOID) This->DirectDrawGlobal.lpDDKernelCaps;
225 DriverInfo.dwExpectedSize = sizeof(DDHAL_DDKERNELCALLBACKS);
226 This->HalInfo.GetDriverInfo( &DriverInfo);
227
228
229 /* Get the MiscellaneousCallbacks */
230 DriverInfo.guidInfo = GUID_MiscellaneousCallbacks;
231 DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous;
232 DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS);
233 This->HalInfo.GetDriverInfo( &DriverInfo);
234
235
236 /* Get the Miscellaneous2Callbacks */
237 /* Not in the DDRAWI_DIRECTDRAW_GBL we map it up as private
238 Contain CreatesurfaceEx and other nice callbacks */
239 DriverInfo.guidInfo = GUID_Miscellaneous2Callbacks;
240 DriverInfo.lpvData = &This->Misc2Callback;
241 DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS);
242 This->HalInfo.GetDriverInfo( &DriverInfo);
243
244
245 /* Get the MotionCompCallbacks */
246 DriverInfo.guidInfo = GUID_MotionCompCallbacks;
247 DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDMotionComp;
248 DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMOTIONCOMPCALLBACKS);
249 This->HalInfo.GetDriverInfo( &DriverInfo);
250
251
252 /* Get the NonLocalVidMemCaps */
253 This->DirectDrawGlobal.lpddNLVCaps = (LPDDNONLOCALVIDMEMCAPS)HeapAlloc(GetProcessHeap(), 0, sizeof(DDNONLOCALVIDMEMCAPS));
254 DriverInfo.guidInfo = GUID_NonLocalVidMemCaps;
255 DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpddNLVCaps;
256 DriverInfo.dwExpectedSize = sizeof(DDNONLOCALVIDMEMCAPS);
257 This->HalInfo.GetDriverInfo( &DriverInfo);
258
259
260 /* Get the NTCallbacks */
261 /* Fill in wher
262 DriverInfo.guidInfo = GUID_NTCallbacks;
263 DriverInfo.lpvData = &misc;
264 DriverInfo.dwExpectedSize = sizeof();
265 This->HalInfo.GetDriverInfo( &DriverInfo);
266 */
267
268 /* Get the NTPrivateDriverCaps */
269 /* Fill in wher
270 DriverInfo.guidInfo = GUID_NTPrivateDriverCaps;
271 DriverInfo.lpvData = &misc;
272 DriverInfo.dwExpectedSize = sizeof();
273 This->HalInfo.GetDriverInfo( &DriverInfo);
274 */
275
276 /* Get the UpdateNonLocalHeap */
277 /* Fill in where
278 DriverInfo.guidInfo = GUID_UpdateNonLocalHeap;
279 DriverInfo.lpvData = &misc;
280 DriverInfo.dwExpectedSize = sizeof();
281 This->HalInfo.GetDriverInfo( &DriverInfo);
282 */
283
284 /* Get the VideoPortCallbacks */
285 DriverInfo.guidInfo = GUID_VideoPortCallbacks;
286 DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDVideoPort;
287 DriverInfo.dwExpectedSize = sizeof(DDHAL_DDVIDEOPORTCALLBACKS);
288 This->HalInfo.GetDriverInfo( &DriverInfo);
289
290
291 /* Get the VideoPortCaps */
292 This->DirectDrawGlobal.lpDDVideoPortCaps = (LPDDVIDEOPORTCAPS)HeapAlloc(GetProcessHeap(), 0, sizeof(DDVIDEOPORTCAPS));
293 DriverInfo.guidInfo = GUID_VideoPortCaps;
294 DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpDDVideoPortCaps;
295 DriverInfo.dwExpectedSize = sizeof(DDVIDEOPORTCAPS);
296 This->HalInfo.GetDriverInfo( &DriverInfo);
297
298
299 /* Get the ZPixelFormats */
300 This->DirectDrawGlobal.lpZPixelFormats = (LPDDPIXELFORMAT)HeapAlloc(GetProcessHeap(), 0, sizeof(DDPIXELFORMAT));
301 DriverInfo.guidInfo = GUID_ZPixelFormats;
302 DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpZPixelFormats;
303 DriverInfo.dwExpectedSize = sizeof(DDPIXELFORMAT);
304 This->HalInfo.GetDriverInfo( &DriverInfo);
305
306
307
308 /* Setup some info from the callbacks we got */
309
310 /* FIXME do more callbacks and fill the gpl struct */
311
312 DDHAL_GETAVAILDRIVERMEMORYDATA mem;
313 mem.lpDD = &This->DirectDrawGlobal;
314
315 This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.GetAvailDriverMemory(&mem);
316
317 This->DirectDrawGlobal.ddCaps.dwVidMemFree = mem.dwFree;
318 This->DirectDrawGlobal.ddCaps.dwVidMemTotal = mem.dwTotal;
319
320
321
322 /* */
323 /* DWORD dwIntRefCnt;
324
325
326 LPVOID lpVtbl;
327 LPDDRAWI_DDRAWSURFACE_LCL lpLcl;
328 LPDDRAWI_DDRAWSURFACE_INT lpLink;
329
330 } DDRAWI_DDRAWSURFACE_INT;
331 */
332
333 /* Setting up some part for surface not ever thing are being fill in yet */
334 This->DirectDrawGlobal.dsList = (LPDDRAWI_DDRAWSURFACE_INT)HeapAlloc(GetProcessHeap(), 0,
335 sizeof(DDRAWI_DDRAWSURFACE_INT));
336
337 This->DirectDrawGlobal.dsList->lpLink = (LPDDRAWI_DDRAWSURFACE_INT) &This->DirectDrawGlobal.dsList;
338
339 This->DirectDrawGlobal.dsList->lpLcl = (LPDDRAWI_DDRAWSURFACE_LCL)HeapAlloc(GetProcessHeap(), 0,
340 sizeof(DDRAWI_DDRAWSURFACE_LCL));
341
342 This->DirectDrawGlobal.dsList->lpLcl->lpGbl =
343 (LPDDRAWI_DDRAWSURFACE_GBL)HeapAlloc(GetProcessHeap(), 0, sizeof(DDRAWI_DDRAWSURFACE_GBL));
344
345 This->DirectDrawGlobal.dsList->lpLcl->lpGbl->lpDD = &This->DirectDrawGlobal;
346
347
348
349
350
351 /* Now all setup for HAL is done and we hopply do not have forget anything */
352
353 return DD_OK;
354 }
355
356 HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface)
357 {
358 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
359
360 DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode;
361
362 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE))
363 {
364 return DDERR_NODRIVERSUPPORT;
365 }
366
367 SetExclusiveMode.lpDD = &This->DirectDrawGlobal;
368 SetExclusiveMode.ddRVal = DDERR_NOTPALETTIZED;
369 SetExclusiveMode.dwEnterExcl = This->cooperative_level;
370
371 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetExclusiveMode(&SetExclusiveMode) != DDHAL_DRIVER_HANDLED)
372 {
373 return DDERR_NODRIVERSUPPORT;
374 }
375
376 return SetExclusiveMode.ddRVal;
377 }
378
379
380 VOID Hal_DirectDraw_Release (LPDIRECTDRAW7 iface)
381 {
382 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
383
384 DdDeleteDirectDrawObject (&This->DirectDrawGlobal);
385
386 if(This->HalInfo.vmiData.pvmList)
387 HeapFree(GetProcessHeap(), 0, This->HalInfo.vmiData.pvmList);
388 if(This->DirectDrawGlobal.lpdwFourCC)
389 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpdwFourCC);
390 if(This->DirectDrawGlobal.lpZPixelFormats)
391 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpZPixelFormats);
392 if(((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats)
393 HeapFree(GetProcessHeap(), 0, ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats);
394
395 if(This->DirectDrawGlobal.lpDDCBtmp)
396 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDCBtmp);
397 if(This->DirectDrawGlobal.lpD3DHALCallbacks)
398 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks);
399 if(This->DirectDrawGlobal.lpD3DGlobalDriverData)
400 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DGlobalDriverData);
401 }
402
403
404 HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
405 LPDWORD total, LPDWORD free)
406 {
407 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
408
409 DDHAL_GETAVAILDRIVERMEMORYDATA mem;
410
411 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY))
412 {
413 return DDERR_NODRIVERSUPPORT;
414 }
415
416 mem.lpDD = &This->DirectDrawGlobal;
417 mem.ddRVal = DDERR_NOTPALETTIZED;
418
419 if (This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.GetAvailDriverMemory(&mem) != DDHAL_DRIVER_HANDLED)
420 {
421 return DDERR_NODRIVERSUPPORT;
422 }
423
424 ddscaps->dwCaps = mem.DDSCaps.dwCaps;
425 ddscaps->dwCaps2 = mem.ddsCapsEx.dwCaps2;
426 ddscaps->dwCaps3 = mem.ddsCapsEx.dwCaps3;
427 ddscaps->dwCaps4 = mem.ddsCapsEx.dwCaps4;
428 *total = mem.dwTotal;
429 *free = mem.dwFree;
430
431 return mem.ddRVal;
432 }
433
434 HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,HANDLE h)
435 {
436
437 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
438
439 DDHAL_WAITFORVERTICALBLANKDATA WaitVectorData;
440
441 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK))
442 {
443 return DDERR_NODRIVERSUPPORT;
444 }
445
446 WaitVectorData.lpDD = &This->DirectDrawGlobal;
447 WaitVectorData.dwFlags = dwFlags;
448 WaitVectorData.hEvent = (DWORD)h;
449 WaitVectorData.ddRVal = DDERR_NOTPALETTIZED;
450
451 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.WaitForVerticalBlank(&WaitVectorData) != DDHAL_DRIVER_HANDLED)
452 {
453 return DDERR_NODRIVERSUPPORT;
454 }
455
456 return WaitVectorData.ddRVal;
457 }
458
459 HRESULT Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
460 {
461 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
462
463 DDHAL_GETSCANLINEDATA GetScan;
464
465 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_GETSCANLINE))
466 {
467 return DDERR_NODRIVERSUPPORT;
468 }
469
470 GetScan.lpDD = &This->DirectDrawGlobal;
471 GetScan.ddRVal = DDERR_NOTPALETTIZED;
472
473 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.GetScanLine(&GetScan) != DDHAL_DRIVER_HANDLED)
474 {
475 return DDERR_NODRIVERSUPPORT;
476 }
477
478 *lpdwScanLine = GetScan.ddRVal;
479 return GetScan.ddRVal;
480 }
481
482 HRESULT Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
483 {
484 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
485
486 DDHAL_FLIPTOGDISURFACEDATA FlipGdi;
487
488 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE))
489 {
490 return DDERR_NODRIVERSUPPORT;
491 }
492
493 FlipGdi.lpDD = &This->DirectDrawGlobal;
494 FlipGdi.ddRVal = DDERR_NOTPALETTIZED;
495
496 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.FlipToGDISurface(&FlipGdi) != DDHAL_DRIVER_HANDLED)
497 {
498 return DDERR_NODRIVERSUPPORT;
499 }
500
501 /* FIXME where should FlipGdi.dwToGDI be fill in */
502 return FlipGdi.ddRVal;
503 }
504
505 HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight,
506 DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
507 {
508 DDHAL_SETMODEDATA mode;
509
510 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
511
512 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE))
513 {
514 return DDERR_NODRIVERSUPPORT;
515 }
516
517 mode.lpDD = &This->DirectDrawGlobal;
518 mode.ddRVal = DDERR_NODRIVERSUPPORT;
519
520 /* FIXME : add search for which mode.ModeIndex we should use */
521 /* FIXME : fill the mode.inexcl; */
522 /* FIXME : fill the mode.useRefreshRate; */
523
524 /*
525 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetMode(&mode) != DDHAL_DRIVER_HANDLED)
526 {
527 return DDERR_NODRIVERSUPPORT;
528 }
529 */
530 DX_STUB;
531 /* return mode.ddRVal */
532 }