merges HEL_SetCooperativeLevel and HAL_SetCooperativeLevel to MAIN_SetCooperativeLevel
authorMagnus Olsen <magnus@greatlord.com>
Sun, 7 May 2006 09:12:37 +0000 (09:12 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Sun, 7 May 2006 09:12:37 +0000 (09:12 +0000)
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
reactos/dll/directx/ddraw/main/ddraw_main.c
reactos/dll/directx/ddraw/rosdraw.h
reactos/dll/directx/ddraw/soft/ddraw_hel.c
reactos/dll/directx/ddraw/soft/surface_callbacks_hel.c

index 00ef4d3..53dab6b 100644 (file)
@@ -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)                                               
index e596e9d..ca2071a 100644 (file)
@@ -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, 
index 7423793..615d43f 100644 (file)
@@ -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()  
 
index 61f4896..0c20fbd 100644 (file)
 #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) 
 {
index d942e87..ac87f3f 100644 (file)
@@ -64,7 +64,9 @@ DWORD CALLBACK  HelDdSetExclusiveMode(LPDDHAL_SETEXCLUSIVEMODEDATA lpSetExclusiv
 {\r
         DX_WINDBG_trace();\r
         DX_STUB_str("Not implement yet, return DD_OK for not bsod\n");\r
-        return DD_OK;\r
+        lpSetExclusiveMode->ddRVal = DD_OK;\r
+        \r
+        return DDHAL_DRIVER_HANDLED;\r
 }\r
 \r
 DWORD CALLBACK  HelDdFlipToGDISurface(LPDDHAL_FLIPTOGDISURFACEDATA lpFlipToGDISurface)\r