Implement IDirectDraw7::GetAvailableVidMem.

svn path=/trunk/; revision=26845
This commit is contained in:
Maarten Bosma 2007-05-20 22:48:19 +00:00
parent cc557fcbd2
commit d49bca10c2
3 changed files with 57 additions and 38 deletions

View file

@ -39,7 +39,6 @@ Main_DirectDraw_QueryInterface (LPDIRECTDRAW7 iface,
return E_NOINTERFACE;
}
Main_DirectDraw_AddRef(iface);
DX_STUB_str("DD_OK");
return DD_OK;
@ -104,17 +103,11 @@ Main_DirectDraw_Release (LPDIRECTDRAW7 iface)
return This->dwIntRefCnt;
}
/*
* IMPLEMENT
* Status ok
*/
HRESULT
WINAPI
Main_DirectDraw_Compact(LPDIRECTDRAW7 iface)
{
/* MSDN say not implement but my question what does it return then */
DX_WINDBG_trace();
return DD_OK;
return DD_OK; // not implemented in ms ddraw
}
HRESULT WINAPI
@ -176,8 +169,41 @@ Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeig
return DD_OK;
}
/*
*/
HRESULT WINAPI
Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
LPDWORD dwTotal, LPDWORD dwFree)
{
LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)iface;
DX_WINDBG_trace();
// There is no HEL implentation of this api
if (!(This->lpLcl->lpDDCB->cbDDMiscellaneousCallbacks.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY))
{
return DDERR_NODIRECTDRAWHW;
}
if ((!dwTotal && !dwFree) || !ddscaps)
{
return DDERR_INVALIDPARAMS;
}
DDHAL_GETAVAILDRIVERMEMORYDATA memdata;
memdata.lpDD = This->lpLcl->lpGbl;
memdata.ddRVal = DDERR_INVALIDPARAMS;
memcpy(&memdata.DDSCaps, ddscaps, sizeof(DDSCAPS2));
if (This->lpLcl->lpDDCB->cbDDMiscellaneousCallbacks.GetAvailDriverMemory(&memdata) == DDHAL_DRIVER_NOTHANDLED)
return DDERR_NODIRECTDRAWHW;
if (dwTotal)
*dwTotal = memdata.dwTotal;
if (dwFree)
*dwFree = memdata.dwFree;
return memdata.ddRVal;
}
HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD,
LPDIRECTDRAWSURFACE7 *ppSurf, IUnknown *pUnkOuter)
{

View file

@ -155,17 +155,6 @@ Main_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,
DX_STUB;
}
/*
* Status: Implentation removed due to rewrite
*/
HRESULT WINAPI
Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
LPDWORD total, LPDWORD free)
{
DX_WINDBG_trace();
DX_STUB;
}
HRESULT WINAPI Main_DirectDraw_GetSurfaceFromDC(LPDIRECTDRAW7 iface, HDC hdc,
LPDIRECTDRAWSURFACE7 *lpDDS)
{

View file

@ -20,7 +20,6 @@ WCHAR classname[128];
WNDCLASSW wnd_class;
HRESULT WINAPI
Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface,
REFIID id, BOOL ex)
@ -140,7 +139,6 @@ StartDirectDraw(LPDIRECTDRAW iface, LPGUID lpGuid, BOOL reenable)
DX_WINDBG_trace();
/*
* ddgbl.dwPDevice is not longer in use in windows 2000 and higher
* I am using it for device type
@ -150,8 +148,6 @@ StartDirectDraw(LPDIRECTDRAW iface, LPGUID lpGuid, BOOL reenable)
* devicetypes = 4 :loading a guid drv from the register
*/
if (reenable == FALSE)
{
if (This->lpLink == NULL)
@ -364,7 +360,6 @@ StartDirectDrawHel(LPDIRECTDRAW iface, BOOL reenable)
HRESULT WINAPI
StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
{
LPDWORD mpFourCC;
DDHALINFO mHALInfo;
BOOL newmode = FALSE;
@ -381,7 +376,6 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
RtlZeroMemory(&mD3dDriverData, sizeof(D3DHAL_GLOBALDRIVERDATA));
RtlZeroMemory(&mD3dBufferCallbacks, sizeof(DDHAL_DDEXEBUFCALLBACKS));
if (reenable == FALSE)
{
if (ddgbl.lpDDCBtmp == NULL)
@ -407,8 +401,6 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
return DD_FALSE;
}
/* Some card disable the dx after it have been created so
* we are force reanble it
*/
@ -456,17 +448,15 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) * mD3dDriverData.dwNumTextureFormats);
if (mpTextures == NULL)
{
DxHeapMemFree( mpFourCC);
DxHeapMemFree(mpFourCC);
DxHeapMemFree(ddgbl.lpDDCBtmp);
// FIXME Close DX fristcall and second call
return DD_FALSE;
}
return DD_FALSE;
}
/* Get all basic data from the driver */
if (!DdQueryDirectDrawObject(
This->lpLcl->lpGbl,
if (!DdQueryDirectDrawObject(This->lpLcl->lpGbl,
&mHALInfo,
&ddgbl.lpDDCBtmp->HALDD,
&ddgbl.lpDDCBtmp->HALDDSurface,
@ -478,15 +468,15 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
mpFourCC,
NULL))
{
DxHeapMemFree( mpFourCC);
DxHeapMemFree( mpTextures);
DxHeapMemFree(mpFourCC);
DxHeapMemFree(mpTextures);
DxHeapMemFree(ddgbl.lpDDCBtmp);
// FIXME Close DX fristcall and second call
return DD_FALSE;
}
memcpy(&ddgbl.vmiData, &mHALInfo.vmiData,sizeof(VIDMEMINFO));
memcpy(&ddgbl.ddCaps, &mHALInfo.ddCaps,sizeof(DDCORECAPS));
memcpy(&ddgbl.ddCaps, &mHALInfo.ddCaps,sizeof(DDCORECAPS));
This->lpLcl->lpGbl->dwNumFourCC = mHALInfo.ddCaps.dwNumFourCCCodes;
This->lpLcl->lpGbl->lpdwFourCC = mpFourCC;
@ -499,8 +489,22 @@ StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
This->lpLcl->lpGbl->lp16DD = This->lpLcl->lpGbl;
/* FIXME convert mpTextures to DDHALMODEINFO */
DxHeapMemFree( mpTextures);
DxHeapMemFree(mpTextures);
/* FIXME D3D setup mD3dCallbacks and mD3dDriverData */
DDHAL_GETDRIVERINFODATA DdGetDriverInfo = { 0 };
DdGetDriverInfo.dwSize = sizeof (DDHAL_GETDRIVERINFODATA);
DdGetDriverInfo.guidInfo = GUID_MiscellaneousCallbacks;
DdGetDriverInfo.lpvData = (PVOID)&ddgbl.lpDDCBtmp->cbDDMiscellaneousCallbacks;
DdGetDriverInfo.dwExpectedSize = sizeof (DDHAL_DDMISCELLANEOUSCALLBACKS);
if(mHALInfo.GetDriverInfo (&DdGetDriverInfo) == DDHAL_DRIVER_NOTHANDLED || DdGetDriverInfo.dwExpectedSize)
{
DxHeapMemFree(mpFourCC);
DxHeapMemFree(mpTextures);
DxHeapMemFree(ddgbl.lpDDCBtmp);
// FIXME Close DX fristcall and second call
return DD_FALSE;
}
return DD_OK;
}