rpms/koules/devel koules-1.4-defines.patch, NONE, 1.1 koules-1.4-fix_xsynchronize.patch, NONE, 1.1 koules-1.4-fpe_fix.patch, NONE, 1.1 koules-1.4-shm_check.patch, NONE, 1.1 koules-1.4-use_right_visual.patch, NONE, 1.1 koules.spec, 1.8, 1.9

Lubomir Rintel lkundrak at fedoraproject.org
Mon Apr 13 19:34:04 UTC 2009


Author: lkundrak

Update of /cvs/pkgs/rpms/koules/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27348

Modified Files:
	koules.spec 
Added Files:
	koules-1.4-defines.patch koules-1.4-fix_xsynchronize.patch 
	koules-1.4-fpe_fix.patch koules-1.4-shm_check.patch 
	koules-1.4-use_right_visual.patch 
Log Message:
* Mon Apr 13 2009 Lubomir Rintel <lkundrak at v3.sk> 1.4-7
- Debian apparently fixed shm more sanely than me
- Import bunch of Debian fixes


koules-1.4-defines.patch:

--- NEW FILE koules-1.4-defines.patch ---
>From Debian: 050_defines.diff

--- koules-1.4.orig/xlib/init.c
+++ koules-1.4/xlib/init.c
@@ -769,6 +770,32 @@
 #endif
 	  break;
 	default:
+#ifdef NETSUPPORT
+#define USAGE_NETSUPPORT " -S run koules as network server\n \
+-C<host> run koules as network client\n \
+-P<port> select port. Default is:%i\n \
+-W run server in width mode-support for 320x200 svgalib and OS/2 clients\n \
+-L<level> select level for server\n \
+-D<number> select dificulty for server:\n \
+    0: nightmare\n \
+    1: hard\n \
+    2: medium(default and recomended)\n \
+    3: easy\n \
+    4: very easy\n \
+-K run server in deathmatch mode\n "
+#else
+#define USAGE_NETSUPPORT ""
+#endif
+#ifdef SOUND
+#define USAGE_SOUND " -d Disable sound support\n"
+#else
+#define USAGE_SOUND ""
+#endif
+#ifdef MITSHM
+#define USAGE_MITSHM " -M DISABLE shared memory support\n"
+#else
+#define USAGE_MITSHM ""
+#endif
 	  printf ("USAGE:"
 		  " -h for help\n"
 		  " -b for blackandwhite displays\n"
@@ -778,27 +805,10 @@
 		  " -p use private colormap\n"
 		  " -y Synchronize with X(for debugging)\n"
 		  " -f nofade(for debugging)\n"
-#ifdef SOUND
-		  " -d Disable sound support\n"
-#endif
+		  USAGE_SOUND
 		  " -x Disable X11 pointer\n"
-#ifdef MITSHM
-		  " -M DISABLE shared memory support\n"
-#endif
-#ifdef NETSUPPORT
-		  " -S run koules as network server\n"
-		  " -C<host> run koules as network client\n"
-		  " -P<port> select port. Default is:%i\n"
-		  " -W run server in width mode-support for 320x200 svgalib and OS/2 clients\n"
-		  " -L<level> select level for server\n"
-		  " -D<number> select dificulty for server:\n"
-		  "     0: nightmare\n"
-		  "     1: hard\n"
-		  "     2: medium(default and recomended)\n"
-		  "     3: easy\n"
-		  "     4: very easy\n"
-		  " -K run server in deathmatch mode\n", DEFAULTINITPORT
-#endif
+		  USAGE_MITSHM
+		  USAGE_NETSUPPORT, DEFAULTINITPORT
 	    );
 	  exit (2);
 	}
--- koules-1.4.orig/Iconfig
+++ koules-1.4/Iconfig
@@ -18,7 +18,7 @@
    use my emulation
    If you are unsure try to leave it commented out. My emulation
    works on most unixes*/
-/*#define HAVEUSLEEP*/
+#define HAVEUSLEEP
 /* for network audio server(supported by most unixes)*/
 /* It does not sound as well as built in driver ... koules uses too 
    much sounds*/
@@ -29,14 +29,14 @@
 /* linux joystick support
    Now compiles w/o joystick toolkit. For using joystick support is
    joystick toolikit required...of course */
-/*#define JOYSTICK*/
+#define JOYSTICK
 /*for fast 386 based assembler routines
   recomended for linux*/
-/*#define I386ASSEMBLY*/
+#define I386ASSEMBLY
 /* directories*/
-KOULESDIR		=/usr/bin/X11
-SOUNDDIR		=/usr/local/lib/koules
-MANDIR			=/usr/local/man/man6
+KOULESDIR		=/usr/games
+SOUNDDIR		=/usr/games/lib/koules
+MANDIR			=/usr/man/man6
 
 /*You need some extra libraryes for BSD sockets compatibility?*/
 /* TOP_INCLUDES =                       /* Sun users with GCC need this */
@@ -61,7 +61,7 @@
 #endif
 
 
-#if defined(HPArchitecture)
+#if defined(HPArchitecture) && !defined(LinuxArchitecture)
     SYSDEFS = +O3 -Ae 
 #if !defined(NAS_SOUND)&&!defined(RSOUND)
 #define SOUND

koules-1.4-fix_xsynchronize.patch:

--- NEW FILE koules-1.4-fix_xsynchronize.patch ---
>From Debian: 107_fix_xsynchronize.diff

diff -up koules1.4/xlib/init.c.fix_xsynchronize koules1.4/xlib/init.c
--- koules1.4/xlib/init.c.fix_xsynchronize	2009-04-13 21:18:35.765152286 +0200
+++ koules1.4/xlib/init.c	2009-04-13 21:20:16.543140365 +0200
@@ -392,6 +392,8 @@ initialize (char **argv, int argc)
       GAMEHEIGHT = MAPHEIGHT = DisplayHeight (dp, DefaultScreen (dp)) * 0.8;
     }
 
+  if (Sync)
+     XSynchronize (dp, 1);
   XSetCloseDownMode (dp, DestroyAll);
   screen = DefaultScreen (dp);
   fadeenable = 1;
@@ -584,8 +586,6 @@ initialize (char **argv, int argc)
     }
 #endif
 
-  if (Sync)
-    XSynchronize (dp, 1);
 #if defined(NAS_SOUND)||defined(RSOUND)
   printf ("Initializing sound server...\n");
   if (sndinit)
@@ -670,7 +670,7 @@ main (int argc, char **argv)
 	  "\n\n\n\n"
 	  "                     Copyright(c) Jan Hubicka 1995, 1996\n\n\n");
   useprivate = 0;
-  while ((c = mygetopt (argc, argv, "KWD:P:L:C:SxslEMmpdhfb")) != -1)
+  while ((c = mygetopt (argc, argv, "KWD:P:L:C:SxyslEMmpdhfb")) != -1)
     {
       switch (c)
 	{

koules-1.4-fpe_fix.patch:

--- NEW FILE koules-1.4-fpe_fix.patch ---
>From Debian: 109_fpe_fix.diff

--- koules-1.4.orig/xlib/shmbitmap.c	2007-10-26 21:16:50.000000000 -0400
+++ koules-1.4/xlib/shmbitmap.c	2007-10-26 21:18:21.000000000 -0400
@@ -187,6 +187,9 @@
 void
 ShmPutBitmap (int x, int y, int w, int h, void *_dp)
 {
+  if (x < 0 || y < 0)
+    return;
+
 /* no clipping */
   uchar          *dp = _dp;
   uchar          *vp, *vpline;

koules-1.4-shm_check.patch:

--- NEW FILE koules-1.4-shm_check.patch ---
>From Debian: 106_shm_check.diff

Index: koules-1.4/xlib/init.c
===================================================================
--- koules-1.4.orig/xlib/init.c	2006-11-03 11:43:49.000000000 +0100
+++ koules-1.4/xlib/init.c	2006-11-03 11:56:04.000000000 +0100
@@ -91,6 +91,8 @@
 
 #ifdef MITSHM
 extern int      XShmQueryExtension (Display * dpy);
+extern Bool     XShmQueryVersion (Display* dpy, int * major, int * minor,
+                                  Bool * sharedpixmaps);
 static int      haderror;
 static int      (*origerrorhandler) (Display *, XErrorEvent *);
 static int      bpp;
@@ -107,6 +109,15 @@
   return (0);
 }
 
+static int
+badmatcherrorhandler (Display * d, XErrorEvent * e)
+{
+  haderror++;
+  if (e->error_code != BadMatch)
+    (*origerrorhandler) (d, e);
+  return (0);
+}
+
 #define Width MAPWIDTH
 #define Height (MAPHEIGHT+20)
 XShmSegmentInfo shminfo;
@@ -186,16 +197,27 @@
   fflush (stdout);
   testpixmap = XCreatePixmap (dp, wi, MAPWIDTH, MAPHEIGHT + 20, DefaultDepth (dp, screen));
   XSync (dp, 0);
+  haderror = False;
+  origerrorhandler = XSetErrorHandler (badmatcherrorhandler);
   for (i = 0; i < 10 && wait > 0; i++)
     {
-      XPutImage (dp, testpixmap, gc, pixmap->ximage, 0, 0, 0, 0, MAPWIDTH, MAPHEIGHT + 20);
+      if (!XPutImage (dp, testpixmap, gc, pixmap->ximage, 0, 0, 0, 0,
+                      MAPWIDTH, MAPHEIGHT + 20))
+        break;
       XSync (dp, 0);
       gettimeofday (&VnewClk, NULL);
       if (VnewClk.tv_usec < VendSleep)
 	VendSleep -= 1000000;
       wait = (VfTime - VnewClk.tv_usec + VendSleep);
     }
+  XSync (dp, False);
+  XSetErrorHandler (origerrorhandler);
   XFreePixmap (dp, testpixmap);
+  if (haderror)
+    {
+      printf (" XPutImage failed (remote server?)\n");
+      return 0;
+    }
   if (i == 10)
     {
       printf ("OK\n");
@@ -258,6 +280,7 @@
   pixmap->ximage->data = (char *) shared_mem;
 
   /* Now try to attach it to the X Server */
+  XSync (dp, False);
   haderror = False;
   origerrorhandler = XSetErrorHandler (shmerrorhandler);
   if (!XShmAttach (dp, &shminfo))
@@ -416,22 +439,25 @@
 #ifdef MITSHM
   /* Make sure all is destroyed if killed off */
 
-  /* Make sure we can do PsuedoColor colormap stuff */
+  /* Make sure we can do PseudoColor colormap stuff */
   if (!shm)
     {
       printf ("Shm support disabled\n");
     }
   else
-    /* Check to see if the extensions are supported */
-  if (!XShmQueryExtension (dp))
     {
-      fprintf (stderr, "X server doesn't support MITSHM extension.\n");
-      shm = 0;
+      /* Check to see if the extensions are supported */
+      int major, minor;
+      Bool pixmaps;
+      if (XShmQueryVersion (dp, &major, &minor, &pixmaps) != 0
+           && (major > 1 || (major == 1 && minor >= 1)))
+          printf ("Shm mode seems to be possible\n");
+      else
+        {
+          fprintf (stderr, "X server doesn't support MITSHM extension.\n");
+          shm = 0;
+        }
     }
-  if (shm)
-    printf ("Shm mode seems to be possible\n");
-
-
 #endif
   wi = physicalscreen.pixmap = XCreateSimpleWindow (dp, RootWindow (dp, screen), 50, 50, MAPWIDTH, MAPHEIGHT + 20,
 						    0, 0, 0);

koules-1.4-use_right_visual.patch:

--- NEW FILE koules-1.4-use_right_visual.patch ---
>From Debian: 108_use_right_visual.diff

diff -up koules1.4/xlib/init.c.use_right_visual koules1.4/xlib/init.c
--- koules1.4/xlib/init.c.use_right_visual	2009-04-13 21:21:50.639259228 +0200
+++ koules1.4/xlib/init.c	2009-04-13 21:27:57.082161986 +0200
@@ -95,7 +95,6 @@ extern Bool     XShmQueryVersion (Displa
                                   Bool * sharedpixmaps);
 static int      haderror;
 static int      (*origerrorhandler) (Display *, XErrorEvent *);
-static int      bpp;
 
 
 static int
@@ -179,14 +178,14 @@ GetImage (VScreenType * pixmap)	/*Work a
   VfTime = 1000000 / 25 * 12;
   pixmap->ximage = XCreateImage (dp, DefaultVisual (dp, screen),
 				 depth, ZPixmap, 0,
-				 NULL, Width, Height, bpp * 8, 0);
+				 NULL, Width, Height, depth, 0);
   if (!pixmap->ximage)
     {
       fprintf (stderr, "Can't get image\n");
       return 0;
     }
   /*Calculate size of shared memory */
-  memsize = ((Width + 1) * (Height + 1) * bpp);
+  memsize = ((Width + 1) * (Height + 1) * depth / 8);
   if ((data = malloc (memsize)) == NULL)
     {
       printf ("Can't malloc memory for image\n");
@@ -340,7 +339,6 @@ initialize (char **argv, int argc)
   char           *title1 = "Koules";
 
   Font            f;
-  XVisualInfo     vinfo_return;
   XGCValues       values;
 #ifndef NAS_SOUND
 #ifndef RSOUND
@@ -396,54 +394,46 @@ initialize (char **argv, int argc)
      XSynchronize (dp, 1);
   XSetCloseDownMode (dp, DestroyAll);
   screen = DefaultScreen (dp);
-  fadeenable = 1;
-  if (XMatchVisualInfo (dp, DefaultScreen (dp),
-			8, PseudoColor, &vinfo_return) == False)
-    {
-      fadeenable = 0;
-      printf ("X: Screen doesn't support PseudoColor!\n");
-      if (XMatchVisualInfo (dp, DefaultScreen (dp),
-			    32, TrueColor, &vinfo_return) == True)
-	{
-	  useprivate = 0;
-	  bpp = 4;
-	}
-      else if (XMatchVisualInfo (dp, DefaultScreen (dp),
-				 24, TrueColor, &vinfo_return) == True)
-	{
-	  useprivate = 0;
-	  bpp = 4;
-	}
-      else if (XMatchVisualInfo (dp, DefaultScreen (dp),
-				 16, TrueColor, &vinfo_return) == True)
-	{
-	  useprivate = 0;
-	  bpp = 2;
-	}
-      else if (XMatchVisualInfo (dp, DefaultScreen (dp),
-				 15, TrueColor, &vinfo_return) == True)
-	{
-	  useprivate = 0;
-	  bpp = 2;
-	}
-      else if (XMatchVisualInfo (dp, DefaultScreen (dp),
-				 8, GrayScale, &vinfo_return) == True)
-	{
-	  useprivate = 0;
-	  monochrome = 1;
-	  bpp = 2;
-	}
-      else
-	{
-	  printf ("Unsupported visual! Using slow and reliable mode\n");
+  {
+    XVisualInfo template;
+    XVisualInfo * vinfo;
+    int nitems_return;
+    template.visualid = XVisualIDFromVisual (DefaultVisual (dp, DefaultScreen (dp)));
+    vinfo = XGetVisualInfo (dp, VisualIDMask, &template, &nitems_return);
+    if (nitems_return == 0)
+      {
+        printf ("X server does not know about the default visual...");
+        exit (0);
+      }
+
+    if (vinfo->class == PseudoColor && vinfo->depth == 8)
+      {
+        fadeenable = 1;
+      }
+    else
+      {
+        fadeenable = 0;
+        printf ("X: Screen doesn't support PseudoColor!\n");
+        if (vinfo->class == TrueColor)
+          {
+            useprivate = 0;
+          }
+        else if (vinfo->class == GrayScale)
+          {
+            useprivate = 0;
+            monochrome = 1;
+          }
+        else
+          {
+            printf ("Unsupported visual! Using slow and reliable mode\n");
 #ifdef MITSHM
-	  shm = 0;
+            shm = 0;
 #endif
-	}
-    }
-  else
-    bpp = 1;
-  depth = vinfo_return.depth;
+          }
+      }
+    depth = vinfo->depth;
+    XFree(vinfo);
+  }
 #ifdef MITSHM
   /* Make sure all is destroyed if killed off */
 


Index: koules.spec
===================================================================
RCS file: /cvs/pkgs/rpms/koules/devel/koules.spec,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- koules.spec	11 Apr 2009 22:40:35 -0000	1.8
+++ koules.spec	13 Apr 2009 19:33:59 -0000	1.9
@@ -1,6 +1,6 @@
 Name:           koules
 Version:        1.4
-Release:        6%{?dist}
+Release:        7%{?dist}
 Summary:        Action game with multiplayer, network and sound support
 
 Group:          Amusements/Games
@@ -29,6 +29,7 @@
 Patch0:         koules-1.4-clean.patch
 Patch1:         koules-1.4-overflows.patch
 Patch2:         koules-1.4-spelling.patch
+Patch3:         koules-1.4-defines.patch
 
 # SVGAlib specific patches
 Patch10:        koules-1.4-retrace.patch
@@ -40,6 +41,10 @@
 Patch22:        koules-1.4-imake.patch
 Patch23:        koules-1.4-shm.patch
 Patch24:        koules-1.4-mode.patch
+Patch25:        koules-1.4-shm_check.patch
+Patch26:        koules-1.4-fix_xsynchronize.patch
+Patch27:        koules-1.4-use_right_visual.patch
+Patch28:        koules-1.4-fpe_fix.patch
 
 %description
 Koules is a fast action arcade-style game.  It works in fine resolution
@@ -97,6 +102,7 @@
 %patch0 -p1 -b .clean
 %patch1 -p1 -b .overflows
 %patch2 -p1 -b .spelling
+%patch3 -p1 -b .defines
 %patch10 -p1 -b .retrace
 %patch11 -p1 -b .make
 %endif
@@ -107,11 +113,16 @@
 %patch0 -p1 -b .clean
 %patch1 -p1 -b .overflows
 %patch2 -p1 -b .spelling
+%patch3 -p1 -b .defines
 %patch20 -p1 -b .noman
 %patch21 -p1 -b .asmfix
 %patch22 -p1 -b .imake
-%patch23 -p1 -b .shm
+#patch23 -p1 -b .shm
 %patch24 -p1 -b .mode
+%patch25 -p1 -b .shm_check
+%patch26 -p1 -b .fix_xsynchronize
+%patch27 -p1 -b .use_right_visual
+%patch28 -p1 -b .fpe_fix
 
 
 %build
@@ -190,6 +201,10 @@
 
 
 %changelog
+* Mon Apr 13 2009 Lubomir Rintel <lkundrak at v3.sk> 1.4-7
+- Debian apparently fixed shm more sanely than me
+- Import bunch of Debian fixes
+
 * Sun Apr 12 2009 Lubomir Rintel <lkundrak at v3.sk> 1.4-6
 - Wrap the OSS-based sound server in padsp
 




More information about the fedora-extras-commits mailing list