3 * COPYRIGHT: See COPYING in the top level directory
5 * FILE: lib/ddraw/hal/ddraw.c
6 * PURPOSE: DirectDraw HAL Implementation
7 * PROGRAMMER: Magnus Olsen, Maarten Bosma
14 HRESULT
Hal_DirectDraw_Initialize (LPDIRECTDRAW7 iface
)
16 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
19 /* point to it self */
20 This
->DirectDrawGlobal
.lp16DD
= &This
->DirectDrawGlobal
;
23 if(!DdCreateDirectDrawObject (&This
->DirectDrawGlobal
, This
->hdc
))
24 return DDERR_INVALIDPARAMS
;
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
));
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
;
41 /* FIXME The insate is not right we need the info that the three NULL return */
43 /* query all kinds of infos from the driver */
44 if(!DdQueryDirectDrawObject (
45 &This
->DirectDrawGlobal
,
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
,
57 OutputDebugString(L
"First DdQueryDirectDrawObject failed");
61 /* FIXME The insate is not right we need the info that the three NULL return and use it here*/
63 /* Fixme shall we selected the pixel type before we call the DdQueryDirectDrawObject second time
64 and fill in more info ?? */
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
);
71 if(!DdQueryDirectDrawObject (
72 &This
->DirectDrawGlobal
,
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
85 OutputDebugString(L
"Second DdQueryDirectDrawObject failed");
89 /* Copy HalInfo to DirectDrawGlobal (Not complete)*/
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
;
95 /* have not check where it should go into yet
96 This->HalInfo.GetDriverInfo datatype LPDDHAL_GETDRIVERINFO
99 This
->DirectDrawGlobal
.dwModeIndex
= This
->HalInfo
.dwModeIndex
;
101 /* have not check where it should go into yet
102 This->HalInfo.lpdwFourCC datatype LPDWORD
105 This
->DirectDrawGlobal
.dwNumModes
= This
->HalInfo
.dwNumModes
;
106 This
->DirectDrawGlobal
.lpModeInfo
= This
->HalInfo
.lpModeInfo
;
108 /* have not check where it should go into yet
109 This->HalInfo.dwFlags data type DWORD
112 /* Unsure which of these two for lpPDevice
113 This->DirectDrawGlobal.dwPDevice = This->HalInfo.lpPDevice;
114 This->lpDriverHandle = This->HalInfo.lpPDevice;
117 This
->DirectDrawGlobal
.hInstance
= This
->HalInfo
.hInstance
;
119 /* have not check where it should go into yet
120 This->lpD3DGlobalDriverData datatype ULONG_PTR
121 This->lpD3DHALCallbacks datatype ULONG_PTR
123 RtlCopyMemory(&This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDExeBuf
,&This
->HalInfo
.lpDDExeBufCallbacks
,sizeof(DDHAL_DDEXEBUFCALLBACKS
));
127 /************************************************************************/
128 /* Set up the rest of the callbacks all callbacks we get back from */
129 /* gdi32.dll is user mode */
130 /************************************************************************/
132 /* Todo add a check see if HalInfo.GetDriverInfo is supported or not */
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 */
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 */
142 DDHAL_GETDRIVERINFODATA DriverInfo
;
143 memset(&DriverInfo
,0, sizeof(DDHAL_GETDRIVERINFODATA
));
144 DriverInfo
.dwSize
= sizeof(DDHAL_GETDRIVERINFODATA
);
145 DriverInfo
.dwContext
= This
->DirectDrawGlobal
.hDD
;
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
);
155 /* Get the GUID_D3DCallbacks callback */
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);*/
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
);
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
);
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);
188 /* Get the D3DExtendedCaps */
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
);
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);
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);
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
);
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
);
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
);
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
);
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
);
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
);
260 /* Get the NTCallbacks */
262 DriverInfo.guidInfo = GUID_NTCallbacks;
263 DriverInfo.lpvData = &misc;
264 DriverInfo.dwExpectedSize = sizeof();
265 This->HalInfo.GetDriverInfo( &DriverInfo);
268 /* Get the NTPrivateDriverCaps */
270 DriverInfo.guidInfo = GUID_NTPrivateDriverCaps;
271 DriverInfo.lpvData = &misc;
272 DriverInfo.dwExpectedSize = sizeof();
273 This->HalInfo.GetDriverInfo( &DriverInfo);
276 /* Get the UpdateNonLocalHeap */
278 DriverInfo.guidInfo = GUID_UpdateNonLocalHeap;
279 DriverInfo.lpvData = &misc;
280 DriverInfo.dwExpectedSize = sizeof();
281 This->HalInfo.GetDriverInfo( &DriverInfo);
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
);
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
);
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
);
308 /* Setup some info from the callbacks we got */
310 /* FIXME do more callbacks and fill the gpl struct */
312 DDHAL_GETAVAILDRIVERMEMORYDATA mem
;
313 mem
.lpDD
= &This
->DirectDrawGlobal
;
315 This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMiscellaneous
.GetAvailDriverMemory(&mem
);
317 This
->DirectDrawGlobal
.ddCaps
.dwVidMemFree
= mem
.dwFree
;
318 This
->DirectDrawGlobal
.ddCaps
.dwVidMemTotal
= mem
.dwTotal
;
323 /* DWORD dwIntRefCnt;
327 LPDDRAWI_DDRAWSURFACE_LCL lpLcl;
328 LPDDRAWI_DDRAWSURFACE_INT lpLink;
330 } DDRAWI_DDRAWSURFACE_INT;
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
));
337 This
->DirectDrawGlobal
.dsList
->lpLink
= (LPDDRAWI_DDRAWSURFACE_INT
) &This
->DirectDrawGlobal
.dsList
;
339 This
->DirectDrawGlobal
.dsList
->lpLcl
= (LPDDRAWI_DDRAWSURFACE_LCL
)HeapAlloc(GetProcessHeap(), 0,
340 sizeof(DDRAWI_DDRAWSURFACE_LCL
));
342 This
->DirectDrawGlobal
.dsList
->lpLcl
->lpGbl
=
343 (LPDDRAWI_DDRAWSURFACE_GBL
)HeapAlloc(GetProcessHeap(), 0, sizeof(DDRAWI_DDRAWSURFACE_GBL
));
345 This
->DirectDrawGlobal
.dsList
->lpLcl
->lpGbl
->lpDD
= &This
->DirectDrawGlobal
;
351 /* Now all setup for HAL is done and we hopply do not have forget anything */
356 HRESULT
Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface
)
358 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
360 DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode
;
362 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_SETEXCLUSIVEMODE
))
364 return DDERR_NODRIVERSUPPORT
;
367 SetExclusiveMode
.lpDD
= &This
->DirectDrawGlobal
;
368 SetExclusiveMode
.ddRVal
= DDERR_NOTPALETTIZED
;
369 SetExclusiveMode
.dwEnterExcl
= This
->cooperative_level
;
371 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.SetExclusiveMode(&SetExclusiveMode
) != DDHAL_DRIVER_HANDLED
)
373 return DDERR_NODRIVERSUPPORT
;
376 return SetExclusiveMode
.ddRVal
;
380 VOID
Hal_DirectDraw_Release (LPDIRECTDRAW7 iface
)
382 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
384 DdDeleteDirectDrawObject (&This
->DirectDrawGlobal
);
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
);
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
);
404 HRESULT
Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface
, LPDDSCAPS2 ddscaps
,
405 LPDWORD total
, LPDWORD free
)
407 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
409 DDHAL_GETAVAILDRIVERMEMORYDATA mem
;
411 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMiscellaneous
.dwFlags
& DDHAL_MISCCB32_GETAVAILDRIVERMEMORY
))
413 return DDERR_NODRIVERSUPPORT
;
416 mem
.lpDD
= &This
->DirectDrawGlobal
;
417 mem
.ddRVal
= DDERR_NOTPALETTIZED
;
419 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMiscellaneous
.GetAvailDriverMemory(&mem
) != DDHAL_DRIVER_HANDLED
)
421 return DDERR_NODRIVERSUPPORT
;
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
;
434 HRESULT
Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface
, DWORD dwFlags
,HANDLE h
)
437 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
439 DDHAL_WAITFORVERTICALBLANKDATA WaitVectorData
;
441 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_WAITFORVERTICALBLANK
))
443 return DDERR_NODRIVERSUPPORT
;
446 WaitVectorData
.lpDD
= &This
->DirectDrawGlobal
;
447 WaitVectorData
.dwFlags
= dwFlags
;
448 WaitVectorData
.hEvent
= (DWORD
)h
;
449 WaitVectorData
.ddRVal
= DDERR_NOTPALETTIZED
;
451 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.WaitForVerticalBlank(&WaitVectorData
) != DDHAL_DRIVER_HANDLED
)
453 return DDERR_NODRIVERSUPPORT
;
456 return WaitVectorData
.ddRVal
;
459 HRESULT
Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface
, LPDWORD lpdwScanLine
)
461 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
463 DDHAL_GETSCANLINEDATA GetScan
;
465 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_GETSCANLINE
))
467 return DDERR_NODRIVERSUPPORT
;
470 GetScan
.lpDD
= &This
->DirectDrawGlobal
;
471 GetScan
.ddRVal
= DDERR_NOTPALETTIZED
;
473 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.GetScanLine(&GetScan
) != DDHAL_DRIVER_HANDLED
)
475 return DDERR_NODRIVERSUPPORT
;
478 *lpdwScanLine
= GetScan
.ddRVal
;
479 return GetScan
.ddRVal
;
482 HRESULT
Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface
)
484 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
486 DDHAL_FLIPTOGDISURFACEDATA FlipGdi
;
488 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_FLIPTOGDISURFACE
))
490 return DDERR_NODRIVERSUPPORT
;
493 FlipGdi
.lpDD
= &This
->DirectDrawGlobal
;
494 FlipGdi
.ddRVal
= DDERR_NOTPALETTIZED
;
496 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.FlipToGDISurface(&FlipGdi
) != DDHAL_DRIVER_HANDLED
)
498 return DDERR_NODRIVERSUPPORT
;
501 /* FIXME where should FlipGdi.dwToGDI be fill in */
502 return FlipGdi
.ddRVal
;
505 HRESULT
Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface
, DWORD dwWidth
, DWORD dwHeight
,
506 DWORD dwBPP
, DWORD dwRefreshRate
, DWORD dwFlags
)
508 DDHAL_SETMODEDATA mode
;
510 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
512 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_SETMODE
))
514 return DDERR_NODRIVERSUPPORT
;
517 mode
.lpDD
= &This
->DirectDrawGlobal
;
518 mode
.ddRVal
= DDERR_NODRIVERSUPPORT
;
520 /* FIXME : add search for which mode.ModeIndex we should use */
521 /* FIXME : fill the mode.inexcl; */
522 /* FIXME : fill the mode.useRefreshRate; */
525 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetMode(&mode) != DDHAL_DRIVER_HANDLED)
527 return DDERR_NODRIVERSUPPORT;
531 /* return mode.ddRVal */