Remove hwnd and hdc, so it being store to right struct.
[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, (HDC)This->DirectDrawGlobal.lpExclusiveOwner->hDC ))
23 return DDERR_INVALIDPARAMS;
24
25 /* alloc all the space */
26 This->DirectDrawGlobal.lpDDCBtmp = (LPDDHAL_CALLBACKS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
27 sizeof(DDHAL_CALLBACKS));
28
29 This->DirectDrawGlobal.lpD3DHALCallbacks = (ULONG_PTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
30 sizeof(D3DHAL_CALLBACKS));
31
32 This->DirectDrawGlobal.lpD3DGlobalDriverData = (ULONG_PTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
33 sizeof(D3DHAL_GLOBALDRIVERDATA));
34
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;
42
43 /* query all kinds of infos from the driver */
44 if(!DdQueryDirectDrawObject (
45 &This->DirectDrawGlobal,
46 &This->HalInfo,
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,
53 NULL,
54 NULL,
55 NULL ))
56 {
57 return DD_FALSE;
58 }
59
60 This->HalInfo.vmiData.pvmList = (LPVIDMEM) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
61 sizeof(VIDMEM) * This->HalInfo.vmiData.dwNumHeaps);
62
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);
68
69 if(!DdQueryDirectDrawObject (
70 &This->DirectDrawGlobal,
71 &This->HalInfo,
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
81 ))
82 {
83 return DD_FALSE;
84 }
85
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;
90
91 This->DirectDrawGlobal.dwModeIndex = This->HalInfo.dwModeIndex;
92 This->DirectDrawGlobal.dwNumModes = This->HalInfo.dwNumModes;
93 This->DirectDrawGlobal.lpModeInfo = This->HalInfo.lpModeInfo;
94
95 /* Unsure which of these two for lpPDevice
96 This->DirectDrawGlobal.dwPDevice = This->HalInfo.lpPDevice;
97 This->lpDriverHandle = This->HalInfo.lpPDevice;
98 */
99 This->DirectDrawGlobal.hInstance = This->HalInfo.hInstance;
100 RtlCopyMemory(&This->DirectDrawGlobal.lpDDCBtmp->HALDDExeBuf,
101 &This->HalInfo.lpDDExeBufCallbacks,sizeof(DDHAL_DDEXEBUFCALLBACKS));
102
103 /************************************************************************/
104 /* Set up the rest of the callbacks all callbacks we get back from */
105 /* gdi32.dll is user mode */
106 /************************************************************************/
107
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 */
112
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 */
116
117 DDHAL_GETDRIVERINFODATA DriverInfo;
118 memset(&DriverInfo,0, sizeof(DDHAL_GETDRIVERINFODATA));
119 DriverInfo.dwSize = sizeof(DDHAL_GETDRIVERINFODATA);
120 DriverInfo.dwContext = This->DirectDrawGlobal.hDD;
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 /* 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);*/
135
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);
143
144
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);
152
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);
159 */
160
161 /* Get the D3DExtendedCaps */
162
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);
169
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);
176 */
177
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);
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 /* 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);
199
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);
205
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);
213
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);
219
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);
227
228 /* Get the NTCallbacks */
229 /* Fill in wher
230 DriverInfo.guidInfo = GUID_NTCallbacks;
231 DriverInfo.lpvData = &misc;
232 DriverInfo.dwExpectedSize = sizeof();
233 This->HalInfo.GetDriverInfo( &DriverInfo);
234 */
235
236 /* Get the NTPrivateDriverCaps */
237 /* Fill in wher
238 DriverInfo.guidInfo = GUID_NTPrivateDriverCaps;
239 DriverInfo.lpvData = &misc;
240 DriverInfo.dwExpectedSize = sizeof();
241 This->HalInfo.GetDriverInfo( &DriverInfo);
242 */
243
244 /* Get the UpdateNonLocalHeap */
245 /* Fill in where
246 DriverInfo.guidInfo = GUID_UpdateNonLocalHeap;
247 DriverInfo.lpvData = &misc;
248 DriverInfo.dwExpectedSize = sizeof();
249 This->HalInfo.GetDriverInfo( &DriverInfo);
250 */
251
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);
257
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);
265
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);
274 */
275
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;
282
283 /* Now all setup for HAL is done */
284 return DD_OK;
285 }
286
287 HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface)
288 {
289 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
290
291 DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode;
292
293 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE))
294 {
295 return DDERR_NODRIVERSUPPORT;
296 }
297
298 SetExclusiveMode.lpDD = &This->DirectDrawGlobal;
299 SetExclusiveMode.ddRVal = DDERR_NOTPALETTIZED;
300 SetExclusiveMode.dwEnterExcl = This->cooperative_level;
301
302 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetExclusiveMode(&SetExclusiveMode) != DDHAL_DRIVER_HANDLED)
303 {
304 return DDERR_NODRIVERSUPPORT;
305 }
306
307 return SetExclusiveMode.ddRVal;
308 }
309
310
311 VOID Hal_DirectDraw_Release (LPDIRECTDRAW7 iface)
312 {
313 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
314
315 DdDeleteDirectDrawObject (&This->DirectDrawGlobal);
316
317 /*
318 if(This->DirectDrawGlobal.lpDDKernelCaps)
319 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDKernelCaps);
320
321 if(This->DirectDrawGlobal.lpddNLVCaps)
322 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpddNLVCaps);
323
324 if(This->DirectDrawGlobal.lpDDVideoPortCaps)
325 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDVideoPortCaps);
326
327 if(This->DirectDrawGlobal.lpdwFourCC)
328 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpdwFourCC);
329
330 if(This->DirectDrawGlobal.lpZPixelFormats)
331 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpZPixelFormats);
332
333 if(This->HalInfo.vmiData.pvmList)
334 HeapFree(GetProcessHeap(), 0, This->HalInfo.vmiData.pvmList);
335
336 if(((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats)
337 HeapFree(GetProcessHeap(), 0, ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats);
338
339 if(This->DirectDrawGlobal.lpDDCBtmp)
340 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDCBtmp);
341
342 if(This->DirectDrawGlobal.lpD3DHALCallbacks)
343 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks);
344
345 if(This->DirectDrawGlobal.lpD3DGlobalDriverData)
346 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DGlobalDriverData);
347 */
348 }
349
350
351 HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
352 LPDWORD total, LPDWORD free)
353 {
354 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
355
356 DDHAL_GETAVAILDRIVERMEMORYDATA mem;
357
358 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY))
359 {
360 return DDERR_NODRIVERSUPPORT;
361 }
362
363 mem.lpDD = &This->DirectDrawGlobal;
364 mem.ddRVal = DDERR_NOTPALETTIZED;
365
366 if (This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.GetAvailDriverMemory(&mem) != DDHAL_DRIVER_HANDLED)
367 {
368 return DDERR_NODRIVERSUPPORT;
369 }
370
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;
376 *free = mem.dwFree;
377
378 return mem.ddRVal;
379 }
380
381 HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,HANDLE h)
382 {
383 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
384
385 DDHAL_WAITFORVERTICALBLANKDATA WaitVectorData;
386
387 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK))
388 {
389 return DDERR_NODRIVERSUPPORT;
390 }
391
392 WaitVectorData.lpDD = &This->DirectDrawGlobal;
393 WaitVectorData.dwFlags = dwFlags;
394 WaitVectorData.hEvent = (DWORD)h;
395 WaitVectorData.ddRVal = DDERR_NOTPALETTIZED;
396
397 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.WaitForVerticalBlank(&WaitVectorData) != DDHAL_DRIVER_HANDLED)
398 {
399 return DDERR_NODRIVERSUPPORT;
400 }
401
402 return WaitVectorData.ddRVal;
403 }
404
405 HRESULT Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
406 {
407 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
408
409 DDHAL_GETSCANLINEDATA GetScan;
410
411 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_GETSCANLINE))
412 {
413 return DDERR_NODRIVERSUPPORT;
414 }
415
416 GetScan.lpDD = &This->DirectDrawGlobal;
417 GetScan.ddRVal = DDERR_NOTPALETTIZED;
418
419 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.GetScanLine(&GetScan) != DDHAL_DRIVER_HANDLED)
420 {
421 return DDERR_NODRIVERSUPPORT;
422 }
423
424 *lpdwScanLine = GetScan.ddRVal;
425 return GetScan.ddRVal;
426 }
427
428 HRESULT Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
429 {
430 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
431
432 DDHAL_FLIPTOGDISURFACEDATA FlipGdi;
433
434 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE))
435 {
436 return DDERR_NODRIVERSUPPORT;
437 }
438
439 FlipGdi.lpDD = &This->DirectDrawGlobal;
440 FlipGdi.ddRVal = DDERR_NOTPALETTIZED;
441
442 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.FlipToGDISurface(&FlipGdi) != DDHAL_DRIVER_HANDLED)
443 {
444 return DDERR_NODRIVERSUPPORT;
445 }
446
447 /* FIXME where should FlipGdi.dwToGDI be fill in */
448 return FlipGdi.ddRVal;
449 }
450
451
452
453 HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight,
454 DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
455 {
456 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
457 DDHAL_SETMODEDATA mode;
458
459 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE))
460 {
461 return DDERR_NODRIVERSUPPORT;
462 }
463
464 mode.lpDD = &This->DirectDrawGlobal;
465 mode.ddRVal = DDERR_NODRIVERSUPPORT;
466
467 // FIXME : add search for which mode.ModeIndex we should use
468 // FIXME : fill the mode.inexcl;
469 // FIXME : fill the mode.useRefreshRate;
470
471 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetMode(&mode) != DDHAL_DRIVER_HANDLED)
472 {
473 return DDERR_NODRIVERSUPPORT;
474 }
475
476 return mode.ddRVal;
477 }
478
479