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
, This
->hdc
))
23 return DDERR_INVALIDPARAMS
;
26 DdReenableDirectDrawObject(&This
->DirectDrawGlobal
, &dummy
);
28 /* alloc all the space */
29 This
->DirectDrawGlobal
.lpDDCBtmp
= (LPDDHAL_CALLBACKS
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
30 sizeof(DDHAL_CALLBACKS
));
32 This
->DirectDrawGlobal
.lpD3DHALCallbacks
= (ULONG_PTR
)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,
33 sizeof(D3DHAL_CALLBACKS
));
35 This
->DirectDrawGlobal
.lpD3DGlobalDriverData
= (ULONG_PTR
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
36 sizeof(D3DHAL_GLOBALDRIVERDATA
));
38 /* Fill in some info */
39 This
->HalInfo
.lpD3DGlobalDriverData
= This
->DirectDrawGlobal
.lpD3DGlobalDriverData
;
40 This
->HalInfo
.lpD3DHALCallbacks
= This
->DirectDrawGlobal
.lpD3DHALCallbacks
;
41 This
->HalInfo
.lpDDCallbacks
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
;
42 This
->HalInfo
.lpDDExeBufCallbacks
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDExeBuf
;
43 This
->HalInfo
.lpDDPaletteCallbacks
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDPalette
;
44 This
->HalInfo
.lpDDSurfaceCallbacks
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDSurface
;
46 /* query all kinds of infos from the driver */
47 if(!DdQueryDirectDrawObject (
48 &This
->DirectDrawGlobal
,
50 This
->HalInfo
.lpDDCallbacks
,
51 This
->HalInfo
.lpDDSurfaceCallbacks
,
52 This
->HalInfo
.lpDDPaletteCallbacks
,
53 (LPD3DHAL_CALLBACKS
)This
->DirectDrawGlobal
.lpD3DHALCallbacks
,
54 (LPD3DHAL_GLOBALDRIVERDATA
)This
->DirectDrawGlobal
.lpD3DGlobalDriverData
,
55 This
->HalInfo
.lpDDExeBufCallbacks
,
63 This
->HalInfo
.vmiData
.pvmList
= (LPVIDMEM
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
64 sizeof(VIDMEM
) * This
->HalInfo
.vmiData
.dwNumHeaps
);
66 This
->DirectDrawGlobal
.lpdwFourCC
= (DWORD
*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
67 sizeof(DWORD
) * This
->HalInfo
.ddCaps
.dwNumFourCCCodes
);
68 ((LPD3DHAL_GLOBALDRIVERDATA
)This
->DirectDrawGlobal
.lpD3DGlobalDriverData
)->lpTextureFormats
=
69 (LPDDSURFACEDESC
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(DDSURFACEDESC
) *
70 ((LPD3DHAL_GLOBALDRIVERDATA
)This
->DirectDrawGlobal
.lpD3DGlobalDriverData
)->dwNumTextureFormats
);
72 if(!DdQueryDirectDrawObject (
73 &This
->DirectDrawGlobal
,
75 This
->HalInfo
.lpDDCallbacks
,
76 This
->HalInfo
.lpDDSurfaceCallbacks
,
77 This
->HalInfo
.lpDDPaletteCallbacks
,
78 (LPD3DHAL_CALLBACKS
)This
->DirectDrawGlobal
.lpD3DHALCallbacks
,
79 (LPD3DHAL_GLOBALDRIVERDATA
)This
->DirectDrawGlobal
.lpD3DGlobalDriverData
,
80 This
->HalInfo
.lpDDExeBufCallbacks
,
81 ((LPD3DHAL_GLOBALDRIVERDATA
)This
->DirectDrawGlobal
.lpD3DGlobalDriverData
)->lpTextureFormats
,
82 This
->DirectDrawGlobal
.lpdwFourCC
,
83 This
->HalInfo
.vmiData
.pvmList
89 /* Copy HalInfo to DirectDrawGlobal (Not complete)*/
90 RtlCopyMemory(&This
->DirectDrawGlobal
.vmiData
,&This
->HalInfo
.vmiData
,sizeof(VIDMEMINFO
));
91 RtlCopyMemory(&This
->DirectDrawGlobal
.ddCaps
,&This
->HalInfo
.ddCaps
,sizeof(DDCORECAPS
));
92 This
->DirectDrawGlobal
.dwMonitorFrequency
= This
->HalInfo
.dwMonitorFrequency
;
94 This
->DirectDrawGlobal
.dwModeIndex
= This
->HalInfo
.dwModeIndex
;
95 This
->DirectDrawGlobal
.dwNumModes
= This
->HalInfo
.dwNumModes
;
96 This
->DirectDrawGlobal
.lpModeInfo
= This
->HalInfo
.lpModeInfo
;
98 /* Unsure which of these two for lpPDevice
99 This->DirectDrawGlobal.dwPDevice = This->HalInfo.lpPDevice;
100 This->lpDriverHandle = This->HalInfo.lpPDevice;
102 This
->DirectDrawGlobal
.hInstance
= This
->HalInfo
.hInstance
;
103 RtlCopyMemory(&This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDExeBuf
,
104 &This
->HalInfo
.lpDDExeBufCallbacks
,sizeof(DDHAL_DDEXEBUFCALLBACKS
));
106 /************************************************************************/
107 /* Set up the rest of the callbacks all callbacks we get back from */
108 /* gdi32.dll is user mode */
109 /************************************************************************/
111 /* Todo add a check see if HalInfo.GetDriverInfo is supported or not */
112 /* Do not trust msdn what it say about dwContext it is not in use for
113 windows nt, it is in use for all os, and it always pont to
114 DirectDrawGlobal.hDD */
116 /* FIXME add all callback that have been commect out to gpl */
117 /* FIXME free the memmor that being alloc when ddraw.dll exists */
118 /* FIXME add check for DriverInfo if the handle or not */
120 DDHAL_GETDRIVERINFODATA DriverInfo
;
121 memset(&DriverInfo
,0, sizeof(DDHAL_GETDRIVERINFODATA
));
122 DriverInfo
.dwSize
= sizeof(DDHAL_GETDRIVERINFODATA
);
123 DriverInfo
.dwContext
= This
->DirectDrawGlobal
.hDD
;
125 /* Get ColorControlCallbacks */
126 DriverInfo
.guidInfo
= GUID_ColorControlCallbacks
;
127 DriverInfo
.lpvData
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDColorControl
;
128 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDCOLORCONTROLCALLBACKS
);
129 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
131 /* Get the GUID_D3DCallbacks callback */
132 /* Problem with include files
133 DDHAL_DDMISCELLANEOUSCALLBACKS misc;
134 DriverInfo.guidInfo = GUID_D3DCallbacks;
135 DriverInfo.lpvData = &misc;
136 DriverInfo.dwExpectedSize = sizeof();
137 This->HalInfo.GetDriverInfo( &DriverInfo);*/
139 /* Get the D3DCallbacks2 */
140 This
->DirectDrawGlobal
.lpD3DHALCallbacks2
= (ULONG_PTR
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
141 sizeof(D3DHAL_CALLBACKS2
));
142 DriverInfo
.guidInfo
= GUID_D3DCallbacks2
;
143 DriverInfo
.lpvData
= (PVOID
)This
->DirectDrawGlobal
.lpD3DHALCallbacks2
;
144 DriverInfo
.dwExpectedSize
= sizeof(D3DHAL_CALLBACKS2
);
145 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
148 /* Get the D3DCallbacks3 */
149 This
->DirectDrawGlobal
.lpD3DHALCallbacks
= (ULONG_PTR
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
150 sizeof(D3DHAL_CALLBACKS3
));
151 DriverInfo
.guidInfo
= GUID_D3DCallbacks3
;
152 DriverInfo
.lpvData
= (PVOID
)This
->DirectDrawGlobal
.lpD3DHALCallbacks
;
153 DriverInfo
.dwExpectedSize
= sizeof(D3DHAL_CALLBACKS3
);
154 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
156 /* Get the misc callback */
157 /* Problem with include files
158 DriverInfo.guidInfo = GUID_D3DCaps;
159 DriverInfo.lpvData = &misc;
160 DriverInfo.dwExpectedSize = sizeof();
161 This->HalInfo.GetDriverInfo( &DriverInfo);
164 /* Get the D3DExtendedCaps */
166 This
->DirectDrawGlobal
.lpD3DExtendedCaps
= (ULONG_PTR
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
167 sizeof(D3DHAL_D3DEXTENDEDCAPS
));
168 DriverInfo
.guidInfo
= GUID_D3DExtendedCaps
;
169 DriverInfo
.lpvData
= (PVOID
) This
->DirectDrawGlobal
.lpD3DExtendedCaps
;
170 DriverInfo
.dwExpectedSize
= sizeof(D3DHAL_D3DEXTENDEDCAPS
);
171 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
173 /* Get the D3DParseUnknownCommandCallback */
174 /* D3dDrawPrimitives2 callback where should it be fill in
175 DriverInfo.guidInfo = GUID_D3DParseUnknownCommandCallback;
176 DriverInfo.lpvData = &misc;
177 DriverInfo.dwExpectedSize = sizeof();
178 This->HalInfo.GetDriverInfo( &DriverInfo);
181 /* Get the GetHeapAlignment */
182 /* where should it be fill in
183 DriverInfo.guidInfo = GUID_GetHeapAlignment;
184 DriverInfo.lpvData = &misc;
185 DriverInfo.dwExpectedSize = sizeof();
186 This->HalInfo.GetDriverInfo( &DriverInfo);
189 /* Get the KernelCallbacks */
190 DriverInfo
.guidInfo
= GUID_KernelCallbacks
;
191 DriverInfo
.lpvData
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDKernel
;
192 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDKERNELCALLBACKS
);
193 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
195 /* Get the KernelCaps */
196 This
->DirectDrawGlobal
.lpDDKernelCaps
= (LPDDKERNELCAPS
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
197 sizeof(DDHAL_DDKERNELCALLBACKS
));
198 DriverInfo
.guidInfo
= GUID_KernelCaps
;
199 DriverInfo
.lpvData
= (PVOID
) This
->DirectDrawGlobal
.lpDDKernelCaps
;
200 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDKERNELCALLBACKS
);
201 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
203 /* Get the MiscellaneousCallbacks */
204 DriverInfo
.guidInfo
= GUID_MiscellaneousCallbacks
;
205 DriverInfo
.lpvData
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMiscellaneous
;
206 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS
);
207 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
209 /* Get the Miscellaneous2Callbacks */
210 /* Not in the DDRAWI_DIRECTDRAW_GBL we map it up as private
211 Contain CreatesurfaceEx and other nice callbacks */
212 DriverInfo
.guidInfo
= GUID_Miscellaneous2Callbacks
;
213 DriverInfo
.lpvData
= &This
->Misc2Callback
;
214 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS
);
215 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
217 /* Get the MotionCompCallbacks */
218 DriverInfo
.guidInfo
= GUID_MotionCompCallbacks
;
219 DriverInfo
.lpvData
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMotionComp
;
220 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDMOTIONCOMPCALLBACKS
);
221 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
223 /* Get the NonLocalVidMemCaps */
224 This
->DirectDrawGlobal
.lpddNLVCaps
= (LPDDNONLOCALVIDMEMCAPS
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
225 sizeof(DDNONLOCALVIDMEMCAPS
));
226 DriverInfo
.guidInfo
= GUID_NonLocalVidMemCaps
;
227 DriverInfo
.lpvData
= (PVOID
)This
->DirectDrawGlobal
.lpddNLVCaps
;
228 DriverInfo
.dwExpectedSize
= sizeof(DDNONLOCALVIDMEMCAPS
);
229 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
231 /* Get the NTCallbacks */
233 DriverInfo.guidInfo = GUID_NTCallbacks;
234 DriverInfo.lpvData = &misc;
235 DriverInfo.dwExpectedSize = sizeof();
236 This->HalInfo.GetDriverInfo( &DriverInfo);
239 /* Get the NTPrivateDriverCaps */
241 DriverInfo.guidInfo = GUID_NTPrivateDriverCaps;
242 DriverInfo.lpvData = &misc;
243 DriverInfo.dwExpectedSize = sizeof();
244 This->HalInfo.GetDriverInfo( &DriverInfo);
247 /* Get the UpdateNonLocalHeap */
249 DriverInfo.guidInfo = GUID_UpdateNonLocalHeap;
250 DriverInfo.lpvData = &misc;
251 DriverInfo.dwExpectedSize = sizeof();
252 This->HalInfo.GetDriverInfo( &DriverInfo);
255 /* Get the VideoPortCallbacks */
256 DriverInfo
.guidInfo
= GUID_VideoPortCallbacks
;
257 DriverInfo
.lpvData
= &This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDVideoPort
;
258 DriverInfo
.dwExpectedSize
= sizeof(DDHAL_DDVIDEOPORTCALLBACKS
);
259 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
261 /* Get the VideoPortCaps */
262 This
->DirectDrawGlobal
.lpDDVideoPortCaps
= (LPDDVIDEOPORTCAPS
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
263 sizeof(DDVIDEOPORTCAPS
));
264 DriverInfo
.guidInfo
= GUID_VideoPortCaps
;
265 DriverInfo
.lpvData
= (PVOID
)This
->DirectDrawGlobal
.lpDDVideoPortCaps
;
266 DriverInfo
.dwExpectedSize
= sizeof(DDVIDEOPORTCAPS
);
267 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
269 /* Get the ZPixelFormats */
270 This
->DirectDrawGlobal
.lpZPixelFormats
= (LPDDPIXELFORMAT
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
271 sizeof(DDPIXELFORMAT
) * This
->DirectDrawGlobal
.dwNumZPixelFormats
);
272 DriverInfo
.guidInfo
= GUID_ZPixelFormats
;
273 DriverInfo
.lpvData
= (PVOID
)This
->DirectDrawGlobal
.lpZPixelFormats
;
274 DriverInfo
.dwExpectedSize
= sizeof(DDPIXELFORMAT
);
275 This
->HalInfo
.GetDriverInfo(&DriverInfo
);
277 /* Setup some info from the callbacks we got */
278 DDHAL_GETAVAILDRIVERMEMORYDATA mem
;
279 mem
.lpDD
= &This
->DirectDrawGlobal
;
280 This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMiscellaneous
.GetAvailDriverMemory(&mem
);
281 This
->DirectDrawGlobal
.ddCaps
.dwVidMemFree
= mem
.dwFree
;
282 This
->DirectDrawGlobal
.ddCaps
.dwVidMemTotal
= mem
.dwTotal
;
284 /* Now all setup for HAL is done */
288 HRESULT
Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface
)
290 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
292 DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode
;
294 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_SETEXCLUSIVEMODE
))
296 return DDERR_NODRIVERSUPPORT
;
299 SetExclusiveMode
.lpDD
= &This
->DirectDrawGlobal
;
300 SetExclusiveMode
.ddRVal
= DDERR_NOTPALETTIZED
;
301 SetExclusiveMode
.dwEnterExcl
= This
->cooperative_level
;
303 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.SetExclusiveMode(&SetExclusiveMode
) != DDHAL_DRIVER_HANDLED
)
305 return DDERR_NODRIVERSUPPORT
;
308 return SetExclusiveMode
.ddRVal
;
312 VOID
Hal_DirectDraw_Release (LPDIRECTDRAW7 iface
)
314 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
316 DdDeleteDirectDrawObject (&This
->DirectDrawGlobal
);
319 if(This->DirectDrawGlobal.lpDDKernelCaps)
320 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDKernelCaps);
322 if(This->DirectDrawGlobal.lpddNLVCaps)
323 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpddNLVCaps);
325 if(This->DirectDrawGlobal.lpDDVideoPortCaps)
326 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDVideoPortCaps);
328 if(This->DirectDrawGlobal.lpdwFourCC)
329 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpdwFourCC);
331 if(This->DirectDrawGlobal.lpZPixelFormats)
332 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpZPixelFormats);
334 if(This->HalInfo.vmiData.pvmList)
335 HeapFree(GetProcessHeap(), 0, This->HalInfo.vmiData.pvmList);
337 if(((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats)
338 HeapFree(GetProcessHeap(), 0, ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats);
340 if(This->DirectDrawGlobal.lpDDCBtmp)
341 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDCBtmp);
343 if(This->DirectDrawGlobal.lpD3DHALCallbacks)
344 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks);
346 if(This->DirectDrawGlobal.lpD3DGlobalDriverData)
347 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DGlobalDriverData);
352 HRESULT
Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface
, LPDDSCAPS2 ddscaps
,
353 LPDWORD total
, LPDWORD free
)
355 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
357 DDHAL_GETAVAILDRIVERMEMORYDATA mem
;
359 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMiscellaneous
.dwFlags
& DDHAL_MISCCB32_GETAVAILDRIVERMEMORY
))
361 return DDERR_NODRIVERSUPPORT
;
364 mem
.lpDD
= &This
->DirectDrawGlobal
;
365 mem
.ddRVal
= DDERR_NOTPALETTIZED
;
367 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDDMiscellaneous
.GetAvailDriverMemory(&mem
) != DDHAL_DRIVER_HANDLED
)
369 return DDERR_NODRIVERSUPPORT
;
372 ddscaps
->dwCaps
= mem
.DDSCaps
.dwCaps
;
373 ddscaps
->dwCaps2
= mem
.ddsCapsEx
.dwCaps2
;
374 ddscaps
->dwCaps3
= mem
.ddsCapsEx
.dwCaps3
;
375 ddscaps
->dwCaps4
= mem
.ddsCapsEx
.dwCaps4
;
376 *total
= mem
.dwTotal
;
382 HRESULT
Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface
, DWORD dwFlags
,HANDLE h
)
384 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
386 DDHAL_WAITFORVERTICALBLANKDATA WaitVectorData
;
388 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_WAITFORVERTICALBLANK
))
390 return DDERR_NODRIVERSUPPORT
;
393 WaitVectorData
.lpDD
= &This
->DirectDrawGlobal
;
394 WaitVectorData
.dwFlags
= dwFlags
;
395 WaitVectorData
.hEvent
= (DWORD
)h
;
396 WaitVectorData
.ddRVal
= DDERR_NOTPALETTIZED
;
398 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.WaitForVerticalBlank(&WaitVectorData
) != DDHAL_DRIVER_HANDLED
)
400 return DDERR_NODRIVERSUPPORT
;
403 return WaitVectorData
.ddRVal
;
406 HRESULT
Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface
, LPDWORD lpdwScanLine
)
408 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
410 DDHAL_GETSCANLINEDATA GetScan
;
412 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_GETSCANLINE
))
414 return DDERR_NODRIVERSUPPORT
;
417 GetScan
.lpDD
= &This
->DirectDrawGlobal
;
418 GetScan
.ddRVal
= DDERR_NOTPALETTIZED
;
420 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.GetScanLine(&GetScan
) != DDHAL_DRIVER_HANDLED
)
422 return DDERR_NODRIVERSUPPORT
;
425 *lpdwScanLine
= GetScan
.ddRVal
;
426 return GetScan
.ddRVal
;
429 HRESULT
Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface
)
431 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
433 DDHAL_FLIPTOGDISURFACEDATA FlipGdi
;
435 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_FLIPTOGDISURFACE
))
437 return DDERR_NODRIVERSUPPORT
;
440 FlipGdi
.lpDD
= &This
->DirectDrawGlobal
;
441 FlipGdi
.ddRVal
= DDERR_NOTPALETTIZED
;
443 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.FlipToGDISurface(&FlipGdi
) != DDHAL_DRIVER_HANDLED
)
445 return DDERR_NODRIVERSUPPORT
;
448 /* FIXME where should FlipGdi.dwToGDI be fill in */
449 return FlipGdi
.ddRVal
;
454 HRESULT
Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface
, DWORD dwWidth
, DWORD dwHeight
,
455 DWORD dwBPP
, DWORD dwRefreshRate
, DWORD dwFlags
)
457 IDirectDrawImpl
* This
= (IDirectDrawImpl
*)iface
;
458 DDHAL_SETMODEDATA mode
;
460 if (!(This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.dwFlags
& DDHAL_CB32_SETMODE
))
462 return DDERR_NODRIVERSUPPORT
;
465 mode
.lpDD
= &This
->DirectDrawGlobal
;
466 mode
.ddRVal
= DDERR_NODRIVERSUPPORT
;
468 // FIXME : add search for which mode.ModeIndex we should use
469 // FIXME : fill the mode.inexcl;
470 // FIXME : fill the mode.useRefreshRate;
472 if (This
->DirectDrawGlobal
.lpDDCBtmp
->HALDD
.SetMode(&mode
) != DDHAL_DRIVER_HANDLED
)
474 return DDERR_NODRIVERSUPPORT
;