mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-10-26 12:27:44 +00:00 
			
		
		
		
	The RAWINPUT driver is no longer tied to HIDAPI in any way
This commit is contained in:
		
							
								
								
									
										12
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								configure
									
									
									
									
										vendored
									
									
								
							| @@ -24547,10 +24547,6 @@ fi | |||||||
|                 enable_hidapi_libusb=yes |                 enable_hidapi_libusb=yes | ||||||
|                 require_hidapi_libusb=yes |                 require_hidapi_libusb=yes | ||||||
|                 ;; |                 ;; | ||||||
|             # RAWINPUT is only available on Win32, but can be enabled if HIDAPI is |  | ||||||
|             *-*-cygwin* | *-*-mingw*) |  | ||||||
|                 enable_joystick_rawinput=yes |  | ||||||
|                 ;; |  | ||||||
|         esac |         esac | ||||||
|  |  | ||||||
|         hidapi_support=yes |         hidapi_support=yes | ||||||
| @@ -24646,11 +24642,6 @@ fi | |||||||
|  |  | ||||||
| $as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h | $as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h | ||||||
|  |  | ||||||
|             if test x$enable_joystick_rawinput = xyes; then |  | ||||||
|  |  | ||||||
| $as_echo "#define SDL_JOYSTICK_RAWINPUT 1" >>confdefs.h |  | ||||||
|  |  | ||||||
|             fi |  | ||||||
|             EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" |             EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" | ||||||
|             SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" |             SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" | ||||||
|             SOURCES="$SOURCES $srcdir/src/hidapi/SDL_hidapi.c" |             SOURCES="$SOURCES $srcdir/src/hidapi/SDL_hidapi.c" | ||||||
| @@ -25230,6 +25221,9 @@ $as_echo "#define SDL_AUDIO_DRIVER_WASAPI 1" >>confdefs.h | |||||||
|         fi |         fi | ||||||
|         # Set up files for the joystick library |         # Set up files for the joystick library | ||||||
|         if test x$enable_joystick = xyes; then |         if test x$enable_joystick = xyes; then | ||||||
|  |  | ||||||
|  | $as_echo "#define SDL_JOYSTICK_RAWINPUT 1" >>confdefs.h | ||||||
|  |  | ||||||
|             if test x$have_dinput = xyes -o x$have_xinput = xyes; then |             if test x$have_dinput = xyes -o x$have_xinput = xyes; then | ||||||
|                 if test x$have_xinput = xyes; then |                 if test x$have_xinput = xyes; then | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3349,10 +3349,6 @@ CheckHIDAPI() | |||||||
|                 enable_hidapi_libusb=yes |                 enable_hidapi_libusb=yes | ||||||
|                 require_hidapi_libusb=yes |                 require_hidapi_libusb=yes | ||||||
|                 ;; |                 ;; | ||||||
|             # RAWINPUT is only available on Win32, but can be enabled if HIDAPI is |  | ||||||
|             *-*-cygwin* | *-*-mingw*) |  | ||||||
|                 enable_joystick_rawinput=yes |  | ||||||
|                 ;; |  | ||||||
|         esac |         esac | ||||||
|  |  | ||||||
|         hidapi_support=yes |         hidapi_support=yes | ||||||
| @@ -3369,9 +3365,6 @@ CheckHIDAPI() | |||||||
|  |  | ||||||
|         if test x$hidapi_support = xyes; then |         if test x$hidapi_support = xyes; then | ||||||
|             AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ]) |             AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ]) | ||||||
|             if test x$enable_joystick_rawinput = xyes; then |  | ||||||
|                 AC_DEFINE(SDL_JOYSTICK_RAWINPUT, 1, [ ]) |  | ||||||
|             fi |  | ||||||
|             EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" |             EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi" | ||||||
|             SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" |             SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" | ||||||
|             SOURCES="$SOURCES $srcdir/src/hidapi/SDL_hidapi.c" |             SOURCES="$SOURCES $srcdir/src/hidapi/SDL_hidapi.c" | ||||||
| @@ -3797,6 +3790,7 @@ case "$host" in | |||||||
|         fi |         fi | ||||||
|         # Set up files for the joystick library |         # Set up files for the joystick library | ||||||
|         if test x$enable_joystick = xyes; then |         if test x$enable_joystick = xyes; then | ||||||
|  |             AC_DEFINE(SDL_JOYSTICK_RAWINPUT, 1, [ ]) | ||||||
|             if test x$have_dinput = xyes -o x$have_xinput = xyes; then |             if test x$have_dinput = xyes -o x$have_xinput = xyes; then | ||||||
|                 if test x$have_xinput = xyes; then |                 if test x$have_xinput = xyes; then | ||||||
|                     AC_DEFINE(SDL_JOYSTICK_XINPUT, 1, [ ]) |                     AC_DEFINE(SDL_JOYSTICK_XINPUT, 1, [ ]) | ||||||
|   | |||||||
| @@ -727,19 +727,6 @@ extern "C" { | |||||||
|  */ |  */ | ||||||
| #define SDL_HINT_JOYSTICK_HIDAPI_XBOX   "SDL_JOYSTICK_HIDAPI_XBOX" | #define SDL_HINT_JOYSTICK_HIDAPI_XBOX   "SDL_JOYSTICK_HIDAPI_XBOX" | ||||||
|  |  | ||||||
|  /** |  | ||||||
|   *  \brief  A variable controlling whether the HIDAPI driver for XBox controllers on Windows should pull correlated |  | ||||||
|   *      data from XInput. |  | ||||||
|   * |  | ||||||
|   *  This variable can be set to the following values: |  | ||||||
|   *    "0"       - HIDAPI Xbox driver will only use HIDAPI data |  | ||||||
|   *    "1"       - HIDAPI Xbox driver will also pull data from XInput, providing better trigger axes, guide button |  | ||||||
|   *                presses, and rumble support |  | ||||||
|   * |  | ||||||
|   *  The default is "1".  This hint applies to any joysticks opened after setting the hint. |  | ||||||
|   */ |  | ||||||
| #define SDL_HINT_JOYSTICK_HIDAPI_CORRELATE_XINPUT   "SDL_JOYSTICK_HIDAPI_CORRELATE_XINPUT" |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  *  \brief  A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used. |  *  \brief  A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used. | ||||||
|  * |  * | ||||||
| @@ -783,6 +770,19 @@ extern "C" { | |||||||
|   */ |   */ | ||||||
| #define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT" | #define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT" | ||||||
|  |  | ||||||
|  |  /** | ||||||
|  |   *  \brief  A variable controlling whether the RAWINPUT driver should pull correlated data from XInput. | ||||||
|  |   * | ||||||
|  |   *  This variable can be set to the following values: | ||||||
|  |   *    "0"       - RAWINPUT driver will only use data from raw input APIs | ||||||
|  |   *    "1"       - RAWINPUT driver will also pull data from XInput, providing | ||||||
|  |   *                better trigger axes, guide button presses, and rumble support | ||||||
|  |   *                for Xbox controllers | ||||||
|  |   * | ||||||
|  |   *  The default is "1".  This hint applies to any joysticks opened after setting the hint. | ||||||
|  |   */ | ||||||
|  | #define SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT   "SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT" | ||||||
|  |  | ||||||
|  /** |  /** | ||||||
|   *  \brief  A variable controlling whether a separate thread should be used |   *  \brief  A variable controlling whether a separate thread should be used | ||||||
|   *          for handling joystick detection and raw input messages on Windows |   *          for handling joystick detection and raw input messages on Windows | ||||||
|   | |||||||
| @@ -1042,7 +1042,7 @@ RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) | |||||||
|         /* We'll try to get guide button and trigger axes from XInput */ |         /* We'll try to get guide button and trigger axes from XInput */ | ||||||
| #ifdef SDL_JOYSTICK_RAWINPUT_XINPUT | #ifdef SDL_JOYSTICK_RAWINPUT_XINPUT | ||||||
|         xinput_device_change = SDL_TRUE; |         xinput_device_change = SDL_TRUE; | ||||||
|         ctx->xinput_enabled = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_CORRELATE_XINPUT, SDL_TRUE); |         ctx->xinput_enabled = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT, SDL_TRUE); | ||||||
|         if (ctx->xinput_enabled && (WIN_LoadXInputDLL() < 0 || !XINPUTGETSTATE)) { |         if (ctx->xinput_enabled && (WIN_LoadXInputDLL() < 0 || !XINPUTGETSTATE)) { | ||||||
|             ctx->xinput_enabled = SDL_FALSE; |             ctx->xinput_enabled = SDL_FALSE; | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Sam Lantinga
					Sam Lantinga