Add some debug messages, and disable them (#define NDEBUG)
[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 BOOL dummy;
26 DdReenableDirectDrawObject(&This->DirectDrawGlobal, &dummy);
27
28 /* alloc all the space */
29 This->DirectDrawGlobal.lpDDCBtmp = (LPDDHAL_CALLBACKS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
30 sizeof(DDHAL_CALLBACKS));
31
32 This->DirectDrawGlobal.lpD3DHALCallbacks = (ULONG_PTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
33 sizeof(D3DHAL_CALLBACKS));
34
35 This->DirectDrawGlobal.lpD3DGlobalDriverData = (ULONG_PTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
36 sizeof(D3DHAL_GLOBALDRIVERDATA));
37
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;
45
46 /* query all kinds of infos from the driver */
47 if(!DdQueryDirectDrawObject (
48 &This->DirectDrawGlobal,
49 &This->HalInfo,
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,
56 NULL,
57 NULL,
58 NULL ))
59 {
60 return DD_FALSE;
61 }
62
63 This->HalInfo.vmiData.pvmList = (LPVIDMEM) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
64 sizeof(VIDMEM) * This->HalInfo.vmiData.dwNumHeaps);
65
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);
71
72 if(!DdQueryDirectDrawObject (
73 &This->DirectDrawGlobal,
74 &This->HalInfo,
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
84 ))
85 {
86 return DD_FALSE;
87 }
88
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;
93
94 This->DirectDrawGlobal.dwModeIndex = This->HalInfo.dwModeIndex;
95 This->DirectDrawGlobal.dwNumModes = This->HalInfo.dwNumModes;
96 This->DirectDrawGlobal.lpModeInfo = This->HalInfo.lpModeInfo;
97
98 /* Unsure which of these two for lpPDevice
99 This->DirectDrawGlobal.dwPDevice = This->HalInfo.lpPDevice;
100 This->lpDriverHandle = This->HalInfo.lpPDevice;
101 */
102 This->DirectDrawGlobal.hInstance = This->HalInfo.hInstance;
103 RtlCopyMemory(&This->DirectDrawGlobal.lpDDCBtmp->HALDDExeBuf,
104 &This->HalInfo.lpDDExeBufCallbacks,sizeof(DDHAL_DDEXEBUFCALLBACKS));
105
106 /************************************************************************/
107 /* Set up the rest of the callbacks all callbacks we get back from */
108 /* gdi32.dll is user mode */
109 /************************************************************************/
110
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 */
115
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 */
119
120 DDHAL_GETDRIVERINFODATA DriverInfo;
121 memset(&DriverInfo,0, sizeof(DDHAL_GETDRIVERINFODATA));
122 DriverInfo.dwSize = sizeof(DDHAL_GETDRIVERINFODATA);
123 DriverInfo.dwContext = This->DirectDrawGlobal.hDD;
124
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);
130
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);*/
138
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);
146
147
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);
155
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);
162 */
163
164 /* Get the D3DExtendedCaps */
165
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);
172
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);
179 */
180
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);
187 */
188
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);
194
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);
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 /* 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);
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 /* 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);
230
231 /* Get the NTCallbacks */
232 /* Fill in wher
233 DriverInfo.guidInfo = GUID_NTCallbacks;
234 DriverInfo.lpvData = &misc;
235 DriverInfo.dwExpectedSize = sizeof();
236 This->HalInfo.GetDriverInfo( &DriverInfo);
237 */
238
239 /* Get the NTPrivateDriverCaps */
240 /* Fill in wher
241 DriverInfo.guidInfo = GUID_NTPrivateDriverCaps;
242 DriverInfo.lpvData = &misc;
243 DriverInfo.dwExpectedSize = sizeof();
244 This->HalInfo.GetDriverInfo( &DriverInfo);
245 */
246
247 /* Get the UpdateNonLocalHeap */
248 /* Fill in where
249 DriverInfo.guidInfo = GUID_UpdateNonLocalHeap;
250 DriverInfo.lpvData = &misc;
251 DriverInfo.dwExpectedSize = sizeof();
252 This->HalInfo.GetDriverInfo( &DriverInfo);
253 */
254
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);
260
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);
268
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);
276
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;
283
284 /* Now all setup for HAL is done */
285 return DD_OK;
286 }
287
288 HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface)
289 {
290 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
291
292 DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode;
293
294 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE))
295 {
296 return DDERR_NODRIVERSUPPORT;
297 }
298
299 SetExclusiveMode.lpDD = &This->DirectDrawGlobal;
300 SetExclusiveMode.ddRVal = DDERR_NOTPALETTIZED;
301 SetExclusiveMode.dwEnterExcl = This->cooperative_level;
302
303 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetExclusiveMode(&SetExclusiveMode) != DDHAL_DRIVER_HANDLED)
304 {
305 return DDERR_NODRIVERSUPPORT;
306 }
307
308 return SetExclusiveMode.ddRVal;
309 }
310
311
312 VOID Hal_DirectDraw_Release (LPDIRECTDRAW7 iface)
313 {
314 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
315
316 DdDeleteDirectDrawObject (&This->DirectDrawGlobal);
317
318 /*
319 if(This->DirectDrawGlobal.lpDDKernelCaps)
320 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDKernelCaps);
321
322 if(This->DirectDrawGlobal.lpddNLVCaps)
323 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpddNLVCaps);
324
325 if(This->DirectDrawGlobal.lpDDVideoPortCaps)
326 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDVideoPortCaps);
327
328 if(This->DirectDrawGlobal.lpdwFourCC)
329 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpdwFourCC);
330
331 if(This->DirectDrawGlobal.lpZPixelFormats)
332 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpZPixelFormats);
333
334 if(This->HalInfo.vmiData.pvmList)
335 HeapFree(GetProcessHeap(), 0, This->HalInfo.vmiData.pvmList);
336
337 if(((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats)
338 HeapFree(GetProcessHeap(), 0, ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats);
339
340 if(This->DirectDrawGlobal.lpDDCBtmp)
341 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDCBtmp);
342
343 if(This->DirectDrawGlobal.lpD3DHALCallbacks)
344 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks);
345
346 if(This->DirectDrawGlobal.lpD3DGlobalDriverData)
347 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DGlobalDriverData);
348 */
349 }
350
351
352 HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
353 LPDWORD total, LPDWORD free)
354 {
355 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
356
357 DDHAL_GETAVAILDRIVERMEMORYDATA mem;
358
359 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY))
360 {
361 return DDERR_NODRIVERSUPPORT;
362 }
363
364 mem.lpDD = &This->DirectDrawGlobal;
365 mem.ddRVal = DDERR_NOTPALETTIZED;
366
367 if (This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.GetAvailDriverMemory(&mem) != DDHAL_DRIVER_HANDLED)
368 {
369 return DDERR_NODRIVERSUPPORT;
370 }
371
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;
377 *free = mem.dwFree;
378
379 return mem.ddRVal;
380 }
381
382 HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,HANDLE h)
383 {
384 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
385
386 DDHAL_WAITFORVERTICALBLANKDATA WaitVectorData;
387
388 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK))
389 {
390 return DDERR_NODRIVERSUPPORT;
391 }
392
393 WaitVectorData.lpDD = &This->DirectDrawGlobal;
394 WaitVectorData.dwFlags = dwFlags;
395 WaitVectorData.hEvent = (DWORD)h;
396 WaitVectorData.ddRVal = DDERR_NOTPALETTIZED;
397
398 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.WaitForVerticalBlank(&WaitVectorData) != DDHAL_DRIVER_HANDLED)
399 {
400 return DDERR_NODRIVERSUPPORT;
401 }
402
403 return WaitVectorData.ddRVal;
404 }
405
406 HRESULT Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
407 {
408 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
409
410 DDHAL_GETSCANLINEDATA GetScan;
411
412 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_GETSCANLINE))
413 {
414 return DDERR_NODRIVERSUPPORT;
415 }
416
417 GetScan.lpDD = &This->DirectDrawGlobal;
418 GetScan.ddRVal = DDERR_NOTPALETTIZED;
419
420 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.GetScanLine(&GetScan) != DDHAL_DRIVER_HANDLED)
421 {
422 return DDERR_NODRIVERSUPPORT;
423 }
424
425 *lpdwScanLine = GetScan.ddRVal;
426 return GetScan.ddRVal;
427 }
428
429 HRESULT Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
430 {
431 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
432
433 DDHAL_FLIPTOGDISURFACEDATA FlipGdi;
434
435 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE))
436 {
437 return DDERR_NODRIVERSUPPORT;
438 }
439
440 FlipGdi.lpDD = &This->DirectDrawGlobal;
441 FlipGdi.ddRVal = DDERR_NOTPALETTIZED;
442
443 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.FlipToGDISurface(&FlipGdi) != DDHAL_DRIVER_HANDLED)
444 {
445 return DDERR_NODRIVERSUPPORT;
446 }
447
448 /* FIXME where should FlipGdi.dwToGDI be fill in */
449 return FlipGdi.ddRVal;
450 }
451
452
453
454 HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight,
455 DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
456 {
457 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
458 DDHAL_SETMODEDATA mode;
459
460 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE))
461 {
462 return DDERR_NODRIVERSUPPORT;
463 }
464
465 mode.lpDD = &This->DirectDrawGlobal;
466 mode.ddRVal = DDERR_NODRIVERSUPPORT;
467
468 // FIXME : add search for which mode.ModeIndex we should use
469 // FIXME : fill the mode.inexcl;
470 // FIXME : fill the mode.useRefreshRate;
471
472 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetMode(&mode) != DDHAL_DRIVER_HANDLED)
473 {
474 return DDERR_NODRIVERSUPPORT;
475 }
476
477 return mode.ddRVal;
478 }
479
480