1 /* $Id: main.c 21434 2006-04-01 19:12:56Z greatlrd $
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)
13 DDRAWI_DIRECTDRAW_GBL ddgbl
;
14 DDRAWI_DDRAWSURFACE_GBL ddSurfGbl
;
21 Create_DirectDraw (LPGUID pGUID
, LPDIRECTDRAW
* pIface
,
22 REFIID id
, BOOL reenable
)
24 LPDDRAWI_DIRECTDRAW_INT This
;
31 return DDERR_INVALIDPARAMS
;
34 This
= (LPDDRAWI_DIRECTDRAW_INT
)*pIface
;
36 DX_STUB_str("Linking?\n")
40 linking
= This
->lpLcl
? TRUE
:FALSE
;
42 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
48 /* fixme linking too second link when we shall not doing it */
51 /* We do not have a DirectDraw interface, we need alloc it*/
52 LPDDRAWI_DIRECTDRAW_INT memThis
;
54 DX_STUB_str("1. no linking\n");
56 DxHeapMemAlloc(memThis
, sizeof(DDRAWI_DIRECTDRAW_INT
));
59 return DDERR_OUTOFMEMORY
;
64 /* Fixme release memory alloc if we fail */
66 DxHeapMemAlloc(This
->lpLcl
, sizeof(DDRAWI_DIRECTDRAW_LCL
));
67 if (This
->lpLcl
== NULL
)
69 return DDERR_OUTOFMEMORY
;
74 /* We got the DirectDraw interface alloc and we need create the link */
75 LPDDRAWI_DIRECTDRAW_INT newThis
;
77 DX_STUB_str("2.linking\n");
79 /* step 1.Alloc the new DDRAWI_DIRECTDRAW_INT for the lnking */
80 DxHeapMemAlloc(newThis
, sizeof(DDRAWI_DIRECTDRAW_INT
));
83 return DDERR_OUTOFMEMORY
;
86 /* step 2 check if it not DDCREATE_HARDWAREONLY we got if so we fail */
87 if ((pGUID
) && (pGUID
!= (LPGUID
)DDCREATE_HARDWAREONLY
))
92 return DDERR_INVALIDDIRECTDRAWGUID
;
96 /* step 3 do the link the old interface are store in the new one */
97 newThis
->lpLink
= This
;
99 /* step 4 we need create new local directdraw struct for the new linked interface */
100 DxHeapMemAlloc(newThis
->lpLcl
, sizeof(DDRAWI_DIRECTDRAW_LCL
));
101 if (newThis
->lpLcl
== NULL
)
104 return DDERR_OUTOFMEMORY
;
110 This
->lpLcl
->lpGbl
= &ddgbl
;
112 *pIface
= (LPDIRECTDRAW
)This
;
114 /* Get right interface we whant */
117 if (IsEqualGUID(&IID_IDirectDraw7
, id
))
119 /* DirectDraw7 Vtable */
120 This
->lpVtbl
= &DirectDraw7_Vtable
;
121 This
->lpLcl
->dwLocalFlags
= This
->lpLcl
->dwLocalFlags
+ DDRAWILCL_DIRECTDRAW7
;
122 *pIface
= (LPDIRECTDRAW
)&This
->lpVtbl
;
123 Main_DirectDraw_AddRef(This
);
125 else if (IsEqualGUID(&IID_IDirectDraw4
, id
))
127 /* DirectDraw4 Vtable */
128 This
->lpVtbl
= &DirectDraw4_Vtable
;
129 *pIface
= (LPDIRECTDRAW
)&This
->lpVtbl
;
130 Main_DirectDraw_AddRef(This
);
132 else if (IsEqualGUID(&IID_IDirectDraw2
, id
))
134 /* DirectDraw2 Vtable */
135 This
->lpVtbl
= &DirectDraw2_Vtable
;
136 *pIface
= (LPDIRECTDRAW
)&This
->lpVtbl
;
137 Main_DirectDraw_AddRef(This
);
139 else if (IsEqualGUID(&IID_IDirectDraw
, id
))
141 /* DirectDraw Vtable */
142 This
->lpVtbl
= &DirectDraw_Vtable
;
143 *pIface
= (LPDIRECTDRAW
)&This
->lpVtbl
;
144 Main_DirectDraw_AddRef(This
);
147 if ( This
->lpVtbl
!= 0)
149 DX_STUB_str("Got iface\n");
151 if (StartDirectDraw((LPDIRECTDRAW
)This
, pGUID
, FALSE
) == DD_OK
)
154 RtlZeroMemory(&wnd_class, sizeof(wnd_class));
155 wnd_class.style = CS_HREDRAW | CS_VREDRAW;
156 wnd_class.lpfnWndProc = DefWindowProcW;
157 wnd_class.cbClsExtra = 0;
158 wnd_class.cbWndExtra = 0;
159 wnd_class.hInstance = GetModuleHandleW(0);
161 wnd_class.hCursor = 0;
162 wnd_class.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
163 wnd_class.lpszMenuName = NULL;
164 wnd_class.lpszClassName = classname;
165 if(!RegisterClassW(&wnd_class))
167 DX_STUB_str("DDERR_GENERIC");
168 return DDERR_GENERIC;
171 This
->lpLcl
->hDD
= ddgbl
.hDD
;
176 return DDERR_INVALIDPARAMS
;
181 StartDirectDraw(LPDIRECTDRAW iface
, LPGUID lpGuid
, BOOL reenable
)
183 LPDDRAWI_DIRECTDRAW_INT This
= (LPDDRAWI_DIRECTDRAW_INT
)iface
;
184 DWORD hal_ret
= DD_FALSE
;
185 DWORD hel_ret
= DD_FALSE
;
186 DWORD devicetypes
= 0;
194 * ddgbl.dwPDevice is not longer in use in windows 2000 and higher
195 * I am using it for device type
196 * devicetypes = 1 : both hal and hel are enable
197 * devicetypes = 2 : both hal are enable
198 * devicetypes = 3 : both hel are enable
199 * devicetypes = 4 :loading a guid drv from the register
202 ddgbl
.lpDriverHandle
= &ddgbl
;
205 if (reenable
== FALSE
)
207 if ((!IsBadReadPtr(This
->lpLink
,sizeof(LPDIRECTDRAW
))) && (This
->lpLink
== NULL
))
209 RtlZeroMemory(&ddgbl
, sizeof(DDRAWI_DIRECTDRAW_GBL
));
210 This
->lpLcl
->lpGbl
->dwRefCnt
++;
211 if (ddgbl
.lpDDCBtmp
== NULL
)
214 DxHeapMemAlloc( ddgbl
.lpDDCBtmp
, sizeof(DDHAL_CALLBACKS
));
215 if (ddgbl
.lpDDCBtmp
== NULL
)
217 DX_STUB_str("Out of memmory\n");
223 DxHeapMemAlloc(ddgbl
.lpModeInfo
, sizeof(DDHALMODEINFO
));
224 if (!ddgbl
.lpModeInfo
)
226 return DDERR_OUTOFMEMORY
;
230 /* Windows handler are by set of SetCooperLevel
234 if (reenable
== FALSE
)
240 /* Create HDC for default, hal and hel driver */
241 // This->lpLcl->hWnd = (ULONG_PTR) GetActiveWindow();
242 This
->lpLcl
->hDC
= (ULONG_PTR
)CreateDCA("DISPLAY",NULL
,NULL
,NULL
);
244 /* cObsolete is undoc in msdn it being use in CreateDCA */
245 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
246 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
247 dwFlags
|= DDRAWI_DISPLAYDRV
| DDRAWI_GDIDRV
;
249 else if (lpGuid
== (LPGUID
) DDCREATE_HARDWAREONLY
)
252 /* Create HDC for default, hal driver */
253 // This->lpLcl->hWnd =(ULONG_PTR) GetActiveWindow();
254 This
->lpLcl
->hDC
= (ULONG_PTR
)CreateDCA("DISPLAY",NULL
,NULL
,NULL
);
256 /* cObsolete is undoc in msdn it being use in CreateDCA */
257 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
258 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
259 dwFlags
|= DDRAWI_DISPLAYDRV
| DDRAWI_GDIDRV
;
261 else if (lpGuid
== (LPGUID
) DDCREATE_EMULATIONONLY
)
265 /* Create HDC for default, hal and hel driver */
266 //This->lpLcl->hWnd = (ULONG_PTR) GetActiveWindow();
267 This
->lpLcl
->hDC
= (ULONG_PTR
)CreateDCA("DISPLAY",NULL
,NULL
,NULL
);
269 /* cObsolete is undoc in msdn it being use in CreateDCA */
270 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
271 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
273 dwFlags
|= DDRAWI_DISPLAYDRV
| DDRAWI_GDIDRV
;
277 /* FIXME : need getting driver from the GUID that have been pass in from
278 * the register. we do not support that yet
281 //This->lpLcl->hDC = (ULONG_PTR) NULL ;
282 //This->lpLcl->hDC = (ULONG_PTR)CreateDCA("DISPLAY",NULL,NULL,NULL);
286 if ( (HDC)This->lpLcl->hDC == NULL)
288 DX_STUB_str("DDERR_OUTOFMEMORY\n");
289 return DDERR_OUTOFMEMORY ;
294 This
->lpLcl
->lpDDCB
= ddgbl
.lpDDCBtmp
;
296 /* Startup HEL and HAL */
297 This
->lpLcl
->lpDDCB
= This
->lpLcl
->lpGbl
->lpDDCBtmp
;
298 This
->lpLcl
->dwProcessId
= GetCurrentProcessId();
302 hal_ret
= StartDirectDrawHal(iface
, reenable
);
303 This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
= 0;
307 hel_ret
= StartDirectDrawHel(iface
, reenable
);
308 This
->lpLcl
->lpDDCB
->HALDD
.dwFlags
= 0;
312 hal_ret
= StartDirectDrawHal(iface
, reenable
);
313 hel_ret
= StartDirectDrawHel(iface
, reenable
);
321 DX_STUB_str("DDERR_NODIRECTDRAWSUPPORT\n");
322 return DDERR_NODIRECTDRAWSUPPORT
;
324 dwFlags
|= DDRAWI_NOHARDWARE
;
325 DX_STUB_str("No hardware support\n");
330 dwFlags
|= DDRAWI_NOEMULATION
;
335 dwFlags
|= DDRAWI_EMULATIONINITIALIZED
;
338 /* Fill some basic info for Surface */
339 This
->lpLcl
->lpGbl
->dwFlags
= This
->lpLcl
->lpGbl
->dwFlags
| dwFlags
| DDRAWI_ATTACHEDTODESKTOP
;
340 This
->lpLcl
->lpDDCB
= This
->lpLcl
->lpGbl
->lpDDCBtmp
;
341 This
->lpLcl
->hDD
= ddgbl
.hDD
;
343 ddgbl
.rectDevice
.top
= 0;
344 ddgbl
.rectDevice
.left
= 0;
345 ddgbl
.rectDevice
.right
= ddgbl
.vmiData
.dwDisplayWidth
;
346 ddgbl
.rectDevice
.bottom
= ddgbl
.vmiData
.dwDisplayHeight
;
348 ddgbl
.rectDesktop
.top
= 0;
349 ddgbl
.rectDesktop
.left
= 0;
350 ddgbl
.rectDesktop
.right
= ddgbl
.vmiData
.dwDisplayWidth
;
351 ddgbl
.rectDesktop
.bottom
= ddgbl
.vmiData
.dwDisplayHeight
;
353 ddgbl
.dwMonitorFrequency
= GetDeviceCaps(GetWindowDC(NULL
),VREFRESH
);
354 ddgbl
.lpModeInfo
->dwWidth
= ddgbl
.vmiData
.dwDisplayWidth
;
355 ddgbl
.lpModeInfo
->dwHeight
= ddgbl
.vmiData
.dwDisplayHeight
;
356 ddgbl
.lpModeInfo
->dwBPP
= ddgbl
.vmiData
.ddpfDisplay
.dwRGBBitCount
;
357 ddgbl
.lpModeInfo
->lPitch
= ddgbl
.vmiData
.lDisplayPitch
;
358 ddgbl
.lpModeInfo
->wRefreshRate
= ddgbl
.dwMonitorFrequency
;
359 ddgbl
.lpModeInfo
->dwRBitMask
= ddgbl
.vmiData
.ddpfDisplay
.dwRBitMask
;
360 ddgbl
.lpModeInfo
->dwGBitMask
= ddgbl
.vmiData
.ddpfDisplay
.dwGBitMask
;
361 ddgbl
.lpModeInfo
->dwBBitMask
= ddgbl
.vmiData
.ddpfDisplay
.dwBBitMask
;
362 ddgbl
.lpModeInfo
->dwAlphaBitMask
= ddgbl
.vmiData
.ddpfDisplay
.dwRGBAlphaBitMask
;
369 StartDirectDrawHel(LPDIRECTDRAW iface
, BOOL reenable
)
371 LPDDRAWI_DIRECTDRAW_INT This
= (LPDDRAWI_DIRECTDRAW_INT
)iface
;
373 if (reenable
== FALSE
)
375 if (ddgbl
.lpDDCBtmp
== NULL
)
377 DxHeapMemAlloc(ddgbl
.lpDDCBtmp
, sizeof(DDHAL_CALLBACKS
));
378 if ( ddgbl
.lpDDCBtmp
== NULL
)
385 ddgbl
.lpDDCBtmp
->HELDD
.CanCreateSurface
= HelDdCanCreateSurface
;
386 ddgbl
.lpDDCBtmp
->HELDD
.CreateSurface
= HelDdCreateSurface
;
387 ddgbl
.lpDDCBtmp
->HELDD
.CreatePalette
= HelDdCreatePalette
;
388 ddgbl
.lpDDCBtmp
->HELDD
.DestroyDriver
= HelDdDestroyDriver
;
389 ddgbl
.lpDDCBtmp
->HELDD
.FlipToGDISurface
= HelDdFlipToGDISurface
;
390 ddgbl
.lpDDCBtmp
->HELDD
.GetScanLine
= HelDdGetScanLine
;
391 ddgbl
.lpDDCBtmp
->HELDD
.SetColorKey
= HelDdSetColorKey
;
392 ddgbl
.lpDDCBtmp
->HELDD
.SetExclusiveMode
= HelDdSetExclusiveMode
;
393 ddgbl
.lpDDCBtmp
->HELDD
.SetMode
= HelDdSetMode
;
394 ddgbl
.lpDDCBtmp
->HELDD
.WaitForVerticalBlank
= HelDdWaitForVerticalBlank
;
396 ddgbl
.lpDDCBtmp
->HELDD
.dwFlags
= DDHAL_CB32_CANCREATESURFACE
|
397 DDHAL_CB32_CREATESURFACE
|
398 DDHAL_CB32_CREATEPALETTE
|
399 DDHAL_CB32_DESTROYDRIVER
|
400 DDHAL_CB32_FLIPTOGDISURFACE
|
401 DDHAL_CB32_GETSCANLINE
|
402 DDHAL_CB32_SETCOLORKEY
|
403 DDHAL_CB32_SETEXCLUSIVEMODE
|
405 DDHAL_CB32_WAITFORVERTICALBLANK
;
407 ddgbl
.lpDDCBtmp
->HELDD
.dwSize
= sizeof(This
->lpLcl
->lpDDCB
->HELDD
);
409 ddgbl
.lpDDCBtmp
->HELDDSurface
.AddAttachedSurface
= HelDdSurfAddAttachedSurface
;
410 ddgbl
.lpDDCBtmp
->HELDDSurface
.Blt
= HelDdSurfBlt
;
411 ddgbl
.lpDDCBtmp
->HELDDSurface
.DestroySurface
= HelDdSurfDestroySurface
;
412 ddgbl
.lpDDCBtmp
->HELDDSurface
.Flip
= HelDdSurfFlip
;
413 ddgbl
.lpDDCBtmp
->HELDDSurface
.GetBltStatus
= HelDdSurfGetBltStatus
;
414 ddgbl
.lpDDCBtmp
->HELDDSurface
.GetFlipStatus
= HelDdSurfGetFlipStatus
;
415 ddgbl
.lpDDCBtmp
->HELDDSurface
.Lock
= HelDdSurfLock
;
416 ddgbl
.lpDDCBtmp
->HELDDSurface
.reserved4
= HelDdSurfreserved4
;
417 ddgbl
.lpDDCBtmp
->HELDDSurface
.SetClipList
= HelDdSurfSetClipList
;
418 ddgbl
.lpDDCBtmp
->HELDDSurface
.SetColorKey
= HelDdSurfSetColorKey
;
419 ddgbl
.lpDDCBtmp
->HELDDSurface
.SetOverlayPosition
= HelDdSurfSetOverlayPosition
;
420 ddgbl
.lpDDCBtmp
->HELDDSurface
.SetPalette
= HelDdSurfSetPalette
;
421 ddgbl
.lpDDCBtmp
->HELDDSurface
.Unlock
= HelDdSurfUnlock
;
422 ddgbl
.lpDDCBtmp
->HELDDSurface
.UpdateOverlay
= HelDdSurfUpdateOverlay
;
423 ddgbl
.lpDDCBtmp
->HELDDSurface
.dwFlags
= DDHAL_SURFCB32_ADDATTACHEDSURFACE
|
425 DDHAL_SURFCB32_DESTROYSURFACE
|
426 DDHAL_SURFCB32_FLIP
|
427 DDHAL_SURFCB32_GETBLTSTATUS
|
428 DDHAL_SURFCB32_GETFLIPSTATUS
|
429 DDHAL_SURFCB32_LOCK
|
430 DDHAL_SURFCB32_RESERVED4
|
431 DDHAL_SURFCB32_SETCLIPLIST
|
432 DDHAL_SURFCB32_SETCOLORKEY
|
433 DDHAL_SURFCB32_SETOVERLAYPOSITION
|
434 DDHAL_SURFCB32_SETPALETTE
|
435 DDHAL_SURFCB32_UNLOCK
|
436 DDHAL_SURFCB32_UPDATEOVERLAY
;
438 ddgbl
.lpDDCBtmp
->HELDDSurface
.dwSize
= sizeof(This
->lpLcl
->lpDDCB
->HELDDSurface
);
441 This->lpLcl->lpDDCB->HELDDPalette.DestroyPalette = HelDdPalDestroyPalette;
442 This->lpLcl->lpDDCB->HELDDPalette.SetEntries = HelDdPalSetEntries;
443 This->lpLcl->lpDDCB->HELDDPalette.dwSize = sizeof(This->lpLcl->lpDDCB->HELDDPalette);
447 This->lpLcl->lpDDCB->HELDDExeBuf.CanCreateExecuteBuffer = HelDdExeCanCreateExecuteBuffer;
448 This->lpLcl->lpDDCB->HELDDExeBuf.CreateExecuteBuffer = HelDdExeCreateExecuteBuffer;
449 This->lpLcl->lpDDCB->HELDDExeBuf.DestroyExecuteBuffer = HelDdExeDestroyExecuteBuffer;
450 This->lpLcl->lpDDCB->HELDDExeBuf.LockExecuteBuffer = HelDdExeLockExecuteBuffer;
451 This->lpLcl->lpDDCB->HELDDExeBuf.UnlockExecuteBuffer = HelDdExeUnlockExecuteBuffer;
459 StartDirectDrawHal(LPDIRECTDRAW iface
, BOOL reenable
)
461 LPDWORD mpFourCC
= NULL
;
463 BOOL newmode
= FALSE
;
464 LPDDSURFACEDESC mpTextures
;
465 D3DHAL_CALLBACKS mD3dCallbacks
;
466 D3DHAL_GLOBALDRIVERDATA mD3dDriverData
;
467 DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks
;
468 LPDDRAWI_DIRECTDRAW_INT This
= (LPDDRAWI_DIRECTDRAW_INT
)iface
;
469 DDHAL_GETDRIVERINFODATA DdGetDriverInfo
= { 0 };
473 RtlZeroMemory(&mHALInfo
, sizeof(DDHALINFO
));
474 RtlZeroMemory(&mD3dCallbacks
, sizeof(D3DHAL_CALLBACKS
));
475 RtlZeroMemory(&mD3dDriverData
, sizeof(D3DHAL_GLOBALDRIVERDATA
));
476 RtlZeroMemory(&mD3dBufferCallbacks
, sizeof(DDHAL_DDEXEBUFCALLBACKS
));
478 if (reenable
== FALSE
)
480 if (ddgbl
.lpDDCBtmp
== NULL
)
482 DxHeapMemAlloc(ddgbl
.lpDDCBtmp
, sizeof(DDHAL_CALLBACKS
));
483 if ( ddgbl
.lpDDCBtmp
== NULL
)
491 RtlZeroMemory(ddgbl
.lpDDCBtmp
,sizeof(DDHAL_CALLBACKS
));
495 * Startup DX HAL step one of three
497 if (!DdCreateDirectDrawObject(This
->lpLcl
->lpGbl
, (HDC
)This
->lpLcl
->hDC
))
499 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
503 /* Some card disable the dx after it have been created so
504 * we are force reanble it
506 if (!DdReenableDirectDrawObject(This
->lpLcl
->lpGbl
, &newmode
))
508 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
512 if (!DdQueryDirectDrawObject(This
->lpLcl
->lpGbl
,
514 &ddgbl
.lpDDCBtmp
->HALDD
,
515 &ddgbl
.lpDDCBtmp
->HALDDSurface
,
516 &ddgbl
.lpDDCBtmp
->HALDDPalette
,
519 &mD3dBufferCallbacks
,
524 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpModeInfo
);
525 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
526 // FIXME Close DX first and second call
531 if (This
->lpLcl
->lpGbl
->lpdwFourCC
!= NULL
)
533 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpdwFourCC
);
536 if (mHALInfo
.ddCaps
.dwNumFourCCCodes
> 0 )
539 DxHeapMemAlloc(mpFourCC
, sizeof(DWORD
) * (mHALInfo
.ddCaps
.dwNumFourCCCodes
+ 2));
541 if (mpFourCC
== NULL
)
543 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
544 // FIXME Close DX first and second call
549 /* Alloc mpTextures */
551 DX_STUB_str("1 Here\n");
553 if (This
->lpLcl
->lpGbl
->texture
!= NULL
)
555 DxHeapMemFree(This
->lpLcl
->lpGbl
->texture
;
559 if (mD3dDriverData
.dwNumTextureFormats
> 0)
561 mpTextures
= (DDSURFACEDESC
*) DxHeapMemAlloc(sizeof(DDSURFACEDESC
) * mD3dDriverData
.dwNumTextureFormats
);
562 if (mpTextures
== NULL
)
564 DxHeapMemFree(mpFourCC
);
565 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
566 // FIXME Close DX first and second call
570 DX_STUB_str("2 Here\n");
577 /* Get all basic data from the driver */
578 if (!DdQueryDirectDrawObject(
581 &ddgbl
.lpDDCBtmp
->HALDD
,
582 &ddgbl
.lpDDCBtmp
->HALDDSurface
,
583 &ddgbl
.lpDDCBtmp
->HALDDPalette
,
586 &ddgbl
.lpDDCBtmp
->HALDDExeBuf
,
587 (DDSURFACEDESC
*)mpTextures
,
591 DxHeapMemFree(mpFourCC
);
592 DxHeapMemFree(mpTextures
);
593 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
594 // FIXME Close DX first and second call
598 memcpy(&ddgbl
.vmiData
, &mHALInfo
.vmiData
,sizeof(VIDMEMINFO
));
601 memcpy(&ddgbl
.ddCaps
, &mHALInfo
.ddCaps
,sizeof(DDCORECAPS
));
603 This
->lpLcl
->lpGbl
->dwNumFourCC
= mHALInfo
.ddCaps
.dwNumFourCCCodes
;
604 This
->lpLcl
->lpGbl
->lpdwFourCC
= mpFourCC
;
605 // This->lpLcl->lpGbl->dwMonitorFrequency = mHALInfo.dwMonitorFrequency; // 0
606 This
->lpLcl
->lpGbl
->dwModeIndex
= mHALInfo
.dwModeIndex
;
607 // This->lpLcl->lpGbl->dwNumModes = mHALInfo.dwNumModes;
608 // This->lpLcl->lpGbl->lpModeInfo = mHALInfo.lpModeInfo;
610 /* FIXME convert mpTextures to DDHALMODEINFO */
611 // DxHeapMemFree( mpTextures);
613 /* FIXME D3D setup mD3dCallbacks and mD3dDriverData */
618 if (mHALInfo
.dwFlags
& DDHALINFO_GETDRIVERINFOSET
)
620 DdGetDriverInfo
.dwSize
= sizeof (DDHAL_GETDRIVERINFODATA
);
621 DdGetDriverInfo
.guidInfo
= GUID_MiscellaneousCallbacks
;
622 DdGetDriverInfo
.lpvData
= (PVOID
)&ddgbl
.lpDDCBtmp
->HALDDMiscellaneous
;
623 DdGetDriverInfo
.dwExpectedSize
= sizeof (DDHAL_DDMISCELLANEOUSCALLBACKS
);
625 if(mHALInfo
.GetDriverInfo (&DdGetDriverInfo
) == DDHAL_DRIVER_NOTHANDLED
|| DdGetDriverInfo
.ddRVal
!= DD_OK
)
627 DxHeapMemFree(mpFourCC
);
628 DxHeapMemFree(mpTextures
);
629 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
630 // FIXME Close DX fristcall and second call
634 RtlZeroMemory(&DdGetDriverInfo
, sizeof(DDHAL_GETDRIVERINFODATA
));
635 DdGetDriverInfo
.dwSize
= sizeof (DDHAL_GETDRIVERINFODATA
);
636 DdGetDriverInfo
.guidInfo
= GUID_Miscellaneous2Callbacks
;
639 DdGetDriverInfo.lpvData = (PVOID)&ddgbl.lpDDCBtmp->HALDDMiscellaneous;
640 DdGetDriverInfo.dwExpectedSize = sizeof (DDHAL_DDMISCELLANEOUS2CALLBACKS);
642 if(mHALInfo.GetDriverInfo (&DdGetDriverInfo) == DDHAL_DRIVER_NOTHANDLED || DdGetDriverInfo.ddRVal != DD_OK)
644 DxHeapMemFree(mpFourCC);
645 DxHeapMemFree(mpTextures);
646 DxHeapMemFree(ddgbl.lpDDCBtmp);
647 // FIXME Close DX fristcall and second call
650 DD_MISCELLANEOUS2CALLBACKS
654 PDD_ALPHABLT AlphaBlt; // unsuse acoding msdn and always set to NULL
655 PDD_CREATESURFACEEX CreateSurfaceEx;
656 PDD_GETDRIVERSTATE GetDriverState;
657 PDD_DESTROYDDLOCAL DestroyDDLocal;
659 DDHAL_MISC2CB32_CREATESURFACEEX
660 DDHAL_MISC2CB32_GETDRIVERSTATE
661 DDHAL_MISC2CB32_DESTROYDDLOCAL
665 if (mHALInfo
.dwFlags
& DDHALINFO_GETDRIVERINFO2
)
667 This
->lpLcl
->lpGbl
->dwFlags
= This
->lpLcl
->lpGbl
->dwFlags
| DDRAWI_DRIVERINFO2
;