added hot-plug support for game controllers and joysticks
[rocksndiamonds.git] / src / libgame / sdl.c
index 5586628b40dabf1385a5ae09472828f079e5501b..d6cf2b1779082a6a5b9d418273fe95c91add3ca7 100644 (file)
@@ -2734,6 +2734,22 @@ void HandleJoystickEvent(Event *event)
   switch(event->type)
   {
 #if defined(TARGET_SDL2)
+    case SDL_CONTROLLERDEVICEADDED:
+#if 1
+      Error(ERR_DEBUG, "SDL_CONTROLLERDEVICEADDED: device %d added",
+           event->cdevice.which);
+#endif
+      InitJoysticks();
+      break;
+
+    case SDL_CONTROLLERDEVICEREMOVED:
+#if 1
+      Error(ERR_DEBUG, "SDL_CONTROLLERDEVICEREMOVED: device %d removed",
+           event->cdevice.which);
+#endif
+      InitJoysticks();
+      break;
+
     case SDL_CONTROLLERAXISMOTION:
 #if 1
       Error(ERR_DEBUG, "SDL_CONTROLLERAXISMOTION: device %d, axis %d: %d",