small ceanup in hal startup process
[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 /* point to it self */
19 This->DirectDrawGlobal.lp16DD = &This->DirectDrawGlobal;
20
21 /* get the object */
22 if(!DdCreateDirectDrawObject (&This->DirectDrawGlobal, This->hdc))
23 return DDERR_INVALIDPARAMS;
24
25
26 /* alloc all the space */
27 This->DirectDrawGlobal.lpDDCBtmp = (LPDDHAL_CALLBACKS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DDHAL_CALLBACKS));
28 This->DirectDrawGlobal.lpD3DHALCallbacks = (ULONG_PTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY, sizeof(D3DHAL_CALLBACKS));
29 This->DirectDrawGlobal.lpD3DGlobalDriverData = (ULONG_PTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(D3DHAL_GLOBALDRIVERDATA));
30
31 /* Fill in some info */
32 This->HalInfo.lpD3DGlobalDriverData = This->DirectDrawGlobal.lpD3DGlobalDriverData;
33 This->HalInfo.lpD3DHALCallbacks = This->DirectDrawGlobal.lpD3DHALCallbacks;
34 This->HalInfo.lpDDCallbacks = &This->DirectDrawGlobal.lpDDCBtmp->HALDD;
35 This->HalInfo.lpDDExeBufCallbacks = &This->DirectDrawGlobal.lpDDCBtmp->HALDDExeBuf;
36 This->HalInfo.lpDDPaletteCallbacks = &This->DirectDrawGlobal.lpDDCBtmp->HALDDPalette;
37 This->HalInfo.lpDDSurfaceCallbacks = &This->DirectDrawGlobal.lpDDCBtmp->HALDDSurface;
38
39 /* query all kinds of infos from the driver */
40 if(!DdQueryDirectDrawObject (
41 &This->DirectDrawGlobal,
42 &This->HalInfo,
43 This->HalInfo.lpDDCallbacks,
44 This->HalInfo.lpDDSurfaceCallbacks,
45 This->HalInfo.lpDDPaletteCallbacks,
46 (LPD3DHAL_CALLBACKS)This->DirectDrawGlobal.lpD3DHALCallbacks,
47 (LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData,
48 This->HalInfo.lpDDExeBufCallbacks,
49 NULL,
50 NULL,
51 NULL ))
52 {
53 return DD_FALSE;
54 }
55
56 This->HalInfo.vmiData.pvmList = HeapAlloc(GetProcessHeap(), 0, sizeof(VIDMEM) * This->HalInfo.vmiData.dwNumHeaps);
57 This->DirectDrawGlobal.lpdwFourCC = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) * This->HalInfo.ddCaps.dwNumFourCCCodes);
58 ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats = HeapAlloc(GetProcessHeap(), 0, sizeof(DDSURFACEDESC) * ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->dwNumTextureFormats);
59
60 if(!DdQueryDirectDrawObject (
61 &This->DirectDrawGlobal,
62 &This->HalInfo,
63 This->HalInfo.lpDDCallbacks,
64 This->HalInfo.lpDDSurfaceCallbacks,
65 This->HalInfo.lpDDPaletteCallbacks,
66 (LPD3DHAL_CALLBACKS)This->DirectDrawGlobal.lpD3DHALCallbacks,
67 (LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData,
68 This->HalInfo.lpDDExeBufCallbacks,
69 ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats,
70 This->DirectDrawGlobal.lpdwFourCC,
71 This->HalInfo.vmiData.pvmList
72 ))
73 {
74 return DD_FALSE;
75 }
76
77 /* Copy HalInfo to DirectDrawGlobal (Not complete)*/
78
79 RtlCopyMemory(&This->DirectDrawGlobal.vmiData,&This->HalInfo.vmiData,sizeof(VIDMEMINFO));
80 RtlCopyMemory(&This->DirectDrawGlobal.ddCaps,&This->HalInfo.ddCaps,sizeof(DDCORECAPS));
81 This->DirectDrawGlobal.dwMonitorFrequency = This->HalInfo.dwMonitorFrequency;
82
83 This->DirectDrawGlobal.dwModeIndex = This->HalInfo.dwModeIndex;
84 This->DirectDrawGlobal.dwNumModes = This->HalInfo.dwNumModes;
85 This->DirectDrawGlobal.lpModeInfo = This->HalInfo.lpModeInfo;
86
87
88 /* Unsure which of these two for lpPDevice
89 This->DirectDrawGlobal.dwPDevice = This->HalInfo.lpPDevice;
90 This->lpDriverHandle = This->HalInfo.lpPDevice;
91 */
92
93 This->DirectDrawGlobal.hInstance = This->HalInfo.hInstance;
94
95 RtlCopyMemory(&This->DirectDrawGlobal.lpDDCBtmp->HALDDExeBuf,&This->HalInfo.lpDDExeBufCallbacks,sizeof(DDHAL_DDEXEBUFCALLBACKS));
96
97
98
99 /************************************************************************/
100 /* Set up the rest of the callbacks all callbacks we get back from */
101 /* gdi32.dll is user mode */
102 /************************************************************************/
103
104 /* Todo add a check see if HalInfo.GetDriverInfo is supported or not */
105
106 /* Do not trust msdn what it say about dwContext it is not in use for
107 windows nt, it is in use for all os, and it always pont to
108 DirectDrawGlobal.hDD */
109
110 /* FIXME add all callback that have been commect out to gpl */
111 /* FIXME free the memmor that being alloc when ddraw.dll exists */
112 /* FIXME add check for DriverInfo if the handle or not */
113
114 DDHAL_GETDRIVERINFODATA DriverInfo;
115 memset(&DriverInfo,0, sizeof(DDHAL_GETDRIVERINFODATA));
116 DriverInfo.dwSize = sizeof(DDHAL_GETDRIVERINFODATA);
117 DriverInfo.dwContext = This->DirectDrawGlobal.hDD;
118
119
120 /* Get ColorControlCallbacks */
121 DriverInfo.guidInfo = GUID_ColorControlCallbacks;
122 DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDColorControl;
123 DriverInfo.dwExpectedSize = sizeof(DDHAL_DDCOLORCONTROLCALLBACKS);
124 This->HalInfo.GetDriverInfo( &DriverInfo);
125
126
127 /* Get the GUID_D3DCallbacks callback */
128
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);*/
135
136 /* Get the D3DCallbacks2 */
137 This->DirectDrawGlobal.lpD3DHALCallbacks2 = (ULONG_PTR)HeapAlloc(GetProcessHeap(), 0, sizeof(D3DHAL_CALLBACKS2));
138 DriverInfo.guidInfo = GUID_D3DCallbacks2;
139 DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks2;
140 DriverInfo.dwExpectedSize = sizeof(D3DHAL_CALLBACKS2);
141 This->HalInfo.GetDriverInfo( &DriverInfo);
142
143
144 /* Get the D3DCallbacks3 */
145 This->DirectDrawGlobal.lpD3DHALCallbacks = (ULONG_PTR)HeapAlloc(GetProcessHeap(), 0, sizeof(D3DHAL_CALLBACKS3));
146 DriverInfo.guidInfo = GUID_D3DCallbacks3;
147 DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks;
148 DriverInfo.dwExpectedSize = sizeof(D3DHAL_CALLBACKS3);
149 This->HalInfo.GetDriverInfo( &DriverInfo);
150
151
152 /* Get the misc callback */
153 /* Problem with include files
154 DriverInfo.guidInfo = GUID_D3DCaps;
155 DriverInfo.lpvData = &misc;
156 DriverInfo.dwExpectedSize = sizeof();
157 This->HalInfo.GetDriverInfo( &DriverInfo);
158 */
159
160 /* Get the D3DExtendedCaps */
161
162 This->DirectDrawGlobal.lpD3DExtendedCaps = (ULONG_PTR)HeapAlloc(GetProcessHeap(), 0, sizeof(D3DHAL_D3DEXTENDEDCAPS));
163 DriverInfo.guidInfo = GUID_D3DExtendedCaps;
164 DriverInfo.lpvData = (PVOID) This->DirectDrawGlobal.lpD3DExtendedCaps;
165 DriverInfo.dwExpectedSize = sizeof(D3DHAL_D3DEXTENDEDCAPS);
166 This->HalInfo.GetDriverInfo( &DriverInfo);
167
168
169 /* Get the D3DParseUnknownCommandCallback */
170 /* D3dDrawPrimitives2 callback where should it be fill in
171 DriverInfo.guidInfo = GUID_D3DParseUnknownCommandCallback;
172 DriverInfo.lpvData = &misc;
173 DriverInfo.dwExpectedSize = sizeof();
174 This->HalInfo.GetDriverInfo( &DriverInfo);
175 */
176
177 /* Get the GetHeapAlignment */
178 /* where should it be fill in
179 DriverInfo.guidInfo = GUID_GetHeapAlignment;
180 DriverInfo.lpvData = &misc;
181 DriverInfo.dwExpectedSize = sizeof();
182 This->HalInfo.GetDriverInfo( &DriverInfo);
183 */
184
185
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);
191
192
193 /* Get the KernelCaps */
194 This->DirectDrawGlobal.lpDDKernelCaps = (LPDDKERNELCAPS)HeapAlloc(GetProcessHeap(), 0, 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);
199
200
201 /* Get the MiscellaneousCallbacks */
202 DriverInfo.guidInfo = GUID_MiscellaneousCallbacks;
203 DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous;
204 DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS);
205 This->HalInfo.GetDriverInfo( &DriverInfo);
206
207
208 /* Get the Miscellaneous2Callbacks */
209 /* Not in the DDRAWI_DIRECTDRAW_GBL we map it up as private
210 Contain CreatesurfaceEx and other nice callbacks */
211 DriverInfo.guidInfo = GUID_Miscellaneous2Callbacks;
212 DriverInfo.lpvData = &This->Misc2Callback;
213 DriverInfo.dwExpectedSize = sizeof(DDHAL_DDMISCELLANEOUSCALLBACKS);
214 This->HalInfo.GetDriverInfo( &DriverInfo);
215
216
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);
222
223
224 /* Get the NonLocalVidMemCaps */
225 This->DirectDrawGlobal.lpddNLVCaps = (LPDDNONLOCALVIDMEMCAPS)HeapAlloc(GetProcessHeap(), 0, sizeof(DDNONLOCALVIDMEMCAPS));
226 DriverInfo.guidInfo = GUID_NonLocalVidMemCaps;
227 DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpddNLVCaps;
228 DriverInfo.dwExpectedSize = sizeof(DDNONLOCALVIDMEMCAPS);
229 This->HalInfo.GetDriverInfo( &DriverInfo);
230
231
232 /* Get the NTCallbacks */
233 /* Fill in wher
234 DriverInfo.guidInfo = GUID_NTCallbacks;
235 DriverInfo.lpvData = &misc;
236 DriverInfo.dwExpectedSize = sizeof();
237 This->HalInfo.GetDriverInfo( &DriverInfo);
238 */
239
240 /* Get the NTPrivateDriverCaps */
241 /* Fill in wher
242 DriverInfo.guidInfo = GUID_NTPrivateDriverCaps;
243 DriverInfo.lpvData = &misc;
244 DriverInfo.dwExpectedSize = sizeof();
245 This->HalInfo.GetDriverInfo( &DriverInfo);
246 */
247
248 /* Get the UpdateNonLocalHeap */
249 /* Fill in where
250 DriverInfo.guidInfo = GUID_UpdateNonLocalHeap;
251 DriverInfo.lpvData = &misc;
252 DriverInfo.dwExpectedSize = sizeof();
253 This->HalInfo.GetDriverInfo( &DriverInfo);
254 */
255
256 /* Get the VideoPortCallbacks */
257 DriverInfo.guidInfo = GUID_VideoPortCallbacks;
258 DriverInfo.lpvData = &This->DirectDrawGlobal.lpDDCBtmp->HALDDVideoPort;
259 DriverInfo.dwExpectedSize = sizeof(DDHAL_DDVIDEOPORTCALLBACKS);
260 This->HalInfo.GetDriverInfo( &DriverInfo);
261
262
263 /* Get the VideoPortCaps */
264 This->DirectDrawGlobal.lpDDVideoPortCaps = (LPDDVIDEOPORTCAPS)HeapAlloc(GetProcessHeap(), 0, sizeof(DDVIDEOPORTCAPS));
265 DriverInfo.guidInfo = GUID_VideoPortCaps;
266 DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpDDVideoPortCaps;
267 DriverInfo.dwExpectedSize = sizeof(DDVIDEOPORTCAPS);
268 This->HalInfo.GetDriverInfo( &DriverInfo);
269
270
271 /* Get the ZPixelFormats */
272 This->DirectDrawGlobal.lpZPixelFormats = HeapAlloc(GetProcessHeap(), 0, sizeof(DDPIXELFORMAT) * This->DirectDrawGlobal.dwNumZPixelFormats);
273 DriverInfo.guidInfo = GUID_ZPixelFormats;
274 DriverInfo.lpvData = (PVOID)This->DirectDrawGlobal.lpZPixelFormats;
275 DriverInfo.dwExpectedSize = sizeof(DDPIXELFORMAT);
276 This->HalInfo.GetDriverInfo( &DriverInfo);
277
278 /* Setup some info from the callbacks we got */
279 DDHAL_GETAVAILDRIVERMEMORYDATA mem;
280 mem.lpDD = &This->DirectDrawGlobal;
281
282 This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.GetAvailDriverMemory(&mem);
283
284 This->DirectDrawGlobal.ddCaps.dwVidMemFree = mem.dwFree;
285 This->DirectDrawGlobal.ddCaps.dwVidMemTotal = mem.dwTotal;
286
287 /* Now all setup for HAL is done */
288 return DD_OK;
289 }
290
291 HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface)
292 {
293 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
294
295 DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode;
296
297 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE))
298 {
299 return DDERR_NODRIVERSUPPORT;
300 }
301
302 SetExclusiveMode.lpDD = &This->DirectDrawGlobal;
303 SetExclusiveMode.ddRVal = DDERR_NOTPALETTIZED;
304 SetExclusiveMode.dwEnterExcl = This->cooperative_level;
305
306 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetExclusiveMode(&SetExclusiveMode) != DDHAL_DRIVER_HANDLED)
307 {
308 return DDERR_NODRIVERSUPPORT;
309 }
310
311 return SetExclusiveMode.ddRVal;
312 }
313
314
315 VOID Hal_DirectDraw_Release (LPDIRECTDRAW7 iface)
316 {
317 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
318
319 DdDeleteDirectDrawObject (&This->DirectDrawGlobal);
320
321 if(This->HalInfo.vmiData.pvmList)
322 HeapFree(GetProcessHeap(), 0, This->HalInfo.vmiData.pvmList);
323 if(This->DirectDrawGlobal.lpdwFourCC)
324 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpdwFourCC);
325 if(This->DirectDrawGlobal.lpZPixelFormats)
326 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpZPixelFormats);
327 if(((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats)
328 HeapFree(GetProcessHeap(), 0, ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats);
329
330 if(This->DirectDrawGlobal.lpDDCBtmp)
331 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDCBtmp);
332 if(This->DirectDrawGlobal.lpD3DHALCallbacks)
333 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks);
334 if(This->DirectDrawGlobal.lpD3DGlobalDriverData)
335 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DGlobalDriverData);
336 }
337
338
339 HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
340 LPDWORD total, LPDWORD free)
341 {
342 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
343
344 DDHAL_GETAVAILDRIVERMEMORYDATA mem;
345
346 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY))
347 {
348 return DDERR_NODRIVERSUPPORT;
349 }
350
351 mem.lpDD = &This->DirectDrawGlobal;
352 mem.ddRVal = DDERR_NOTPALETTIZED;
353
354 if (This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.GetAvailDriverMemory(&mem) != DDHAL_DRIVER_HANDLED)
355 {
356 return DDERR_NODRIVERSUPPORT;
357 }
358
359 ddscaps->dwCaps = mem.DDSCaps.dwCaps;
360 ddscaps->dwCaps2 = mem.ddsCapsEx.dwCaps2;
361 ddscaps->dwCaps3 = mem.ddsCapsEx.dwCaps3;
362 ddscaps->dwCaps4 = mem.ddsCapsEx.dwCaps4;
363 *total = mem.dwTotal;
364 *free = mem.dwFree;
365
366 return mem.ddRVal;
367 }
368
369 HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,HANDLE h)
370 {
371
372 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
373
374 DDHAL_WAITFORVERTICALBLANKDATA WaitVectorData;
375
376 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK))
377 {
378 return DDERR_NODRIVERSUPPORT;
379 }
380
381 WaitVectorData.lpDD = &This->DirectDrawGlobal;
382 WaitVectorData.dwFlags = dwFlags;
383 WaitVectorData.hEvent = (DWORD)h;
384 WaitVectorData.ddRVal = DDERR_NOTPALETTIZED;
385
386 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.WaitForVerticalBlank(&WaitVectorData) != DDHAL_DRIVER_HANDLED)
387 {
388 return DDERR_NODRIVERSUPPORT;
389 }
390
391 return WaitVectorData.ddRVal;
392 }
393
394 HRESULT Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
395 {
396 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
397
398 DDHAL_GETSCANLINEDATA GetScan;
399
400 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_GETSCANLINE))
401 {
402 return DDERR_NODRIVERSUPPORT;
403 }
404
405 GetScan.lpDD = &This->DirectDrawGlobal;
406 GetScan.ddRVal = DDERR_NOTPALETTIZED;
407
408 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.GetScanLine(&GetScan) != DDHAL_DRIVER_HANDLED)
409 {
410 return DDERR_NODRIVERSUPPORT;
411 }
412
413 *lpdwScanLine = GetScan.ddRVal;
414 return GetScan.ddRVal;
415 }
416
417 HRESULT Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
418 {
419 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
420
421 DDHAL_FLIPTOGDISURFACEDATA FlipGdi;
422
423 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE))
424 {
425 return DDERR_NODRIVERSUPPORT;
426 }
427
428 FlipGdi.lpDD = &This->DirectDrawGlobal;
429 FlipGdi.ddRVal = DDERR_NOTPALETTIZED;
430
431 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.FlipToGDISurface(&FlipGdi) != DDHAL_DRIVER_HANDLED)
432 {
433 return DDERR_NODRIVERSUPPORT;
434 }
435
436 /* FIXME where should FlipGdi.dwToGDI be fill in */
437 return FlipGdi.ddRVal;
438 }
439
440 HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight,
441 DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
442 {
443 DDHAL_SETMODEDATA mode;
444
445 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
446
447 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE))
448 {
449 return DDERR_NODRIVERSUPPORT;
450 }
451
452 mode.lpDD = &This->DirectDrawGlobal;
453 mode.ddRVal = DDERR_NODRIVERSUPPORT;
454
455 /* FIXME : add search for which mode.ModeIndex we should use */
456 /* FIXME : fill the mode.inexcl; */
457 /* FIXME : fill the mode.useRefreshRate; */
458
459 /*
460 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetMode(&mode) != DDHAL_DRIVER_HANDLED)
461 {
462 return DDERR_NODRIVERSUPPORT;
463 }
464 */
465 DX_STUB;
466 /* return mode.ddRVal */
467 }