[D3D 50] Some hacks to please some games :-)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



D3D50
Changelog:
 Added 'blt' and 'bltfast' override functions

PS: this is a bit hacky for now, but it will be fixed the day we
    'merge' both the TEXTURE and D3DDEVICE surface type in the current
    surface hierarchy instead of adding callbacks everywhere.

-- 
		 Lionel Ulmer - http://www.bbrox.org/
--- /home/ulmer/Wine/wine_base//dlls/ddraw/d3ddevice/mesa.c	2002-12-25 21:26:29.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/d3ddevice/mesa.c	2002-12-25 21:51:19.000000000 +0100
@@ -1685,14 +1685,16 @@
     
     TRACE("(%p)->(%08lx,%p,%08lx,%08lx,%f,%08lx)\n", This, dwCount, lpRects, dwFlags, dwColor, dvZ, dwStencil);
     if (TRACE_ON(ddraw)) {
-        int i;
-	TRACE(" rectangles : \n");
-	for (i = 0; i < dwCount; i++) {
-	    TRACE("  - %ld x %ld     %ld x %ld\n", lpRects[i].u1.x1, lpRects[i].u2.y1, lpRects[i].u3.x2, lpRects[i].u4.y2);
+	if (dwCount > 0) {
+	    int i;
+	    TRACE(" rectangles : \n");
+	    for (i = 0; i < dwCount; i++) {
+	        TRACE("  - %ld x %ld     %ld x %ld\n", lpRects[i].u1.x1, lpRects[i].u2.y1, lpRects[i].u3.x2, lpRects[i].u4.y2);
+	    }
 	}
     }
 
-    if (dwCount != 1) {
+    if (dwCount > 1) {
         WARN("  Warning, this function only for now clears the whole screen...\n");
     }
 
@@ -1745,6 +1747,29 @@
     return DD_OK;
 }
 
+HRESULT
+d3ddevice_blt(IDirectDrawSurfaceImpl *This, LPRECT rdst,
+	      LPDIRECTDRAWSURFACE7 src, LPRECT rsrc,
+	      DWORD dwFlags, LPDDBLTFX lpbltfx)
+{
+    if (dwFlags & DDBLT_COLORFILL) {
+        /* This is easy to handle for the D3D Device... */
+        TRACE(" executing D3D Device override.\n");
+        DWORD color = lpbltfx->u5.dwFillColor;
+	d3ddevice_clear(This->d3ddevice, 0, NULL, D3DCLEAR_TARGET, color, 0.0, 0x00000000);
+	return DD_OK;
+    }
+    return DDERR_INVALIDPARAMS;
+}
+
+HRESULT
+d3ddevice_bltfast(IDirectDrawSurfaceImpl *This, DWORD dstx,
+		  DWORD dsty, LPDIRECTDRAWSURFACE7 src,
+		  LPRECT rsrc, DWORD trans)
+{
+     return DDERR_INVALIDPARAMS;
+}
+
 
 /* TODO for both these functions :
     - change / restore OpenGL parameters for pictures transfers in case they are ever modified
@@ -1916,6 +1945,9 @@
 	    /* Override the Lock / Unlock function for all these surfaces */
 	    surf->lock_update = d3ddevice_lock_update;
 	    surf->unlock_update = d3ddevice_unlock_update;
+	    /* And install also the blt / bltfast overrides */
+	    surf->aux_blt = d3ddevice_blt;
+	    surf->aux_bltfast = d3ddevice_bltfast;
 	}
 	surf->d3ddevice = object;
     }
--- /home/ulmer/Wine/wine_base//dlls/ddraw/d3dtexture.c	2002-12-25 17:25:28.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/d3dtexture.c	2002-12-25 21:37:46.000000000 +0100
@@ -60,7 +60,7 @@
 /*******************************************************************************
  *			   IDirectSurface callback methods
  */
-HRESULT WINAPI gltex_setcolorkey_cb(IDirectDrawSurfaceImpl *texture, DWORD dwFlags, LPDDCOLORKEY ckey )
+HRESULT gltex_setcolorkey_cb(IDirectDrawSurfaceImpl *texture, DWORD dwFlags, LPDDCOLORKEY ckey )
 {
     DDSURFACEDESC *tex_d;
     GLuint current_texture;
@@ -689,7 +689,7 @@
 	surf->lock_update = gltex_lock_update;
 	surf->unlock_update = gltex_unlock_update;
 	surf->tex_private = private;
-	surf->SetColorKey_cb = gltex_setcolorkey_cb;
+	surf->aux_setcolorkey_cb = gltex_setcolorkey_cb;
 	
 	ENTER_GL();
 	if (surf->mipmap_level == 0) {
--- /home/ulmer/Wine/wine_base//dlls/ddraw/ddraw_private.h	2002-12-24 15:48:07.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/ddraw_private.h	2002-12-25 21:35:03.000000000 +0100
@@ -294,7 +294,9 @@
     void (*aux_release)(LPVOID ctx, LPVOID data);
     BOOL (*aux_flip)(LPVOID ctx, LPVOID data);
     void (*aux_unlock)(LPVOID ctx, LPVOID data, LPRECT lpRect);
-    HRESULT (WINAPI *SetColorKey_cb)(struct IDirectDrawSurfaceImpl *texture, DWORD dwFlags, LPDDCOLORKEY ckey ) ;
+    HRESULT (*aux_blt)(struct IDirectDrawSurfaceImpl *This, LPRECT rdst, LPDIRECTDRAWSURFACE7 src, LPRECT rsrc, DWORD dwFlags, LPDDBLTFX lpbltfx);
+    HRESULT (*aux_bltfast)(struct IDirectDrawSurfaceImpl *This, DWORD dstx, DWORD dsty, LPDIRECTDRAWSURFACE7 src, LPRECT rsrc, DWORD trans);
+    HRESULT (*aux_setcolorkey_cb)(struct IDirectDrawSurfaceImpl *texture, DWORD dwFlags, LPDDCOLORKEY ckey );
     /* This is to get the D3DDevice object associated to this surface */
     struct IDirect3DDeviceImpl *d3ddevice;
     /* This is for texture */
--- /home/ulmer/Wine/wine_base//dlls/ddraw/dsurface/dib.c	2002-12-22 15:09:19.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/dsurface/dib.c	2002-12-25 21:37:16.000000000 +0100
@@ -365,6 +365,11 @@
 	}
     }
 
+    /* First, check if the possible override function handles this case */
+    if (This->aux_blt != NULL) {
+        if (This->aux_blt(This, rdst, src, rsrc, dwFlags, lpbltfx) == DD_OK) return DD_OK;
+    }
+
     DD_STRUCT_INIT(&ddesc);
     DD_STRUCT_INIT(&sdesc);
 
@@ -814,6 +819,11 @@
 	  FIXME(" srcrect: NULL\n");
     }
 
+    /* First, check if the possible override function handles this case */
+    if (This->aux_bltfast != NULL) {
+        if (This->aux_bltfast(This, dstx, dsty, src, rsrc, trans) == DD_OK) return DD_OK;
+    }
+
     /* We need to lock the surfaces, or we won't get refreshes when done. */
     sdesc.dwSize = sizeof(sdesc);
     IDirectDrawSurface7_Lock(src, NULL,&sdesc,DDLOCK_READONLY, 0);

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux