From 234eeebea47e95ee7250b2e4e59d106804d1104d Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Sun, 7 May 2006 09:12:37 +0000 Subject: [PATCH] merges HEL_SetCooperativeLevel and HAL_SetCooperativeLevel to MAIN_SetCooperativeLevel the new desgin allown us to use HEL as callbacks, we need change all HEL calls to the new desgin now svn path=/trunk/; revision=21821 --- reactos/dll/directx/ddraw/hal/ddraw_hal.c | 27 ------------------- reactos/dll/directx/ddraw/main/ddraw_main.c | 25 +++++++++++++---- reactos/dll/directx/ddraw/rosdraw.h | 12 ++++----- reactos/dll/directx/ddraw/soft/ddraw_hel.c | 19 ------------- .../ddraw/soft/surface_callbacks_hel.c | 4 ++- 5 files changed, 28 insertions(+), 59 deletions(-) diff --git a/reactos/dll/directx/ddraw/hal/ddraw_hal.c b/reactos/dll/directx/ddraw/hal/ddraw_hal.c index 00ef4d3b3c4..53dab6bb961 100644 --- a/reactos/dll/directx/ddraw/hal/ddraw_hal.c +++ b/reactos/dll/directx/ddraw/hal/ddraw_hal.c @@ -198,33 +198,6 @@ Hal_DirectDraw_Release (LPDIRECTDRAW7 iface) } - -HRESULT -Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface) -{ - IDirectDrawImpl* This = (IDirectDrawImpl*)iface; - - DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode; - - if (!(This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE)) - { - return DDERR_NODRIVERSUPPORT; - } - - SetExclusiveMode.lpDD = &This->mDDrawGlobal; - SetExclusiveMode.ddRVal = DDERR_NOTPALETTIZED; - SetExclusiveMode.dwEnterExcl = This->cooperative_level; - - if (This->mDDrawGlobal.lpDDCBtmp->HALDD.SetExclusiveMode(&SetExclusiveMode) != DDHAL_DRIVER_HANDLED) - { - return DDERR_NODRIVERSUPPORT; - } - - return SetExclusiveMode.ddRVal; -} - - - HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, LPDWORD total, LPDWORD free) diff --git a/reactos/dll/directx/ddraw/main/ddraw_main.c b/reactos/dll/directx/ddraw/main/ddraw_main.c index e596e9df02a..ca2071afecc 100644 --- a/reactos/dll/directx/ddraw/main/ddraw_main.c +++ b/reactos/dll/directx/ddraw/main/ddraw_main.c @@ -290,7 +290,8 @@ HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hw DX_WINDBG_trace(); IDirectDrawImpl* This = (IDirectDrawImpl*)iface; - + DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode; + // check the parameters if ((This->cooperative_level == cooplevel) && ((HWND)This->mDDrawGlobal.lpExclusiveOwner->hWnd == hwnd)) return DD_OK; @@ -314,13 +315,27 @@ HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hw This->cooperative_level = cooplevel; - if (This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE) + if ((This->mDDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE)) + { + DX_STUB_str("HAL \n"); + SetExclusiveMode.SetExclusiveMode = This->mDDrawGlobal.lpDDCBtmp->HALDD.SetExclusiveMode; + } + else { - return Hal_DirectDraw_SetCooperativeLevel (iface); + DX_STUB_str("HEL \n"); + SetExclusiveMode.SetExclusiveMode = This->mDDrawGlobal.lpDDCBtmp->HELDD.SetExclusiveMode; + } + + SetExclusiveMode.lpDD = &This->mDDrawGlobal; + SetExclusiveMode.ddRVal = DDERR_NOTPALETTIZED; + SetExclusiveMode.dwEnterExcl = This->cooperative_level; + + if (SetExclusiveMode.SetExclusiveMode(&SetExclusiveMode) != DDHAL_DRIVER_HANDLED) + { + return DDERR_NODRIVERSUPPORT; } - return Hel_DirectDraw_SetCooperativeLevel(iface); - + return SetExclusiveMode.ddRVal; } HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight, diff --git a/reactos/dll/directx/ddraw/rosdraw.h b/reactos/dll/directx/ddraw/rosdraw.h index 7423793e8db..615d43f850f 100644 --- a/reactos/dll/directx/ddraw/rosdraw.h +++ b/reactos/dll/directx/ddraw/rosdraw.h @@ -303,15 +303,13 @@ DWORD CALLBACK HelDdFlipToGDISurface(LPDDHAL_FLIPTOGDISURFACEDATA lpFlipToGDISu return DD_OK; -#define DX_STUB_str(x) \ - static BOOL firstcall = TRUE; \ - if (firstcall) \ - { \ - char buffer[1024]; \ +#define DX_STUB_str(x) \ + { \ + char buffer[1024]; \ sprintf ( buffer, "Function %s %s (%s:%d)\n", __FUNCTION__,x,__FILE__,__LINE__ ); \ OutputDebugStringA(buffer); \ - firstcall = FALSE; \ - } + } + //#define DX_WINDBG_trace() diff --git a/reactos/dll/directx/ddraw/soft/ddraw_hel.c b/reactos/dll/directx/ddraw/soft/ddraw_hel.c index 61f4896c655..0c20fbdfae1 100644 --- a/reactos/dll/directx/ddraw/soft/ddraw_hel.c +++ b/reactos/dll/directx/ddraw/soft/ddraw_hel.c @@ -11,26 +11,7 @@ #include "rosdraw.h" -/* -HRESULT Hel_DirectDraw_Initialize (LPDIRECTDRAW7 iface) -{ - IDirectDrawImpl* This = (IDirectDrawImpl*)iface; - - This->HELMemoryAvilable = HEL_GRAPHIC_MEMORY_MAX; - - This->mCallbacks.HELDD.dwFlags = DDHAL_CB32_CANCREATESURFACE; - This->mCallbacks.HELDD.CanCreateSurface = HelDdCanCreateSurface; - - This->mCallbacks.HELDD.dwFlags = DDHAL_CB32_CREATESURFACE; - This->mCallbacks.HELDD.CreateSurface = HelDdCreateSurface; - return DD_OK; -} */ - -HRESULT Hel_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface) -{ - return DD_OK; -} VOID Hel_DirectDraw_Release (LPDIRECTDRAW7 iface) { diff --git a/reactos/dll/directx/ddraw/soft/surface_callbacks_hel.c b/reactos/dll/directx/ddraw/soft/surface_callbacks_hel.c index d942e87637d..ac87f3fcae0 100644 --- a/reactos/dll/directx/ddraw/soft/surface_callbacks_hel.c +++ b/reactos/dll/directx/ddraw/soft/surface_callbacks_hel.c @@ -64,7 +64,9 @@ DWORD CALLBACK HelDdSetExclusiveMode(LPDDHAL_SETEXCLUSIVEMODEDATA lpSetExclusiv { DX_WINDBG_trace(); DX_STUB_str("Not implement yet, return DD_OK for not bsod\n"); - return DD_OK; + lpSetExclusiveMode->ddRVal = DD_OK; + + return DDHAL_DRIVER_HANDLED; } DWORD CALLBACK HelDdFlipToGDISurface(LPDDHAL_FLIPTOGDISURFACEDATA lpFlipToGDISurface) -- 2.17.1