Просмотр исходного кода

Prevent GameInput from picking up controllers when SDL_HINT_JOYSTICK_GAMEINPUT is disabled

Sam Lantinga 1 день назад
Родитель
Сommit
c4cfb739ae
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      src/joystick/gdk/SDL_gameinputjoystick.cpp

+ 5 - 1
src/joystick/gdk/SDL_gameinputjoystick.cpp

@@ -283,7 +283,11 @@ static void GAMEINPUT_InternalAddOrFind(IGameInputDevice *pDevice)
     }
     }
 #endif
 #endif
 
 
-    if (!GAMEINPUT_InternalIsGamepad(info) && raw_type == SDL_GAMEINPUT_RAWTYPE_NONE) {
+    if (GAMEINPUT_InternalIsGamepad(info)) {
+        if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_GAMEINPUT, SDL_GAMEINPUT_DEFAULT)) {
+            goto done;
+        }
+    } else if (raw_type == SDL_GAMEINPUT_RAWTYPE_NONE) {
 #if defined(SDL_JOYSTICK_DINPUT)
 #if defined(SDL_JOYSTICK_DINPUT)
         // Let other backends handle non-gamepad controllers to possibly avoid bugs and/or regressions.
         // Let other backends handle non-gamepad controllers to possibly avoid bugs and/or regressions.
         if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_DIRECTINPUT, true)) {
         if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_DIRECTINPUT, true)) {