diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj index f4640c02c..381213fc0 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj +++ b/VisualC-GDK/SDL/SDL.vcxproj @@ -403,6 +403,7 @@ + diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters index 62aff4c97..40c9fd6a7 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj.filters +++ b/VisualC-GDK/SDL/SDL.vcxproj.filters @@ -483,6 +483,9 @@ haptic + + joystick + joystick diff --git a/VisualC-WinRT/SDL-UWP.vcxproj b/VisualC-WinRT/SDL-UWP.vcxproj index 1b49d517f..04b21ff44 100644 --- a/VisualC-WinRT/SDL-UWP.vcxproj +++ b/VisualC-WinRT/SDL-UWP.vcxproj @@ -121,6 +121,7 @@ + @@ -837,4 +838,4 @@ - \ No newline at end of file + diff --git a/VisualC-WinRT/SDL-UWP.vcxproj.filters b/VisualC-WinRT/SDL-UWP.vcxproj.filters index a6be95fe5..7127c2c19 100644 --- a/VisualC-WinRT/SDL-UWP.vcxproj.filters +++ b/VisualC-WinRT/SDL-UWP.vcxproj.filters @@ -162,6 +162,9 @@ Header Files + + Header Files + Header Files @@ -843,4 +846,4 @@ Source Files - \ No newline at end of file + diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj index ea1849f2d..798033270 100644 --- a/VisualC/SDL/SDL.vcxproj +++ b/VisualC/SDL/SDL.vcxproj @@ -347,6 +347,7 @@ + diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters index 260a16a3c..eb48c1e2d 100644 --- a/VisualC/SDL/SDL.vcxproj.filters +++ b/VisualC/SDL/SDL.vcxproj.filters @@ -477,6 +477,9 @@ haptic + + joystick + joystick diff --git a/src/SDL.c b/src/SDL.c index 812995bb0..42a8ea273 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -41,6 +41,7 @@ #include "video/SDL_video_c.h" #include "events/SDL_events_c.h" #include "haptic/SDL_haptic_c.h" +#include "joystick/SDL_gamepad_c.h" #include "joystick/SDL_joystick_c.h" #include "sensor/SDL_sensor_c.h" diff --git a/src/joystick/SDL_gamepad.c b/src/joystick/SDL_gamepad.c index bf59c1db0..34703fd64 100644 --- a/src/joystick/SDL_gamepad.c +++ b/src/joystick/SDL_gamepad.c @@ -24,6 +24,7 @@ #include "SDL_sysjoystick.h" #include "SDL_joystick_c.h" +#include "SDL_gamepad_c.h" #include "SDL_gamepad_db.h" #include "controller_type.h" #include "usb_ids.h" diff --git a/src/joystick/SDL_gamepad_c.h b/src/joystick/SDL_gamepad_c.h new file mode 100644 index 000000000..7316a1de9 --- /dev/null +++ b/src/joystick/SDL_gamepad_c.h @@ -0,0 +1,45 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_gamepad_c_h_ +#define SDL_gamepad_c_h_ + +#include "SDL_internal.h" + +/* Useful functions and variables from SDL_gamepad.c */ + +/* Initialization and shutdown functions */ +extern int SDL_GamepadInitMappings(void); +extern void SDL_GamepadQuitMappings(void); +extern int SDL_GamepadInit(void); +extern void SDL_GamepadQuit(void); + + +/* Function to return whether a joystick name and GUID is a gamepad */ +extern SDL_bool SDL_IsGamepadNameAndGUID(const char *name, SDL_JoystickGUID guid); + +/* Function to return whether a gamepad should be ignored */ +extern SDL_bool SDL_ShouldIgnoreGamepad(const char *name, SDL_JoystickGUID guid); + +/* Handle delayed guide button on a gamepad */ +extern void SDL_GamepadHandleDelayedGuideButton(SDL_Joystick *joystick); + +#endif /* SDL_gamepad_c_h_ */ diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 3cd509ae3..e1854c3ae 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -24,6 +24,8 @@ #include "SDL_sysjoystick.h" #include "../SDL_hints_c.h" +#include "SDL_gamepad_c.h" +#include "SDL_joystick_c.h" #if !SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" diff --git a/src/joystick/SDL_joystick_c.h b/src/joystick/SDL_joystick_c.h index 45917a19c..c9e6b4913 100644 --- a/src/joystick/SDL_joystick_c.h +++ b/src/joystick/SDL_joystick_c.h @@ -52,12 +52,6 @@ extern void SDL_AssertJoysticksLocked(void) SDL_ASSERT_CAPABILITY(SDL_joystick_l /* Function to get the next available joystick instance ID */ extern SDL_JoystickID SDL_GetNextJoystickInstanceID(void); -/* Initialization and shutdown functions */ -extern int SDL_GamepadInitMappings(void); -extern void SDL_GamepadQuitMappings(void); -extern int SDL_GamepadInit(void); -extern void SDL_GamepadQuit(void); - /* Function to return the device index for a joystick ID, or -1 if not found */ extern int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id); @@ -137,15 +131,6 @@ extern SDL_bool SDL_IsJoystickVIRTUAL(SDL_JoystickGUID guid); /* Function to return whether a joystick should be ignored */ extern SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid); -/* Function to return whether a joystick name and GUID is a gamepad */ -extern SDL_bool SDL_IsGamepadNameAndGUID(const char *name, SDL_JoystickGUID guid); - -/* Function to return whether a gamepad should be ignored */ -extern SDL_bool SDL_ShouldIgnoreGamepad(const char *name, SDL_JoystickGUID guid); - -/* Handle delayed guide button on a gamepad */ -extern void SDL_GamepadHandleDelayedGuideButton(SDL_Joystick *joystick); - /* Internal event queueing functions */ extern void SDL_PrivateJoystickAddTouchpad(SDL_Joystick *joystick, int nfingers); extern void SDL_PrivateJoystickAddSensor(SDL_Joystick *joystick, SDL_SensorType type, float rate);