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