[comp.sources.bugs] Official patch #1 for sidtool

richb@sunk.oz (Rich Burridge) (05/02/87)

I've been meaning to put this out for two or three weeks, but
finding the time has been almost impossible.

Firstly, sidtool was compiled and tested on v3.2 of SunOS and
will work correctly work on v3.2 or later. I mentioned this in
the news Keywords line, but I should really have also stated it
in the README.  This is fixed in the patches below.

Tony Kusalik (kusalik@sask.bitnet) has retrofitted it back to
v3.0 (thanks Tony). Here are the things to look out for.

(1) Declarations for Pixfont should be changed to struct pixfont
(2) Declarations for Pixrect should be changed to struct pixrect
(3) Declarations for Pixwin should be changed to struct pixwin
(4) fcntl.h was in /usr/include in v3.0 not /usr/include/sys.
(5) In sid_main.c, remove the lines:
             CANVAS_FAST_MONO, TRUE,
    -and-    window_set(canvas, WIN_CONSUME_KBD_EVENTS, WIN_LEFT_KEYS, 0) ;

These are the ones Tony mentioned to me, and should solve most of
the problems. I do not support v3.0, so you are on your own.

A copy of the sidtool v2.1 distribution has been sent to the moderator
of mod.sources.games. Requests for individual files or the complete
archive should be directed to Bill.

  Bill Randle <billr@tekred.TEK.COM> <games-request@tekred.TEK.COM>

Official patch number 1 below fixes the following problems:

(1) Sidtool incorrectly uses the default font. This has been changed
    to use screen.r.14.
(2) All nine function keys (R7-R15) used to be remapped. This is no
    longer required under SunView. The code for this has also been
    tidied up.
(3) The Makefile incorrectly did a make install, when the release
    directory was not relative to the current directory.
(4) Not mentioning that sidtool was for v3.2 or later in the README.

My thanks to David St Pierre and Dan Heller for these changes.

**IMPORTANT NOTE**.
The sixth part of the patch, tries to patch images/Makefile. Using
Larry Wall's patch program this patch will be rejected. Please apply
by hand. If somebody could show me how you can use patch to apply
patches to files in a subdirectory, at the same time as applying
patches to files in the top directory, I would be grateful.


There is a known problem of sidtool leaving a bogus copy of the Sun
screen lying around when it's in eating mode, and it "eats", a pair
of eyes going back home to be reincarnated.

This is proving to be difficult to consistently recreate, so that
fix hopefully will be in the next set of patches.

Look out for a mouse "joystick" interface to sidtool, coming soon.

    Rich.

Rich Burridge,            JANET richb%sunk.oz@uk.ac.ucl.cs
ACSnet  richb@sunk.oz     UUCP {seismo,hplabs,ukc}!munnari!sunk.oz!richb
PHONE: +61 3 811 9927     ARPAnet richb%sunk.oz@seismo.css.gov
MAIL: Sun Microsystems, 123 Camberwell Rd, Hawthorn, VICTORIA 3122, AUST


--------CUT HERE--------
*** Makefile.old	Sat May  2 10:04:10 1987
--- Makefile	Sat May  2 10:55:49 1987
***************
*** 24,30 ****
  		cp README sidtool.maze sidtool.help	$(BINDIR)
  
  animate:
! 		(cd images; make BINDIR=../$(BINDIR) install)
  
  clean:
  		(cd images; make clean)
--- 24,30 ----
  		cp README sidtool.maze sidtool.help	$(BINDIR)
  
  animate:
! 		(cd images; make BINDIR=$(BINDIR) install)
  
  clean:
  		(cd images; make clean)
*** README.old	Sat Apr 25 14:27:45 1987
--- README	Sat Apr 25 14:29:03 1987
***************
*** 6,11 ****
--- 6,15 ----
  contains bugs (and features). Should you find any of these, I
  would be pleased to hear about them, and try to remove them.
  
+ This software will only work correctly with SunOS v3.2 or later.
+ With a small effort, it could probably be made to run under v3.0,
+ but this is not supported.
+ 
  SETUP.
  Note there is a #define in sidtool.h called SPEED. Experimentation
  with this should give a better timing for other machines such as 
*** patchlevel.h.old	Sat May  2 10:54:33 1987
--- patchlevel.h	Sat May  2 10:54:48 1987
***************
*** 1 ****
! #define  PATCHLEVEL  0
--- 1 ----
! #define  PATCHLEVEL  1
*** sid_main.c.old	Sat Apr 25 14:04:41 1987
--- sid_main.c	Sat Apr 25 14:14:05 1987
***************
*** 63,80 ****
         "Multiple Process Interaction"
       } ;
  
! char old_key_vals[9][MAXLINE] ;       /* Function key string values to save. */
! char new_key_vals[9][MAXLINE] =       /* Function key values used by SIDtool. */
       {
!        "",                   /* R7 */
!        "u",                  /* R8 */
!        "",                   /* R9 */
!        "l",                  /* R10 */
!        "",                   /* R11 */
!        "r",                  /* R12 */
!        "",                   /* R13 */
!        "d",                  /* R14 */
!        ""                    /* R15 */
       } ;
  
  char maze[XSIZE+2][YSIZE+2] ;
--- 63,75 ----
         "Multiple Process Interaction"
       } ;
  
! char old_key_vals[4][MAXLINE] ;       /* Function key string values to save. */
! char new_key_vals[4][MAXLINE] =       /* Function key values used by sidtool. */
       {
!        "u",                  /* R8  - UPARROW. */
!        "d",                  /* R14 - DOWNARROW. */
!        "l",                  /* R10 - LEFTARROW. */
!        "r",                  /* R12 - RIGHTARROW. */
       } ;
  
  char maze[XSIZE+2][YSIZE+2] ;
***************
*** 97,103 ****
  int dots[MAXNUMPLAYERS+1][XSIZE+4][YSIZE+2] ;
  int tunnel[XSIZE+4][YSIZE+2] ;
  
! int key_stations[9] = {68, 69, 70, 91, 92, 93, 112, 113, 114} ;
  
  int button ;            /* Indicates users selection from control panel. */
  int c ;                 /* Contains latest mouse or keyboard interaction. */
--- 92,98 ----
  int dots[MAXNUMPLAYERS+1][XSIZE+4][YSIZE+2] ;
  int tunnel[XSIZE+4][YSIZE+2] ;
  
! int key_stations[9] = {69, 113, 91, 93} ;
  
  int button ;            /* Indicates users selection from control panel. */
  int c ;                 /* Contains latest mouse or keyboard interaction. */
***************
*** 651,656 ****
--- 646,658 ----
    get_options(argc,argv) ;          /* Get command line options. */
    function_keys(KEY_SET) ;          /* Set direction arrow function keys. */
  
+   if ((pf = pf_open("/usr/lib/fonts/fixedwidthfonts/screen.r.14")) == NULL)
+     {
+       FPRINTF("Can't open screen.r.14 font.\n") ;
+       function_keys(KEY_RESET) ;
+       exit(1) ;
+     }
+ 
    base_frame = window_create(NULL, FRAME,
                               FRAME_LABEL, titlestring,
                               FRAME_ICON, &sid_icon,
***************
*** 658,663 ****
--- 660,666 ----
                               WIN_Y, orgy,
                               WIN_WIDTH, width,
                               WIN_HEIGHT, height,
+                              WIN_FONT, pf,
                               FRAME_ARGS, argc, argv,
                               0) ;
    canvas = window_create(base_frame, CANVAS,
***************
*** 671,677 ****
    window_set(canvas, WIN_CONSUME_KBD_EVENTS, WIN_LEFT_KEYS, 0) ;
    window_set(canvas,WIN_IGNORE_PICK_EVENT,LOC_MOVE,0) ;
  
-   pf = pf_default() ;
    pw = canvas_pixwin(canvas) ;
  
  /* Set up no delay for events within the canvas. */
--- 674,679 ----
*** sid_stuff.c.old	Sat Apr 25 14:14:30 1987
--- sid_stuff.c	Sat Apr 25 14:20:46 1987
***************
*** 15,20 ****
--- 15,21 ----
  #include <stdio.h>
  #include <strings.h>
  #include <setjmp.h>
+ #include <sundev/kbd.h>
  #include "bltstuff.h"
  #include "sidtool.h"
  #include <suntool/sunview.h>
***************
*** 257,263 ****
        case BUT_PLAYERS : numplayers = numplayers % 4 + 1 ;
                           display_settings() ;
                           break ;
!       case BUT_QUIT    : exit(0) ;
        case BUT_SCORES  : dohighscores() ;
                           break ;
        case BUT_START   : autoplay = FALSE ;
--- 258,265 ----
        case BUT_PLAYERS : numplayers = numplayers % 4 + 1 ;
                           display_settings() ;
                           break ;
!       case BUT_QUIT    : function_keys(KEY_RESET) ;
!                          exit(0) ;
        case BUT_SCORES  : dohighscores() ;
                           break ;
        case BUT_START   : autoplay = FALSE ;
***************
*** 531,537 ****
  int state ;
  
  {
!   int count = 176 ;         /* 0xB0 -- the starting entry for strings. */
    int fd,i ;
  
    if ((fd = open("/dev/kbd",0,0)) < 0)
--- 533,539 ----
  int state ;
  
  {
!   int count = STRING ;         /* 0xB0 -- the starting entry for strings. */
    int fd,i ;
  
    if ((fd = open("/dev/kbd",0,0)) < 0)
***************
*** 539,548 ****
        FPRINTF(stderr,"sidtool: can't open /dev/kbd\n") ;
        exit(1) ;
      }
!   for (i = 0; i < 9; i++)       /* Set up function keys R7-R15, saving old values. */
      {
!       if (state == KEY_SET) get_key(fd,key_stations[i],old_key_vals[i],count) ;
!       set_key(fd,key_stations[i],new_key_vals[i],count++) ;
      }
    CLOSE(fd) ;
  }
--- 541,554 ----
        FPRINTF(stderr,"sidtool: can't open /dev/kbd\n") ;
        exit(1) ;
      }
!   for (i = 0; i < 4; i++)       /* Set up function keys R7-R15, saving old values. */
      {
!       if (state == KEY_SET)
!         {
!           get_key(fd,key_stations[i],old_key_vals[i],STRING + 1 + i) ;
!           set_key(fd,key_stations[i],new_key_vals[i],STRING + 5 + i) ;
!         }
!       else set_key(fd,key_stations[i],old_key_vals[i],STRING + 1 + i) ;
      }
    CLOSE(fd) ;
  }
*** images/Makefile.old	Sat May  2 10:05:31 1987
--- images/Makefile	Sat May  2 10:10:08 1987
***************
*** 18,24 ****
  
  install:        all
  		animate
! 		cp sidtool.animate $(BINDIR)
  
  clean:
  		rm -f *~ *.o core animate sidtool.animate
--- 18,24 ----
  
  install:        all
  		animate
! 		(cd .. ; cp images/sidtool.animate $(BINDIR))
  
  clean:
  		rm -f *~ *.o core animate sidtool.animate
D
D
D