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
;
283 /* Now all setup for HAL is done */
287 HRESULT
Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface
)
289 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
291 DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode
;
293 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_SETEXCLUSIVEMODE
))
295 return DDERR_NODRIVERSUPPORT
;
298 SetExclusiveMode
.lpDD
= &This
->DirectDrawGlobal
;
299 SetExclusiveMode
.ddRVal
= DDERR_NOTPALETTIZED
;
300 SetExclusiveMode
.dwEnterExcl
= This
->cooperative_level
;
302 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.SetExclusiveMode(&SetExclusiveMode
) != DDHAL_DRIVER_HANDLED
)
304 return DDERR_NODRIVERSUPPORT
;
307 return SetExclusiveMode
.ddRVal
;
311 VOID
Hal_DirectDraw_Release (LPDIRECTDRAW7 iface
)
313 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
315 DdDeleteDirectDrawObject (&This
->DirectDrawGlobal
);
318 if(This->DirectDrawGlobal.lpDDKernelCaps)
319 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDKernelCaps);
321 if(This->DirectDrawGlobal.lpddNLVCaps)
322 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpddNLVCaps);
324 if(This->DirectDrawGlobal.lpDDVideoPortCaps)
325 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDVideoPortCaps);
327 if(This->DirectDrawGlobal.lpdwFourCC)
328 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpdwFourCC);
330 if(This->DirectDrawGlobal.lpZPixelFormats)
331 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpZPixelFormats);
333 if(This->HalInfo.vmiData.pvmList)
334 HeapFree(GetProcessHeap(), 0, This->HalInfo.vmiData.pvmList);
336 if(((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats)
337 HeapFree(GetProcessHeap(), 0, ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats);
339 if(This->DirectDrawGlobal.lpDDCBtmp)
340 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDCBtmp);
342 if(This->DirectDrawGlobal.lpD3DHALCallbacks)
343 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks);
345 if(This->DirectDrawGlobal.lpD3DGlobalDriverData)
346 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DGlobalDriverData);
351 HRESULT
Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface
, LPDDSCAPS2 ddscaps
,
352 LPDWORD total
, LPDWORD free
)
354 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
356 DDHAL_GETAVAILDRIVERMEMORYDATA mem
;
358 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMiscellaneous
.dwFlags
& DDHAL_MISCCB32_GETAVAILDRIVERMEMORY
))
360 return DDERR_NODRIVERSUPPORT
;
363 mem
.lpDD
= &This
->DirectDrawGlobal
;
364 mem
.ddRVal
= DDERR_NOTPALETTIZED
;
366 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMiscellaneous
.GetAvailDriverMemory(&mem
) != DDHAL_DRIVER_HANDLED
)
368 return DDERR_NODRIVERSUPPORT
;
371 ddscaps
->dwCaps
= mem
.DDSCaps
.dwCaps
;
372 ddscaps
->dwCaps2
= mem
.ddsCapsEx
.dwCaps2
;
373 ddscaps
->dwCaps3
= mem
.ddsCapsEx
.dwCaps3
;
374 ddscaps
->dwCaps4
= mem
.ddsCapsEx
.dwCaps4
;
375 *total
= mem
.dwTotal
;
381 HRESULT
Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface
, DWORD dwFlags
,HANDLE h
)
383 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
385 DDHAL_WAITFORVERTICALBLANKDATA WaitVectorData
;
387 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_WAITFORVERTICALBLANK
))
389 return DDERR_NODRIVERSUPPORT
;
392 WaitVectorData
.lpDD
= &This
->DirectDrawGlobal
;
393 WaitVectorData
.dwFlags
= dwFlags
;
394 WaitVectorData
.hEvent
= (DWORD
)h
;
395 WaitVectorData
.ddRVal
= DDERR_NOTPALETTIZED
;
397 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.WaitForVerticalBlank(&WaitVectorData
) != DDHAL_DRIVER_HANDLED
)
399 return DDERR_NODRIVERSUPPORT
;
402 return WaitVectorData
.ddRVal
;
405 HRESULT
Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface
, LPDWORD lpdwScanLine
)
407 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
409 DDHAL_GETSCANLINEDATA GetScan
;
411 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_GETSCANLINE
))
413 return DDERR_NODRIVERSUPPORT
;
416 GetScan
.lpDD
= &This
->DirectDrawGlobal
;
417 GetScan
.ddRVal
= DDERR_NOTPALETTIZED
;
419 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.GetScanLine(&GetScan
) != DDHAL_DRIVER_HANDLED
)
421 return DDERR_NODRIVERSUPPORT
;
424 *lpdwScanLine
= GetScan
.ddRVal
;
425 return GetScan
.ddRVal
;
428 HRESULT
Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface
)
430 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
432 DDHAL_FLIPTOGDISURFACEDATA FlipGdi
;
434 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_FLIPTOGDISURFACE
))
436 return DDERR_NODRIVERSUPPORT
;
439 FlipGdi
.lpDD
= &This
->DirectDrawGlobal
;
440 FlipGdi
.ddRVal
= DDERR_NOTPALETTIZED
;
442 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.FlipToGDISurface(&FlipGdi
) != DDHAL_DRIVER_HANDLED
)
444 return DDERR_NODRIVERSUPPORT
;
447 /* FIXME where should FlipGdi.dwToGDI be fill in */
448 return FlipGdi
.ddRVal
;
453 HRESULT
Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface
, DWORD dwWidth
, DWORD dwHeight
,
454 DWORD dwBPP
, DWORD dwRefreshRate
, DWORD dwFlags
)
456 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
457 DDHAL_SETMODEDATA mode
;
459 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_SETMODE
))
461 return DDERR_NODRIVERSUPPORT
;
464 mode
.lpDD
= &This
->DirectDrawGlobal
;
465 mode
.ddRVal
= DDERR_NODRIVERSUPPORT
;
467 // FIXME : add search for which mode.ModeIndex we should use
468 // FIXME : fill the mode.inexcl;
469 // FIXME : fill the mode.useRefreshRate;
471 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.SetMode(&mode
) != DDHAL_DRIVER_HANDLED
)
473 return DDERR_NODRIVERSUPPORT
;