Implement Hal GetAvailableVidMem and is it working in windows
authorMagnus Olsen <magnus@greatlord.com>
Sun, 30 Oct 2005 01:06:56 +0000 (01:06 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Sun, 30 Oct 2005 01:06:56 +0000 (01:06 +0000)
svn path=/trunk/; revision=18864

reactos/lib/ddraw/hal/ddraw.c
reactos/lib/ddraw/main/ddraw.c
reactos/lib/ddraw/rosdraw.h
reactos/lib/ddraw/soft/ddraw.c

index 3fb3a6f..63e117d 100644 (file)
@@ -354,3 +354,33 @@ VOID Hal_DirectDraw_Release (LPDIRECTDRAW7 iface)
        if(This->DirectDrawGlobal.lpD3DGlobalDriverData)
                HeapFree(GetProcessHeap(), 0, (PVOID)This->DirectDrawGlobal.lpD3DGlobalDriverData);
 }
+
+
+HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
+                                  LPDWORD total, LPDWORD free)                                                                                    
+{
+       IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+       
+       DDHAL_GETAVAILDRIVERMEMORYDATA  mem;
+
+       if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDDMiscellaneous.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY)) 
+       {
+               return DDERR_NODRIVERSUPPORT;
+       }
+
+       mem.lpDD = &This->DirectDrawGlobal;     
+       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;
+}
index db4a4a1..85ba697 100644 (file)
@@ -352,7 +352,8 @@ HRESULT WINAPI Main_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface, LPDDSURFACEDE
     DDCOLORKEY    ddckCKSrcOverlay;
     DDCOLORKEY    ddckCKSrcBlt;
        */
-
+    
+       
     RtlCopyMemory(&pDDSD->ddpfPixelFormat,&This->DirectDrawGlobal.vmiData.ddpfDisplay,sizeof(DDPIXELFORMAT));
     RtlCopyMemory(&pDDSD->ddsCaps,&This->DirectDrawGlobal.ddCaps,sizeof(DDCORECAPS));
        
@@ -412,9 +413,18 @@ HRESULT WINAPI Main_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD d
 
 HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
                                   LPDWORD total, LPDWORD free)                                                                                    
-{
-     
-       DX_STUB;
+{      
+       DWORD ret;
+
+     if((ret = Hal_DirectDraw_GetAvailableVidMem (iface,ddscaps,total,free)) == DD_OK)
+               return ret;
+
+       if((ret = Hel_DirectDraw_GetAvailableVidMem (iface,ddscaps,total,free)) == DD_OK)
+               return ret;
+
+
+       return DDERR_NOTINITIALIZED;
+
 }
                                                                                                   
 HRESULT WINAPI Main_DirectDraw_GetSurfaceFromDC(LPDIRECTDRAW7 iface, HDC hdc,
index 4e4cb5a..1294dc9 100644 (file)
@@ -88,10 +88,18 @@ HRESULT Hal_DirectDraw_Initialize (LPDIRECTDRAW7 iface);
 HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface);
 VOID Hal_DirectDraw_Release (LPDIRECTDRAW7 iface);
 
+HRESULT Hal_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
+                                  LPDWORD total, LPDWORD free);                                                                                           
+
+
 HRESULT Hel_DirectDraw_Initialize (LPDIRECTDRAW7 iface);
 HRESULT Hel_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface);
 VOID Hel_DirectDraw_Release (LPDIRECTDRAW7 iface);
 
+HRESULT Hel_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
+                                  LPDWORD total, LPDWORD free);                                                                                           
+
+
 /*********** Macros ***********/
 
 #define DX_STUB \
index fa83d26..a9a758f 100644 (file)
@@ -24,3 +24,10 @@ HRESULT Hel_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface)
 VOID Hel_DirectDraw_Release (LPDIRECTDRAW7 iface) 
 {
 }
+
+
+HRESULT Hel_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
+                                  LPDWORD total, LPDWORD free) 
+{
+       DX_STUB;
+}