From 8e68e084ee4ce703129b59570a8e7a2d218b16dd Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Sun, 30 Oct 2005 07:41:33 +0000 Subject: [PATCH] implement Hal WaitForVerticalBlank svn path=/trunk/; revision=18868 --- reactos/lib/ddraw/hal/ddraw.c | 32 ++++++++++++++++++++++++++++++-- reactos/lib/ddraw/main/ddraw.c | 14 +++++++++++--- reactos/lib/ddraw/rosdraw.h | 12 ++++++++++-- reactos/lib/ddraw/soft/ddraw.c | 6 ++++++ 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/reactos/lib/ddraw/hal/ddraw.c b/reactos/lib/ddraw/hal/ddraw.c index 63e117dcd95..87f33a2dc04 100644 --- a/reactos/lib/ddraw/hal/ddraw.c +++ b/reactos/lib/ddraw/hal/ddraw.c @@ -369,18 +369,46 @@ HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscap } mem.lpDD = &This->DirectDrawGlobal; + mem.ddRVal = DDERR_NOTPALETTIZED; + 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; } + +HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,HANDLE h) +{ + + IDirectDrawImpl* This = (IDirectDrawImpl*)iface; + + DDHAL_WAITFORVERTICALBLANKDATA WaitVectorData; + + if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK)) + { + return DDERR_NODRIVERSUPPORT; + } + + WaitVectorData.lpDD = &This->DirectDrawGlobal; + WaitVectorData.dwFlags = dwFlags; + WaitVectorData.hEvent = (DWORD)h; + WaitVectorData.ddRVal = DDERR_NOTPALETTIZED; + + if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.WaitForVerticalBlank(&WaitVectorData) != DDHAL_DRIVER_HANDLED) + { + return DDERR_NODRIVERSUPPORT; + } + + return WaitVectorData.ddRVal; + + return DD_OK; +} diff --git a/reactos/lib/ddraw/main/ddraw.c b/reactos/lib/ddraw/main/ddraw.c index 85ba6979856..990e639f8ca 100644 --- a/reactos/lib/ddraw/main/ddraw.c +++ b/reactos/lib/ddraw/main/ddraw.c @@ -407,8 +407,16 @@ HRESULT WINAPI Main_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface) HRESULT WINAPI Main_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags, HANDLE h) { - - DX_STUB; + + DWORD ret; + + if((ret = Hal_DirectDraw_WaitForVerticalBlank( iface, dwFlags, h)) == DD_OK) + return ret; + + if((ret = Hel_DirectDraw_WaitForVerticalBlank( iface, dwFlags, h)) == DD_OK) + return ret; + + return DDERR_NOTINITIALIZED; } HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, @@ -416,7 +424,7 @@ HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS { DWORD ret; - if((ret = Hal_DirectDraw_GetAvailableVidMem (iface,ddscaps,total,free)) == DD_OK) + if((ret = Hal_DirectDraw_GetAvailableVidMem (iface,ddscaps,total,free)) == DD_OK) return ret; if((ret = Hel_DirectDraw_GetAvailableVidMem (iface,ddscaps,total,free)) == DD_OK) diff --git a/reactos/lib/ddraw/rosdraw.h b/reactos/lib/ddraw/rosdraw.h index 1294dc9c543..ba9c30c44a4 100644 --- a/reactos/lib/ddraw/rosdraw.h +++ b/reactos/lib/ddraw/rosdraw.h @@ -89,7 +89,11 @@ HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface); VOID Hal_DirectDraw_Release (LPDIRECTDRAW7 iface); HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, - LPDWORD total, LPDWORD free); + LPDWORD total, LPDWORD free); + +HRESULT Hal_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags, + HANDLE h); + HRESULT Hel_DirectDraw_Initialize (LPDIRECTDRAW7 iface); @@ -97,7 +101,11 @@ HRESULT Hel_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface); VOID Hel_DirectDraw_Release (LPDIRECTDRAW7 iface); HRESULT Hel_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, - LPDWORD total, LPDWORD free); + LPDWORD total, LPDWORD free); + +HRESULT Hel_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags, + HANDLE h); + /*********** Macros ***********/ diff --git a/reactos/lib/ddraw/soft/ddraw.c b/reactos/lib/ddraw/soft/ddraw.c index a9a758f8429..ccaf8004d52 100644 --- a/reactos/lib/ddraw/soft/ddraw.c +++ b/reactos/lib/ddraw/soft/ddraw.c @@ -31,3 +31,9 @@ HRESULT Hel_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscap { DX_STUB; } + + +HRESULT Hel_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,HANDLE h) +{ + DX_STUB; +}