SDL: Steam Controller support defaults off on mobile platforms

From 0f9505256d733ede8af6e29835c2a530f7247fe0 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 14 Nov 2024 09:05:16 -0800
Subject: [PATCH] Steam Controller support defaults off on mobile platforms

These platforms require prompting for Bluetooth permissions, so don't enable this by default.
---
 src/joystick/hidapi/SDL_hidapi_steam.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/joystick/hidapi/SDL_hidapi_steam.c b/src/joystick/hidapi/SDL_hidapi_steam.c
index 83d923a80520b..3db0d7510ad5f 100644
--- a/src/joystick/hidapi/SDL_hidapi_steam.c
+++ b/src/joystick/hidapi/SDL_hidapi_steam.c
@@ -27,6 +27,13 @@
 
 #ifdef SDL_JOYSTICK_HIDAPI_STEAM
 
+#if defined(SDL_PLATFORM_ANDROID) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS)
+// This requires prompting for Bluetooth permissions, so make sure the application really wants it
+#define SDL_HINT_JOYSTICK_HIDAPI_STEAM_DEFAULT  false
+#else
+#define SDL_HINT_JOYSTICK_HIDAPI_STEAM_DEFAULT  SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT)
+#endif
+
 /*****************************************************************************************************/
 
 #include "steam/controller_constants.h"
@@ -981,8 +988,7 @@ static void HIDAPI_DriverSteam_UnregisterHints(SDL_HintCallback callback, void *
 
 static bool HIDAPI_DriverSteam_IsEnabled(void)
 {
-    return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_STEAM,
-                              SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
+    return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_STEAM, SDL_HINT_JOYSTICK_HIDAPI_STEAM_DEFAULT);
 }
 
 static bool HIDAPI_DriverSteam_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)