Relax the assumption that all joystick users will use a joystick for player 1.
Make support more consistent for joydevs 3 and 4.

--- snes9x/unix/unix.cpp
+++ snes9x/unix/unix.cpp
@@ -268,6 +268,20 @@
 	else
 	    S9xUsage ();
     }
+    else if (strcasecmp (argv [i], "-joydev3") == 0)
+    {
+	if (i + 1 < argc)
+	    js_device[2] = argv[++i];
+	else
+	    S9xUsage ();
+    }
+    else if (strcasecmp (argv [i], "-joydev4") == 0)
+    {
+	if (i + 1 < argc)
+	    js_device[3] = argv[++i];
+	else
+	    S9xUsage ();
+    }
     else if (strcasecmp (argv [i], "-joymap1") == 0)
     {
 	if (i + 8 < argc)
@@ -705,54 +719,42 @@
 #ifdef JSIOCGVERSION
     int version;
     unsigned char axes, buttons;
+    int i;
 
-    if ((js_fd [0] = open (js_device [0], O_RDONLY | O_NONBLOCK)) < 0)
-    {
-#ifdef DEBUGGER
-        perror (js_device [0]);
-#endif
-        fprintf(stderr, "joystick: No joystick found.\n");
-	return;
-    }
+    for (i = 0; i < 4; i++)
+        js_fd [i] = open (js_device [i], O_RDONLY | O_NONBLOCK);
 
-    if (ioctl (js_fd [0], JSIOCGVERSION, &version))
+    for (i = 0; i < 4; i++)
     {
-        fprintf(stderr, "joystick: You need at least driver version 1.0"
-                " for joystick support.\n");
-	close (js_fd [0]);
-	return;
+        if (js_fd [i] >= 0 && ioctl (js_fd [i], JSIOCGVERSION, &version))
+        {
+            fprintf(stderr, "joydev%d: You need at least driver version 1.0"
+                    " for joystick support.\n", i + 1);
+	    close (js_fd [i]);
+	    js_fd [i] = -1;
+        }
     }
-    js_fd [1] = open (js_device [1], O_RDONLY | O_NONBLOCK);
-    js_fd [2] = open (js_device [2], O_RDONLY | O_NONBLOCK);
-    js_fd [3] = open (js_device [3], O_RDONLY | O_NONBLOCK);
 
-#ifdef JSIOCGNAME
-    char name [130];
-    bzero (name, 128);
-    if (ioctl (js_fd [0], JSIOCGNAME(128), name) > 0) 
+    for (i = 0; i < 4; i++)
     {
-        printf ("Using %s (%s) as pad1", name, js_device [0]);
-        if (js_fd [1] > 0)
+	if (js_fd[i] < 0) continue;
+#ifdef JSIOCGNAME
+	char name [130];
+	bzero (name, 128);
+	if (ioctl (js_fd [i], JSIOCGNAME(128), name) > 0) 
 	{
-	    ioctl (js_fd [1], JSIOCGNAME(128), name);
-	    printf ("and %s (%s) as pad2", name, js_device [1]);
-	}
-    } 
-    else
+	    printf ("Using %s (%s) as pad%d", name, js_device [i], i + 1);
+	} 
+	else
 #endif
-    {
-	ioctl (js_fd [0], JSIOCGAXES, &axes);
-	ioctl (js_fd [0], JSIOCGBUTTONS, &buttons);
-	printf ("Using %d-axis %d-button joystick (%s) as pad1", axes, buttons, js_device [0]);
-	if (js_fd [1] > 0)
 	{
-	    ioctl (js_fd [0], JSIOCGAXES, &axes);
-	    ioctl (js_fd [0], JSIOCGBUTTONS, &buttons);
-	    printf (" and %d-axis %d-button (%s) as pad2", axes, buttons, js_device [1]);
+	    ioctl (js_fd [i], JSIOCGAXES, &axes);
+	    ioctl (js_fd [i], JSIOCGBUTTONS, &buttons);
+	    printf ("Using %d-axis %d-button joystick (%s) as pad%d", axes, buttons, js_device [i], i + 1);
 	}
-    }
 
-    puts (".");
+	puts (".");
+    }
 #endif
 }
 
@@ -762,8 +764,10 @@
     struct js_event js_ev;
     int i;
 
-    for (i = 0; i < 4 && js_fd [i] >= 0; i++)
+    for (i = 0; i < 4; i++)
     {
+        if (js_fd [i] < 0) continue;
+
 	while (read (js_fd[i], &js_ev, sizeof (struct js_event)) == sizeof (struct js_event) )
 	{
 	    switch (js_ev.type & ~JS_EVENT_INIT)