diff --git a/reactos/lib/ddraw/hal/ddraw.c b/reactos/lib/ddraw/hal/ddraw.c index 3fb3a6f4566..63e117dcd95 100644 --- a/reactos/lib/ddraw/hal/ddraw.c +++ b/reactos/lib/ddraw/hal/ddraw.c @@ -354,3 +354,33 @@ VOID Hal_DirectDraw_Release (LPDIRECTDRAW7 iface) if(This->DirectDrawGlobal.lpD3DGlobalDriverData) HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DGlobalDriverData); } + + +HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, + LPDWORD total, LPDWORD free) +{ + IDirectDrawImpl* This = (IDirectDrawImpl*)iface; + + DDHAL_GETAVAILDRIVERMEMORYDATA mem; + + if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY)) + { + return DDERR_NODRIVERSUPPORT; + } + + mem.lpDD = &This->DirectDrawGlobal; + if (This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.GetAvailDriverMemory(&mem) != DDHAL_DRIVER_HANDLED) + { + return DDERR_NODRIVERSUPPORT; + } + + + ddscaps->dwCaps = mem.DDSCaps.dwCaps; + ddscaps->dwCaps2 = mem.ddsCapsEx.dwCaps2; + ddscaps->dwCaps3 = mem.ddsCapsEx.dwCaps3; + ddscaps->dwCaps4 = mem.ddsCapsEx.dwCaps4; + *total = mem.dwTotal; + *free = mem.dwFree; + + return mem.ddRVal; +} diff --git a/reactos/lib/ddraw/main/ddraw.c b/reactos/lib/ddraw/main/ddraw.c index db4a4a15d96..85ba6979856 100644 --- a/reactos/lib/ddraw/main/ddraw.c +++ b/reactos/lib/ddraw/main/ddraw.c @@ -352,7 +352,8 @@ HRESULT WINAPI Main_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface, LPDDSURFACEDE DDCOLORKEY ddckCKSrcOverlay; DDCOLORKEY ddckCKSrcBlt; */ - + + RtlCopyMemory(&pDDSD->ddpfPixelFormat,&This->DirectDrawGlobal.vmiData.ddpfDisplay,sizeof(DDPIXELFORMAT)); RtlCopyMemory(&pDDSD->ddsCaps,&This->DirectDrawGlobal.ddCaps,sizeof(DDCORECAPS)); @@ -412,9 +413,18 @@ HRESULT WINAPI Main_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD d HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, LPDWORD total, LPDWORD free) -{ - - DX_STUB; +{ + DWORD ret; + + if((ret = Hal_DirectDraw_GetAvailableVidMem (iface,ddscaps,total,free)) == DD_OK) + return ret; + + if((ret = Hel_DirectDraw_GetAvailableVidMem (iface,ddscaps,total,free)) == DD_OK) + return ret; + + + return DDERR_NOTINITIALIZED; + } HRESULT WINAPI Main_DirectDraw_GetSurfaceFromDC(LPDIRECTDRAW7 iface, HDC hdc, diff --git a/reactos/lib/ddraw/rosdraw.h b/reactos/lib/ddraw/rosdraw.h index 4e4cb5aceec..1294dc9c543 100644 --- a/reactos/lib/ddraw/rosdraw.h +++ b/reactos/lib/ddraw/rosdraw.h @@ -88,10 +88,18 @@ HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 iface); HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface); VOID Hal_DirectDraw_Release (LPDIRECTDRAW7 iface); +HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, + LPDWORD total, LPDWORD free); + + HRESULT Hel_DirectDraw_Initialize (LPDIRECTDRAW7 iface); HRESULT Hel_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface); VOID Hel_DirectDraw_Release (LPDIRECTDRAW7 iface); +HRESULT Hel_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, + LPDWORD total, LPDWORD free); + + /*********** Macros ***********/ #define DX_STUB \ diff --git a/reactos/lib/ddraw/soft/ddraw.c b/reactos/lib/ddraw/soft/ddraw.c index fa83d26099d..a9a758f8429 100644 --- a/reactos/lib/ddraw/soft/ddraw.c +++ b/reactos/lib/ddraw/soft/ddraw.c @@ -24,3 +24,10 @@ HRESULT Hel_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface) VOID Hel_DirectDraw_Release (LPDIRECTDRAW7 iface) { } + + +HRESULT Hel_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, + LPDWORD total, LPDWORD free) +{ + DX_STUB; +}