[Bf-blender-cvs] [f322362] blender-v2.73-release: Recent fix for SDL2 broke joysticks for SDL1.2

Campbell Barton noreply at git.blender.org
Tue Jan 6 10:45:05 CET 2015


Commit: f322362363066cd8863938fda33d0667570bb97a
Author: Campbell Barton
Date:   Mon Jan 5 20:23:30 2015 +1100
Branches: blender-v2.73-release
https://developer.blender.org/rBf322362363066cd8863938fda33d0667570bb97a

Recent fix for SDL2 broke joysticks for SDL1.2

===================================================================

M	source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp

===================================================================

diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
index e3bc409..daf869e 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
@@ -111,7 +111,11 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
 		char *videodriver = getenv("SDL_VIDEODRIVER");
 		BLI_setenv("SDL_VIDEODRIVER", "dummy");
 
+#if SDL_VERSION_ATLEAST(2, 0, 0)
 		int success = (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1 );
+#else
+		int success = (SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) != -1 );
+#endif
 
 		BLI_setenv("SDL_VIDEODRIVER", videodriver);
 #  endif
@@ -156,7 +160,11 @@ void SCA_Joystick::ReleaseInstance()
 		/* The video subsystem is required for joystick input to work. However,
 		 * when GHOST is running under SDL, video is freed elsewhere.
 		 * Do this once only. */
+#if SDL_VERSION_ATLEAST(2, 0, 0)
 		SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
+#else
+		SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO);
+#endif
 #endif /* WITH_SDL */
 	}
 }




More information about the Bf-blender-cvs mailing list