SDL: Fixed building with older versions of GameInput

From f8d5628163b487ab473a1cd848d3ddd1fe8f66f9 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 21 Apr 2026 19:40:57 -0700
Subject: [PATCH] Fixed building with older versions of GameInput

---
 src/joystick/gdk/SDL_gameinputjoystick.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/joystick/gdk/SDL_gameinputjoystick.cpp b/src/joystick/gdk/SDL_gameinputjoystick.cpp
index 5d373a25504b5..bb511dda2bede 100644
--- a/src/joystick/gdk/SDL_gameinputjoystick.cpp
+++ b/src/joystick/gdk/SDL_gameinputjoystick.cpp
@@ -419,9 +419,11 @@ static bool GAMEINPUT_JoystickInit(void)
     if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_GAMEINPUT, SDL_GAMEINPUT_DEFAULT)) {
         kind |= GameInputKindController;
     }
+#if GAMEINPUT_API_VERSION >= 3
     if (GAMEINPUT_IsRawGameInputEnabled()) {
         kind |= GameInputKindRawDeviceReport;
     }
+#endif
 
     hr = g_pGameInput->RegisterDeviceCallback(NULL,
                                            kind,
@@ -701,7 +703,8 @@ static bool GAMEINPUT_JoystickSetSensorsEnabled(SDL_Joystick *joystick, bool ena
 
 static void GAMEINPUT_GuitarUpdate(SDL_Joystick *joystick, IGameInputReading *reading, Uint64 timestamp)
 {
-    IGameInputRawDeviceReport* rawState;
+#if GAMEINPUT_API_VERSION >= 3
+    IGameInputRawDeviceReport *rawState;
     if (reading->GetRawReport(&rawState)) {
         static WORD s_GuitarButtons[] = {
             0x0010,  // SDL_GAMEPAD_BUTTON_SOUTH
@@ -753,6 +756,7 @@ static void GAMEINPUT_GuitarUpdate(SDL_Joystick *joystick, IGameInputReading *re
             SDL_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, effects_mappings[rawData[4] >> 4]);
         }
     }
+#endif // GAMEINPUT_API_VERSION >= 3
 }
 
 static void GAMEINPUT_GamepadUpdate(SDL_Joystick *joystick, IGameInputReading *reading, Uint64 timestamp) {