2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: lib/ddraw/ddraw.c
5 * PURPOSE: DirectDraw Library
6 * PROGRAMMER: Magnus Olsen (greatlrd)
12 DDRAWI_DIRECTDRAW_GBL ddgbl
;
13 DDRAWI_DDRAWSURFACE_GBL ddSurfGbl
;
20 Create_DirectDraw (LPGUID pGUID
, LPDIRECTDRAW
* pIface
,
21 REFIID id
, BOOL reenable
)
23 LPDDRAWI_DIRECTDRAW_INT This
;
30 return DDERR_INVALIDPARAMS
;
33 This
= (LPDDRAWI_DIRECTDRAW_INT
)*pIface
;
35 DX_STUB_str("Linking?\n")
39 linking
= This
->lpLcl
? TRUE
:FALSE
;
41 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
47 /* fixme linking too second link when we shall not doing it */
50 /* We do not have a DirectDraw interface, we need alloc it*/
51 LPDDRAWI_DIRECTDRAW_INT memThis
;
53 DX_STUB_str("1. no linking\n");
55 DxHeapMemAlloc(memThis
, sizeof(DDRAWI_DIRECTDRAW_INT
));
58 return DDERR_OUTOFMEMORY
;
63 /* Fixme release memory alloc if we fail */
65 DxHeapMemAlloc(This
->lpLcl
, sizeof(DDRAWI_DIRECTDRAW_LCL
));
66 if (This
->lpLcl
== NULL
)
68 return DDERR_OUTOFMEMORY
;
73 /* We got the DirectDraw interface alloc and we need create the link */
74 LPDDRAWI_DIRECTDRAW_INT newThis
;
76 DX_STUB_str("2.linking\n");
78 /* step 1.Alloc the new DDRAWI_DIRECTDRAW_INT for the lnking */
79 DxHeapMemAlloc(newThis
, sizeof(DDRAWI_DIRECTDRAW_INT
));
82 return DDERR_OUTOFMEMORY
;
85 /* step 2 check if it not DDCREATE_HARDWAREONLY we got if so we fail */
86 if ((pGUID
) && (pGUID
!= (LPGUID
)DDCREATE_HARDWAREONLY
))
91 return DDERR_INVALIDDIRECTDRAWGUID
;
95 /* step 3 do the link the old interface are store in the new one */
96 newThis
->lpLink
= This
;
98 /* step 4 we need create new local directdraw struct for the new linked interface */
99 DxHeapMemAlloc(newThis
->lpLcl
, sizeof(DDRAWI_DIRECTDRAW_LCL
));
100 if (newThis
->lpLcl
== NULL
)
103 return DDERR_OUTOFMEMORY
;
109 This
->lpLcl
->lpGbl
= &ddgbl
;
111 *pIface
= (LPDIRECTDRAW
)This
;
113 /* Get right interface we whant */
116 if (IsEqualGUID(&IID_IDirectDraw7
, id
))
118 /* DirectDraw7 Vtable */
119 This
->lpVtbl
= &DirectDraw7_Vtable
;
120 This
->lpLcl
->dwLocalFlags
= This
->lpLcl
->dwLocalFlags
+ DDRAWILCL_DIRECTDRAW7
;
121 *pIface
= (LPDIRECTDRAW
)&This
->lpVtbl
;
122 Main_DirectDraw_AddRef(This
);
124 else if (IsEqualGUID(&IID_IDirectDraw4
, id
))
126 /* DirectDraw4 Vtable */
127 This
->lpVtbl
= &DirectDraw4_Vtable
;
128 *pIface
= (LPDIRECTDRAW
)&This
->lpVtbl
;
129 Main_DirectDraw_AddRef(This
);
131 else if (IsEqualGUID(&IID_IDirectDraw2
, id
))
133 /* DirectDraw2 Vtable */
134 This
->lpVtbl
= &DirectDraw2_Vtable
;
135 *pIface
= (LPDIRECTDRAW
)&This
->lpVtbl
;
136 Main_DirectDraw_AddRef(This
);
138 else if (IsEqualGUID(&IID_IDirectDraw
, id
))
140 /* DirectDraw Vtable */
141 This
->lpVtbl
= &DirectDraw_Vtable
;
142 *pIface
= (LPDIRECTDRAW
)&This
->lpVtbl
;
143 Main_DirectDraw_AddRef(This
);
146 if ( This
->lpVtbl
!= 0)
148 DX_STUB_str("Got iface\n");
150 if (StartDirectDraw((LPDIRECTDRAW
)This
, pGUID
, FALSE
) == DD_OK
)
153 RtlZeroMemory(&wnd_class, sizeof(wnd_class));
154 wnd_class.style = CS_HREDRAW | CS_VREDRAW;
155 wnd_class.lpfnWndProc = DefWindowProcW;
156 wnd_class.cbClsExtra = 0;
157 wnd_class.cbWndExtra = 0;
158 wnd_class.hInstance = GetModuleHandleW(0);
160 wnd_class.hCursor = 0;
161 wnd_class.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
162 wnd_class.lpszMenuName = NULL;
163 wnd_class.lpszClassName = classname;
164 if(!RegisterClassW(&wnd_class))
166 DX_STUB_str("DDERR_GENERIC");
167 return DDERR_GENERIC;
170 This
->lpLcl
->hDD
= ddgbl
.hDD
;
175 return DDERR_INVALIDPARAMS
;
180 StartDirectDraw(LPDIRECTDRAW iface
, LPGUID lpGuid
, BOOL reenable
)
182 LPDDRAWI_DIRECTDRAW_INT This
= (LPDDRAWI_DIRECTDRAW_INT
)iface
;
183 DWORD hal_ret
= DD_FALSE
;
184 DWORD hel_ret
= DD_FALSE
;
185 DWORD devicetypes
= 0;
193 * ddgbl.dwPDevice is not longer in use in windows 2000 and higher
194 * I am using it for device type
195 * devicetypes = 1 : both hal and hel are enable
196 * devicetypes = 2 : both hal are enable
197 * devicetypes = 3 : both hel are enable
198 * devicetypes = 4 :loading a guid drv from the register
201 ddgbl
.lpDriverHandle
= &ddgbl
;
204 if (reenable
== FALSE
)
206 if ((!IsBadReadPtr(This
->lpLink
,sizeof(LPDIRECTDRAW
))) && (This
->lpLink
== NULL
))
208 RtlZeroMemory(&ddgbl
, sizeof(DDRAWI_DIRECTDRAW_GBL
));
209 This
->lpLcl
->lpGbl
->dwRefCnt
++;
210 if (ddgbl
.lpDDCBtmp
== NULL
)
213 DxHeapMemAlloc( ddgbl
.lpDDCBtmp
, sizeof(DDHAL_CALLBACKS
));
214 if (ddgbl
.lpDDCBtmp
== NULL
)
216 DX_STUB_str("Out of memmory\n");
222 DxHeapMemAlloc(ddgbl
.lpModeInfo
, sizeof(DDHALMODEINFO
));
223 if (!ddgbl
.lpModeInfo
)
225 return DDERR_OUTOFMEMORY
;
229 /* Windows handler are by set of SetCooperLevel
233 if (reenable
== FALSE
)
239 /* Create HDC for default, hal and hel driver */
240 // This->lpLcl->hWnd = (ULONG_PTR) GetActiveWindow();
241 This
->lpLcl
->hDC
= (ULONG_PTR
)CreateDCA("DISPLAY",NULL
,NULL
,NULL
);
243 /* cObsolete is undoc in msdn it being use in CreateDCA */
244 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
245 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
246 dwFlags
|= DDRAWI_DISPLAYDRV
| DDRAWI_GDIDRV
;
248 else if (lpGuid
== (LPGUID
) DDCREATE_HARDWAREONLY
)
251 /* Create HDC for default, hal driver */
252 // This->lpLcl->hWnd =(ULONG_PTR) GetActiveWindow();
253 This
->lpLcl
->hDC
= (ULONG_PTR
)CreateDCA("DISPLAY",NULL
,NULL
,NULL
);
255 /* cObsolete is undoc in msdn it being use in CreateDCA */
256 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
257 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
258 dwFlags
|= DDRAWI_DISPLAYDRV
| DDRAWI_GDIDRV
;
260 else if (lpGuid
== (LPGUID
) DDCREATE_EMULATIONONLY
)
264 /* Create HDC for default, hal and hel driver */
265 //This->lpLcl->hWnd = (ULONG_PTR) GetActiveWindow();
266 This
->lpLcl
->hDC
= (ULONG_PTR
)CreateDCA("DISPLAY",NULL
,NULL
,NULL
);
268 /* cObsolete is undoc in msdn it being use in CreateDCA */
269 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
270 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
272 dwFlags
|= DDRAWI_DISPLAYDRV
| DDRAWI_GDIDRV
;
276 /* FIXME : need getting driver from the GUID that have been pass in from
277 * the register. we do not support that yet
280 //This->lpLcl->hDC = (ULONG_PTR) NULL ;
281 //This->lpLcl->hDC = (ULONG_PTR)CreateDCA("DISPLAY",NULL,NULL,NULL);
285 if ( (HDC)This->lpLcl->hDC == NULL)
287 DX_STUB_str("DDERR_OUTOFMEMORY\n");
288 return DDERR_OUTOFMEMORY ;
293 This
->lpLcl
->lpDDCB
= ddgbl
.lpDDCBtmp
;
295 /* Startup HEL and HAL */
296 This
->lpLcl
->lpDDCB
= This
->lpLcl
->lpGbl
->lpDDCBtmp
;
297 This
->lpLcl
->dwProcessId
= GetCurrentProcessId();
301 hal_ret
= StartDirectDrawHal(iface
, reenable
);
302 This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
= 0;
306 hel_ret
= StartDirectDrawHel(iface
, reenable
);
307 This
->lpLcl
->lpDDCB
->HALDD
.dwFlags
= 0;
311 hal_ret
= StartDirectDrawHal(iface
, reenable
);
312 hel_ret
= StartDirectDrawHel(iface
, reenable
);
320 DX_STUB_str("DDERR_NODIRECTDRAWSUPPORT\n");
321 return DDERR_NODIRECTDRAWSUPPORT
;
323 dwFlags
|= DDRAWI_NOHARDWARE
;
324 DX_STUB_str("No hardware support\n");
329 dwFlags
|= DDRAWI_NOEMULATION
;
334 dwFlags
|= DDRAWI_EMULATIONINITIALIZED
;
337 /* Fill some basic info for Surface */
338 This
->lpLcl
->lpGbl
->dwFlags
= This
->lpLcl
->lpGbl
->dwFlags
| dwFlags
| DDRAWI_ATTACHEDTODESKTOP
;
339 This
->lpLcl
->lpDDCB
= This
->lpLcl
->lpGbl
->lpDDCBtmp
;
340 This
->lpLcl
->hDD
= ddgbl
.hDD
;
342 ddgbl
.rectDevice
.top
= 0;
343 ddgbl
.rectDevice
.left
= 0;
344 ddgbl
.rectDevice
.right
= ddgbl
.vmiData
.dwDisplayWidth
;
345 ddgbl
.rectDevice
.bottom
= ddgbl
.vmiData
.dwDisplayHeight
;
347 ddgbl
.rectDesktop
.top
= 0;
348 ddgbl
.rectDesktop
.left
= 0;
349 ddgbl
.rectDesktop
.right
= ddgbl
.vmiData
.dwDisplayWidth
;
350 ddgbl
.rectDesktop
.bottom
= ddgbl
.vmiData
.dwDisplayHeight
;
352 ddgbl
.dwMonitorFrequency
= GetDeviceCaps(GetWindowDC(NULL
),VREFRESH
);
353 ddgbl
.lpModeInfo
->dwWidth
= ddgbl
.vmiData
.dwDisplayWidth
;
354 ddgbl
.lpModeInfo
->dwHeight
= ddgbl
.vmiData
.dwDisplayHeight
;
355 ddgbl
.lpModeInfo
->dwBPP
= ddgbl
.vmiData
.ddpfDisplay
.dwRGBBitCount
;
356 ddgbl
.lpModeInfo
->lPitch
= ddgbl
.vmiData
.lDisplayPitch
;
357 ddgbl
.lpModeInfo
->wRefreshRate
= ddgbl
.dwMonitorFrequency
;
358 ddgbl
.lpModeInfo
->dwRBitMask
= ddgbl
.vmiData
.ddpfDisplay
.dwRBitMask
;
359 ddgbl
.lpModeInfo
->dwGBitMask
= ddgbl
.vmiData
.ddpfDisplay
.dwGBitMask
;
360 ddgbl
.lpModeInfo
->dwBBitMask
= ddgbl
.vmiData
.ddpfDisplay
.dwBBitMask
;
361 ddgbl
.lpModeInfo
->dwAlphaBitMask
= ddgbl
.vmiData
.ddpfDisplay
.dwRGBAlphaBitMask
;
368 StartDirectDrawHel(LPDIRECTDRAW iface
, BOOL reenable
)
370 LPDDRAWI_DIRECTDRAW_INT This
= (LPDDRAWI_DIRECTDRAW_INT
)iface
;
372 if (reenable
== FALSE
)
374 if (ddgbl
.lpDDCBtmp
== NULL
)
376 DxHeapMemAlloc(ddgbl
.lpDDCBtmp
, sizeof(DDHAL_CALLBACKS
));
377 if ( ddgbl
.lpDDCBtmp
== NULL
)
384 ddgbl
.lpDDCBtmp
->HELDD
.CanCreateSurface
= HelDdCanCreateSurface
;
385 ddgbl
.lpDDCBtmp
->HELDD
.CreateSurface
= HelDdCreateSurface
;
386 ddgbl
.lpDDCBtmp
->HELDD
.CreatePalette
= HelDdCreatePalette
;
387 ddgbl
.lpDDCBtmp
->HELDD
.DestroyDriver
= HelDdDestroyDriver
;
388 ddgbl
.lpDDCBtmp
->HELDD
.FlipToGDISurface
= HelDdFlipToGDISurface
;
389 ddgbl
.lpDDCBtmp
->HELDD
.GetScanLine
= HelDdGetScanLine
;
390 ddgbl
.lpDDCBtmp
->HELDD
.SetColorKey
= HelDdSetColorKey
;
391 ddgbl
.lpDDCBtmp
->HELDD
.SetExclusiveMode
= HelDdSetExclusiveMode
;
392 ddgbl
.lpDDCBtmp
->HELDD
.SetMode
= HelDdSetMode
;
393 ddgbl
.lpDDCBtmp
->HELDD
.WaitForVerticalBlank
= HelDdWaitForVerticalBlank
;
395 ddgbl
.lpDDCBtmp
->HELDD
.dwFlags
= DDHAL_CB32_CANCREATESURFACE
|
396 DDHAL_CB32_CREATESURFACE
|
397 DDHAL_CB32_CREATEPALETTE
|
398 DDHAL_CB32_DESTROYDRIVER
|
399 DDHAL_CB32_FLIPTOGDISURFACE
|
400 DDHAL_CB32_GETSCANLINE
|
401 DDHAL_CB32_SETCOLORKEY
|
402 DDHAL_CB32_SETEXCLUSIVEMODE
|
404 DDHAL_CB32_WAITFORVERTICALBLANK
;
406 ddgbl
.lpDDCBtmp
->HELDD
.dwSize
= sizeof(This
->lpLcl
->lpDDCB
->HELDD
);
408 ddgbl
.lpDDCBtmp
->HELDDSurface
.AddAttachedSurface
= HelDdSurfAddAttachedSurface
;
409 ddgbl
.lpDDCBtmp
->HELDDSurface
.Blt
= HelDdSurfBlt
;
410 ddgbl
.lpDDCBtmp
->HELDDSurface
.DestroySurface
= HelDdSurfDestroySurface
;
411 ddgbl
.lpDDCBtmp
->HELDDSurface
.Flip
= HelDdSurfFlip
;
412 ddgbl
.lpDDCBtmp
->HELDDSurface
.GetBltStatus
= HelDdSurfGetBltStatus
;
413 ddgbl
.lpDDCBtmp
->HELDDSurface
.GetFlipStatus
= HelDdSurfGetFlipStatus
;
414 ddgbl
.lpDDCBtmp
->HELDDSurface
.Lock
= HelDdSurfLock
;
415 ddgbl
.lpDDCBtmp
->HELDDSurface
.reserved4
= HelDdSurfreserved4
;
416 ddgbl
.lpDDCBtmp
->HELDDSurface
.SetClipList
= HelDdSurfSetClipList
;
417 ddgbl
.lpDDCBtmp
->HELDDSurface
.SetColorKey
= HelDdSurfSetColorKey
;
418 ddgbl
.lpDDCBtmp
->HELDDSurface
.SetOverlayPosition
= HelDdSurfSetOverlayPosition
;
419 ddgbl
.lpDDCBtmp
->HELDDSurface
.SetPalette
= HelDdSurfSetPalette
;
420 ddgbl
.lpDDCBtmp
->HELDDSurface
.Unlock
= HelDdSurfUnlock
;
421 ddgbl
.lpDDCBtmp
->HELDDSurface
.UpdateOverlay
= HelDdSurfUpdateOverlay
;
422 ddgbl
.lpDDCBtmp
->HELDDSurface
.dwFlags
= DDHAL_SURFCB32_ADDATTACHEDSURFACE
|
424 DDHAL_SURFCB32_DESTROYSURFACE
|
425 DDHAL_SURFCB32_FLIP
|
426 DDHAL_SURFCB32_GETBLTSTATUS
|
427 DDHAL_SURFCB32_GETFLIPSTATUS
|
428 DDHAL_SURFCB32_LOCK
|
429 DDHAL_SURFCB32_RESERVED4
|
430 DDHAL_SURFCB32_SETCLIPLIST
|
431 DDHAL_SURFCB32_SETCOLORKEY
|
432 DDHAL_SURFCB32_SETOVERLAYPOSITION
|
433 DDHAL_SURFCB32_SETPALETTE
|
434 DDHAL_SURFCB32_UNLOCK
|
435 DDHAL_SURFCB32_UPDATEOVERLAY
;
437 ddgbl
.lpDDCBtmp
->HELDDSurface
.dwSize
= sizeof(This
->lpLcl
->lpDDCB
->HELDDSurface
);
440 This->lpLcl->lpDDCB->HELDDPalette.DestroyPalette = HelDdPalDestroyPalette;
441 This->lpLcl->lpDDCB->HELDDPalette.SetEntries = HelDdPalSetEntries;
442 This->lpLcl->lpDDCB->HELDDPalette.dwSize = sizeof(This->lpLcl->lpDDCB->HELDDPalette);
446 This->lpLcl->lpDDCB->HELDDExeBuf.CanCreateExecuteBuffer = HelDdExeCanCreateExecuteBuffer;
447 This->lpLcl->lpDDCB->HELDDExeBuf.CreateExecuteBuffer = HelDdExeCreateExecuteBuffer;
448 This->lpLcl->lpDDCB->HELDDExeBuf.DestroyExecuteBuffer = HelDdExeDestroyExecuteBuffer;
449 This->lpLcl->lpDDCB->HELDDExeBuf.LockExecuteBuffer = HelDdExeLockExecuteBuffer;
450 This->lpLcl->lpDDCB->HELDDExeBuf.UnlockExecuteBuffer = HelDdExeUnlockExecuteBuffer;
458 StartDirectDrawHal(LPDIRECTDRAW iface
, BOOL reenable
)
460 LPDWORD mpFourCC
= NULL
;
462 BOOL newmode
= FALSE
;
463 LPDDSURFACEDESC mpTextures
;
464 D3DHAL_CALLBACKS mD3dCallbacks
;
465 D3DHAL_GLOBALDRIVERDATA mD3dDriverData
;
466 DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks
;
467 LPDDRAWI_DIRECTDRAW_INT This
= (LPDDRAWI_DIRECTDRAW_INT
)iface
;
468 DDHAL_GETDRIVERINFODATA DdGetDriverInfo
= { 0 };
472 RtlZeroMemory(&mHALInfo
, sizeof(DDHALINFO
));
473 RtlZeroMemory(&mD3dCallbacks
, sizeof(D3DHAL_CALLBACKS
));
474 RtlZeroMemory(&mD3dDriverData
, sizeof(D3DHAL_GLOBALDRIVERDATA
));
475 RtlZeroMemory(&mD3dBufferCallbacks
, sizeof(DDHAL_DDEXEBUFCALLBACKS
));
477 if (reenable
== FALSE
)
479 if (ddgbl
.lpDDCBtmp
== NULL
)
481 DxHeapMemAlloc(ddgbl
.lpDDCBtmp
, sizeof(DDHAL_CALLBACKS
));
482 if ( ddgbl
.lpDDCBtmp
== NULL
)
490 RtlZeroMemory(ddgbl
.lpDDCBtmp
,sizeof(DDHAL_CALLBACKS
));
494 * Startup DX HAL step one of three
496 if (!DdCreateDirectDrawObject(This
->lpLcl
->lpGbl
, (HDC
)This
->lpLcl
->hDC
))
498 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
502 /* Some card disable the dx after it have been created so
503 * we are force reanble it
505 if (!DdReenableDirectDrawObject(This
->lpLcl
->lpGbl
, &newmode
))
507 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
511 if (!DdQueryDirectDrawObject(This
->lpLcl
->lpGbl
,
513 &ddgbl
.lpDDCBtmp
->HALDD
,
514 &ddgbl
.lpDDCBtmp
->HALDDSurface
,
515 &ddgbl
.lpDDCBtmp
->HALDDPalette
,
518 &mD3dBufferCallbacks
,
523 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpModeInfo
);
524 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
525 // FIXME Close DX first and second call
530 if (This
->lpLcl
->lpGbl
->lpdwFourCC
!= NULL
)
532 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpdwFourCC
);
535 if (mHALInfo
.ddCaps
.dwNumFourCCCodes
> 0 )
538 DxHeapMemAlloc(mpFourCC
, sizeof(DWORD
) * (mHALInfo
.ddCaps
.dwNumFourCCCodes
+ 2));
540 if (mpFourCC
== NULL
)
542 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
543 // FIXME Close DX first and second call
548 /* Alloc mpTextures */
550 DX_STUB_str("1 Here\n");
552 if (This
->lpLcl
->lpGbl
->texture
!= NULL
)
554 DxHeapMemFree(This
->lpLcl
->lpGbl
->texture
;
558 if (mD3dDriverData
.dwNumTextureFormats
> 0)
560 mpTextures
= (DDSURFACEDESC
*) DxHeapMemAlloc(sizeof(DDSURFACEDESC
) * mD3dDriverData
.dwNumTextureFormats
);
561 if (mpTextures
== NULL
)
563 DxHeapMemFree(mpFourCC
);
564 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
565 // FIXME Close DX first and second call
569 DX_STUB_str("2 Here\n");
576 /* Get all basic data from the driver */
577 if (!DdQueryDirectDrawObject(
580 &ddgbl
.lpDDCBtmp
->HALDD
,
581 &ddgbl
.lpDDCBtmp
->HALDDSurface
,
582 &ddgbl
.lpDDCBtmp
->HALDDPalette
,
585 &ddgbl
.lpDDCBtmp
->HALDDExeBuf
,
586 (DDSURFACEDESC
*)mpTextures
,
590 DxHeapMemFree(mpFourCC
);
591 DxHeapMemFree(mpTextures
);
592 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
593 // FIXME Close DX first and second call
597 memcpy(&ddgbl
.vmiData
, &mHALInfo
.vmiData
,sizeof(VIDMEMINFO
));
600 memcpy(&ddgbl
.ddCaps
, &mHALInfo
.ddCaps
,sizeof(DDCORECAPS
));
602 This
->lpLcl
->lpGbl
->dwNumFourCC
= mHALInfo
.ddCaps
.dwNumFourCCCodes
;
603 This
->lpLcl
->lpGbl
->lpdwFourCC
= mpFourCC
;
604 // This->lpLcl->lpGbl->dwMonitorFrequency = mHALInfo.dwMonitorFrequency; // 0
605 This
->lpLcl
->lpGbl
->dwModeIndex
= mHALInfo
.dwModeIndex
;
606 // This->lpLcl->lpGbl->dwNumModes = mHALInfo.dwNumModes;
607 // This->lpLcl->lpGbl->lpModeInfo = mHALInfo.lpModeInfo;
609 /* FIXME convert mpTextures to DDHALMODEINFO */
610 // DxHeapMemFree( mpTextures);
612 /* FIXME D3D setup mD3dCallbacks and mD3dDriverData */
617 if (mHALInfo
.dwFlags
& DDHALINFO_GETDRIVERINFOSET
)
619 DdGetDriverInfo
.dwSize
= sizeof (DDHAL_GETDRIVERINFODATA
);
620 DdGetDriverInfo
.guidInfo
= GUID_MiscellaneousCallbacks
;
621 DdGetDriverInfo
.lpvData
= (PVOID
)&ddgbl
.lpDDCBtmp
->HALDDMiscellaneous
;
622 DdGetDriverInfo
.dwExpectedSize
= sizeof (DDHAL_DDMISCELLANEOUSCALLBACKS
);
624 if(mHALInfo
.GetDriverInfo (&DdGetDriverInfo
) == DDHAL_DRIVER_NOTHANDLED
|| DdGetDriverInfo
.ddRVal
!= DD_OK
)
626 DxHeapMemFree(mpFourCC
);
627 DxHeapMemFree(mpTextures
);
628 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
629 // FIXME Close DX fristcall and second call
633 RtlZeroMemory(&DdGetDriverInfo
, sizeof(DDHAL_GETDRIVERINFODATA
));
634 DdGetDriverInfo
.dwSize
= sizeof (DDHAL_GETDRIVERINFODATA
);
635 DdGetDriverInfo
.guidInfo
= GUID_Miscellaneous2Callbacks
;
638 DdGetDriverInfo.lpvData = (PVOID)&ddgbl.lpDDCBtmp->HALDDMiscellaneous;
639 DdGetDriverInfo.dwExpectedSize = sizeof (DDHAL_DDMISCELLANEOUS2CALLBACKS);
641 if(mHALInfo.GetDriverInfo (&DdGetDriverInfo) == DDHAL_DRIVER_NOTHANDLED || DdGetDriverInfo.ddRVal != DD_OK)
643 DxHeapMemFree(mpFourCC);
644 DxHeapMemFree(mpTextures);
645 DxHeapMemFree(ddgbl.lpDDCBtmp);
646 // FIXME Close DX fristcall and second call
649 DD_MISCELLANEOUS2CALLBACKS
653 PDD_ALPHABLT AlphaBlt; // unsuse acoding msdn and always set to NULL
654 PDD_CREATESURFACEEX CreateSurfaceEx;
655 PDD_GETDRIVERSTATE GetDriverState;
656 PDD_DESTROYDDLOCAL DestroyDDLocal;
658 DDHAL_MISC2CB32_CREATESURFACEEX
659 DDHAL_MISC2CB32_GETDRIVERSTATE
660 DDHAL_MISC2CB32_DESTROYDDLOCAL
664 if (mHALInfo
.dwFlags
& DDHALINFO_GETDRIVERINFO2
)
666 This
->lpLcl
->lpGbl
->dwFlags
= This
->lpLcl
->lpGbl
->dwFlags
| DDRAWI_DRIVERINFO2
;