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)
16 DDRAWI_DIRECTDRAW_GBL ddgbl
;
17 DDRAWI_DDRAWSURFACE_GBL ddSurfGbl
;
24 Create_DirectDraw (LPGUID pGUID
, LPDIRECTDRAW
* pIface
,
27 LPDDRAWI_DIRECTDRAW_INT This
;
31 if ((IsBadReadPtr(pIface
,sizeof(LPDIRECTDRAW
))) ||
32 (IsBadWritePtr(pIface
,sizeof(LPDIRECTDRAW
))))
34 return DDERR_INVALIDPARAMS
;
37 This
= (LPDDRAWI_DIRECTDRAW_INT
)*pIface
;
40 /* fixme linking too second link when we shall not doing it */
41 if (IsBadReadPtr(This
,sizeof(LPDIRECTDRAW
)))
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
;
47 memThis
= DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT
));
52 DxHeapMemFree(memThis
);
54 DX_STUB_str("DDERR_OUTOFMEMORY");
55 return DDERR_OUTOFMEMORY
;
58 /* Fixme release memory alloc if we fail */
59 This
->lpLcl
= DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT
));
60 if (This
->lpLcl
== NULL
)
62 DX_STUB_str("DDERR_OUTOFMEMORY");
63 return DDERR_OUTOFMEMORY
;
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
;
72 /* step 1.Alloc the new DDRAWI_DIRECTDRAW_INT for the lnking */
73 newThis
= DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT
));
76 DX_STUB_str("DDERR_OUTOFMEMORY\n");
77 return DDERR_OUTOFMEMORY
;
80 /* step 2 check if it not DDCREATE_HARDWAREONLY we got if so we fail */
81 if ((pGUID
) && (pGUID
!= (LPGUID
)DDCREATE_HARDWAREONLY
))
86 DX_STUB_str("DDERR_INVALIDDIRECTDRAWGUID\n");
87 return DDERR_INVALIDDIRECTDRAWGUID
;
91 /* step 3 do the link the old interface are store in the new one */
92 newThis
->lpLink
= This
;
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
)
99 DX_STUB_str("DDERR_OUTOFMEMORY");
100 return DDERR_OUTOFMEMORY
;
106 /* FIXME HACK linking does not working we need figout why */
107 LPDDRAWI_DIRECTDRAW_INT memThis
;
109 DxHeapMemAlloc(memThis
, sizeof(DDRAWI_DIRECTDRAW_INT
));
114 DxHeapMemFree(memThis
);
116 DX_STUB_str("DDERR_OUTOFMEMORY");
117 return DDERR_OUTOFMEMORY
;
120 /* Fixme release memory alloc if we fail */
121 DxHeapMemAlloc(This
->lpLcl
, sizeof(DDRAWI_DIRECTDRAW_INT
));
122 if (This
->lpLcl
== NULL
)
124 DX_STUB_str("DDERR_OUTOFMEMORY");
125 return DDERR_OUTOFMEMORY
;
129 This
->lpLcl
->lpGbl
= &ddgbl
;
131 *pIface
= (LPDIRECTDRAW
)This
;
133 /* Get right interface we whant */
134 if (Main_DirectDraw_QueryInterface((LPDIRECTDRAW7
)This
, id
, (void**)&pIface
) == DD_OK
)
136 DX_STUB_str("Got iface");
138 if (StartDirectDraw((LPDIRECTDRAW
)This
, pGUID
, FALSE
) == DD_OK
);
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);
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))
154 DX_STUB_str("DDERR_GENERIC");
155 return DDERR_GENERIC;
159 DX_STUB_str("DD_OK");
164 DX_STUB_str("DDERR_INVALIDPARAMS");
165 return DDERR_INVALIDPARAMS
;
170 StartDirectDraw(LPDIRECTDRAW iface
, LPGUID lpGuid
, BOOL reenable
)
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;
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
189 if (reenable
== FALSE
)
191 if ((!IsBadReadPtr(This
->lpLink
,sizeof(LPDIRECTDRAW
))) && (This
->lpLink
== NULL
))
193 RtlZeroMemory(&ddgbl
, sizeof(DDRAWI_DIRECTDRAW_GBL
));
194 This
->lpLcl
->lpGbl
->dwRefCnt
++;
195 if (ddgbl
.lpDDCBtmp
== NULL
)
198 DxHeapMemAlloc( ddgbl
.lpDDCBtmp
, sizeof(DDHAL_CALLBACKS
));
199 if (ddgbl
.lpDDCBtmp
== NULL
)
201 DX_STUB_str("Out of memmory\n");
208 DX_STUB_str("here\n");
210 if (reenable
== FALSE
)
214 DX_STUB_str("lpGuid == NULL\n");
217 /* Create HDC for default, hal and hel driver */
218 This
->lpLcl
->hWnd
= (ULONG_PTR
) GetActiveWindow();
219 This
->lpLcl
->hDC
= (ULONG_PTR
) GetDC((HWND
)This
->lpLcl
->hWnd
);
221 /* cObsolete is undoc in msdn it being use in CreateDCA */
222 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
223 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
224 dwFlags
|= DDRAWI_DISPLAYDRV
| DDRAWI_GDIDRV
;
228 else if (lpGuid
== (LPGUID
) DDCREATE_HARDWAREONLY
)
231 /* Create HDC for default, hal driver */
232 This
->lpLcl
->hWnd
=(ULONG_PTR
) GetActiveWindow();
233 This
->lpLcl
->hDC
= (ULONG_PTR
) GetDC((HWND
)This
->lpLcl
->hWnd
);
235 /* cObsolete is undoc in msdn it being use in CreateDCA */
236 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
237 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
238 dwFlags
|= DDRAWI_DISPLAYDRV
| DDRAWI_GDIDRV
;
240 else if (lpGuid
== (LPGUID
) DDCREATE_EMULATIONONLY
)
244 /* Create HDC for default, hal and hel driver */
245 This
->lpLcl
->hWnd
= (ULONG_PTR
) GetActiveWindow();
246 This
->lpLcl
->hDC
= (ULONG_PTR
) GetDC((HWND
)This
->lpLcl
->hWnd
);
248 /* cObsolete is undoc in msdn it being use in CreateDCA */
249 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
250 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
252 dwFlags
|= DDRAWI_DISPLAYDRV
| DDRAWI_GDIDRV
;
256 /* FIXME : need getting driver from the GUID that have been pass in from
257 * the register. we do not support that yet
260 This
->lpLcl
->hDC
= (ULONG_PTR
) NULL
;
261 This
->lpLcl
->hWnd
= (ULONG_PTR
) GetActiveWindow();
264 if ( (HDC
)This
->lpLcl
->hDC
== NULL
)
266 DX_STUB_str("DDERR_OUTOFMEMORY\n");
267 return DDERR_OUTOFMEMORY
;
271 This
->lpLcl
->lpDDCB
= ddgbl
.lpDDCBtmp
;
273 /* Startup HEL and HAL */
274 This
->lpLcl
->lpDDCB
= This
->lpLcl
->lpGbl
->lpDDCBtmp
;
275 This
->lpLcl
->dwProcessId
= GetCurrentProcessId();
280 hal_ret
= StartDirectDrawHal(iface
, reenable
);
281 This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
= 0;
285 hel_ret
= StartDirectDrawHel(iface
, reenable
);
286 This
->lpLcl
->lpDDCB
->HALDD
.dwFlags
= 0;
290 hal_ret
= StartDirectDrawHal(iface
, reenable
);
291 hel_ret
= StartDirectDrawHel(iface
, reenable
);
294 DX_STUB_str("return\n");
300 DX_STUB_str("DDERR_NODIRECTDRAWSUPPORT\n");
301 return DDERR_NODIRECTDRAWSUPPORT
;
303 dwFlags
|= DDRAWI_NOHARDWARE
;
308 dwFlags
|= DDRAWI_NOEMULATION
;
313 dwFlags
|= DDRAWI_EMULATIONINITIALIZED
;
316 /* Fill some basic info for Surface */
317 This
->lpLcl
->lpGbl
->dwFlags
= dwFlags
| DDRAWI_ATTACHEDTODESKTOP
;
318 This
->lpLcl
->lpDDCB
= This
->lpLcl
->lpGbl
->lpDDCBtmp
;
319 This
->lpLcl
->hDD
= This
->lpLcl
->lpGbl
->hDD
;
320 ddgbl
.hDD
= This
->lpLcl
->lpGbl
->hDD
;
322 DX_STUB_str("DD_OK\n");
327 StartDirectDrawHel(LPDIRECTDRAW iface
, BOOL reenable
)
329 LPDDRAWI_DIRECTDRAW_INT This
= (LPDDRAWI_DIRECTDRAW_INT
)iface
;
331 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.CanCreateSurface
= HelDdCanCreateSurface
;
332 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.CreateSurface
= HelDdCreateSurface
;
333 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.CreatePalette
= HelDdCreatePalette
;
334 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.DestroyDriver
= HelDdDestroyDriver
;
335 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.FlipToGDISurface
= HelDdFlipToGDISurface
;
336 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.GetScanLine
= HelDdGetScanLine
;
337 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.SetColorKey
= HelDdSetColorKey
;
338 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.SetExclusiveMode
= HelDdSetExclusiveMode
;
339 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.SetMode
= HelDdSetMode
;
340 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.WaitForVerticalBlank
= HelDdWaitForVerticalBlank
;
342 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.dwFlags
= DDHAL_CB32_CANCREATESURFACE
|
343 DDHAL_CB32_CREATESURFACE
|
344 DDHAL_CB32_CREATEPALETTE
|
345 DDHAL_CB32_DESTROYDRIVER
|
346 DDHAL_CB32_FLIPTOGDISURFACE
|
347 DDHAL_CB32_GETSCANLINE
|
348 DDHAL_CB32_SETCOLORKEY
|
349 DDHAL_CB32_SETEXCLUSIVEMODE
|
351 DDHAL_CB32_WAITFORVERTICALBLANK
;
353 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.dwSize
= sizeof(This
->lpLcl
->lpDDCB
->HELDD
);
355 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.AddAttachedSurface
= HelDdSurfAddAttachedSurface
;
356 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.Blt
= HelDdSurfBlt
;
357 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.DestroySurface
= HelDdSurfDestroySurface
;
358 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.Flip
= HelDdSurfFlip
;
359 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.GetBltStatus
= HelDdSurfGetBltStatus
;
360 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.GetFlipStatus
= HelDdSurfGetFlipStatus
;
361 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.Lock
= HelDdSurfLock
;
362 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.reserved4
= HelDdSurfreserved4
;
363 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.SetClipList
= HelDdSurfSetClipList
;
364 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.SetColorKey
= HelDdSurfSetColorKey
;
365 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.SetOverlayPosition
= HelDdSurfSetOverlayPosition
;
366 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.SetPalette
= HelDdSurfSetPalette
;
367 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.Unlock
= HelDdSurfUnlock
;
368 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.UpdateOverlay
= HelDdSurfUpdateOverlay
;
369 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.dwFlags
= DDHAL_SURFCB32_ADDATTACHEDSURFACE
|
371 DDHAL_SURFCB32_DESTROYSURFACE
|
372 DDHAL_SURFCB32_FLIP
|
373 DDHAL_SURFCB32_GETBLTSTATUS
|
374 DDHAL_SURFCB32_GETFLIPSTATUS
|
375 DDHAL_SURFCB32_LOCK
|
376 DDHAL_SURFCB32_RESERVED4
|
377 DDHAL_SURFCB32_SETCLIPLIST
|
378 DDHAL_SURFCB32_SETCOLORKEY
|
379 DDHAL_SURFCB32_SETOVERLAYPOSITION
|
380 DDHAL_SURFCB32_SETPALETTE
|
381 DDHAL_SURFCB32_UNLOCK
|
382 DDHAL_SURFCB32_UPDATEOVERLAY
;
384 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.dwSize
= sizeof(This
->lpLcl
->lpDDCB
->HELDDSurface
);
387 This->lpLcl->lpDDCB->HELDDPalette.DestroyPalette = HelDdPalDestroyPalette;
388 This->lpLcl->lpDDCB->HELDDPalette.SetEntries = HelDdPalSetEntries;
389 This->lpLcl->lpDDCB->HELDDPalette.dwSize = sizeof(This->lpLcl->lpDDCB->HELDDPalette);
393 This->lpLcl->lpDDCB->HELDDExeBuf.CanCreateExecuteBuffer = HelDdExeCanCreateExecuteBuffer;
394 This->lpLcl->lpDDCB->HELDDExeBuf.CreateExecuteBuffer = HelDdExeCreateExecuteBuffer;
395 This->lpLcl->lpDDCB->HELDDExeBuf.DestroyExecuteBuffer = HelDdExeDestroyExecuteBuffer;
396 This->lpLcl->lpDDCB->HELDDExeBuf.LockExecuteBuffer = HelDdExeLockExecuteBuffer;
397 This->lpLcl->lpDDCB->HELDDExeBuf.UnlockExecuteBuffer = HelDdExeUnlockExecuteBuffer;
405 StartDirectDrawHal(LPDIRECTDRAW iface
, BOOL reenable
)
407 LPDWORD mpFourCC
= NULL
;
409 BOOL newmode
= FALSE
;
410 LPDDSURFACEDESC mpTextures
;
411 D3DHAL_CALLBACKS mD3dCallbacks
;
412 D3DHAL_GLOBALDRIVERDATA mD3dDriverData
;
413 DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks
;
414 LPDDRAWI_DIRECTDRAW_INT This
= (LPDDRAWI_DIRECTDRAW_INT
)iface
;
419 RtlZeroMemory(&mHALInfo
, sizeof(DDHALINFO
));
420 RtlZeroMemory(&mD3dCallbacks
, sizeof(D3DHAL_CALLBACKS
));
421 RtlZeroMemory(&mD3dDriverData
, sizeof(D3DHAL_GLOBALDRIVERDATA
));
422 RtlZeroMemory(&mD3dBufferCallbacks
, sizeof(DDHAL_DDEXEBUFCALLBACKS
));
424 if (reenable
== FALSE
)
426 if (ddgbl
.lpDDCBtmp
== NULL
)
428 DxHeapMemAlloc(ddgbl
.lpDDCBtmp
, sizeof(DDHAL_CALLBACKS
));
429 if ( ddgbl
.lpDDCBtmp
== NULL
)
437 RtlZeroMemory(ddgbl
.lpDDCBtmp
,sizeof(DDHAL_CALLBACKS
));
441 * Startup DX HAL step one of three
443 if (!DdCreateDirectDrawObject(This
->lpLcl
->lpGbl
, (HDC
)This
->lpLcl
->hDC
))
445 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
449 /* Some card disable the dx after it have been created so
450 * we are force reanble it
452 if (!DdReenableDirectDrawObject(This
->lpLcl
->lpGbl
, &newmode
))
454 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
458 if (!DdQueryDirectDrawObject(This
->lpLcl
->lpGbl
,
460 &ddgbl
.lpDDCBtmp
->HALDD
,
461 &ddgbl
.lpDDCBtmp
->HALDDSurface
,
462 &ddgbl
.lpDDCBtmp
->HALDDPalette
,
465 &mD3dBufferCallbacks
,
470 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpModeInfo
);
471 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
472 // FIXME Close DX fristcall and second call
479 sprintf ( buffer
, "test %d %d\n", mpFourCC
, mHALInfo
.ddCaps
.dwNumFourCCCodes
);
480 OutputDebugStringA(buffer
);
483 // count = mHALInfo.ddCaps.dwNumFourCCCodes;
485 DX_STUB_str("Here\n");
489 //if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 )
491 //mpFourCC = (DWORD *) DxHeapMemAlloc( sizeof(DWORD) * 21);
492 // DxHeapMemAlloc(mpFourCC, sizeof(DWORD) * 21);
494 // mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * (mHALInfo.ddCaps.dwNumFourCCCodes + 2));
496 if (mpFourCC == NULL)
498 DxHeapMemFree(ddgbl.lpDDCBtmp);
499 // FIXME Close DX fristcall and second call
505 DX_STUB_str("Here\n");
509 sprintf ( buffer
, "test %d %d\n", mpFourCC
, mHALInfo
.ddCaps
.dwNumFourCCCodes
);
510 OutputDebugStringA(buffer
);
514 /* Alloc mpTextures */
517 if (mD3dDriverData
.dwNumTextureFormats
> 0)
519 mpTextures
= (DDSURFACEDESC
*) DxHeapMemAlloc(sizeof(DDSURFACEDESC
) * mD3dDriverData
.dwNumTextureFormats
);
520 if (mpTextures
== NULL
)
522 DxHeapMemFree(mpFourCC
);
523 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
524 // FIXME Close DX fristcall and second call
531 DX_STUB_str("Here\n");
533 /* Get all basic data from the driver */
534 if (!DdQueryDirectDrawObject(
537 &ddgbl
.lpDDCBtmp
->HALDD
,
538 &ddgbl
.lpDDCBtmp
->HALDDSurface
,
539 &ddgbl
.lpDDCBtmp
->HALDDPalette
,
542 &ddgbl
.lpDDCBtmp
->HALDDExeBuf
,
543 (DDSURFACEDESC
*)mpTextures
,
547 DxHeapMemFree(mpFourCC
);
548 DxHeapMemFree(mpTextures
);
549 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
550 // FIXME Close DX fristcall and second call
556 sprintf ( buffer
, "test %d %d\n", mpFourCC
, mHALInfo
.ddCaps
.dwNumFourCCCodes
);
557 OutputDebugStringA(buffer
);
560 memcpy(&ddgbl
.vmiData
, &mHALInfo
.vmiData
,sizeof(VIDMEMINFO
));
563 memcpy(&ddgbl
.ddCaps
, &mHALInfo
.ddCaps
,sizeof(DDCORECAPS
));
565 This
->lpLcl
->lpGbl
->dwNumFourCC
= mHALInfo
.ddCaps
.dwNumFourCCCodes
;
566 This
->lpLcl
->lpGbl
->lpdwFourCC
= mpFourCC
;
568 This
->lpLcl
->lpGbl
->dwMonitorFrequency
= mHALInfo
.dwMonitorFrequency
;
569 This
->lpLcl
->lpGbl
->dwModeIndex
= mHALInfo
.dwModeIndex
;
570 This
->lpLcl
->lpGbl
->dwNumModes
= mHALInfo
.dwNumModes
;
571 This
->lpLcl
->lpGbl
->lpModeInfo
= mHALInfo
.lpModeInfo
;
573 DX_STUB_str("Here\n");
575 /* FIXME convert mpTextures to DDHALMODEINFO */
576 // DxHeapMemFree( mpTextures);
578 /* FIXME D3D setup mD3dCallbacks and mD3dDriverData */
579 DDHAL_GETDRIVERINFODATA DdGetDriverInfo
= { 0 };
580 DdGetDriverInfo
.dwSize
= sizeof (DDHAL_GETDRIVERINFODATA
);
581 DdGetDriverInfo
.guidInfo
= GUID_MiscellaneousCallbacks
;
583 DdGetDriverInfo
.lpvData
= (PVOID
)&ddgbl
.lpDDCBtmp
->HALDDMiscellaneous
;
585 DdGetDriverInfo
.dwExpectedSize
= sizeof (DDHAL_DDMISCELLANEOUSCALLBACKS
);
587 if(mHALInfo
.GetDriverInfo (&DdGetDriverInfo
) == DDHAL_DRIVER_NOTHANDLED
|| DdGetDriverInfo
.ddRVal
!= DD_OK
)
589 DxHeapMemFree(mpFourCC
);
590 DxHeapMemFree(mpTextures
);
591 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
592 // FIXME Close DX fristcall and second call
596 /* try get the memory and show it */
597 if (ddgbl
.lpDDCBtmp
->HALDDMiscellaneous
.GetAvailDriverMemory
)
599 DDHAL_GETAVAILDRIVERMEMORYDATA memdata
;
602 ZeroMemory(&memdata
, sizeof(DDHAL_GETAVAILDRIVERMEMORYDATA
));
605 DX_STUB_str("found GetAvailDriverMemory, testing \n");
606 memdata
.lpDD
= &ddgbl
;
607 memdata
.ddRVal
= DDERR_GENERIC
;
608 ddgbl
.lpDDCBtmp
->HALDDMiscellaneous
.GetAvailDriverMemory(&memdata
);
610 sprintf ( buffer
, "GetAvailDriverMemory : retval %ld, Graphice memory free %ld Bytes, memory total %ld Bytes\n",memdata
.ddRVal
,memdata
.dwFree
,memdata
.dwTotal
);
611 OutputDebugStringA(buffer
);
619 DX_STUB_str("Return DD_OK\n");