*** drivers/svgalib/joystick.c	Sun Oct 28 12:19:32 2001
--- ../../fceu/drivers/svgalib/joystick.c	Mon Nov 26 23:53:43 2001
***************
*** 1,5 ****
  static int joy[4]={0,0,0,0};
! static int joyBMap[4][4];
  static int32 joybuttons[4]={0,0,0,0};
  static int32 joyx[4]={0,0,0,0};
  static int32 joyy[4]={0,0,0,0};
--- 1,5 ----
  static int joy[4]={0,0,0,0};
! static int joyBMap[4][6];
  static int32 joybuttons[4]={0,0,0,0};
  static int32 joyx[4]={0,0,0,0};
  static int32 joyy[4]={0,0,0,0};
***************
*** 52,57 ****
--- 52,64 ----
  
    if(!joy[x]) continue;
    UpdateJoyData(x);
+ 
+   /* Handle save/load from joystick */
+   if( joym[ 4 ] == joybuttons[ x ] )
+ 	  DriverInterface(DES_SAVESTATE,0);
+   if( joym[ 5 ] == joybuttons[ x ] )
+ 	  DriverInterface(DES_LOADSTATE,0);
+ 
    for(y=0;y<4;y++)
     if(joybuttons[x]&joym[y]) ret|=(1<<y)<<(x<<3);
    if(joyx[x]<=-16383) ret|=JOY_LEFT<<(x<<3);
***************
*** 175,180 ****
--- 182,193 ----
  
    printf("%s\"A\".\n",genb);
    BConfig(z,0);
+ 
+   printf("%s\"Save State\".\n",genb);
+   BConfig(z,4);
+ 
+   printf("%s\"Load State\".\n",genb);
+   BConfig(z,5);
  
    fcntl(fileno(stdin),F_SETFL,sa);
  }
