SDL: Added missing events in SDL event logging

From 84fa11f740c7abc185901155c799ef223df6b23f Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 13 May 2024 21:01:01 -0700
Subject: [PATCH] Added missing events in SDL event logging

Also improved formatting for unknown events
---
 src/events/SDL_events.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c
index 02091ac1ea082..888c6f0dcf8bf 100644
--- a/src/events/SDL_events.c
+++ b/src/events/SDL_events.c
@@ -428,6 +428,12 @@ static void SDL_LogEvent(const SDL_Event *event)
         break;
 #undef PRINT_JBUTTON_EVENT
 
+        SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_BATTERY_UPDATED)
+        (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d state=%u percent=%d)",
+                           (uint)event->jbattery.timestamp, (int)event->jbattery.which,
+                           event->jbattery.state, event->jbattery.percent);
+        break;
+
 #define PRINT_JOYDEV_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d)", (uint)event->jdevice.timestamp, (int)event->jdevice.which)
         SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_ADDED)
         PRINT_JOYDEV_EVENT(event);
@@ -435,6 +441,9 @@ static void SDL_LogEvent(const SDL_Event *event)
         SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_REMOVED)
         PRINT_JOYDEV_EVENT(event);
         break;
+        SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_UPDATE_COMPLETE)
+        PRINT_JOYDEV_EVENT(event);
+        break;
 #undef PRINT_JOYDEV_EVENT
 
         SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_AXIS_MOTION)
@@ -465,6 +474,9 @@ static void SDL_LogEvent(const SDL_Event *event)
         SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_REMAPPED)
         PRINT_GAMEPADDEV_EVENT(event);
         break;
+        SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_UPDATE_COMPLETE)
+        PRINT_GAMEPADDEV_EVENT(event);
+        break;
         SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED)
         PRINT_GAMEPADDEV_EVENT(event);
         break;
@@ -615,8 +627,12 @@ static void SDL_LogEvent(const SDL_Event *event)
 
     default:
         if (!name[0]) {
-            SDL_strlcpy(name, "UNKNOWN", sizeof(name));
-            (void)SDL_snprintf(details, sizeof(details), " #%u! (Bug? FIXME?)", (uint)event->type);
+			if (event->type >= SDL_EVENT_USER) {
+				SDL_strlcpy(name, "USER", sizeof(name));
+			} else {
+				SDL_strlcpy(name, "UNKNOWN", sizeof(name));
+			}
+            (void)SDL_snprintf(details, sizeof(details), " 0x%x", (uint)event->type);
         }
         break;
     }