adding more stuff for create surface right
authorMagnus Olsen <magnus@greatlord.com>
Sun, 30 Oct 2005 15:45:40 +0000 (15:45 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Sun, 30 Oct 2005 15:45:40 +0000 (15:45 +0000)
svn path=/trunk/; revision=18886

reactos/lib/ddraw/hal/ddraw_hal.c
reactos/lib/ddraw/main/ddraw_main.c
reactos/lib/ddraw/rosdraw.h

index 8b769e8..f00d010 100644 (file)
@@ -319,6 +319,33 @@ HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 iface)
                
 
 
                
 
 
+     /* */
+        /*  DWORD   dwIntRefCnt;
+
+        
+        LPVOID  lpVtbl;
+        LPDDRAWI_DDRAWSURFACE_LCL  lpLcl;
+        LPDDRAWI_DDRAWSURFACE_INT  lpLink;
+       
+        } DDRAWI_DDRAWSURFACE_INT;
+     */
+
+        /* Setting up some part for surface not ever thing are being fill in yet */
+        This->DirectDrawGlobal.dsList = (LPDDRAWI_DDRAWSURFACE_INT)HeapAlloc(GetProcessHeap(), 0,
+                                             sizeof(DDRAWI_DDRAWSURFACE_INT));
+
+        This->DirectDrawGlobal.dsList->lpLink = (LPDDRAWI_DDRAWSURFACE_INT) &This->DirectDrawGlobal.dsList;
+
+        This->DirectDrawGlobal.dsList->lpLcl = (LPDDRAWI_DDRAWSURFACE_LCL)HeapAlloc(GetProcessHeap(), 0,
+                                             sizeof(DDRAWI_DDRAWSURFACE_LCL));
+
+        This->DirectDrawGlobal.dsList->lpLcl->lpGbl = 
+                          (LPDDRAWI_DDRAWSURFACE_GBL)HeapAlloc(GetProcessHeap(), 0, sizeof(DDRAWI_DDRAWSURFACE_GBL));
+
+        This->DirectDrawGlobal.dsList->lpLcl->lpGbl->lpDD  = &This->DirectDrawGlobal;
+
+        
+
 
 
        /* Now all setup for HAL is done and we hopply do not have forget anything */
 
 
        /* Now all setup for HAL is done and we hopply do not have forget anything */
@@ -328,7 +355,25 @@ HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 iface)
 
 HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface)
 {
 
 HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface)
 {
-       return DD_OK;
+       IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+
+       DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode;
+
+       if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE)) 
+       {
+               return DDERR_NODRIVERSUPPORT;
+       }
+
+       SetExclusiveMode.lpDD = &This->DirectDrawGlobal;
+    SetExclusiveMode.ddRVal = DDERR_NOTPALETTIZED;
+       SetExclusiveMode.dwEnterExcl = This->cooperative_level;
+
+       if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetExclusiveMode(&SetExclusiveMode) != DDHAL_DRIVER_HANDLED)
+       {
+          return DDERR_NODRIVERSUPPORT;
+       }
+
+       return SetExclusiveMode.ddRVal;
 }
 
 
 }
 
 
index 3a8b4b8..e064ce2 100644 (file)
@@ -16,6 +16,8 @@ HRESULT WINAPI Main_DirectDraw_Initialize (LPDIRECTDRAW7 iface, LPGUID lpGUID)
     IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
        HRESULT ret;
 
     IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
        HRESULT ret;
 
+       
+
        // this if it is not called by DirectDrawCreate
        if(FALSE)
                return DDERR_ALREADYINITIALIZED;
        // this if it is not called by DirectDrawCreate
        if(FALSE)
                return DDERR_ALREADYINITIALIZED;
@@ -48,7 +50,6 @@ HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hw
        // - allow more Flags
 
     IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
        // - allow more Flags
 
     IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
-       HRESULT ret;
 
        // check the parameters
        if (This->cooperative_level == cooplevel && This->window == hwnd)
 
        // check the parameters
        if (This->cooperative_level == cooplevel && This->window == hwnd)
@@ -72,20 +73,21 @@ HRESULT WINAPI Main_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface, HWND hw
        This->cooperative_level = cooplevel;
 
        
        This->cooperative_level = cooplevel;
 
        
+    if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE) 
+       {
+           return Hal_DirectDraw_SetCooperativeLevel (iface);          
+       }
 
 
-       if((ret = Hal_DirectDraw_SetCooperativeLevel (iface)) != DD_OK)
-               return ret;
+       return Hel_DirectDraw_SetCooperativeLevel(iface);
 
 
-       if((ret = Hel_DirectDraw_SetCooperativeLevel (iface)) != DD_OK)
-               return ret;
-
-       return DD_OK;
 }
 
 HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight, 
                                                                                                                                DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
 {
        DWORD ret;
 }
 
 HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight, 
                                                                                                                                DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
 {
        DWORD ret;
+
+    /* FIXME implement hal setMode */
        if((ret = Hal_DirectDraw_SetDisplayMode(iface,  dwWidth,  dwHeight, 
                                             dwBPP,  dwRefreshRate,  dwFlags)) == DD_OK)
        {
        if((ret = Hal_DirectDraw_SetDisplayMode(iface,  dwWidth,  dwHeight, 
                                             dwBPP,  dwRefreshRate,  dwFlags)) == DD_OK)
        {
@@ -174,7 +176,11 @@ HRESULT WINAPI Main_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDE
 
        That->lpVtbl = &DirectDrawSurface7_Vtable;
        That->lpVtbl_v3 = &DDRAW_IDDS3_Thunk_VTable;
 
        That->lpVtbl = &DirectDrawSurface7_Vtable;
        That->lpVtbl_v3 = &DDRAW_IDDS3_Thunk_VTable;
-       That->ref = 1;
+       
+       That->owner->DirectDrawGlobal.dsList->dwIntRefCnt =1;
+
+       /* we alwasy set to use the DirectDrawSurface7_Vtable as internel */
+       That->owner->DirectDrawGlobal.dsList->lpVtbl = (PVOID) &DirectDrawSurface7_Vtable;
 
        *ppSurf = (LPDIRECTDRAWSURFACE7)That;
 
 
        *ppSurf = (LPDIRECTDRAWSURFACE7)That;
 
index 05245c7..f7b1e01 100644 (file)
@@ -38,13 +38,7 @@ typedef struct
 {
        IDirectDrawSurface7Vtbl* lpVtbl;
        IDirectDrawSurface3Vtbl* lpVtbl_v3;
 {
        IDirectDrawSurface7Vtbl* lpVtbl;
        IDirectDrawSurface3Vtbl* lpVtbl_v3;
-
-    LONG ref;
-
-       DDRAWI_DDRAWSURFACE_GBL Global;
-       DDRAWI_DDRAWSURFACE_MORE More;
-       DDRAWI_DDRAWSURFACE_LCL Local;
-
+   
     IDirectDrawImpl* owner;
 
 } IDirectDrawSurfaceImpl;
     IDirectDrawImpl* owner;
 
 } IDirectDrawSurfaceImpl;