From dec7875a6e23212021e4d9080330a42832dfe02a Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Tue, 15 Jun 2021 01:40:19 +0000
Subject: [PATCH] update SDL soruce to 2.0.14

---
 source/src/joystick/SDL_joystick_c.h |   93 +++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 82 insertions(+), 11 deletions(-)

diff --git a/source/src/joystick/SDL_joystick_c.h b/source/src/joystick/SDL_joystick_c.h
index 1ba4dee..de330ab 100644
--- a/source/src/joystick/SDL_joystick_c.h
+++ b/source/src/joystick/SDL_joystick_c.h
@@ -52,17 +52,30 @@
 /* Function to extract information from an SDL joystick GUID */
 extern void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version);
 
-/* Function to get a custom name for a controller manufacturer, if it's available */
-extern const char *SDL_GetCustomJoystickManufacturer(const char *manufacturer);
-
-/* Function to get a custom name for a controller, if it's available */
-extern const char *SDL_GetCustomJoystickName(Uint16 vendor, Uint16 product);
+/* Function to standardize the name for a controller
+   This should be freed with SDL_free() when no longer needed
+ */
+extern char *SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, const char *product_name);
 
 /* Function to return the type of a controller */
+extern SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product);
 extern SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGUID guid, const char *name);
 extern SDL_GameControllerType SDL_GetJoystickGameControllerType(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol);
 
+/* Function to return whether a joystick is an Xbox One Elite controller */
+extern SDL_bool SDL_IsJoystickXboxOneElite(Uint16 vendor_id, Uint16 product_id);
+
+/* Function to return whether a joystick is an Xbox One Series X controller */
+extern SDL_bool SDL_IsJoystickXboxOneSeriesX(Uint16 vendor_id, Uint16 product_id);
+
+/* Function to return whether a joystick is a PS4 controller */
+extern SDL_bool SDL_IsJoystickPS4(Uint16 vendor_id, Uint16 product_id);
+
+/* Function to return whether a joystick is a PS5 controller */
+extern SDL_bool SDL_IsJoystickPS5(Uint16 vendor_id, Uint16 product_id);
+
 /* Function to return whether a joystick is a Nintendo Switch Pro controller */
+extern SDL_bool SDL_IsJoystickNintendoSwitchPro(Uint16 vendor_id, Uint16 product_id);
 extern SDL_bool SDL_IsJoystickNintendoSwitchProInputOnly(Uint16 vendor_id, Uint16 product_id);
 
 /* Function to return whether a joystick is a Steam Controller */
@@ -71,8 +84,17 @@
 /* Function to return whether a joystick guid comes from the XInput driver */
 extern SDL_bool SDL_IsJoystickXInput(SDL_JoystickGUID guid);
 
+/* Function to return whether a joystick guid comes from the WGI driver */
+extern SDL_bool SDL_IsJoystickWGI(SDL_JoystickGUID guid);
+
 /* Function to return whether a joystick guid comes from the HIDAPI driver */
 extern SDL_bool SDL_IsJoystickHIDAPI(SDL_JoystickGUID guid);
+
+/* Function to return whether a joystick guid comes from the RAWINPUT driver */
+extern SDL_bool SDL_IsJoystickRAWINPUT(SDL_JoystickGUID guid);
+
+/* Function to return whether a joystick guid comes from the Virtual driver */
+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);
@@ -87,21 +109,70 @@
 extern void SDL_GameControllerHandleDelayedGuideButton(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);
 extern void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance);
 extern void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance);
-extern int SDL_PrivateJoystickAxis(SDL_Joystick * joystick,
+extern int SDL_PrivateJoystickAxis(SDL_Joystick *joystick,
                                    Uint8 axis, Sint16 value);
-extern int SDL_PrivateJoystickBall(SDL_Joystick * joystick,
+extern int SDL_PrivateJoystickBall(SDL_Joystick *joystick,
                                    Uint8 ball, Sint16 xrel, Sint16 yrel);
-extern int SDL_PrivateJoystickHat(SDL_Joystick * joystick,
+extern int SDL_PrivateJoystickHat(SDL_Joystick *joystick,
                                   Uint8 hat, Uint8 value);
-extern int SDL_PrivateJoystickButton(SDL_Joystick * joystick,
+extern int SDL_PrivateJoystickButton(SDL_Joystick *joystick,
                                      Uint8 button, Uint8 state);
-extern void SDL_PrivateJoystickBatteryLevel(SDL_Joystick * joystick,
+extern int SDL_PrivateJoystickTouchpad(SDL_Joystick *joystick,
+                                       int touchpad, int finger, Uint8 state, float x, float y, float pressure);
+extern int SDL_PrivateJoystickSensor(SDL_Joystick *joystick,
+                                     SDL_SensorType type, const float *data, int num_values);
+extern void SDL_PrivateJoystickBatteryLevel(SDL_Joystick *joystick,
                                             SDL_JoystickPowerLevel ePowerLevel);
 
 /* Internal sanity checking functions */
-extern SDL_bool SDL_PrivateJoystickValid(SDL_Joystick * joystick);
+extern SDL_bool SDL_PrivateJoystickValid(SDL_Joystick *joystick);
+
+typedef enum
+{
+    EMappingKind_None = 0,
+    EMappingKind_Button = 1,
+    EMappingKind_Axis = 2,
+    EMappingKind_Hat = 3
+} EMappingKind;
+
+typedef struct _SDL_InputMapping
+{
+    EMappingKind kind;
+    Uint8 target;
+} SDL_InputMapping;
+
+typedef struct _SDL_GamepadMapping
+{
+    SDL_InputMapping a;
+    SDL_InputMapping b;
+    SDL_InputMapping x;
+    SDL_InputMapping y;
+    SDL_InputMapping back;
+    SDL_InputMapping guide;
+    SDL_InputMapping start;
+    SDL_InputMapping leftstick;
+    SDL_InputMapping rightstick;
+    SDL_InputMapping leftshoulder;
+    SDL_InputMapping rightshoulder;
+    SDL_InputMapping dpup;
+    SDL_InputMapping dpdown;
+    SDL_InputMapping dpleft;
+    SDL_InputMapping dpright;
+    SDL_InputMapping leftx;
+    SDL_InputMapping lefty;
+    SDL_InputMapping rightx;
+    SDL_InputMapping righty;
+    SDL_InputMapping lefttrigger;
+    SDL_InputMapping righttrigger;
+} SDL_GamepadMapping;
+
+/* Function to get autodetected gamepad controller mapping from the driver */
+extern SDL_bool SDL_PrivateJoystickGetAutoGamepadMapping(int device_index,
+                                                         SDL_GamepadMapping *out);
 
 #endif /* SDL_joystick_c_h_ */
 

--
Gitblit v1.9.3