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
;
18 /* point to it self */
19 This
->DirectDrawGlobal
.lp16DD
= &This
->DirectDrawGlobal
;
22 if(!DdCreateDirectDrawObject (&This
->DirectDrawGlobal
, (HDC
)This
->DirectDrawGlobal
.lpExclusiveOwner
->hDC
))
23 return DDERR_INVALIDPARAMS
;
25 /* alloc all the space */
26 This
->DirectDrawGlobal
.lpDDCBtmp
= (LPDDHAL_CALLBACKS
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
27 sizeof(DDHAL_CALLBACKS
));
29 This
->DirectDrawGlobal
.lpD3DHALCallbacks
= (ULONG_PTR
)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,
30 sizeof(D3DHAL_CALLBACKS
));
32 This
->DirectDrawGlobal
.lpD3DGlobalDriverData
= (ULONG_PTR
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
33 sizeof(D3DHAL_GLOBALDRIVERDATA
));
35 /* Fill in some info */
36 This
->HalInfo
.lpD3DGlobalDriverData
= This
->DirectDrawGlobal
.lpD3DGlobalDriverData
;
37 This
->HalInfo
.lpD3DHALCallbacks
= This
->DirectDrawGlobal
.lpD3DHALCallbacks
;
38 This
->HalInfo
.lpDDCallbacks
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
;
39 This
->HalInfo
.lpDDExeBufCallbacks
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDExeBuf
;
40 This
->HalInfo
.lpDDPaletteCallbacks
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDPalette
;
41 This
->HalInfo
.lpDDSurfaceCallbacks
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDSurface
;
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
,
60 This
->HalInfo
.vmiData
.pvmList
= (LPVIDMEM
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
61 sizeof(VIDMEM
) * This
->HalInfo
.vmiData
.dwNumHeaps
);
63 This
->DirectDrawGlobal
.lpdwFourCC
= (DWORD
*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
64 sizeof(DWORD
) * This
->HalInfo
.ddCaps
.dwNumFourCCCodes
);
65 ((LPD3DHAL_GLOBALDRIVERDATA
)This
->DirectDrawGlobal
.lpD3DGlobalDriverData
)->lpTextureFormats
=
66 (LPDDSURFACEDESC
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(DDSURFACEDESC
) *
67 ((LPD3DHAL_GLOBALDRIVERDATA
)This
->DirectDrawGlobal
.lpD3DGlobalDriverData
)->dwNumTextureFormats
);
69 if(!DdQueryDirectDrawObject (
70 &This
->DirectDrawGlobal
,
72 This
->HalInfo
.lpDDCallbacks
,
73 This
->HalInfo
.lpDDSurfaceCallbacks
,
74 This
->HalInfo
.lpDDPaletteCallbacks
,
75 (LPD3DHAL_CALLBACKS
)This
->DirectDrawGlobal
.lpD3DHALCallbacks
,
76 (LPD3DHAL_GLOBALDRIVERDATA
)This
->DirectDrawGlobal
.lpD3DGlobalDriverData
,
77 This
->HalInfo
.lpDDExeBufCallbacks
,
78 ((LPD3DHAL_GLOBALDRIVERDATA
)This
->DirectDrawGlobal
.lpD3DGlobalDriverData
)->lpTextureFormats
,
79 This
->DirectDrawGlobal
.lpdwFourCC
,
80 This
->HalInfo
.vmiData
.pvmList
86 /* Copy HalInfo to DirectDrawGlobal (Not complete)*/
87 RtlCopyMemory(&This
->DirectDrawGlobal
.vmiData
,&This
->HalInfo
.vmiData
,sizeof(VIDMEMINFO
));
88 RtlCopyMemory(&This
->DirectDrawGlobal
.ddCaps
,&This
->HalInfo
.ddCaps
,sizeof(DDCORECAPS
));
89 This
->DirectDrawGlobal
.dwMonitorFrequency
= This
->HalInfo
.dwMonitorFrequency
;
91 This
->DirectDrawGlobal
.dwModeIndex
= This
->HalInfo
.dwModeIndex
;
92 This
->DirectDrawGlobal
.dwNumModes
= This
->HalInfo
.dwNumModes
;
93 This
->DirectDrawGlobal
.lpModeInfo
= This
->HalInfo
.lpModeInfo
;
95 /* Unsure which of these two for lpPDevice
96 This->DirectDrawGlobal.dwPDevice = This->HalInfo.lpPDevice;
97 This->lpDriverHandle = This->HalInfo.lpPDevice;
99 This
->DirectDrawGlobal
.hInstance
= This
->HalInfo
.hInstance
;
100 RtlCopyMemory(&This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDExeBuf
,
101 &This
->HalInfo
.lpDDExeBufCallbacks
,sizeof(DDHAL_DDEXEBUFCALLBACKS
));
103 /************************************************************************/
104 /* Set up the rest of the callbacks all callbacks we get back from */
105 /* gdi32.dll is user mode */
106 /************************************************************************/
108 /* Todo add a check see if HalInfo.GetDriverInfo is supported or not */
109 /* Do not trust msdn what it say about dwContext it is not in use for
110 windows nt, it is in use for all os, and it always pont to
111 DirectDrawGlobal.hDD */
113 /* FIXME add all callback that have been commect out to gpl */
114 /* FIXME free the memmor that being alloc when ddraw.dll exists */
115 /* FIXME add check for DriverInfo if the handle or not */
117 DDHAL_GETDRIVERINFODATA DriverInfo
;
118 memset(&DriverInfo
,0, sizeof(DDHAL_GETDRIVERINFODATA
));
119 DriverInfo
.dwSize
= sizeof(DDHAL_GETDRIVERINFODATA
);
120 DriverInfo
.dwContext
= This
->DirectDrawGlobal
.hDD
;
122 /* Get ColorControlCallbacks */
123 DriverInfo
.guidInfo
= GUID_ColorControlCallbacks
;
124 DriverInfo
.lpvData
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDColorControl
;
125 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDCOLORCONTROLCALLBACKS
);
126 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
128 /* Get the GUID_D3DCallbacks callback */
129 /* Problem with include files
130 DDHAL_DDMISCELLANEOUSCALLBACKS misc;
131 DriverInfo.guidInfo = GUID_D3DCallbacks;
132 DriverInfo.lpvData = &misc;
133 DriverInfo.dwExpectedSize = sizeof();
134 This->HalInfo.GetDriverInfo( &DriverInfo);*/
136 /* Get the D3DCallbacks2 */
137 This
->DirectDrawGlobal
.lpD3DHALCallbacks2
= (ULONG_PTR
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
138 sizeof(D3DHAL_CALLBACKS2
));
139 DriverInfo
.guidInfo
= GUID_D3DCallbacks2
;
140 DriverInfo
.lpvData
= (PVOID
)This
->DirectDrawGlobal
.lpD3DHALCallbacks2
;
141 DriverInfo
.dwExpectedSize
= sizeof(D3DHAL_CALLBACKS2
);
142 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
145 /* Get the D3DCallbacks3 */
146 This
->DirectDrawGlobal
.lpD3DHALCallbacks
= (ULONG_PTR
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
147 sizeof(D3DHAL_CALLBACKS3
));
148 DriverInfo
.guidInfo
= GUID_D3DCallbacks3
;
149 DriverInfo
.lpvData
= (PVOID
)This
->DirectDrawGlobal
.lpD3DHALCallbacks
;
150 DriverInfo
.dwExpectedSize
= sizeof(D3DHAL_CALLBACKS3
);
151 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
153 /* Get the misc callback */
154 /* Problem with include files
155 DriverInfo.guidInfo = GUID_D3DCaps;
156 DriverInfo.lpvData = &misc;
157 DriverInfo.dwExpectedSize = sizeof();
158 This->HalInfo.GetDriverInfo( &DriverInfo);
161 /* Get the D3DExtendedCaps */
163 This
->DirectDrawGlobal
.lpD3DExtendedCaps
= (ULONG_PTR
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
164 sizeof(D3DHAL_D3DEXTENDEDCAPS
));
165 DriverInfo
.guidInfo
= GUID_D3DExtendedCaps
;
166 DriverInfo
.lpvData
= (PVOID
) This
->DirectDrawGlobal
.lpD3DExtendedCaps
;
167 DriverInfo
.dwExpectedSize
= sizeof(D3DHAL_D3DEXTENDEDCAPS
);
168 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
170 /* Get the D3DParseUnknownCommandCallback */
171 /* D3dDrawPrimitives2 callback where should it be fill in
172 DriverInfo.guidInfo = GUID_D3DParseUnknownCommandCallback;
173 DriverInfo.lpvData = &misc;
174 DriverInfo.dwExpectedSize = sizeof();
175 This->HalInfo.GetDriverInfo( &DriverInfo);
178 /* Get the GetHeapAlignment */
179 /* where should it be fill in
180 DriverInfo.guidInfo = GUID_GetHeapAlignment;
181 DriverInfo.lpvData = &misc;
182 DriverInfo.dwExpectedSize = sizeof();
183 This->HalInfo.GetDriverInfo( &DriverInfo);
186 /* Get the KernelCallbacks */
187 DriverInfo
.guidInfo
= GUID_KernelCallbacks
;
188 DriverInfo
.lpvData
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDKernel
;
189 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDKERNELCALLBACKS
);
190 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
192 /* Get the KernelCaps */
193 This
->DirectDrawGlobal
.lpDDKernelCaps
= (LPDDKERNELCAPS
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
194 sizeof(DDHAL_DDKERNELCALLBACKS
));
195 DriverInfo
.guidInfo
= GUID_KernelCaps
;
196 DriverInfo
.lpvData
= (PVOID
) This
->DirectDrawGlobal
.lpDDKernelCaps
;
197 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDKERNELCALLBACKS
);
198 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
200 /* Get the MiscellaneousCallbacks */
201 DriverInfo
.guidInfo
= GUID_MiscellaneousCallbacks
;
202 DriverInfo
.lpvData
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMiscellaneous
;
203 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS
);
204 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
206 /* Get the Miscellaneous2Callbacks */
207 /* Not in the DDRAWI_DIRECTDRAW_GBL we map it up as private
208 Contain CreatesurfaceEx and other nice callbacks */
209 DriverInfo
.guidInfo
= GUID_Miscellaneous2Callbacks
;
210 DriverInfo
.lpvData
= &This
->Misc2Callback
;
211 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS
);
212 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
214 /* Get the MotionCompCallbacks */
215 DriverInfo
.guidInfo
= GUID_MotionCompCallbacks
;
216 DriverInfo
.lpvData
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMotionComp
;
217 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDMOTIONCOMPCALLBACKS
);
218 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
220 /* Get the NonLocalVidMemCaps */
221 This
->DirectDrawGlobal
.lpddNLVCaps
= (LPDDNONLOCALVIDMEMCAPS
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
222 sizeof(DDNONLOCALVIDMEMCAPS
));
223 DriverInfo
.guidInfo
= GUID_NonLocalVidMemCaps
;
224 DriverInfo
.lpvData
= (PVOID
)This
->DirectDrawGlobal
.lpddNLVCaps
;
225 DriverInfo
.dwExpectedSize
= sizeof(DDNONLOCALVIDMEMCAPS
);
226 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
228 /* Get the NTCallbacks */
230 DriverInfo.guidInfo = GUID_NTCallbacks;
231 DriverInfo.lpvData = &misc;
232 DriverInfo.dwExpectedSize = sizeof();
233 This->HalInfo.GetDriverInfo( &DriverInfo);
236 /* Get the NTPrivateDriverCaps */
238 DriverInfo.guidInfo = GUID_NTPrivateDriverCaps;
239 DriverInfo.lpvData = &misc;
240 DriverInfo.dwExpectedSize = sizeof();
241 This->HalInfo.GetDriverInfo( &DriverInfo);
244 /* Get the UpdateNonLocalHeap */
246 DriverInfo.guidInfo = GUID_UpdateNonLocalHeap;
247 DriverInfo.lpvData = &misc;
248 DriverInfo.dwExpectedSize = sizeof();
249 This->HalInfo.GetDriverInfo( &DriverInfo);
252 /* Get the VideoPortCallbacks */
253 DriverInfo
.guidInfo
= GUID_VideoPortCallbacks
;
254 DriverInfo
.lpvData
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDVideoPort
;
255 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDVIDEOPORTCALLBACKS
);
256 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
258 /* Get the VideoPortCaps */
259 This
->DirectDrawGlobal
.lpDDVideoPortCaps
= (LPDDVIDEOPORTCAPS
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
260 sizeof(DDVIDEOPORTCAPS
));
261 DriverInfo
.guidInfo
= GUID_VideoPortCaps
;
262 DriverInfo
.lpvData
= (PVOID
)This
->DirectDrawGlobal
.lpDDVideoPortCaps
;
263 DriverInfo
.dwExpectedSize
= sizeof(DDVIDEOPORTCAPS
);
264 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
266 /* Get the ZPixelFormats */
267 /* take off this it until we figout how lpexluisev should be fild in
268 This->DirectDrawGlobal.lpZPixelFormats = (LPDDPIXELFORMAT) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
269 sizeof(DDPIXELFORMAT) * This->DirectDrawGlobal.dwNumZPixelFormats);
270 DriverInfo.guidInfo = GUID_ZPixelFormats;
271 DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpZPixelFormats;
272 DriverInfo.dwExpectedSize = sizeof(DDPIXELFORMAT);
273 This->HalInfo.GetDriverInfo(&DriverInfo);
276 /* Setup some info from the callbacks we got */
277 DDHAL_GETAVAILDRIVERMEMORYDATA mem
;
278 mem
.lpDD
= &This
->DirectDrawGlobal
;
279 This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMiscellaneous
.GetAvailDriverMemory(&mem
);
280 This
->DirectDrawGlobal
.ddCaps
.dwVidMemFree
= mem
.dwFree
;
281 This
->DirectDrawGlobal
.ddCaps
.dwVidMemTotal
= mem
.dwTotal
;
284 DdReenableDirectDrawObject(&This
->DirectDrawGlobal
, &dummy
);
286 /* Now all setup for HAL is done */
290 HRESULT
Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface
)
292 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
294 DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode
;
296 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_SETEXCLUSIVEMODE
))
298 return DDERR_NODRIVERSUPPORT
;
301 SetExclusiveMode
.lpDD
= &This
->DirectDrawGlobal
;
302 SetExclusiveMode
.ddRVal
= DDERR_NOTPALETTIZED
;
303 SetExclusiveMode
.dwEnterExcl
= This
->cooperative_level
;
305 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.SetExclusiveMode(&SetExclusiveMode
) != DDHAL_DRIVER_HANDLED
)
307 return DDERR_NODRIVERSUPPORT
;
310 return SetExclusiveMode
.ddRVal
;
314 VOID
Hal_DirectDraw_Release (LPDIRECTDRAW7 iface
)
316 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
318 DdDeleteDirectDrawObject (&This
->DirectDrawGlobal
);
321 if(This->DirectDrawGlobal.lpDDKernelCaps)
322 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDKernelCaps);
324 if(This->DirectDrawGlobal.lpddNLVCaps)
325 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpddNLVCaps);
327 if(This->DirectDrawGlobal.lpDDVideoPortCaps)
328 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDVideoPortCaps);
330 if(This->DirectDrawGlobal.lpdwFourCC)
331 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpdwFourCC);
333 if(This->DirectDrawGlobal.lpZPixelFormats)
334 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpZPixelFormats);
336 if(This->HalInfo.vmiData.pvmList)
337 HeapFree(GetProcessHeap(), 0, This->HalInfo.vmiData.pvmList);
339 if(((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats)
340 HeapFree(GetProcessHeap(), 0, ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats);
342 if(This->DirectDrawGlobal.lpDDCBtmp)
343 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDCBtmp);
345 if(This->DirectDrawGlobal.lpD3DHALCallbacks)
346 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks);
348 if(This->DirectDrawGlobal.lpD3DGlobalDriverData)
349 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DGlobalDriverData);
354 HRESULT
Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface
, LPDDSCAPS2 ddscaps
,
355 LPDWORD total
, LPDWORD free
)
357 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
359 DDHAL_GETAVAILDRIVERMEMORYDATA mem
;
361 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMiscellaneous
.dwFlags
& DDHAL_MISCCB32_GETAVAILDRIVERMEMORY
))
363 return DDERR_NODRIVERSUPPORT
;
366 mem
.lpDD
= &This
->DirectDrawGlobal
;
367 mem
.ddRVal
= DDERR_NOTPALETTIZED
;
369 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMiscellaneous
.GetAvailDriverMemory(&mem
) != DDHAL_DRIVER_HANDLED
)
371 return DDERR_NODRIVERSUPPORT
;
374 ddscaps
->dwCaps
= mem
.DDSCaps
.dwCaps
;
375 ddscaps
->dwCaps2
= mem
.ddsCapsEx
.dwCaps2
;
376 ddscaps
->dwCaps3
= mem
.ddsCapsEx
.dwCaps3
;
377 ddscaps
->dwCaps4
= mem
.ddsCapsEx
.dwCaps4
;
378 *total
= mem
.dwTotal
;
384 HRESULT
Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface
, DWORD dwFlags
,HANDLE h
)
386 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
388 DDHAL_WAITFORVERTICALBLANKDATA WaitVectorData
;
390 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_WAITFORVERTICALBLANK
))
392 return DDERR_NODRIVERSUPPORT
;
395 WaitVectorData
.lpDD
= &This
->DirectDrawGlobal
;
396 WaitVectorData
.dwFlags
= dwFlags
;
397 WaitVectorData
.hEvent
= (DWORD
)h
;
398 WaitVectorData
.ddRVal
= DDERR_NOTPALETTIZED
;
400 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.WaitForVerticalBlank(&WaitVectorData
) != DDHAL_DRIVER_HANDLED
)
402 return DDERR_NODRIVERSUPPORT
;
405 return WaitVectorData
.ddRVal
;
408 HRESULT
Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface
, LPDWORD lpdwScanLine
)
410 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
412 DDHAL_GETSCANLINEDATA GetScan
;
414 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_GETSCANLINE
))
416 return DDERR_NODRIVERSUPPORT
;
419 GetScan
.lpDD
= &This
->DirectDrawGlobal
;
420 GetScan
.ddRVal
= DDERR_NOTPALETTIZED
;
422 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.GetScanLine(&GetScan
) != DDHAL_DRIVER_HANDLED
)
424 return DDERR_NODRIVERSUPPORT
;
427 *lpdwScanLine
= GetScan
.ddRVal
;
428 return GetScan
.ddRVal
;
431 HRESULT
Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface
)
433 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
435 DDHAL_FLIPTOGDISURFACEDATA FlipGdi
;
437 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_FLIPTOGDISURFACE
))
439 return DDERR_NODRIVERSUPPORT
;
442 FlipGdi
.lpDD
= &This
->DirectDrawGlobal
;
443 FlipGdi
.ddRVal
= DDERR_NOTPALETTIZED
;
445 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.FlipToGDISurface(&FlipGdi
) != DDHAL_DRIVER_HANDLED
)
447 return DDERR_NODRIVERSUPPORT
;
450 /* FIXME where should FlipGdi.dwToGDI be fill in */
451 return FlipGdi
.ddRVal
;
456 HRESULT
Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface
, DWORD dwWidth
, DWORD dwHeight
,
457 DWORD dwBPP
, DWORD dwRefreshRate
, DWORD dwFlags
)
459 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
460 DDHAL_SETMODEDATA mode
;
462 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_SETMODE
))
464 return DDERR_NODRIVERSUPPORT
;
467 mode
.lpDD
= &This
->DirectDrawGlobal
;
468 mode
.ddRVal
= DDERR_NODRIVERSUPPORT
;
470 // FIXME : add search for which mode.ModeIndex we should use
471 // FIXME : fill the mode.inexcl;
472 // FIXME : fill the mode.useRefreshRate;
474 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.SetMode(&mode
) != DDHAL_DRIVER_HANDLED
)
476 return DDERR_NODRIVERSUPPORT
;