Regression (SimCity 3000 is Broke )

Tony Lambregts tony.lambregts at gmail.com
Tue Mar 15 13:23:39 CST 2005


Matthew Mastracci wrote:
> (removing Paul from CC)
> 
> I think the problem is that we lock both the src and dest surfaces, 
> without checking to see if they are the same.  I think we then try to 
> lock both surfaces and one of the locks fails.
> 
> Perhaps this might be a better solution:
> 
>    if (src == iface) {
>        DD_STRUCT_INIT(&ddesc);
>        DD_STRUCT_INIT(&sdesc);
> 
>        IDirectDrawSurface7_Lock(iface,NULL,&ddesc,0,0);
> 
>        DD_STRUCT_COPY_BYSIZE(&ddesc,&sdesc);
>    } else {
>        DD_STRUCT_INIT(&ddesc);
>        DD_STRUCT_INIT(&sdesc);
> 
>        sdesc.dwSize = sizeof(sdesc);
>        if (src) IDirectDrawSurface7_Lock(src, NULL, &sdesc, 
> DDLOCK_READONLY, 0);
>        ddesc.dwSize = sizeof(ddesc);
>        IDirectDrawSurface7_Lock(iface,NULL,&ddesc,DDLOCK_WRITEONLY,0);
>    }
> 
> I don't have access to my box with my Wine tree right now so I don't 
> know if this will compile.  Note that the fix will need to be done for 
> both _Blt() and _BltFast().
> Paul Vriens wrote:
> 
I have fixed it on my machine with the following patch. The reasoning for it is that I get the following waring in my trace's

warn:ddraw:Main_DirectDrawSurface_Lock  - unsupported locking flag : DDLOCK_NOSYSLOCK

That would indicate that we do not want to actually "Lock" it to prevent others from using it. I think that it can be improved on 
but I would like you to try this and see if it works for you. If it does then can work on getting it acceptable for cvs.




-------------- next part --------------
Index: dlls/ddraw/dsurface/main.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/dsurface/main.c,v
retrieving revision 1.64
diff -u -r1.64 main.c
--- dlls/ddraw/dsurface/main.c	7 Mar 2005 12:23:34 -0000	1.64
+++ dlls/ddraw/dsurface/main.c	15 Mar 2005 19:15:04 -0000
@@ -1147,9 +1147,9 @@
     } else {
 	This->lock_update(This, NULL, flags);
     }
-
-    This->locked = TRUE;
-
+    if (flags & ~(DDLOCK_WAIT|DDLOCK_READONLY|DDLOCK_WRITEONLY)) {
+        This->locked = TRUE;
+    }
     TRACE("locked surface returning description : \n");
     if (TRACE_ON(ddraw)) DDRAW_dump_surface_desc(pDDSD);
     
@@ -1421,13 +1421,13 @@
 HRESULT WINAPI
 Main_DirectDrawSurface_Unlock(LPDIRECTDRAWSURFACE7 iface, LPRECT pRect)
 {
+
     IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
 
     TRACE("(%p)->Unlock(%p)\n",This,pRect);
 
     if (!This->locked) {
-        WARN("Surface not locked - returing DDERR_NOTLOCKED\n");
-        return DDERR_NOTLOCKED;
+        WARN("Surface not locked\n");
     }
 
     This->locked = FALSE;


More information about the wine-devel mailing list