make ddraw.dll lite more msvs frendly
[reactos.git] / reactos / dll / directx / ddraw / startup.c
1 /* $Id: main.c 21434 2006-04-01 19:12:56Z greatlrd $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: lib/ddraw/ddraw.c
6 * PURPOSE: DirectDraw Library
7 * PROGRAMMER: Magnus Olsen (greatlrd)
8 *
9 */
10
11 #include "rosdraw.h"
12 #include "ddrawgdi.h"
13
14 DDRAWI_DIRECTDRAW_GBL ddgbl;
15 DDRAWI_DDRAWSURFACE_GBL ddSurfGbl;
16
17 WCHAR classname[128];
18 WNDCLASSW wnd_class;
19
20
21 HRESULT WINAPI
22 Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
23 REFIID id, BOOL ex)
24 {
25 LPDDRAWI_DIRECTDRAW_INT This;
26
27 DX_WINDBG_trace();
28
29 if ((IsBadReadPtr(pIface,sizeof(LPDIRECTDRAW))) ||
30 (IsBadWritePtr(pIface,sizeof(LPDIRECTDRAW))))
31 {
32 return DDERR_INVALIDPARAMS;
33 }
34
35 This = (LPDDRAWI_DIRECTDRAW_INT)*pIface;
36
37 /* fixme linking too second link when we shall not doing it */
38 if (IsBadReadPtr(This,sizeof(LPDIRECTDRAW)))
39 {
40 /* We do not have a DirectDraw interface, we need alloc it*/
41 LPDDRAWI_DIRECTDRAW_INT memThis;
42
43 DX_STUB_str("1. no linking\n");
44
45 DxHeapMemAlloc(memThis, sizeof(DDRAWI_DIRECTDRAW_INT));
46 if (memThis == NULL)
47 {
48 return DDERR_OUTOFMEMORY;
49 }
50
51 This = memThis;
52
53 /* Fixme release memory alloc if we fail */
54
55 DxHeapMemAlloc(This->lpLcl, sizeof(DDRAWI_DIRECTDRAW_LCL));
56 if (This->lpLcl == NULL)
57 {
58 return DDERR_OUTOFMEMORY;
59 }
60 }
61 else
62 {
63 /* We got the DirectDraw interface alloc and we need create the link */
64 LPDDRAWI_DIRECTDRAW_INT newThis;
65
66 DX_STUB_str("2.linking\n");
67
68 /* step 1.Alloc the new DDRAWI_DIRECTDRAW_INT for the lnking */
69 DxHeapMemAlloc(newThis, sizeof(DDRAWI_DIRECTDRAW_INT));
70 if (newThis == NULL)
71 {
72 return DDERR_OUTOFMEMORY;
73 }
74
75 /* step 2 check if it not DDCREATE_HARDWAREONLY we got if so we fail */
76 if ((pGUID) && (pGUID != (LPGUID)DDCREATE_HARDWAREONLY))
77 {
78 if (pGUID !=NULL)
79 {
80 This = newThis;
81 return DDERR_INVALIDDIRECTDRAWGUID;
82 }
83 }
84
85 /* step 3 do the link the old interface are store in the new one */
86 newThis->lpLink = This;
87
88 /* step 4 we need create new local directdraw struct for the new linked interface */
89 DxHeapMemAlloc(newThis->lpLcl, sizeof(DDRAWI_DIRECTDRAW_LCL));
90 if (newThis->lpLcl == NULL)
91 {
92 This = newThis;
93 return DDERR_OUTOFMEMORY;
94 }
95
96 This = newThis;
97 }
98
99 This->lpLcl->lpGbl = &ddgbl;
100
101 *pIface = (LPDIRECTDRAW)This;
102
103 /* Get right interface we whant */
104 if (Main_DirectDraw_QueryInterface((LPDIRECTDRAW7)This, id, (void**)&pIface) == DD_OK)
105 {
106 DX_STUB_str("Got iface\n");
107
108 if (StartDirectDraw((LPDIRECTDRAW)This, pGUID, FALSE) == DD_OK);
109 {
110 /*
111 RtlZeroMemory(&wnd_class, sizeof(wnd_class));
112 wnd_class.style = CS_HREDRAW | CS_VREDRAW;
113 wnd_class.lpfnWndProc = DefWindowProcW;
114 wnd_class.cbClsExtra = 0;
115 wnd_class.cbWndExtra = 0;
116 wnd_class.hInstance = GetModuleHandleW(0);
117 wnd_class.hIcon = 0;
118 wnd_class.hCursor = 0;
119 wnd_class.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
120 wnd_class.lpszMenuName = NULL;
121 wnd_class.lpszClassName = classname;
122 if(!RegisterClassW(&wnd_class))
123 {
124 DX_STUB_str("DDERR_GENERIC");
125 return DDERR_GENERIC;
126 }
127 */
128 This->lpLcl->hDD = ddgbl.hDD;
129 return DD_OK;
130 }
131 }
132
133 return DDERR_INVALIDPARAMS;
134 }
135
136
137 HRESULT WINAPI
138 StartDirectDraw(LPDIRECTDRAW iface, LPGUID lpGuid, BOOL reenable)
139 {
140 LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
141 DWORD hal_ret = DD_FALSE;
142 DWORD hel_ret = DD_FALSE;
143 DWORD devicetypes = 0;
144 DWORD dwFlags = 0;
145
146 DX_WINDBG_trace();
147
148 /*
149 * ddgbl.dwPDevice is not longer in use in windows 2000 and higher
150 * I am using it for device type
151 * devicetypes = 1 : both hal and hel are enable
152 * devicetypes = 2 : both hal are enable
153 * devicetypes = 3 : both hel are enable
154 * devicetypes = 4 :loading a guid drv from the register
155 */
156
157 if (reenable == FALSE)
158 {
159 if ((!IsBadReadPtr(This->lpLink,sizeof(LPDIRECTDRAW))) && (This->lpLink == NULL))
160 {
161 RtlZeroMemory(&ddgbl, sizeof(DDRAWI_DIRECTDRAW_GBL));
162 This->lpLcl->lpGbl->dwRefCnt++;
163 if (ddgbl.lpDDCBtmp == NULL)
164 {
165 // LPDDHAL_CALLBACKS
166 DxHeapMemAlloc( ddgbl.lpDDCBtmp , sizeof(DDHAL_CALLBACKS));
167 if (ddgbl.lpDDCBtmp == NULL)
168 {
169 DX_STUB_str("Out of memmory\n");
170 return DD_FALSE;
171 }
172 }
173 }
174 }
175
176 DX_STUB_str("here\n");
177
178 if (reenable == FALSE)
179 {
180 if (lpGuid == NULL)
181 {
182 DX_STUB_str("lpGuid == NULL\n");
183 devicetypes= 1;
184
185 /* Create HDC for default, hal and hel driver */
186 This->lpLcl->hWnd = (ULONG_PTR) GetActiveWindow();
187 This->lpLcl->hDC = (ULONG_PTR) GetDC((HWND)This->lpLcl->hWnd);
188
189 /* cObsolete is undoc in msdn it being use in CreateDCA */
190 RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7);
191 RtlCopyMemory(&ddgbl.cDriverName,&"DISPLAY",7);
192 dwFlags |= DDRAWI_DISPLAYDRV | DDRAWI_GDIDRV;
193
194
195 }
196 else if (lpGuid == (LPGUID) DDCREATE_HARDWAREONLY)
197 {
198 devicetypes = 2;
199 /* Create HDC for default, hal driver */
200 This->lpLcl->hWnd =(ULONG_PTR) GetActiveWindow();
201 This->lpLcl->hDC = (ULONG_PTR) GetDC((HWND)This->lpLcl->hWnd);
202
203 /* cObsolete is undoc in msdn it being use in CreateDCA */
204 RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7);
205 RtlCopyMemory(&ddgbl.cDriverName,&"DISPLAY",7);
206 dwFlags |= DDRAWI_DISPLAYDRV | DDRAWI_GDIDRV;
207 }
208 else if (lpGuid == (LPGUID) DDCREATE_EMULATIONONLY)
209 {
210 devicetypes = 3;
211
212 /* Create HDC for default, hal and hel driver */
213 This->lpLcl->hWnd = (ULONG_PTR) GetActiveWindow();
214 This->lpLcl->hDC = (ULONG_PTR) GetDC((HWND)This->lpLcl->hWnd);
215
216 /* cObsolete is undoc in msdn it being use in CreateDCA */
217 RtlCopyMemory(&ddgbl.cObsolete,&"DISPLAY",7);
218 RtlCopyMemory(&ddgbl.cDriverName,&"DISPLAY",7);
219
220 dwFlags |= DDRAWI_DISPLAYDRV | DDRAWI_GDIDRV;
221 }
222 else
223 {
224 /* FIXME : need getting driver from the GUID that have been pass in from
225 * the register. we do not support that yet
226 */
227 devicetypes = 4;
228 This->lpLcl->hDC = (ULONG_PTR) NULL ;
229 This->lpLcl->hWnd = (ULONG_PTR) GetActiveWindow();
230 }
231
232 if ( (HDC)This->lpLcl->hDC == NULL)
233 {
234 DX_STUB_str("DDERR_OUTOFMEMORY\n");
235 return DDERR_OUTOFMEMORY ;
236 }
237 }
238
239 This->lpLcl->lpDDCB = ddgbl.lpDDCBtmp;
240
241 /* Startup HEL and HAL */
242 This->lpLcl->lpDDCB = This->lpLcl->lpGbl->lpDDCBtmp;
243 This->lpLcl->dwProcessId = GetCurrentProcessId();
244
245 switch (devicetypes)
246 {
247 case 2:
248 hal_ret = StartDirectDrawHal(iface, reenable);
249 This->lpLcl->lpDDCB->HELDD.dwFlags = 0;
250 break;
251
252 case 3:
253 hel_ret = StartDirectDrawHel(iface, reenable);
254 This->lpLcl->lpDDCB->HALDD.dwFlags = 0;
255 break;
256
257 default:
258 hal_ret = StartDirectDrawHal(iface, reenable);
259 hel_ret = StartDirectDrawHel(iface, reenable);
260 }
261
262 DX_STUB_str("return\n");
263
264 if (hal_ret!=DD_OK)
265 {
266 if (hel_ret!=DD_OK)
267 {
268 DX_STUB_str("DDERR_NODIRECTDRAWSUPPORT\n");
269 return DDERR_NODIRECTDRAWSUPPORT;
270 }
271 dwFlags |= DDRAWI_NOHARDWARE;
272 }
273
274 if (hel_ret!=DD_OK)
275 {
276 dwFlags |= DDRAWI_NOEMULATION;
277
278 }
279 else
280 {
281 dwFlags |= DDRAWI_EMULATIONINITIALIZED;
282 }
283
284 /* Fill some basic info for Surface */
285 This->lpLcl->lpGbl->dwFlags = dwFlags | DDRAWI_ATTACHEDTODESKTOP;
286 This->lpLcl->lpDDCB = This->lpLcl->lpGbl->lpDDCBtmp;
287 This->lpLcl->hDD = ddgbl.hDD;
288
289 DX_STUB_str("DD_OK\n");
290 return DD_OK;
291 }
292
293 HRESULT WINAPI
294 StartDirectDrawHel(LPDIRECTDRAW iface, BOOL reenable)
295 {
296 LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
297
298 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.CanCreateSurface = HelDdCanCreateSurface;
299 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.CreateSurface = HelDdCreateSurface;
300 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.CreatePalette = HelDdCreatePalette;
301 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.DestroyDriver = HelDdDestroyDriver;
302 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.FlipToGDISurface = HelDdFlipToGDISurface;
303 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.GetScanLine = HelDdGetScanLine;
304 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.SetColorKey = HelDdSetColorKey;
305 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.SetExclusiveMode = HelDdSetExclusiveMode;
306 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.SetMode = HelDdSetMode;
307 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.WaitForVerticalBlank = HelDdWaitForVerticalBlank;
308
309 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.dwFlags = DDHAL_CB32_CANCREATESURFACE |
310 DDHAL_CB32_CREATESURFACE |
311 DDHAL_CB32_CREATEPALETTE |
312 DDHAL_CB32_DESTROYDRIVER |
313 DDHAL_CB32_FLIPTOGDISURFACE |
314 DDHAL_CB32_GETSCANLINE |
315 DDHAL_CB32_SETCOLORKEY |
316 DDHAL_CB32_SETEXCLUSIVEMODE |
317 DDHAL_CB32_SETMODE |
318 DDHAL_CB32_WAITFORVERTICALBLANK ;
319
320 This->lpLcl->lpGbl->lpDDCBtmp->HELDD.dwSize = sizeof(This->lpLcl->lpDDCB->HELDD);
321
322 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.AddAttachedSurface = HelDdSurfAddAttachedSurface;
323 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.Blt = HelDdSurfBlt;
324 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.DestroySurface = HelDdSurfDestroySurface;
325 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.Flip = HelDdSurfFlip;
326 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.GetBltStatus = HelDdSurfGetBltStatus;
327 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.GetFlipStatus = HelDdSurfGetFlipStatus;
328 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.Lock = HelDdSurfLock;
329 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.reserved4 = HelDdSurfreserved4;
330 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.SetClipList = HelDdSurfSetClipList;
331 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.SetColorKey = HelDdSurfSetColorKey;
332 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.SetOverlayPosition = HelDdSurfSetOverlayPosition;
333 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.SetPalette = HelDdSurfSetPalette;
334 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.Unlock = HelDdSurfUnlock;
335 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.UpdateOverlay = HelDdSurfUpdateOverlay;
336 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.dwFlags = DDHAL_SURFCB32_ADDATTACHEDSURFACE |
337 DDHAL_SURFCB32_BLT |
338 DDHAL_SURFCB32_DESTROYSURFACE |
339 DDHAL_SURFCB32_FLIP |
340 DDHAL_SURFCB32_GETBLTSTATUS |
341 DDHAL_SURFCB32_GETFLIPSTATUS |
342 DDHAL_SURFCB32_LOCK |
343 DDHAL_SURFCB32_RESERVED4 |
344 DDHAL_SURFCB32_SETCLIPLIST |
345 DDHAL_SURFCB32_SETCOLORKEY |
346 DDHAL_SURFCB32_SETOVERLAYPOSITION |
347 DDHAL_SURFCB32_SETPALETTE |
348 DDHAL_SURFCB32_UNLOCK |
349 DDHAL_SURFCB32_UPDATEOVERLAY;
350
351 This->lpLcl->lpGbl->lpDDCBtmp->HELDDSurface.dwSize = sizeof(This->lpLcl->lpDDCB->HELDDSurface);
352
353 /*
354 This->lpLcl->lpDDCB->HELDDPalette.DestroyPalette = HelDdPalDestroyPalette;
355 This->lpLcl->lpDDCB->HELDDPalette.SetEntries = HelDdPalSetEntries;
356 This->lpLcl->lpDDCB->HELDDPalette.dwSize = sizeof(This->lpLcl->lpDDCB->HELDDPalette);
357 */
358
359 /*
360 This->lpLcl->lpDDCB->HELDDExeBuf.CanCreateExecuteBuffer = HelDdExeCanCreateExecuteBuffer;
361 This->lpLcl->lpDDCB->HELDDExeBuf.CreateExecuteBuffer = HelDdExeCreateExecuteBuffer;
362 This->lpLcl->lpDDCB->HELDDExeBuf.DestroyExecuteBuffer = HelDdExeDestroyExecuteBuffer;
363 This->lpLcl->lpDDCB->HELDDExeBuf.LockExecuteBuffer = HelDdExeLockExecuteBuffer;
364 This->lpLcl->lpDDCB->HELDDExeBuf.UnlockExecuteBuffer = HelDdExeUnlockExecuteBuffer;
365 */
366
367 return DD_OK;
368 }
369
370
371 HRESULT WINAPI
372 StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
373 {
374 LPDWORD mpFourCC = NULL;
375 DDHALINFO mHALInfo;
376 BOOL newmode = FALSE;
377 LPDDSURFACEDESC mpTextures;
378 D3DHAL_CALLBACKS mD3dCallbacks;
379 D3DHAL_GLOBALDRIVERDATA mD3dDriverData;
380 DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks;
381 LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
382 DDHAL_GETDRIVERINFODATA DdGetDriverInfo = { 0 };
383
384 DX_WINDBG_trace();
385
386 RtlZeroMemory(&mHALInfo, sizeof(DDHALINFO));
387 RtlZeroMemory(&mD3dCallbacks, sizeof(D3DHAL_CALLBACKS));
388 RtlZeroMemory(&mD3dDriverData, sizeof(D3DHAL_GLOBALDRIVERDATA));
389 RtlZeroMemory(&mD3dBufferCallbacks, sizeof(DDHAL_DDEXEBUFCALLBACKS));
390
391 if (reenable == FALSE)
392 {
393 if (ddgbl.lpDDCBtmp == NULL)
394 {
395 DxHeapMemAlloc(ddgbl.lpDDCBtmp, sizeof(DDHAL_CALLBACKS));
396 if ( ddgbl.lpDDCBtmp == NULL)
397 {
398 return DD_FALSE;
399 }
400 }
401 }
402 else
403 {
404 RtlZeroMemory(ddgbl.lpDDCBtmp,sizeof(DDHAL_CALLBACKS));
405 }
406
407 /*
408 * Startup DX HAL step one of three
409 */
410 if (!DdCreateDirectDrawObject(This->lpLcl->lpGbl, (HDC)This->lpLcl->hDC))
411 {
412 DxHeapMemFree(ddgbl.lpDDCBtmp);
413 return DD_FALSE;
414 }
415
416 /* Some card disable the dx after it have been created so
417 * we are force reanble it
418 */
419 if (!DdReenableDirectDrawObject(This->lpLcl->lpGbl, &newmode))
420 {
421 DxHeapMemFree(ddgbl.lpDDCBtmp);
422 return DD_FALSE;
423 }
424
425 if (!DdQueryDirectDrawObject(This->lpLcl->lpGbl,
426 &mHALInfo,
427 &ddgbl.lpDDCBtmp->HALDD,
428 &ddgbl.lpDDCBtmp->HALDDSurface,
429 &ddgbl.lpDDCBtmp->HALDDPalette,
430 &mD3dCallbacks,
431 &mD3dDriverData,
432 &mD3dBufferCallbacks,
433 NULL,
434 mpFourCC,
435 NULL))
436 {
437 DxHeapMemFree(This->lpLcl->lpGbl->lpModeInfo);
438 DxHeapMemFree(ddgbl.lpDDCBtmp);
439 // FIXME Close DX fristcall and second call
440 return DD_FALSE;
441 }
442
443 DX_STUB_str("Trying alloc FourCCC \n");
444
445 /* Alloc mpFourCC */
446 if (This->lpLcl->lpGbl->lpdwFourCC != NULL)
447 {
448 DxHeapMemFree(This->lpLcl->lpGbl->lpdwFourCC);
449 }
450
451 if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 )
452 {
453
454 DxHeapMemAlloc(mpFourCC, sizeof(DWORD) * (mHALInfo.ddCaps.dwNumFourCCCodes + 2));
455
456 if (mpFourCC == NULL)
457 {
458 DxHeapMemFree(ddgbl.lpDDCBtmp);
459 // FIXME Close DX fristcall and second call
460 return DD_FALSE;
461 }
462 }
463
464 DX_STUB_str("End Trying alloc FourCCC\n");
465
466
467
468
469
470 /* Alloc mpTextures */
471 #if 0
472 DX_STUB_str("1 Here\n");
473
474 if (This->lpLcl->lpGbl->texture != NULL)
475 {
476 DxHeapMemFree(This->lpLcl->lpGbl->texture;
477 }
478
479 mpTextures = NULL;
480 if (mD3dDriverData.dwNumTextureFormats > 0)
481 {
482 mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) * mD3dDriverData.dwNumTextureFormats);
483 if (mpTextures == NULL)
484 {
485 DxHeapMemFree(mpFourCC);
486 DxHeapMemFree(ddgbl.lpDDCBtmp);
487 // FIXME Close DX fristcall and second call
488 }
489 }
490
491 DX_STUB_str("2 Here\n");
492
493 #else
494 mpTextures = NULL;
495 #endif
496
497
498 /* Get all basic data from the driver */
499 if (!DdQueryDirectDrawObject(
500 This->lpLcl->lpGbl,
501 &mHALInfo,
502 &ddgbl.lpDDCBtmp->HALDD,
503 &ddgbl.lpDDCBtmp->HALDDSurface,
504 &ddgbl.lpDDCBtmp->HALDDPalette,
505 &mD3dCallbacks,
506 &mD3dDriverData,
507 &ddgbl.lpDDCBtmp->HALDDExeBuf,
508 (DDSURFACEDESC*)mpTextures,
509 mpFourCC,
510 NULL))
511 {
512 DxHeapMemFree(mpFourCC);
513 DxHeapMemFree(mpTextures);
514 DxHeapMemFree(ddgbl.lpDDCBtmp);
515 // FIXME Close DX fristcall and second call
516 return DD_FALSE;
517 }
518
519 memcpy(&ddgbl.vmiData, &mHALInfo.vmiData,sizeof(VIDMEMINFO));
520
521
522 memcpy(&ddgbl.ddCaps, &mHALInfo.ddCaps,sizeof(DDCORECAPS));
523
524 This->lpLcl->lpGbl->dwNumFourCC = mHALInfo.ddCaps.dwNumFourCCCodes;
525 This->lpLcl->lpGbl->lpdwFourCC = mpFourCC;
526 This->lpLcl->lpGbl->dwMonitorFrequency = mHALInfo.dwMonitorFrequency;
527 This->lpLcl->lpGbl->dwModeIndex = mHALInfo.dwModeIndex;
528 This->lpLcl->lpGbl->dwNumModes = mHALInfo.dwNumModes;
529 This->lpLcl->lpGbl->lpModeInfo = mHALInfo.lpModeInfo;
530
531 DX_STUB_str("Here\n");
532
533 /* FIXME convert mpTextures to DDHALMODEINFO */
534 // DxHeapMemFree( mpTextures);
535
536 /* FIXME D3D setup mD3dCallbacks and mD3dDriverData */
537
538
539
540
541 if (mHALInfo.dwFlags & DDHALINFO_GETDRIVERINFOSET)
542 {
543 DdGetDriverInfo.dwSize = sizeof (DDHAL_GETDRIVERINFODATA);
544 DdGetDriverInfo.guidInfo = GUID_MiscellaneousCallbacks;
545 DdGetDriverInfo.lpvData = (PVOID)&ddgbl.lpDDCBtmp->HALDDMiscellaneous;
546 DdGetDriverInfo.dwExpectedSize = sizeof (DDHAL_DDMISCELLANEOUSCALLBACKS);
547
548 if(mHALInfo.GetDriverInfo (&DdGetDriverInfo) == DDHAL_DRIVER_NOTHANDLED || DdGetDriverInfo.ddRVal != DD_OK)
549 {
550 DxHeapMemFree(mpFourCC);
551 DxHeapMemFree(mpTextures);
552 DxHeapMemFree(ddgbl.lpDDCBtmp);
553 // FIXME Close DX fristcall and second call
554 return DD_FALSE;
555 }
556
557 RtlZeroMemory(&DdGetDriverInfo, sizeof(DDHAL_GETDRIVERINFODATA));
558 DdGetDriverInfo.dwSize = sizeof (DDHAL_GETDRIVERINFODATA);
559 DdGetDriverInfo.guidInfo = GUID_Miscellaneous2Callbacks;
560
561 /* FIXME
562 DdGetDriverInfo.lpvData = (PVOID)&ddgbl.lpDDCBtmp->HALDDMiscellaneous;
563 DdGetDriverInfo.dwExpectedSize = sizeof (DDHAL_DDMISCELLANEOUS2CALLBACKS);
564
565 if(mHALInfo.GetDriverInfo (&DdGetDriverInfo) == DDHAL_DRIVER_NOTHANDLED || DdGetDriverInfo.ddRVal != DD_OK)
566 {
567 DxHeapMemFree(mpFourCC);
568 DxHeapMemFree(mpTextures);
569 DxHeapMemFree(ddgbl.lpDDCBtmp);
570 // FIXME Close DX fristcall and second call
571 return DD_FALSE;
572 }
573 DD_MISCELLANEOUS2CALLBACKS
574 {
575 DWORD dwSize;
576 DWORD dwFlags;
577 PDD_ALPHABLT AlphaBlt; // unsuse acoding msdn and always set to NULL
578 PDD_CREATESURFACEEX CreateSurfaceEx;
579 PDD_GETDRIVERSTATE GetDriverState;
580 PDD_DESTROYDDLOCAL DestroyDDLocal;
581 }
582 DDHAL_MISC2CB32_CREATESURFACEEX
583 DDHAL_MISC2CB32_GETDRIVERSTATE
584 DDHAL_MISC2CB32_DESTROYDDLOCAL
585 */
586 }
587
588
589 return DD_OK;
590 }