Small DDraw logging fixes

Lionel Ulmer lionel.ulmer at free.fr
Sun Nov 10 12:10:57 CST 2002


Hi all,

Since my patch that adds logging of the new fields in the DDSCAPS2
structure, a lot of garbage was displayed that was not significant.
This is fixed by this patch.

Changelog:
 Proper logging of DDSCAPS / DDSCAPS2 structures

                    Lionel

PS: I hand-edited the patch, so I hope it still applies fine :-)

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
Index: dlls/ddraw/ddraw_private.h
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/ddraw_private.h,v
retrieving revision 1.26
diff -u -r1.26 ddraw_private.h
--- dlls/ddraw/ddraw_private.h	16 Jul 2002 01:16:14 -0000	1.26
+++ dlls/ddraw/ddraw_private.h	10 Nov 2002 18:00:54 -0000
@@ -40,6 +40,7 @@
 	do {						\
 	    	DWORD __size = (to)->dwSize;		\
 	    	DWORD __copysize = __size;		\
+                memset(to,0,__size);                    \
 	        if ((from)->dwSize < __size) 		\
 		    __copysize = (from)->dwSize;	\
 		memcpy(to,from,__copysize);		\
@@ -350,7 +351,8 @@
 extern void DDRAW_dump_DDBLTFX(DWORD flagmask);
 extern void DDRAW_dump_DDBLTFAST(DWORD flagmask);
 extern void DDRAW_dump_DDBLT(DWORD flagmask);
-extern void DDRAW_dump_DDSCAPS(const DDSCAPS2 *in);
+extern void DDRAW_dump_DDSCAPS(const DDSCAPS *in);
+extern void DDRAW_dump_DDSCAPS2(const DDSCAPS2 *in);
 extern void DDRAW_dump_pixelformat_flag(DWORD flagmask);
 extern void DDRAW_dump_paletteformat(DWORD dwFlags);
 extern void DDRAW_dump_pixelformat(const DDPIXELFORMAT *in);
Index: dlls/ddraw/helper.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/helper.c,v
retrieving revision 1.19
diff -u -r1.19 helper.c
--- dlls/ddraw/helper.c	4 Nov 2002 22:33:53 -0000	1.19
+++ dlls/ddraw/helper.c	10 Nov 2002 18:00:54 -0000
@@ -155,7 +155,7 @@
     DDRAW_dump_flags(flagmask, flags, sizeof(flags)/sizeof(flags[0]));
 }
 
-void DDRAW_dump_DDSCAPS(const DDSCAPS2 *in)
+void DDRAW_dump_DDSCAPS2(const DDSCAPS2 *in)
 {
     static const flag_info flags[] = {
         FE(DDSCAPS_RESERVED1),
@@ -215,6 +215,17 @@
     DDRAW_dump_flags_(in->dwCaps2, flags2, sizeof(flags2)/sizeof(flags2[0]), 0);
 }
 
+void DDRAW_dump_DDSCAPS(const DDSCAPS *in) {
+    DDSCAPS2 in_bis;
+
+    in_bis.dwCaps = in->dwCaps;
+    in_bis.dwCaps2 = 0;
+    in_bis.dwCaps3 = 0;
+    in_bis.dwCaps4 = 0;
+
+    DDRAW_dump_DDSCAPS2(&in_bis);
+}
+
 void DDRAW_dump_pixelformat_flag(DWORD flagmask)
 {
     static const flag_info flags[] =
@@ -329,26 +340,40 @@
 {
 #define STRUCT DDSURFACEDESC2
     static const member_info members[] =
-	{
-	    ME(DDSD_CAPS, DDRAW_dump_DDSCAPS, ddsCaps),
-	    ME(DDSD_HEIGHT, DDRAW_dump_DWORD, dwHeight),
-	    ME(DDSD_WIDTH, DDRAW_dump_DWORD, dwWidth),
-	    ME(DDSD_PITCH, DDRAW_dump_DWORD, u1.lPitch),
-	    ME(DDSD_LINEARSIZE, DDRAW_dump_DWORD, u1.dwLinearSize),
-	    ME(DDSD_BACKBUFFERCOUNT, DDRAW_dump_DWORD, dwBackBufferCount),
-	    ME(DDSD_MIPMAPCOUNT, DDRAW_dump_DWORD, u2.dwMipMapCount),
-	    ME(DDSD_REFRESHRATE, DDRAW_dump_DWORD, u2.dwRefreshRate),
-	    ME(DDSD_ALPHABITDEPTH, DDRAW_dump_DWORD, dwAlphaBitDepth),
-	    ME(DDSD_LPSURFACE, DDRAW_dump_PTR, lpSurface),
-	    ME(DDSD_CKDESTOVERLAY, DDRAW_dump_DDCOLORKEY, u3.ddckCKDestOverlay),
-	    ME(DDSD_CKDESTBLT, DDRAW_dump_DDCOLORKEY, ddckCKDestBlt),
-	    ME(DDSD_CKSRCOVERLAY, DDRAW_dump_DDCOLORKEY, ddckCKSrcOverlay),
-	    ME(DDSD_CKSRCBLT, DDRAW_dump_DDCOLORKEY, ddckCKSrcBlt),
-	    ME(DDSD_PIXELFORMAT, DDRAW_dump_pixelformat, u4.ddpfPixelFormat)
-	};
-
+        {
+            ME(DDSD_HEIGHT, DDRAW_dump_DWORD, dwHeight),
+            ME(DDSD_WIDTH, DDRAW_dump_DWORD, dwWidth),
+            ME(DDSD_PITCH, DDRAW_dump_DWORD, u1.lPitch),
+            ME(DDSD_LINEARSIZE, DDRAW_dump_DWORD, u1.dwLinearSize),
+            ME(DDSD_BACKBUFFERCOUNT, DDRAW_dump_DWORD, dwBackBufferCount),
+            ME(DDSD_MIPMAPCOUNT, DDRAW_dump_DWORD, u2.dwMipMapCount),
+            ME(DDSD_REFRESHRATE, DDRAW_dump_DWORD, u2.dwRefreshRate),
+            ME(DDSD_ALPHABITDEPTH, DDRAW_dump_DWORD, dwAlphaBitDepth),
+            ME(DDSD_LPSURFACE, DDRAW_dump_PTR, lpSurface),
+            ME(DDSD_CKDESTOVERLAY, DDRAW_dump_DDCOLORKEY, u3.ddckCKDestOverlay),
+            ME(DDSD_CKDESTBLT, DDRAW_dump_DDCOLORKEY, ddckCKDestBlt),
+            ME(DDSD_CKSRCOVERLAY, DDRAW_dump_DDCOLORKEY, ddckCKSrcOverlay),
+            ME(DDSD_CKSRCBLT, DDRAW_dump_DDCOLORKEY, ddckCKSrcBlt),
+            ME(DDSD_PIXELFORMAT, DDRAW_dump_pixelformat, u4.ddpfPixelFormat)
+        };
+    static const member_info members_caps[] =
+        {
+            ME(DDSD_CAPS, DDRAW_dump_DDSCAPS, ddsCaps)
+        };
+    static const member_info members_caps2[] =
+        {
+            ME(DDSD_CAPS, DDRAW_dump_DDSCAPS2, ddsCaps)
+        };
+#undef STRUCT
+
+    if (lpddsd->dwSize >= sizeof(DDSURFACEDESC2)) {
+        DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members_caps2, 1);
+    } else {
+        DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members_caps, 1);
+    }
+                                                  
     DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members,
-		       sizeof(members)/sizeof(members[0]));
+                       sizeof(members)/sizeof(members[0]));
 }
 
 void DDRAW_dump_cooperativelevel(DWORD cooplevel)
@@ -533,5 +558,5 @@
     DPRINTF(" - dwMinOverlayStretch : %ld\n", lpcaps->dwMinOverlayStretch);
     DPRINTF(" - dwMaxOverlayStretch : %ld\n", lpcaps->dwMaxOverlayStretch);
     DPRINTF("...\n");
-    DPRINTF(" - ddsCaps : "); DDRAW_dump_DDSCAPS(&lpcaps->ddsCaps); DPRINTF("\n");
+    DPRINTF(" - ddsCaps : "); DDRAW_dump_DDSCAPS2(&lpcaps->ddsCaps); DPRINTF("\n");
 }
Index: dlls/ddraw/dsurface/main.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/dsurface/main.c,v
retrieving revision 1.32
diff -u -r1.32 main.c
--- dlls/ddraw/dsurface/main.c	4 Nov 2002 22:34:11 -0000	1.32
+++ dlls/ddraw/dsurface/main.c	10 Nov 2002 18:00:56 -0000
@@ -600,7 +596,7 @@
     if (TRACE_ON(ddraw)) {
         TRACE("(%p)->Looking for caps: %lx,%lx,%lx,%lx output: %p\n",This,pCaps->dwCaps, pCaps->dwCaps2,
 	      pCaps->dwCaps3, pCaps->dwCaps4, ppSurface);
-	DPRINTF("   Caps are : "); DDRAW_dump_DDSCAPS(pCaps); DPRINTF("\n");
+	DPRINTF("   Caps are : "); DDRAW_dump_DDSCAPS2(pCaps); DPRINTF("\n");
     }
 
     our_caps = *pCaps;
@@ -611,7 +607,7 @@
 	our_caps.dwCaps3 = 0;
 	our_caps.dwCaps4 = 0;
 	if (TRACE_ON(ddraw)) {
-	    DPRINTF("   Real caps are : "); DDRAW_dump_DDSCAPS(&our_caps); DPRINTF("\n");
+	    DPRINTF("   Real caps are : "); DDRAW_dump_DDSCAPS2(&our_caps); DPRINTF("\n");
 	}
     }
     
@@ -623,7 +619,7 @@
 		  surf->surface_desc.ddsCaps.dwCaps2,
 		  surf->surface_desc.ddsCaps.dwCaps3,
 		  surf->surface_desc.ddsCaps.dwCaps4);
-	    DPRINTF("   Surface caps are : "); DDRAW_dump_DDSCAPS(&(surf->surface_desc.ddsCaps)); DPRINTF("\n");
+	    DPRINTF("   Surface caps are : "); DDRAW_dump_DDSCAPS2(&(surf->surface_desc.ddsCaps)); DPRINTF("\n");
 	}
 	if (((surf->surface_desc.ddsCaps.dwCaps & our_caps.dwCaps) == our_caps.dwCaps) &&
 	    ((surf->surface_desc.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2))



More information about the wine-patches mailing list