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)
14 DDRAWI_DIRECTDRAW_GBL ddgbl
;
15 DDRAWI_DIRECTDRAW_INT primaryDirectDrawInt
;
16 DDRAWI_DDRAWSURFACE_GBL ddSurfGbl
;
23 Create_DirectDraw (LPGUID pGUID
, LPDIRECTDRAW
* pIface
,
26 LPDDRAWI_DIRECTDRAW_INT This
;
30 if ((IsBadReadPtr(pIface
,sizeof(LPDIRECTDRAW
))) ||
31 (IsBadWritePtr(pIface
,sizeof(LPDIRECTDRAW
))))
33 return DDERR_INVALIDPARAMS
;
36 DX_STUB_str("here\n");
38 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 DX_STUB_str("here\n");
49 memThis
= &primaryDirectDrawInt
;
51 RtlZeroMemory(memThis
, sizeof(DDRAWI_DIRECTDRAW_INT
));
57 DX_STUB_str("DDERR_OUTOFMEMORY\n");
58 return DDERR_OUTOFMEMORY
;
64 DX_STUB_str("here\n");
66 /* Fixme release memory alloc if we fail */
68 DxHeapMemAlloc(This
->lpLcl
, sizeof(DDRAWI_DIRECTDRAW_LCL
));
69 if (This
->lpLcl
== NULL
)
71 DX_STUB_str("DDERR_OUTOFMEMORY\n");
72 return DDERR_OUTOFMEMORY
;
75 DX_STUB_str("here\n");
79 DX_STUB_str("2.linking\n");
80 /* We got the DirectDraw interface alloc and we need create the link */
81 LPDDRAWI_DIRECTDRAW_INT newThis
;
83 DX_STUB_str("here\n");
85 /* step 1.Alloc the new DDRAWI_DIRECTDRAW_INT for the lnking */
86 DxHeapMemAlloc(newThis
, sizeof(DDRAWI_DIRECTDRAW_INT
));
89 DX_STUB_str("DDERR_OUTOFMEMORY\n");
90 return DDERR_OUTOFMEMORY
;
93 DX_STUB_str("here\n");
95 /* step 2 check if it not DDCREATE_HARDWAREONLY we got if so we fail */
96 if ((pGUID
) && (pGUID
!= (LPGUID
)DDCREATE_HARDWAREONLY
))
101 DX_STUB_str("DDERR_INVALIDDIRECTDRAWGUID\n");
102 return DDERR_INVALIDDIRECTDRAWGUID
;
106 DX_STUB_str("here\n");
108 /* step 3 do the link the old interface are store in the new one */
109 newThis
->lpLink
= This
;
111 /* step 4 we need create new local directdraw struct for the new linked interface */
112 DxHeapMemAlloc(newThis
->lpLcl
, sizeof(DDRAWI_DIRECTDRAW_LCL
));
113 if (newThis
->lpLcl
== NULL
)
116 DX_STUB_str("DDERR_OUTOFMEMORY\n");
117 return DDERR_OUTOFMEMORY
;
120 DX_STUB_str("here\n");
126 This
->lpLcl
->lpGbl
= &ddgbl
;
128 *pIface
= (LPDIRECTDRAW
)This
;
130 /* Get right interface we whant */
131 if (Main_DirectDraw_QueryInterface((LPDIRECTDRAW7
)This
, id
, (void**)&pIface
) == DD_OK
)
133 DX_STUB_str("Got iface\n");
135 if (StartDirectDraw((LPDIRECTDRAW
)This
, pGUID
, FALSE
) == DD_OK
);
138 RtlZeroMemory(&wnd_class, sizeof(wnd_class));
139 wnd_class.style = CS_HREDRAW | CS_VREDRAW;
140 wnd_class.lpfnWndProc = DefWindowProcW;
141 wnd_class.cbClsExtra = 0;
142 wnd_class.cbWndExtra = 0;
143 wnd_class.hInstance = GetModuleHandleW(0);
145 wnd_class.hCursor = 0;
146 wnd_class.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
147 wnd_class.lpszMenuName = NULL;
148 wnd_class.lpszClassName = classname;
149 if(!RegisterClassW(&wnd_class))
151 DX_STUB_str("DDERR_GENERIC");
152 return DDERR_GENERIC;
156 DX_STUB_str("DD_OK\n");
161 DX_STUB_str("DDERR_INVALIDPARAMS\n");
162 return DDERR_INVALIDPARAMS
;
167 StartDirectDraw(LPDIRECTDRAW iface
, LPGUID lpGuid
, BOOL reenable
)
169 LPDDRAWI_DIRECTDRAW_INT This
= (LPDDRAWI_DIRECTDRAW_INT
)iface
;
170 DWORD hal_ret
= DD_FALSE
;
171 DWORD hel_ret
= DD_FALSE
;
172 DWORD devicetypes
= 0;
178 * ddgbl.dwPDevice is not longer in use in windows 2000 and higher
179 * I am using it for device type
180 * devicetypes = 1 : both hal and hel are enable
181 * devicetypes = 2 : both hal are enable
182 * devicetypes = 3 : both hel are enable
183 * devicetypes = 4 :loading a guid drv from the register
186 if (reenable
== FALSE
)
188 if ((!IsBadReadPtr(This
->lpLink
,sizeof(LPDIRECTDRAW
))) && (This
->lpLink
== NULL
))
190 RtlZeroMemory(&ddgbl
, sizeof(DDRAWI_DIRECTDRAW_GBL
));
191 This
->lpLcl
->lpGbl
->dwRefCnt
++;
192 if (ddgbl
.lpDDCBtmp
== NULL
)
195 DxHeapMemAlloc( ddgbl
.lpDDCBtmp
, sizeof(DDHAL_CALLBACKS
));
196 if (ddgbl
.lpDDCBtmp
== NULL
)
198 DX_STUB_str("Out of memmory\n");
205 DX_STUB_str("here\n");
207 if (reenable
== FALSE
)
211 DX_STUB_str("lpGuid == NULL\n");
214 /* Create HDC for default, hal and hel driver */
215 This
->lpLcl
->hWnd
= (ULONG_PTR
) GetActiveWindow();
216 This
->lpLcl
->hDC
= (ULONG_PTR
) GetDC((HWND
)This
->lpLcl
->hWnd
);
218 /* cObsolete is undoc in msdn it being use in CreateDCA */
219 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
220 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
221 dwFlags
|= DDRAWI_DISPLAYDRV
| DDRAWI_GDIDRV
;
225 else if (lpGuid
== (LPGUID
) DDCREATE_HARDWAREONLY
)
228 /* Create HDC for default, hal driver */
229 This
->lpLcl
->hWnd
=(ULONG_PTR
) GetActiveWindow();
230 This
->lpLcl
->hDC
= (ULONG_PTR
) GetDC((HWND
)This
->lpLcl
->hWnd
);
232 /* cObsolete is undoc in msdn it being use in CreateDCA */
233 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
234 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
235 dwFlags
|= DDRAWI_DISPLAYDRV
| DDRAWI_GDIDRV
;
237 else if (lpGuid
== (LPGUID
) DDCREATE_EMULATIONONLY
)
241 /* Create HDC for default, hal and hel driver */
242 This
->lpLcl
->hWnd
= (ULONG_PTR
) GetActiveWindow();
243 This
->lpLcl
->hDC
= (ULONG_PTR
) GetDC((HWND
)This
->lpLcl
->hWnd
);
245 /* cObsolete is undoc in msdn it being use in CreateDCA */
246 RtlCopyMemory(&ddgbl
.cObsolete
,&"DISPLAY",7);
247 RtlCopyMemory(&ddgbl
.cDriverName
,&"DISPLAY",7);
249 dwFlags
|= DDRAWI_DISPLAYDRV
| DDRAWI_GDIDRV
;
253 /* FIXME : need getting driver from the GUID that have been pass in from
254 * the register. we do not support that yet
257 This
->lpLcl
->hDC
= (ULONG_PTR
) NULL
;
258 This
->lpLcl
->hWnd
= (ULONG_PTR
) GetActiveWindow();
261 if ( (HDC
)This
->lpLcl
->hDC
== NULL
)
263 DX_STUB_str("DDERR_OUTOFMEMORY\n");
264 return DDERR_OUTOFMEMORY
;
268 This
->lpLcl
->lpDDCB
= ddgbl
.lpDDCBtmp
;
270 /* Startup HEL and HAL */
271 This
->lpLcl
->lpDDCB
= This
->lpLcl
->lpGbl
->lpDDCBtmp
;
272 This
->lpLcl
->dwProcessId
= GetCurrentProcessId();
277 hal_ret
= StartDirectDrawHal(iface
, reenable
);
278 This
->lpLcl
->lpDDCB
->HELDD
.dwFlags
= 0;
282 hel_ret
= StartDirectDrawHel(iface
, reenable
);
283 This
->lpLcl
->lpDDCB
->HALDD
.dwFlags
= 0;
287 hal_ret
= StartDirectDrawHal(iface
, reenable
);
288 hel_ret
= StartDirectDrawHel(iface
, reenable
);
291 DX_STUB_str("return\n");
297 DX_STUB_str("DDERR_NODIRECTDRAWSUPPORT\n");
298 return DDERR_NODIRECTDRAWSUPPORT
;
300 dwFlags
|= DDRAWI_NOHARDWARE
;
305 dwFlags
|= DDRAWI_NOEMULATION
;
310 dwFlags
|= DDRAWI_EMULATIONINITIALIZED
;
313 /* Fill some basic info for Surface */
314 This
->lpLcl
->lpGbl
->dwFlags
= dwFlags
| DDRAWI_ATTACHEDTODESKTOP
;
315 This
->lpLcl
->lpDDCB
= This
->lpLcl
->lpGbl
->lpDDCBtmp
;
316 This
->lpLcl
->hDD
= This
->lpLcl
->lpGbl
->hDD
;
317 ddgbl
.hDD
= This
->lpLcl
->lpGbl
->hDD
;
319 DX_STUB_str("DD_OK\n");
324 StartDirectDrawHel(LPDIRECTDRAW iface
, BOOL reenable
)
326 LPDDRAWI_DIRECTDRAW_INT This
= (LPDDRAWI_DIRECTDRAW_INT
)iface
;
328 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.CanCreateSurface
= HelDdCanCreateSurface
;
329 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.CreateSurface
= HelDdCreateSurface
;
330 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.CreatePalette
= HelDdCreatePalette
;
331 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.DestroyDriver
= HelDdDestroyDriver
;
332 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.FlipToGDISurface
= HelDdFlipToGDISurface
;
333 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.GetScanLine
= HelDdGetScanLine
;
334 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.SetColorKey
= HelDdSetColorKey
;
335 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.SetExclusiveMode
= HelDdSetExclusiveMode
;
336 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.SetMode
= HelDdSetMode
;
337 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.WaitForVerticalBlank
= HelDdWaitForVerticalBlank
;
339 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.dwFlags
= DDHAL_CB32_CANCREATESURFACE
|
340 DDHAL_CB32_CREATESURFACE
|
341 DDHAL_CB32_CREATEPALETTE
|
342 DDHAL_CB32_DESTROYDRIVER
|
343 DDHAL_CB32_FLIPTOGDISURFACE
|
344 DDHAL_CB32_GETSCANLINE
|
345 DDHAL_CB32_SETCOLORKEY
|
346 DDHAL_CB32_SETEXCLUSIVEMODE
|
348 DDHAL_CB32_WAITFORVERTICALBLANK
;
350 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDD
.dwSize
= sizeof(This
->lpLcl
->lpDDCB
->HELDD
);
352 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.AddAttachedSurface
= HelDdSurfAddAttachedSurface
;
353 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.Blt
= HelDdSurfBlt
;
354 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.DestroySurface
= HelDdSurfDestroySurface
;
355 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.Flip
= HelDdSurfFlip
;
356 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.GetBltStatus
= HelDdSurfGetBltStatus
;
357 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.GetFlipStatus
= HelDdSurfGetFlipStatus
;
358 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.Lock
= HelDdSurfLock
;
359 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.reserved4
= HelDdSurfreserved4
;
360 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.SetClipList
= HelDdSurfSetClipList
;
361 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.SetColorKey
= HelDdSurfSetColorKey
;
362 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.SetOverlayPosition
= HelDdSurfSetOverlayPosition
;
363 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.SetPalette
= HelDdSurfSetPalette
;
364 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.Unlock
= HelDdSurfUnlock
;
365 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.UpdateOverlay
= HelDdSurfUpdateOverlay
;
366 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.dwFlags
= DDHAL_SURFCB32_ADDATTACHEDSURFACE
|
368 DDHAL_SURFCB32_DESTROYSURFACE
|
369 DDHAL_SURFCB32_FLIP
|
370 DDHAL_SURFCB32_GETBLTSTATUS
|
371 DDHAL_SURFCB32_GETFLIPSTATUS
|
372 DDHAL_SURFCB32_LOCK
|
373 DDHAL_SURFCB32_RESERVED4
|
374 DDHAL_SURFCB32_SETCLIPLIST
|
375 DDHAL_SURFCB32_SETCOLORKEY
|
376 DDHAL_SURFCB32_SETOVERLAYPOSITION
|
377 DDHAL_SURFCB32_SETPALETTE
|
378 DDHAL_SURFCB32_UNLOCK
|
379 DDHAL_SURFCB32_UPDATEOVERLAY
;
381 This
->lpLcl
->lpGbl
->lpDDCBtmp
->HELDDSurface
.dwSize
= sizeof(This
->lpLcl
->lpDDCB
->HELDDSurface
);
384 This->lpLcl->lpDDCB->HELDDPalette.DestroyPalette = HelDdPalDestroyPalette;
385 This->lpLcl->lpDDCB->HELDDPalette.SetEntries = HelDdPalSetEntries;
386 This->lpLcl->lpDDCB->HELDDPalette.dwSize = sizeof(This->lpLcl->lpDDCB->HELDDPalette);
390 This->lpLcl->lpDDCB->HELDDExeBuf.CanCreateExecuteBuffer = HelDdExeCanCreateExecuteBuffer;
391 This->lpLcl->lpDDCB->HELDDExeBuf.CreateExecuteBuffer = HelDdExeCreateExecuteBuffer;
392 This->lpLcl->lpDDCB->HELDDExeBuf.DestroyExecuteBuffer = HelDdExeDestroyExecuteBuffer;
393 This->lpLcl->lpDDCB->HELDDExeBuf.LockExecuteBuffer = HelDdExeLockExecuteBuffer;
394 This->lpLcl->lpDDCB->HELDDExeBuf.UnlockExecuteBuffer = HelDdExeUnlockExecuteBuffer;
402 StartDirectDrawHal(LPDIRECTDRAW iface
, BOOL reenable
)
404 LPDWORD mpFourCC
= NULL
;
406 BOOL newmode
= FALSE
;
407 LPDDSURFACEDESC mpTextures
;
408 D3DHAL_CALLBACKS mD3dCallbacks
;
409 D3DHAL_GLOBALDRIVERDATA mD3dDriverData
;
410 DDHAL_DDEXEBUFCALLBACKS mD3dBufferCallbacks
;
411 LPDDRAWI_DIRECTDRAW_INT This
= (LPDDRAWI_DIRECTDRAW_INT
)iface
;
415 RtlZeroMemory(&mHALInfo
, sizeof(DDHALINFO
));
416 RtlZeroMemory(&mD3dCallbacks
, sizeof(D3DHAL_CALLBACKS
));
417 RtlZeroMemory(&mD3dDriverData
, sizeof(D3DHAL_GLOBALDRIVERDATA
));
418 RtlZeroMemory(&mD3dBufferCallbacks
, sizeof(DDHAL_DDEXEBUFCALLBACKS
));
420 if (reenable
== FALSE
)
422 if (ddgbl
.lpDDCBtmp
== NULL
)
424 DxHeapMemAlloc(ddgbl
.lpDDCBtmp
, sizeof(DDHAL_CALLBACKS
));
425 if ( ddgbl
.lpDDCBtmp
== NULL
)
433 RtlZeroMemory(ddgbl
.lpDDCBtmp
,sizeof(DDHAL_CALLBACKS
));
437 * Startup DX HAL step one of three
439 if (!DdCreateDirectDrawObject(This
->lpLcl
->lpGbl
, (HDC
)This
->lpLcl
->hDC
))
441 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
445 /* Some card disable the dx after it have been created so
446 * we are force reanble it
448 if (!DdReenableDirectDrawObject(This
->lpLcl
->lpGbl
, &newmode
))
450 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
454 if (!DdQueryDirectDrawObject(This
->lpLcl
->lpGbl
,
456 &ddgbl
.lpDDCBtmp
->HALDD
,
457 &ddgbl
.lpDDCBtmp
->HALDDSurface
,
458 &ddgbl
.lpDDCBtmp
->HALDDPalette
,
461 &mD3dBufferCallbacks
,
466 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpModeInfo
);
467 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
468 // FIXME Close DX fristcall and second call
473 DX_STUB_str("Trying alloc FourCCC \n");
476 if (This
->lpLcl
->lpGbl
->lpdwFourCC
!= NULL
)
478 DxHeapMemFree(This
->lpLcl
->lpGbl
->lpdwFourCC
);
481 if (mHALInfo
.ddCaps
.dwNumFourCCCodes
> 0 )
483 DxHeapMemAlloc(mpFourCC
, sizeof(DWORD
) * 21);
485 mpFourCC
= (DWORD
*) DxHeapMemAlloc(sizeof(DWORD
) * (mHALInfo
.ddCaps
.dwNumFourCCCodes
+ 2));
487 if (mpFourCC
== NULL
)
489 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
490 // FIXME Close DX fristcall and second call
495 DX_STUB_str("End Trying alloc FourCCC\n");
501 /* Alloc mpTextures */
503 DX_STUB_str("1 Here\n");
505 if (This
->lpLcl
->lpGbl
->texture
!= NULL
)
507 DxHeapMemFree(This
->lpLcl
->lpGbl
->texture
;
511 if (mD3dDriverData
.dwNumTextureFormats
> 0)
513 mpTextures
= (DDSURFACEDESC
*) DxHeapMemAlloc(sizeof(DDSURFACEDESC
) * mD3dDriverData
.dwNumTextureFormats
);
514 if (mpTextures
== NULL
)
516 DxHeapMemFree(mpFourCC
);
517 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
518 // FIXME Close DX fristcall and second call
522 DX_STUB_str("2 Here\n");
529 /* Get all basic data from the driver */
530 if (!DdQueryDirectDrawObject(
533 &ddgbl
.lpDDCBtmp
->HALDD
,
534 &ddgbl
.lpDDCBtmp
->HALDDSurface
,
535 &ddgbl
.lpDDCBtmp
->HALDDPalette
,
538 &ddgbl
.lpDDCBtmp
->HALDDExeBuf
,
539 (DDSURFACEDESC
*)mpTextures
,
543 DxHeapMemFree(mpFourCC
);
544 DxHeapMemFree(mpTextures
);
545 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
546 // FIXME Close DX fristcall and second call
550 memcpy(&ddgbl
.vmiData
, &mHALInfo
.vmiData
,sizeof(VIDMEMINFO
));
553 memcpy(&ddgbl
.ddCaps
, &mHALInfo
.ddCaps
,sizeof(DDCORECAPS
));
555 This
->lpLcl
->lpGbl
->dwNumFourCC
= mHALInfo
.ddCaps
.dwNumFourCCCodes
;
556 This
->lpLcl
->lpGbl
->lpdwFourCC
= mpFourCC
;
557 This
->lpLcl
->lpGbl
->dwMonitorFrequency
= mHALInfo
.dwMonitorFrequency
;
558 This
->lpLcl
->lpGbl
->dwModeIndex
= mHALInfo
.dwModeIndex
;
559 This
->lpLcl
->lpGbl
->dwNumModes
= mHALInfo
.dwNumModes
;
560 This
->lpLcl
->lpGbl
->lpModeInfo
= mHALInfo
.lpModeInfo
;
562 DX_STUB_str("Here\n");
564 /* FIXME convert mpTextures to DDHALMODEINFO */
565 // DxHeapMemFree( mpTextures);
567 /* FIXME D3D setup mD3dCallbacks and mD3dDriverData */
568 DDHAL_GETDRIVERINFODATA DdGetDriverInfo
= { 0 };
569 DdGetDriverInfo
.dwSize
= sizeof (DDHAL_GETDRIVERINFODATA
);
570 DdGetDriverInfo
.guidInfo
= GUID_MiscellaneousCallbacks
;
572 DdGetDriverInfo
.lpvData
= (PVOID
)&ddgbl
.lpDDCBtmp
->HALDDMiscellaneous
;
574 DdGetDriverInfo
.dwExpectedSize
= sizeof (DDHAL_DDMISCELLANEOUSCALLBACKS
);
576 if(mHALInfo
.GetDriverInfo (&DdGetDriverInfo
) == DDHAL_DRIVER_NOTHANDLED
|| DdGetDriverInfo
.ddRVal
!= DD_OK
)
578 DxHeapMemFree(mpFourCC
);
579 DxHeapMemFree(mpTextures
);
580 DxHeapMemFree(ddgbl
.lpDDCBtmp
);
581 // FIXME Close DX fristcall and second call