From 225642a5f648ba5aaff76ea44071a44fc053d466 Mon Sep 17 00:00:00 2001 From: Maarten Bosma Date: Tue, 9 Aug 2005 13:57:03 +0000 Subject: [PATCH] Add second call to DdQueryDirectDrawObject. svn path=/trunk/; revision=17238 --- reactos/lib/ddraw/hal/ddraw.c | 33 ++++++++++++++++++++++++++------- reactos/lib/ddraw/rosdraw.h | 8 ++++++-- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/reactos/lib/ddraw/hal/ddraw.c b/reactos/lib/ddraw/hal/ddraw.c index 1673f1ee41d..b35283a2d52 100644 --- a/reactos/lib/ddraw/hal/ddraw.c +++ b/reactos/lib/ddraw/hal/ddraw.c @@ -19,11 +19,11 @@ HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 iface) return DDERR_INVALIDPARAMS; This->HalInfo.dwSize = sizeof(DDHALINFO); + This->D3dDriverData.dwSize = sizeof(D3DHAL_GLOBALDRIVERDATA); This->DriverCallbacks.DdMain.dwSize = sizeof(DDHAL_DDCALLBACKS); This->DriverCallbacks.DdSurface.dwSize = sizeof(DDHAL_DDSURFACECALLBACKS); This->DriverCallbacks.DdPalette.dwSize = sizeof(DDHAL_DDPALETTECALLBACKS); This->DriverCallbacks.D3dMain.dwSize = sizeof(D3DHAL_CALLBACKS); - This->DriverCallbacks.D3dDriverData.dwSize = sizeof(D3DHAL_GLOBALDRIVERDATA); This->DriverCallbacks.D3dBufferCallbacks.dwSize = sizeof(DDHAL_DDEXEBUFCALLBACKS); if(!DdQueryDirectDrawObject ( @@ -33,14 +33,30 @@ HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 iface) &This->DriverCallbacks.DdSurface, &This->DriverCallbacks.DdPalette, &This->DriverCallbacks.D3dMain, - &This->DriverCallbacks.D3dDriverData, + &This->D3dDriverData, &This->DriverCallbacks.D3dBufferCallbacks, NULL, NULL, NULL )) return DDERR_INVALIDPARAMS; - // ToDo: Second DdQueryDirectDrawObject without the three NULLs + This->pD3dTextureFormats = HeapAlloc(GetProcessHeap(), 0, sizeof(DDSURFACEDESC) * This->D3dDriverData.dwNumTextureFormats); + This->pdwFourCC = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) * This->HalInfo.ddCaps.dwNumFourCCCodes); + This->pvmList = HeapAlloc(GetProcessHeap(), 0, sizeof(VIDMEM) * This->HalInfo.vmiData.dwNumHeaps); + + if(!DdQueryDirectDrawObject ( + &This->DirectDrawGlobal, + &This->HalInfo, + &This->DriverCallbacks.DdMain, + &This->DriverCallbacks.DdSurface, + &This->DriverCallbacks.DdPalette, + &This->DriverCallbacks.D3dMain, + &This->D3dDriverData, + &This->DriverCallbacks.D3dBufferCallbacks, + This->pD3dTextureFormats, + This->pdwFourCC, + This->pvmList )) + return DDERR_INVALIDPARAMS; return DD_OK; } @@ -55,8 +71,11 @@ VOID Hal_DirectDraw_Release (LPDIRECTDRAW7 iface) IDirectDrawImpl* This = (IDirectDrawImpl*)iface; DdDeleteDirectDrawObject (&This->DirectDrawGlobal); + + if(This->pD3dTextureFormats) + HeapFree(GetProcessHeap(), 0, This->pD3dTextureFormats); + if(This->pdwFourCC) + HeapFree(GetProcessHeap(), 0, This->pdwFourCC); + if(This->pvmList) + HeapFree(GetProcessHeap(), 0, This->pvmList); } - - - - diff --git a/reactos/lib/ddraw/rosdraw.h b/reactos/lib/ddraw/rosdraw.h index 8942a6026f0..dac73c05e11 100644 --- a/reactos/lib/ddraw/rosdraw.h +++ b/reactos/lib/ddraw/rosdraw.h @@ -22,7 +22,6 @@ typedef struct DDHAL_DDSURFACECALLBACKS DdSurface; DDHAL_DDPALETTECALLBACKS DdPalette; D3DHAL_CALLBACKS D3dMain; - D3DHAL_GLOBALDRIVERDATA D3dDriverData; DDHAL_DDEXEBUFCALLBACKS D3dBufferCallbacks; } DRIVERCALLBACKS; @@ -33,7 +32,12 @@ typedef struct DRIVERCALLBACKS DriverCallbacks; DWORD ref; - DDHALINFO HalInfo; + DDHALINFO HalInfo; + D3DHAL_GLOBALDRIVERDATA D3dDriverData; + + LPDDSURFACEDESC pD3dTextureFormats; + LPDWORD pdwFourCC; + LPVIDMEM pvmList; HWND window; DWORD cooperative_level; -- 2.17.1