diff -r -U4 d024_midi/d_main.c d025_joystick/d_main.c
--- d024_midi/d_main.c	2023-02-10 05:38:07.746965447 -0600
+++ d025_joystick/d_main.c	2023-08-27 07:33:23.089936133 -0500
@@ -276,9 +276,9 @@
 #endif
 
 // Versioning
 #ifndef SVN_REV
-#define SVN_REV "1648"
+#define SVN_REV "1649"
 #endif
 
 
 // Version number: major.minor.revision
diff -r -U4 d024_midi/djgppdos/I_system.c d025_joystick/djgppdos/I_system.c
--- d024_midi/djgppdos/I_system.c	2020-11-29 05:51:00.184940000 -0600
+++ d025_joystick/djgppdos/I_system.c	2023-08-27 07:40:46.452902528 -0500
@@ -189,16 +189,20 @@
 {
     return ticcount;
 }
 
-byte joystick_detected=false;
+// Joystick support is enabled in doomdef.h
+#ifdef JOYSTICK_SUPPORT
+byte joystick_detected = false;
 JoyType_t   Joystick;
+#endif
 
 //
 // I_Init
 //
 
 
+#ifdef JOYSTICK_SUPPORT
 void I_WaitJoyButton (void)
 {
      CON_Drawer ();
      I_FinishUpdate ();        // page flip or blit buffer
@@ -209,10 +213,12 @@
 
      while (joy_b1 || joy_b2)
          poll_joystick();
 }
+#endif
 
 
+#ifdef JOYSTICK_SUPPORT
 void I_InitJoystick (void)
 {
     //init the joystick
     joystick_detected=0;
@@ -265,8 +271,9 @@
             CONS_Printf("\2No Joystick detected.\n");
         }
     }
 }
+#endif
 
 
 
 
@@ -716,13 +723,14 @@
           D_PostEvent(&event);
         }
 
     }
+#ifdef JOYSTICK_SUPPORT
     //joystick
     if (joystick_detected)
     {
-        static int lastjoybuttons=0;
-        int joybuttons;
+        static unsigned int last_joybuttons=0;
+        unsigned int joybuttons;
 
         poll_joystick();
         // I assume that true is 1
         joybuttons=joy_b1+(joy_b2<<1)+(joy_b3<<2)+(joy_b4<<3)
@@ -735,44 +743,46 @@
           case JOY_HAT_RIGHT: joybuttons|=1<<13;break;
         }
 
         // post key event for buttons
-        if(joybuttons!=lastjoybuttons)
+        unsigned int djoy = (joybuttons ^ lastjoybuttons); // only those that changed
+        if (djoy)
         {
-            int j=1,k;
-            k=(joybuttons ^ lastjoybuttons); // only changed bit to 1
-            lastjoybuttons=joybuttons;
+            last_joybuttons = joybuttons;
 
-            for(i=0;i<JOYBUTTONS;i++,j<<=1)
+            unsigned int jm=1;  // joy button bit mask
+            int i;  // joy button index
+            for(i=0; i<JOYBUTTONS; i++,jm<<=1)  // step through the joysticks by bit mask
 	    {
-                if(k & j) // test each bit and post the corresponding event
+                if(djoy & jm) // test each bit and post the corresponding event
                 {
-                    if(joybuttons & j)
-                       event.type=ev_keydown;
+                    if(joybuttons & jm)
+                       event.type = ev_keydown;
                     else
-                       event.type=ev_keyup;
-                    event.data1=KEY_JOY0BUT0+i;
+                       event.type = ev_keyup;
+                    event.data1 = KEY_JOY0BUT0 + i;
                     D_PostEvent(&event);
                 }
 	    }
         }
 
-        event.type=ev_joystick;
-        event.data1=0;
-        event.data2=0;
-        event.data3=0;
+        event.type = ev_joystick;
+        event.data1 = 0;
+        event.data2 = 0;
+        event.data3 = 0;
 
         if(joy_left)
-           event.data2=-1;
+           event.data2 = -1;
         if(joy_right)
-           event.data2=1;
+           event.data2 = 1;
         if(joy_up)
-           event.data3=-1;
+           event.data3 = -1;
         if(joy_down)
-           event.data3=1;
+           event.data3 = 1;
 
         D_PostEvent(&event);
     }
+#endif
 }
 
 //
 //  Timer user routine called at ticrate.
@@ -1153,19 +1163,23 @@
     CONS_Printf("DOS system ...\n");
 
     I_StartupSystem();
 
+#ifdef JOYSTICK_SUPPORT
     // Initialize the joystick subsystem.
     I_InitJoystick();
+#endif
 
     // d_main will next call I_StartupGraphics
 }
 
 
 // Shutdown joystick and other interfaces, before I_ShutdownGraphics.
 void I_Shutdown_IO(void)
 {
+#ifdef JOYSTICK_SUPPORT
 //    I_ShutdownJoystick();
+#endif
 }
 
 //added:08-01-98:
 //
Only in d025_joystick/djgppdos: I_system.c~
diff -r -U4 d024_midi/doomdef.h d025_joystick/doomdef.h
--- d024_midi/doomdef.h	2022-11-21 07:18:40.044974579 -0600
+++ d025_joystick/doomdef.h	2023-08-27 07:41:23.292899736 -0500
@@ -191,8 +191,11 @@
 #define MUSIC_SELECT_ALT_IS_SILENCE
 #endif
 #endif
 
+// Ability to disable joystick.
+#define JOYSTICK_SUPPORT
+
 // Coronas in dynlights
 #define DYLT_CORONAS
 // Coronas drawn with sprite draw
 #define SPDR_CORONAS
diff -r -U4 d024_midi/g_game.c d025_joystick/g_game.c
--- d024_midi/g_game.c	2022-11-21 07:31:30.279291422 -0600
+++ d025_joystick/g_game.c	2023-08-27 07:42:41.597893800 -0500
@@ -141,8 +141,9 @@
 // This only changes the demo header, not the content.
 // Writes demoversion 143 and up, and can read any DoomLegacy demo.
 // Older DoomLegacy demos are demo versions 111..143.
 
+
 #include "doomincl.h"
 #include "doomstat.h"
 #include "command.h"
 #include "console.h"
@@ -1003,15 +1004,13 @@
 
 //  pind : player index, [0]=main player, [1]=splitscreen player
 void G_BuildTiccmd(ticcmd_t* cmd, int realtics, byte pind)
 {
-    int         i;
-    
-    ticcmd_t *base = I_BaseTiccmd ();             // empty, or external driver
+    ticcmd_t * base = I_BaseTiccmd ();             // empty, or external driver
     memcpy (cmd,base,sizeof(*cmd));
 
     
-    player_t *this_player;
+    player_t * this_player;
     int (*gcc)[2];
 
 #define G_KEY_DOWN(k) (gamekeydown[gcc[(k)][0]] || gamekeydown[gcc[(k)][1]])
 #define G_KEY_PRESSED(k) (G_KEY_DOWN(k) || gamekeytapped[gcc[(k)][0]] || gamekeytapped[gcc[(k)][1]])
@@ -1101,18 +1100,22 @@
       cmd->buttons |= NextWeapon(this_player,-1);
     else if (G_KEY_PRESSED(gc_bestweapon))
       cmd->buttons |= BestWeapon(this_player);
     else
-    for (i=gc_weapon1; i<gc_weapon1+NUMWEAPONS-1; i++)
     {
-        if (G_KEY_PRESSED(i))
+        int ki;
+        for (ki=gc_weapon1; ki<gc_weapon1+NUMWEAPONS-1; ki++)
         {
-            cmd->buttons |= BT_CHANGE | BT_EXTRAWEAPON; // extra by default
-            cmd->buttons |= (i-gc_weapon1)<<BT_WEAPONSHIFT;
-            // already have extraweapon in hand switch to the normal one
-            if (this_player->readyweapon == extraweapons[i-gc_weapon1])
-                cmd->buttons &= ~BT_EXTRAWEAPON;
-            break;
+            if (G_KEY_PRESSED(ki))
+            {
+                int wix = ki - gc_weapon1;
+                cmd->buttons |= BT_CHANGE | BT_EXTRAWEAPON; // extra by default
+                cmd->buttons |= wix<<BT_WEAPONSHIFT;
+                // already have extraweapon in hand switch to the normal one
+                if (this_player->readyweapon == extraweapons[wix])
+                    cmd->buttons &= ~BT_EXTRAWEAPON;
+                break;
+            }
         }
     }
 
 
@@ -1191,21 +1194,23 @@
 
       mouse2x = mouse2y = 0;
     }
 
+#ifdef JOYSTICK_SUPPORT
     // Finally the joysticks.
-    for (i=0; i < num_joybindings; i++)
+    int ji;
+    for (ji=0; ji < num_joybindings; ji++)
     {
-      joybinding_t j = joybindings[i];
+      joybinding_t jb = joybindings[ji];
 
-      if (j.playnum != pind)
+      if (jb.playnum != pind)
         continue;
 
-      int joyvalue = I_JoystickGetAxis(j.joynum, j.axisnum);
+      int joyvalue = I_JoystickGetAxis(jb.joynum, jb.axisnum);
       if( joyvalue >= -cv_joy_deadzone.value && joyvalue <= cv_joy_deadzone.value)  joyvalue = 0; // Deadzone
-      int value = (int)(j.scale * joyvalue);
+      int value = (int)(jb.scale * joyvalue);
 
-      switch (j.action)
+      switch (jb.action)
       {
         case ja_pitch:
           pitch = value << 16;
           break;
@@ -1223,8 +1228,9 @@
         default:
           break;
       }
     }
+#endif
 
 
     // Do not go faster than max. speed
     if (forward > MAXPLMOVE)
diff -r -U4 d024_midi/g_input.c d025_joystick/g_input.c
--- d024_midi/g_input.c	2022-03-03 22:29:44.628993000 -0600
+++ d025_joystick/g_input.c	2023-08-27 07:42:55.570892741 -0500
@@ -61,10 +61,13 @@
 #include "console.h"
 #include "i_joy.h"
 #include "i_system.h"
 
+
+#ifdef JOYSTICK_SUPPORT    
 int num_joybindings = 0;
 joybinding_t joybindings[MAX_JOYBINDINGS];
+#endif
 
 
 CV_PossibleValue_t mousesens_cons_t[]={{1,"MIN"},{MAXMOUSESENSITIVITY,"MAXCURSOR"},{INT_MAX,"MAX"},{0,NULL}};
 CV_PossibleValue_t onecontrolperkey_cons_t[]={{1,"One"},{2,"Several"},{0,NULL}};
@@ -122,11 +125,13 @@
 
 // A normal double click is approx. 6 tics from previous click.
 CV_PossibleValue_t double_cons_t[]={{1,"MIN"},{40,"MAX"},{0,NULL}};  // double click threshold
 consvar_t  cv_mouse_double   = {"mousedouble","8",CV_SAVE, double_cons_t};
+#ifdef JOYSTICK_SUPPORT
 #ifdef JOY_BUTTONS_DOUBLE
 consvar_t  cv_joy_double     = {"joydouble",  "8",CV_SAVE, double_cons_t};
 #endif
+#endif
 
 
 // Called for cv_grabinput, cv_mouse_motion, use_mouse
 void  CV_mouse_OnChange( void )
@@ -157,11 +162,13 @@
 } dclick_t;
 
 // FIXME: only one mouse, only one joy
 static  dclick_t  mouse_dclick[MOUSEBUTTONS];
+#ifdef JOYSTICK_SUPPORT
 #ifdef JOY_BUTTONS_DOUBLE
 static  dclick_t  joy_dclick[JOYBUTTONS];
 #endif
+#endif
 
 static tic_t  clicktic = 0;  // gametic of last button check
 static unsigned int  click_delta;  // tics since last button check, limited 120
 
@@ -263,14 +270,16 @@
     // FIXME: first MOUSE only
     for (i=0;i<MOUSEBUTTONS;i++)
       gamekeydown[KEY_MOUSE1DBL+i] = G_CheckDoubleClick( KEY_MOUSE1+i, &mouse_dclick[i], cv_mouse_double.value );
 
+#ifdef JOYSTICK_SUPPORT
 #ifdef JOY_BUTTONS_DOUBLE
     // joystick doubleclicks
     // FIXME: JOY0 only
     for (i=0;i<JOYBUTTONS;i++)
       gamekeydown[KEY_JOY0BUT0DBL+i] = G_CheckDoubleClick( KEY_JOY0BUT0+i, &joy_dclick[i], cv_joy_double.value );
 #endif
+#endif
 }
 
 
 
@@ -385,8 +394,10 @@
   {KEY_MOUSE2DBL+5,"mouse2 6 d"},
   {KEY_MOUSE2DBL+6,"mouse2 7 d"},
   {KEY_MOUSE2DBL+7,"mouse2 8 d"},
 
+#ifdef JOYSTICK_SUPPORT
+  // This is translation table, index does not matter, so this can be optional.
   {KEY_JOY0BUT0, "Joy0 b0"},
   {KEY_JOY0BUT1, "Joy0 b1"},
   {KEY_JOY0BUT2, "Joy0 b2"},
   {KEY_JOY0BUT3, "Joy0 b3"},
@@ -484,8 +495,9 @@
   {KEY_JOY2RIGHTTRIGGER, "Joy2 rt"},
   
   {KEY_JOY3LEFTTRIGGER, "Joy3 lt"},
   {KEY_JOY3RIGHTTRIGGER, "Joy3 rt"},
+#endif
 };
 
 // Index gamecontrols_e
 char *gamecontrolname[num_gamecontrols] =
@@ -703,15 +715,17 @@
         else
             fprintf(f,"\n");
     }
 
+#ifdef JOYSTICK_SUPPORT    
     // Writes the joystick axis binding commands to the config file.
     for (i=0; i<num_joybindings; i++)
     {
-        joybinding_t j = joybindings[i];
+        joybinding_t jb = joybindings[i];
         fprintf(f, "bindjoyaxis %d %d %d %d %f\n",
-                j.joynum, j.axisnum, j.playnum, (int)(j.action), j.scale);
+                jb.joynum, jb.axisnum, jb.playnum, (int)(jb.action), jb.scale);
     }
+#endif
 }
 
 void G_CheckDoubleUsage(int keynum)
 {
@@ -781,26 +795,29 @@
 
 //! Magically converts a console command to a joystick axis binding. Also releases bindings.
 void Command_BindJoyaxis_f()
 {
-  joybinding_t j;
-  unsigned int i;
+#ifdef JOYSTICK_SUPPORT
+  joybinding_t jb;
   COM_args_t  carg;
     
   COM_Args( &carg );
 
   if(carg.num == 1)
   { // Print bindings.
     CONS_Printf("%d joysticks found.\n", num_joysticks);
-    if(num_joybindings == 0) {
+    if(num_joybindings == 0)
+    {
       CONS_Printf("No joystick axis bindings defined.\n");
       return;
     }
     CONS_Printf("Current axis bindings.\n");
-    for(i=0; i<num_joybindings; i++) {
-      j = joybindings[i];
-      CONS_Printf("%d %d %d %d %f\n", j.joynum, j.axisnum,
-                  j.playnum, (int)j.action, j.scale);
+    unsigned int i;
+    for(i=0; i<num_joybindings; i++)
+    {
+      jb = joybindings[i];
+      CONS_Printf("%d %d %d %d %f\n", jb.joynum, jb.axisnum,
+                  jb.playnum, (int)jb.action, jb.scale);
     }
     return;
   }
 
@@ -810,19 +827,19 @@
                 "bindjoyaxis [joynum] [axisnum]  to unbind\n");
     return;
   }
 
-  j.joynum  = atoi( carg.arg[1] );
-  if(j.joynum < 0 || j.joynum >= num_joysticks)
+  jb.joynum  = atoi( carg.arg[1] );
+  if(jb.joynum < 0 || jb.joynum >= num_joysticks)
   {
-    CONS_Printf("Attempting to bind/release non-existent joystick %d.\n", j.joynum);
+    CONS_Printf("Attempting to bind/release non-existent joystick %d.\n", jb.joynum);
     return;
   }
 
-  j.axisnum = (carg.num >= 3) ? atoi( carg.arg[2] ) : -1;
-  if(j.axisnum < -1 || j.axisnum >= I_JoystickNumAxes(j.joynum))
+  jb.axisnum = (carg.num >= 3) ? atoi( carg.arg[2] ) : -1;
+  if(jb.axisnum < -1 || jb.axisnum >= I_JoystickNumAxes(jb.joynum))
   {
-    CONS_Printf("Attempting to bind/release non-existent axis %d.\n", j.axisnum);
+    CONS_Printf("Attempting to bind/release non-existent axis %d.\n", jb.axisnum);
     return;
   }
 
   if (carg.num == 3)
@@ -844,10 +861,10 @@
     unsigned int i;
     for(i=0; i<num_joybindings; i++)
     {
       joybinding_t temp = joybindings[i];
-      if((j.joynum == temp.joynum) &&
-         (j.axisnum == -1 || j.axisnum == temp.axisnum))
+      if((jb.joynum == temp.joynum) &&
+         (jb.axisnum == -1 || jb.axisnum == temp.axisnum))
         continue; // We have a binding to prune.
 
       keep_bindings[num_keep_bindings++] = temp; // keep it
     }
@@ -865,40 +882,42 @@
       joybindings[i] = keep_bindings[i];
   }
   else
   { // create a binding
-    j.playnum = atoi( carg.arg[3] );
+    jb.playnum = atoi( carg.arg[3] );
     // carg.arg[0..3] only, use COM_Argv for others
     int j_action  = atoi(COM_Argv(4));
     if (carg.num == 6)
-      j.scale = atof(COM_Argv(5));
+      jb.scale = atof(COM_Argv(5));
     else
-      j.scale = 1.0f;
+      jb.scale = 1.0f;
 
     if(j_action < 0 || j_action >= num_joyactions)
     {
       CONS_Printf("Attempting to bind non-existent action %d.\n", j_action);
       return;
     }
-    j.action = (joyactions_e)j_action;  // test actual value before convert to enum
+    jb.action = (joyactions_e)j_action;  // test actual value before convert to enum
 
     // Overwrite existing binding, if any. Otherwise just append.
+    unsigned int i;
     for(i=0; i<num_joybindings; i++)
     {
       joybinding_t j2 = joybindings[i];
-      if(j2.joynum == j.joynum && j2.axisnum == j.axisnum)
+      if(j2.joynum == jb.joynum && j2.axisnum == jb.axisnum)
       {
-        joybindings[i] = j;
+        joybindings[i] = jb;
         CONS_Printf("Joystick binding modified.\n");
         return;
       }
     }
     // new binding
     if (num_joybindings < MAX_JOYBINDINGS)
     {
-        joybindings[num_joybindings++] = j;
+        joybindings[num_joybindings++] = jb;
         CONS_Printf("Joystick binding added.\n");
     }
     else
       CONS_Printf("Maximum number of joystick bindings reached.\n");
   }
+#endif
 }
diff -r -U4 d024_midi/linux_x/i_system.c d025_joystick/linux_x/i_system.c
--- d024_midi/linux_x/i_system.c	2022-04-03 11:23:17.664403476 -0500
+++ d025_joystick/linux_x/i_system.c	2023-08-27 07:43:25.903890442 -0500
@@ -159,8 +159,9 @@
 // holds wad path
 static char returnWadPath[256];
 #endif
 
+#ifdef JOYSTICK_SUPPORT
 #ifdef LJOYSTICK
 
 #define MAX_JOYAXES 3
 typedef struct {
@@ -183,11 +184,15 @@
 "/dev/input/js3",
 };
 
 #endif
+#endif
+
+#ifdef JOYSTICK_SUPPORT
 //JoyType_t Joystick;
 // must exist, even when LJOYSTICK off
 int num_joysticks = 0;
+#endif
 
 #ifdef MOUSE2_NIX
 int mouse2_fd = -1;
 byte mouse2_started = 0;
@@ -236,8 +241,9 @@
     
     return rc; 
 }
 
+#ifdef JOYSTICK_SUPPORT
 #ifdef LJOYSTICK
 
 #if 0
 // [WDJ] Old joystick code, scale is now handled in g_game.c
@@ -253,12 +259,16 @@
   struct js_event jdata;
   static event_t event = {0,0,0,0};
   static int buttons = 0;
   int i;
-  if(!joystick_started) return;
+
+  if(!joystick_started)
+      return;
+
   for(i=0; i<num_joysticks; i++)  // all joysticks found
   {
-   while(read( joystk[i].fd, &jdata, sizeof(jdata)) != -1) {
+   while(read( joystk[i].fd, &jdata, sizeof(jdata)) != -1)
+   {
     switch(jdata.type) {
     case JS_EVENT_AXIS:
 #if 1
       // [WDJ] Polled joystick
@@ -302,10 +312,10 @@
         }
       }
       break;
     }
-   }
-  }
+   }  // while
+  } // for
 }
 
 static void I_ShutdownJoystick(void)
 {
@@ -320,9 +330,9 @@
   joystick_started = 0;
 }
 
 // open the next joystick
-boolean joy_open(char *fname)
+static boolean joy_open(char * fname)
 {
 #define JOYNAME_LEN 511
   char * joyname[JOYNAME_LEN+1];
   int joyaxes;
@@ -339,8 +349,9 @@
     CONS_Printf("Not enought axes?\n");
     close(joyfd);
     return 0;
   }
+
   // Record the joystick
   if( num_joysticks >= MAX_JOYSTICK )  return 0;
   joystk[num_joysticks].fd = joyfd;
   joystk[num_joysticks].numaxes = joyaxes;
@@ -385,9 +396,11 @@
     }
   }
   }*/
 #endif
+#endif
 
+#ifdef JOYSTICK_SUPPORT
 void I_InitJoystick (void)
 {
 #ifdef LJOYSTICK
   int i;
@@ -425,8 +438,9 @@
     }
 #endif
     return 0;
 }
+#endif
 
 
 #ifdef MOUSE2
 // always MOUSE2_NIX
@@ -1317,9 +1331,11 @@
 void I_SysInit(void)
 {
   CONS_Printf("Linux X11 system ...\n");
 
+#ifdef JOYSTICK_SUPPORT
   // Initialize the joystick subsystem.
   I_InitJoystick();
+#endif
   
   // d_main will next call I_StartupGraphics
 }
diff -r -U4 d024_midi/m_menu.c d025_joystick/m_menu.c
--- d024_midi/m_menu.c	2022-11-21 07:35:19.752406554 -0600
+++ d025_joystick/m_menu.c	2023-08-27 07:43:44.094889063 -0500
@@ -566,9 +566,12 @@
   VideoModeDef, VideoOptionsDef, DrawmodeDef, MouseOptionsDef,
   PlayerDirectorDef, PlayerOptionsDef,
   SingleMultiDef, TwoPlayerDef, MultiPlayerDef, SetupMultiPlayerDef,
   ReadDef2, ReadDef1, SaveDef, LoadDef, 
-  ControlDef, ControlDef2, ControlDef3, MControlDef, JoystickOptionsDef,
+  ControlDef, ControlDef2, ControlDef3, MControlDef,
+#ifdef JOYSTICK_SUPPORT
+  JoystickOptionsDef,
+#endif
   OptionsDef, EffectsOption1Def, EffectsOption2Def, AdvOption1Def, AdvOption2Def,
   GameOptionDef, MenuOptionsDef, LightingDef, BotDef,
   NetOptionDef, ConnectOptionDef, ServerOptionsDef,
   MPOptionDef;
@@ -2392,8 +2395,9 @@
     60,40,
     0
 };
 
+#ifdef JOYSTICK_SUPPORT
 //===========================================================================
 //                        Joystick OPTIONS MENU
 //===========================================================================
 
@@ -2419,9 +2423,10 @@
     sizeof(JoystickOptionsMenu)/sizeof(menuitem_t),
     60,40,
     0
 };
-   
+#endif
+
 //===========================================================================
 //                        Game OPTIONS MENU
 //===========================================================================
 
@@ -2942,9 +2947,11 @@
     {IT_SUBMENU | IT_WHITESTRING, 0,"Mouse Options >>" ,&MouseOptionsDef   , 'm'},
     {IT_SUBMENU | IT_WHITESTRING, 0,"Second Mouse config >>", &SecondMouseCfgdef, 0},
     {IT_CALL | IT_WHITESTRING, 0,"Player1 Controls >>", M_Setup_P1_Controls, '1'},
     {IT_CALL | IT_WHITESTRING, 0,"Player2 Controls >>", M_Setup_P2_Controls, '2'},
+#ifdef JOYSTICK_SUPPORT   
     {IT_SUBMENU | IT_WHITESTRING, 0,"Joystick Options >>" ,&JoystickOptionsDef   , 'j'},
+#endif
 };
 
 menu_t  MControlDef =
 {
@@ -3206,22 +3213,19 @@
                 goto done;
             }
 #endif
 
+#ifdef JOYSTICK_SUPPORT
 #ifdef JOY_BUTTONS_DOUBLE
-#if 1
             else if( ch>=KEY_JOY0BUT0 && ch<=(KEY_JOYLAST) )  // all JOY input
-#else
-            // FIXME: JOY0 only
-            else if (ch>=KEY_JOY0BUT0 && ch<=(KEY_JOY0BUT0+JOYBUTTONS))  // one JOY
-#endif
             {
                 // Change to joystick doubleclicks.
                 // Spacing of JOYxBUTn to JOYxBUTnDBL is uniform for all JOY and all BUT.
                 setupcontrols[control][found] = ch + (KEY_JOY0BUT0DBL - KEY_JOY0BUT0);
                 goto done;
             }
 #endif
+#endif
         }
 
         // Direct replacement is default.
         {
diff -r -U4 d024_midi/macos/i_input_mac.c d025_joystick/macos/i_input_mac.c
--- d024_midi/macos/i_input_mac.c	2015-05-22 13:40:52.371135000 -0500
+++ d025_joystick/macos/i_input_mac.c	2023-08-27 07:44:15.001886721 -0500
@@ -256,11 +256,13 @@
 }
 
 static boolean ISpConfigured = false;
 
+#ifdef JOYSTICK_SUPPORT
 void I_InitJoystick (void)
 {
 }
+#endif
 
 void I_StartupMouse2 (void)
 {
 }
diff -r -U4 d024_midi/macos/i_system.c d025_joystick/macos/i_system.c
--- d024_midi/macos/i_system.c	2021-02-04 05:26:49.812421000 -0600
+++ d025_joystick/macos/i_system.c	2023-08-27 07:44:27.649885762 -0500
@@ -37,10 +37,12 @@
 #include "g_game.h"
 #include "g_input.h"
 #include "i_joy.h"
 
-JoyType_t Joystick;
 
+#ifdef JOYSTICK_SUPPORT
+JoyType_t Joystick;
+#endif
 
 uint16_t scantokey [128] =
 {
   '=',  '9',  '7',  '-',  '8',  '0',  ']',  'o',
@@ -349,11 +351,13 @@
 
 // Shutdown joystick and other interfaces, before I_ShutdownGraphics.
 void I_Shutdown_IO(void)
 {
+#ifdef JOYSTICK_SUPPORT
 #ifdef LJOYSTICK
     I_ShutdownJoystick();
 #endif
+#endif
 }
 
 void I_ShutdownSystem(void)
 {
diff -r -U4 d024_midi/os2/I_system.c d025_joystick/os2/I_system.c
--- d024_midi/os2/I_system.c	2021-02-04 05:26:49.812421000 -0600
+++ d025_joystick/os2/I_system.c	2023-08-27 07:45:08.147882692 -0500
@@ -69,20 +69,27 @@
 #endif
 #include "i_system.h"
 #include "i_joy.h"
 
+
+#ifdef JOYSTICK_SUPPORT
 JoyType_t Joystick;
+#endif
 
 byte    mb_used = 12;
 
 // Do not execute cleanup code more than once. See Shutdown_xxx() routines.
 byte    keyboard_started=0;
 byte    sound_started=0;
 boolean timer_started = false;
 boolean mouse_enabled = false;
+#ifdef JOYSTICK_SUPPORT
 boolean joystick_detected;
+#endif
 
+#ifdef JOYSTICK_SUPPORT
 void I_InitJoystick (void) {}
+#endif
 // Called on video mode change, usemouse change, mousemotion change,
 // and game paused.
 //   play_mode : enable mouse containment during play
 void I_StartupMouse( boolean play_mode ) {};
@@ -236,15 +243,19 @@
 // Post new events for all sorts of user-input
 // ----------
 static void I_GetKeyboardEvents (void);
 static void I_GetMouseEvents (void);
+#ifdef JOYSTICK_SUPPORT
 static void I_GetJoystickEvents (void);
+#endif
 
 void I_GetEvent (void)
 {
    I_GetKeyboardEvents();
    //I_GetMouseEvents();
+#ifdef JOYSTICK_SUPPORT
    //I_GetJoystickEvents();
+#endif
 }
 
 
 static event_t ev_alt_up = { ev_keyup, KEY_LALT, 0, 0 };
@@ -468,9 +479,11 @@
 
 // Shutdown joystick and other interfaces, before I_ShutdownGraphics.
 void I_Shutdown_IO(void)
 {
+#ifdef JOYSTICK_SUPPORT
 //    I_ShutdownJoystick();
+#endif
 }
 
 //  Closes down everything. This includes restoring the initial
 //  pallete and video mode, and removing whatever mouse, keyboard, and
@@ -499,9 +512,9 @@
 
 char *I_GetUserName(void)
 {
 static char username[MAXPLAYERNAME];
-     char  *p;
+     char * p;
      if((p=getenv("USER"))==NULL)
          if((p=getenv("user"))==NULL)
             if((p=getenv("USERNAME"))==NULL)
                if((p=getenv("username"))==NULL)
diff -r -U4 d024_midi/win32/win_sys.c d025_joystick/win32/win_sys.c
--- d024_midi/win32/win_sys.c	2022-04-03 14:30:41.001368850 -0500
+++ d025_joystick/win32/win_sys.c	2023-08-27 07:45:42.069880121 -0500
@@ -143,9 +143,11 @@
 boolean timer_started = false;
 boolean mouse_enabled = false;
 
 static void I_ShutdownKeyboard (void);
+#ifdef JOYSTICK_SUPPORT
 static void I_ShutdownJoystick (void);
+#endif
 
 //
 // Force feedback here ? :)
 //
@@ -343,16 +345,20 @@
 // Post new events for all sorts of user-input
 // ----------
 static void I_GetKeyboardEvents (void);
 static void I_GetMouseEvents (void);
+#ifdef JOYSTICK_SUPPORT
 static void I_GetJoystickEvents (void);
+#endif
 
 
 void I_GetEvent (void)
 {
     I_GetKeyboardEvents ();
     I_GetMouseEvents ();
+#ifdef JOYSTICK_SUPPORT
     I_GetJoystickEvents ();
+#endif
 }
 
 
 // ----------
@@ -1396,8 +1402,9 @@
     }
 }
 
 
+#ifdef JOYSTICK_SUPPORT
 // ===========================================================================
 //                                                DIRECT INPUT JOYSTICK
 // ===========================================================================
 
@@ -1425,8 +1432,9 @@
 
 static byte joystick_detect = 0;
 int num_joysticks = 0;
 //byte joystick_started = 0;
+#endif
 
 
 // ------------------
 // SetDIDwordProperty ( HELPER )
@@ -1449,8 +1457,9 @@
     return pdev->lpVtbl->SetProperty( pdev, guidProperty, &dipdw.diph );
 }
 
 
+#ifdef JOYSTICK_SUPPORT
 // ---------------
 // DIEnumJoysticks
 // There is no such thing as a 'system' joystick, contrary to mouse,
 // we must enumerate joysticks.
@@ -1621,11 +1630,13 @@
     CONS_Printf ("DIEnumJoysticks(): %s\n", reason);
 retcont:
     return DIENUM_CONTINUE;
 }
+#endif
 
 
 
+#ifdef JOYSTICK_SUPPORT
 // --------------
 // I_InitJoystick
 // --------------
 
@@ -1928,8 +1939,9 @@
 {
     return ((joynum < num_joysticks) && (axisnum < joystk[joynum].numaxes)) ?
            joystk[joynum].axis[axisnum] : 0;
 }
+#endif
 
 
 
 // ===========================================================================
@@ -2291,9 +2303,11 @@
 
 // Shutdown joystick and other interfaces, before I_ShutdownGraphics.
 void I_Shutdown_IO(void)
 {
+#ifdef JOYSTICK_SUPPORT
 //    I_ShutdownJoystick();
+#endif
 }
 
 //  Closes down everything. This includes restoring the initial
 //  palette and video mode, and removing whatever mouse, keyboard, and
@@ -2321,10 +2335,12 @@
     I_StartupSystem();
    
     I_StartupKeyboard();
 
+#ifdef JOYSTICK_SUPPORT
     // Initialize the joystick subsystem.
     I_InitJoystick();
+#endif
 
     // d_main will next call I_StartupGraphics
 }
    
