Author: mbosma
Date: Mon May 21 02:48:19 2007
New Revision: 26845
URL:
http://svn.reactos.org/svn/reactos?rev=26845&view=rev
Log:
Implement IDirectDraw7::GetAvailableVidMem.
Modified:
trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c
trunk/reactos/dll/directx/ddraw/startup.c
Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/dd…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c Mon May 21 02:48:19 2007
@@ -39,7 +39,6 @@
return E_NOINTERFACE;
}
-
Main_DirectDraw_AddRef(iface);
DX_STUB_str("DD_OK");
return DD_OK;
@@ -104,17 +103,11 @@
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 @@
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)
{
Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/dd…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c Mon May 21 02:48:19 2007
@@ -155,17 +155,6 @@
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)
{
Modified: trunk/reactos/dll/directx/ddraw/startup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/startup.…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/startup.c (original)
+++ trunk/reactos/dll/directx/ddraw/startup.c Mon May 21 02:48:19 2007
@@ -18,7 +18,6 @@
WCHAR classname[128];
WNDCLASSW wnd_class;
-
HRESULT WINAPI
@@ -140,7 +139,6 @@
DX_WINDBG_trace();
-
/*
* ddgbl.dwPDevice is not longer in use in windows 2000 and higher
* I am using it for device type
@@ -149,8 +147,6 @@
* devicetypes = 3 : both hel are enable
* devicetypes = 4 :loading a guid drv from the register
*/
-
-
if (reenable == FALSE)
{
@@ -364,7 +360,6 @@
HRESULT WINAPI
StartDirectDrawHal(LPDIRECTDRAW iface, BOOL reenable)
{
-
LPDWORD mpFourCC;
DDHALINFO mHALInfo;
BOOL newmode = FALSE;
@@ -381,7 +376,6 @@
RtlZeroMemory(&mD3dDriverData, sizeof(D3DHAL_GLOBALDRIVERDATA));
RtlZeroMemory(&mD3dBufferCallbacks, sizeof(DDHAL_DDEXEBUFCALLBACKS));
-
if (reenable == FALSE)
{
if (ddgbl.lpDDCBtmp == NULL)
@@ -406,8 +400,6 @@
DxHeapMemFree(ddgbl.lpDDCBtmp);
return DD_FALSE;
}
-
-
/* Some card disable the dx after it have been created so
* we are force reanble it
@@ -456,17 +448,15 @@
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 @@
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 @@
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;
}