move more dlls
[reactos.git] / reactos / dll / 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 BOOL dummy = TRUE;
284 DdReenableDirectDrawObject(&This->DirectDrawGlobal, &dummy);
285
286 /* Now all setup for HAL is done */
287 return DD_OK;
288 }
289
290 HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface)
291 {
292 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
293
294 DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode;
295
296 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE))
297 {
298 return DDERR_NODRIVERSUPPORT;
299 }
300
301 SetExclusiveMode.lpDD = &This->DirectDrawGlobal;
302 SetExclusiveMode.ddRVal = DDERR_NOTPALETTIZED;
303 SetExclusiveMode.dwEnterExcl = This->cooperative_level;
304
305 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetExclusiveMode(&SetExclusiveMode) != DDHAL_DRIVER_HANDLED)
306 {
307 return DDERR_NODRIVERSUPPORT;
308 }
309
310 return SetExclusiveMode.ddRVal;
311 }
312
313
314 VOID Hal_DirectDraw_Release (LPDIRECTDRAW7 iface)
315 {
316 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
317
318 DdDeleteDirectDrawObject (&This->DirectDrawGlobal);
319
320 /*
321 if(This->DirectDrawGlobal.lpDDKernelCaps)
322 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDKernelCaps);
323
324 if(This->DirectDrawGlobal.lpddNLVCaps)
325 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpddNLVCaps);
326
327 if(This->DirectDrawGlobal.lpDDVideoPortCaps)
328 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDVideoPortCaps);
329
330 if(This->DirectDrawGlobal.lpdwFourCC)
331 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpdwFourCC);
332
333 if(This->DirectDrawGlobal.lpZPixelFormats)
334 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpZPixelFormats);
335
336 if(This->HalInfo.vmiData.pvmList)
337 HeapFree(GetProcessHeap(), 0, This->HalInfo.vmiData.pvmList);
338
339 if(((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats)
340 HeapFree(GetProcessHeap(), 0, ((LPD3DHAL_GLOBALDRIVERDATA)This->DirectDrawGlobal.lpD3DGlobalDriverData)->lpTextureFormats);
341
342 if(This->DirectDrawGlobal.lpDDCBtmp)
343 HeapFree(GetProcessHeap(), 0, This->DirectDrawGlobal.lpDDCBtmp);
344
345 if(This->DirectDrawGlobal.lpD3DHALCallbacks)
346 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DHALCallbacks);
347
348 if(This->DirectDrawGlobal.lpD3DGlobalDriverData)
349 HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DGlobalDriverData);
350 */
351 }
352
353
354 HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
355 LPDWORD total, LPDWORD free)
356 {
357 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
358
359 DDHAL_GETAVAILDRIVERMEMORYDATA mem;
360
361 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY))
362 {
363 return DDERR_NODRIVERSUPPORT;
364 }
365
366 mem.lpDD = &This->DirectDrawGlobal;
367 mem.ddRVal = DDERR_NOTPALETTIZED;
368
369 if (This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.GetAvailDriverMemory(&mem) != DDHAL_DRIVER_HANDLED)
370 {
371 return DDERR_NODRIVERSUPPORT;
372 }
373
374 ddscaps->dwCaps = mem.DDSCaps.dwCaps;
375 ddscaps->dwCaps2 = mem.ddsCapsEx.dwCaps2;
376 ddscaps->dwCaps3 = mem.ddsCapsEx.dwCaps3;
377 ddscaps->dwCaps4 = mem.ddsCapsEx.dwCaps4;
378 *total = mem.dwTotal;
379 *free = mem.dwFree;
380
381 return mem.ddRVal;
382 }
383
384 HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,HANDLE h)
385 {
386 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
387
388 DDHAL_WAITFORVERTICALBLANKDATA WaitVectorData;
389
390 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK))
391 {
392 return DDERR_NODRIVERSUPPORT;
393 }
394
395 WaitVectorData.lpDD = &This->DirectDrawGlobal;
396 WaitVectorData.dwFlags = dwFlags;
397 WaitVectorData.hEvent = (DWORD)h;
398 WaitVectorData.ddRVal = DDERR_NOTPALETTIZED;
399
400 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.WaitForVerticalBlank(&WaitVectorData) != DDHAL_DRIVER_HANDLED)
401 {
402 return DDERR_NODRIVERSUPPORT;
403 }
404
405 return WaitVectorData.ddRVal;
406 }
407
408 HRESULT Hal_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
409 {
410 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
411
412 DDHAL_GETSCANLINEDATA GetScan;
413
414 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_GETSCANLINE))
415 {
416 return DDERR_NODRIVERSUPPORT;
417 }
418
419 GetScan.lpDD = &This->DirectDrawGlobal;
420 GetScan.ddRVal = DDERR_NOTPALETTIZED;
421
422 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.GetScanLine(&GetScan) != DDHAL_DRIVER_HANDLED)
423 {
424 return DDERR_NODRIVERSUPPORT;
425 }
426
427 *lpdwScanLine = GetScan.ddRVal;
428 return GetScan.ddRVal;
429 }
430
431 HRESULT Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
432 {
433 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
434
435 DDHAL_FLIPTOGDISURFACEDATA FlipGdi;
436
437 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_FLIPTOGDISURFACE))
438 {
439 return DDERR_NODRIVERSUPPORT;
440 }
441
442 FlipGdi.lpDD = &This->DirectDrawGlobal;
443 FlipGdi.ddRVal = DDERR_NOTPALETTIZED;
444
445 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.FlipToGDISurface(&FlipGdi) != DDHAL_DRIVER_HANDLED)
446 {
447 return DDERR_NODRIVERSUPPORT;
448 }
449
450 /* FIXME where should FlipGdi.dwToGDI be fill in */
451 return FlipGdi.ddRVal;
452 }
453
454
455
456 HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight,
457 DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
458 {
459 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
460 DDHAL_SETMODEDATA mode;
461
462 if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE))
463 {
464 return DDERR_NODRIVERSUPPORT;
465 }
466
467 mode.lpDD = &This->DirectDrawGlobal;
468 mode.ddRVal = DDERR_NODRIVERSUPPORT;
469
470 // FIXME : add search for which mode.ModeIndex we should use
471 // FIXME : fill the mode.inexcl;
472 // FIXME : fill the mode.useRefreshRate;
473
474 if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetMode(&mode) != DDHAL_DRIVER_HANDLED)
475 {
476 return DDERR_NODRIVERSUPPORT;
477 }
478
479 return mode.ddRVal;
480 }
481
482