Starcraft Patch

John Spiegel mithrir at yahoo.com
Thu Apr 10 00:39:27 CDT 2003


I've done some work getting the patches from
http://starcraft-wine.sourceforge.net/ working with CVS wine.  Using the
patch I'm including, starcraft works perfectly on my machine, run as
root using DGA on a 640x480 XF86 layout.

In particular the changes to event.c enable the mouse and keyboard with
DGA.  The changes to input.c make the mouse acceleration work the same
in all directions.  The changes to mouse.c enable mouse scrolling around
the map.

I'm using redhat 9, so the patch also has a change to wineinstall so
that the configure is set up for rh9.  You'll probably need to drop that
if you aren't running rh9.

Now, it would be great to get these changes merged into mainline wine. 
However, I imagine they break other stuff somewhere.  I don't really
know exactly what the changes mean, as I've mostly been converting an
old patch over.  I believe that the patch to input.c is simple and
straightforward enough to be merged in, even if the others aren't.

Any comments as to what needs to happen to get these into wine are
greatly appreciated.

John
-------------- next part --------------
? dlls/x11drv/.mouse.c.swp
Index: dlls/x11drv/event.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/event.c,v
retrieving revision 1.18
diff -u -r1.18 event.c
--- dlls/x11drv/event.c	23 Jan 2003 01:29:58 -0000	1.18
+++ dlls/x11drv/event.c	10 Apr 2003 02:13:51 -0000
@@ -112,7 +112,7 @@
 static int DGAKeyPressEventType;
 static int DGAKeyReleaseEventType;
 
-static BOOL DGAUsed = FALSE;
+BOOL DGAUsed = FALSE;
 static HWND DGAhwnd = 0;
 
 extern void X11DRV_DGAMotionEvent( HWND hwnd, XDGAMotionEvent *event );
@@ -133,18 +133,40 @@
     XEvent event;
     int count = 0;
 
+    /* Added to make starcraft work */
+#ifdef HAVE_LIBXXF86DGA2
+    Display *display = DGAUsed ? gdi_display : data->display;
+#else
+    Display *display = data->display;
+#endif
+
     wine_tsx11_lock();
-    while ( XPending( data->display ) )
+    /* Changed to make starcraft work */
+    while ( XPending( display ) )
     {
-        Bool ignore;
-
-        XNextEvent( data->display, &event );
-        ignore = XFilterEvent( &event, None );
+        XNextEvent( display, &event );
         wine_tsx11_unlock();
-        if (!ignore) EVENT_ProcessEvent( &event );
+        EVENT_ProcessEvent( &event );
         count++;
         wine_tsx11_lock();
     }
+/* this is a way in old patch, but I think it is unecessary
+   not sure why we need a separate loop
+
+    int events;
+    while ( (events = XPending( display )) )
+    {
+        do
+        {
+            XNextEvent( display, &event );
+            wine_tsx11_unlock();
+            EVENT_ProcessEvent( &event );
+            count++;
+            wine_tsx11_lock();
+        }
+        while ( --events != 0);
+    }
+*/
     wine_tsx11_unlock();
     return count;
 }
Index: dlls/x11drv/mouse.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/mouse.c,v
retrieving revision 1.11
diff -u -r1.11 mouse.c
--- dlls/x11drv/mouse.c	7 Jan 2003 20:36:22 -0000	1.11
+++ dlls/x11drv/mouse.c	10 Apr 2003 02:14:04 -0000
@@ -35,6 +35,10 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(cursor);
 
+#ifdef HAVE_LIBXXF86DGA2
+extern BOOL DGAUsed;
+#endif
+
 /**********************************************************************/
 
 #define NB_BUTTONS   5     /* Windows can handle 3 buttons and the wheel too */
@@ -159,8 +163,13 @@
 
     if (data->cursor_window != win)
     {
+#ifdef HAVE_LIBXXF86DGA2
+        Display *display = DGAUsed ? gdi_display : data->display;
+#else
+        Display *display = data->display;
+#endif
         data->cursor_window = win;
-        if (data->cursor) TSXDefineCursor( data->display, win, data->cursor );
+        if (data->cursor) TSXDefineCursor( display, win, data->cursor );
     }
 }
 
@@ -480,18 +489,23 @@
     else /* set the same cursor for all top-level windows of the current thread */
     {
         struct x11drv_thread_data *data = x11drv_thread_data();
+#ifdef HAVE_LIBXXF86DGA2
+        Display *display = DGAUsed ? gdi_display : data->display;
+#else
+        Display *display = data->display;
+#endif
 
         wine_tsx11_lock();
-        cursor = create_cursor( data->display, lpCursor );
+        cursor = create_cursor( display, lpCursor );
         if (cursor)
         {
-            if (data->cursor) XFreeCursor( data->display, data->cursor );
+            if (data->cursor) XFreeCursor( display, data->cursor );
             data->cursor = cursor;
             if (data->cursor_window)
             {
-                XDefineCursor( data->display, data->cursor_window, cursor );
+                XDefineCursor( display, data->cursor_window, cursor );
                 /* Make the change take effect immediately */
-                XFlush( data->display );
+                XFlush( display );
             }
         }
         wine_tsx11_unlock();
@@ -503,7 +517,11 @@
  */
 void X11DRV_SetCursorPos( INT x, INT y )
 {
+#ifdef HAVE_LIBXXF86DGA2
+    Display *display = DGAUsed ? gdi_display : thread_display();
+#else
     Display *display = thread_display();
+#endif
 
     TRACE( "warping to (%d,%d)\n", x, y );
 
@@ -518,7 +536,11 @@
  */
 void X11DRV_GetCursorPos(LPPOINT pos)
 {
+#ifdef HAVE_LIBXXF86DGA2
+  Display *display = DGAUsed ? gdi_display : thread_display();
+#else
   Display *display = thread_display();
+#endif
   Window root, child;
   int rootX, rootY, winX, winY;
   unsigned int xstate;
Index: tools/wineinstall
===================================================================
RCS file: /home/wine/wine/tools/wineinstall,v
retrieving revision 1.52
diff -u -r1.52 wineinstall
--- tools/wineinstall	24 Mar 2003 19:29:38 -0000	1.52
+++ tools/wineinstall	10 Apr 2003 02:14:49 -0000
@@ -20,7 +20,7 @@
 #
 
 #--- defaults (change these if you are a packager)
-CONFARGS=""                   # configure args, e.g. --prefix=/usr --sysconfdir=/etc
+CONFARGS="--with-nptl"                   # configure args, e.g. --prefix=/usr --sysconfdir=/etc
 prefix=/usr/local             # installation prefix
 sysconfdir=$prefix/etc        # where wine.conf and the global registry are supposed to be
 bindir=$prefix/bin            # where winelib apps will be (or are) installed
Index: windows/input.c
===================================================================
RCS file: /home/wine/wine/windows/input.c,v
retrieving revision 1.90
diff -u -r1.90 input.c
--- windows/input.c	8 Jan 2003 00:27:58 -0000	1.90
+++ windows/input.c	10 Apr 2003 02:16:20 -0000
@@ -230,10 +230,10 @@
         SystemParametersInfoA(SPI_GETMOUSE, 0, accel, 0);
 
         accelMult = 1;
-        if (mi->dx > accel[0] && accel[2] != 0)
+        if (labs(mi->dx) > accel[0] && accel[2] != 0)
         {
             accelMult = 2;
-            if ((mi->dx > accel[1]) && (accel[2] == 2))
+            if ((labs(mi->dx) > accel[1]) && (accel[2] == 2))
             {
                 accelMult = 4;
             }
@@ -241,10 +241,10 @@
         posX += (long)mi->dx * accelMult;
 
         accelMult = 1;
-        if (mi->dy > accel[0] && accel[2] != 0)
+        if (labs(mi->dy) > accel[0] && accel[2] != 0)
         {
             accelMult = 2;
-            if ((mi->dy > accel[1]) && (accel[2] == 2))
+            if ((labs(mi->dy) > accel[1]) && (accel[2] == 2))
             {
                 accelMult = 4;
             }
@@ -472,7 +472,7 @@
     if (!pt) return 0;
     pt->x = PosX;
     pt->y = PosY;
-    if (USER_Driver.pGetCursorPos) USER_Driver.pGetCursorPos( pt );
+    //if (USER_Driver.pGetCursorPos) USER_Driver.pGetCursorPos( pt );
     return 1;
 }
 


More information about the wine-users mailing list