--- wine-cvs/dlls/ddraw/ddraw/main.c Tue Apr 23 13:12:19 2002 +++ wine/dlls/ddraw/ddraw/main.c Wed Jul 24 14:17:04 2002 @@ -1221,16 +1221,47 @@ return DD_OK; } +/* + * System Shock 2 expects like as right value of freeVidMem. + * it calls GetAvailableVidMem before and after CreateTexture, + * compares first and second values and exit with error message + * about bad DirectX provider ;-) + * + * So let it be happy + */ +#define VidMemAlign 4 +/* How it aligned? maybe by bus width but it's just workaround ;-) */ +#define VidMemMask (~(VidMemAlign-1)) +#define SIZE_ALIGN( X) ((X+VidMemAlign-1)&VidMemMask) + +/* + * I have no idea how get correct totalVidMem & freeVidMem from Xserver. + * SDL do that by parsing /proc/self/maps if DGA available ;-) + * maybe read it from config? + */ +static int totalVidMem = 32*1024*1024; +static int freeVidMem = 24*1024*1024; + +void DirectDraw_Dec_VidMem( int size) { + + freeVidMem -= SIZE_ALIGN( size); +} + +void DirectDraw_Inc_Vidmem( int size) { + + freeVidMem += SIZE_ALIGN( size); +} + HRESULT WINAPI Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps, LPDWORD total, LPDWORD free) { ICOM_THIS(IDirectDrawImpl,iface); - TRACE("(%p)->(%p,%p,%p)\n", This,ddscaps,total,free); + TRACE("(%p)->(%p,%p->%d,%p->%d)\n", This,ddscaps,total,totalVidMem,free,freeVidMem); - /* We have 16 MB videomemory */ - if (total) *total= 16*1024*1024; - if (free) *free = 16*1024*1024; + if (total) *total= totalVidMem; + if (free) *free = freeVidMem; + return DD_OK; } --- wine-cvs/dlls/ddraw/dsurface/dib.c Tue Mar 26 12:57:11 2002 +++ wine/dlls/ddraw/dsurface/dib.c Wed Jul 24 13:09:40 2002 @@ -140,6 +140,9 @@ return S_OK; } +extern void DirectDraw_Inc_VidMem( int size); +extern void DirectDraw_Dec_VidMem( int size); + void DIB_DirectDrawSurface_final_release(IDirectDrawSurfaceImpl* This) { DIB_DirectDrawSurfaceImpl* priv = This->private; @@ -147,8 +150,10 @@ if (priv->dib.DIBsection) DeleteObject(priv->dib.DIBsection); - if (!priv->dib.client_memory) + if (!priv->dib.client_memory) { + DirectDraw_Inc_VidMem( This->surface_desc.u1.lPitch * This->surface_desc.dwHeight); VirtualFree(This->surface_desc.lpSurface, 0, MEM_RELEASE); + } Main_DirectDrawSurface_final_release(This); } @@ -250,7 +255,7 @@ Main_DirectDrawSurface_final_release(This); return HRESULT_FROM_WIN32(GetLastError()); } - + DirectDraw_Dec_VidMem( This->surface_desc.u1.lPitch * This->surface_desc.dwHeight); priv->dib.client_memory = FALSE; } --- wine-cvs/dlls/d3dgl/texture.c Tue May 7 17:20:51 2002 +++ wine/dlls/d3dgl/texture.c Wed Jul 24 14:15:35 2002 @@ -900,8 +900,11 @@ if (d3dp->texstagestate[dwStage][D3DTSS_ALPHAOP] != D3DTOP_DISABLE) return D3DERR_UNSUPPORTEDALPHAOPERATION; FIXME("trying to validate disabled alpha operation\n"); + return D3D_OK; /* FIXME: maybe some apps might expect this to succeed anyway? */ - return D3DERR_UNSUPPORTEDALPHAOPERATION; + /* - Yes, System Shock 2 expects success here */ + /* FIXME: It can wark after that but same textures (glass, sky, fog) are corrupted :-/ */ + /* return D3DERR_UNSUPPORTEDALPHAOPERATION; */ } GL_get_color_src0(d3dp, dwStage, cop, &csrc0, &copn0);