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