1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00
Files
godot/thirdparty/sdl/patches/0002-msvc-constants-fpstrict.patch
Nintorch 0b3496fb4f Add support for SDL3 joystick input driver
Made possible by EIREXE, xsellier and the SDL team.

This commit includes statically linked SDL3 for Windows, Linux and macOS.
The vendored copy of SDL3 was setup to only build the required subsystems
for gamepad/joystick support, with some patches to be able to make it as
minimal as possible and reduce the impact on binary size and code size.

Co-authored-by: Álex Román Núñez <eirexe123@gmail.com>
Co-authored-by: Xavier Sellier <xsellier@gmail.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-06-25 01:28:50 +02:00

42 lines
2.4 KiB
Diff

diff --git a/thirdparty/sdl/joystick/hidapi/SDL_hidapi_ps4.c b/thirdparty/sdl/joystick/hidapi/SDL_hidapi_ps4.c
index 7404bf2268..a697cdf6d9 100644
--- a/thirdparty/sdl/joystick/hidapi/SDL_hidapi_ps4.c
+++ b/thirdparty/sdl/joystick/hidapi/SDL_hidapi_ps4.c
@@ -1003,8 +1003,8 @@ static bool HIDAPI_DriverPS4_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *device
static void HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_device *dev, SDL_DriverPS4_Context *ctx, PS4StatePacket_t *packet, int size)
{
- static const float TOUCHPAD_SCALEX = 1.0f / 1920;
- static const float TOUCHPAD_SCALEY = 1.0f / 920; // This is noted as being 944 resolution, but 920 feels better
+ static const float TOUCHPAD_SCALEX = 5.20833333e-4f; // 1.0f / 1920
+ static const float TOUCHPAD_SCALEY = 1.08695652e-3f; // 1.0f / 920 // This is noted as being 944 resolution, but 920 feels better
Sint16 axis;
bool touchpad_down;
int touchpad_x, touchpad_y;
diff --git a/thirdparty/sdl/joystick/hidapi/SDL_hidapi_ps5.c b/thirdparty/sdl/joystick/hidapi/SDL_hidapi_ps5.c
index abf59a87f2..a486af6b0f 100644
--- a/thirdparty/sdl/joystick/hidapi/SDL_hidapi_ps5.c
+++ b/thirdparty/sdl/joystick/hidapi/SDL_hidapi_ps5.c
@@ -1355,8 +1355,8 @@ static void HIDAPI_DriverPS5_HandleStatePacketCommon(SDL_Joystick *joystick, SDL
static void HIDAPI_DriverPS5_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_device *dev, SDL_DriverPS5_Context *ctx, PS5StatePacket_t *packet, Uint64 timestamp)
{
- static const float TOUCHPAD_SCALEX = 1.0f / 1920;
- static const float TOUCHPAD_SCALEY = 1.0f / 1070;
+ static const float TOUCHPAD_SCALEX = 5.20833333e-4f; // 1.0f / 1920
+ static const float TOUCHPAD_SCALEY = 9.34579439e-4f; // 1.0f / 1070
bool touchpad_down;
int touchpad_x, touchpad_y;
@@ -1406,8 +1406,8 @@ static void HIDAPI_DriverPS5_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_d
static void HIDAPI_DriverPS5_HandleStatePacketAlt(SDL_Joystick *joystick, SDL_hid_device *dev, SDL_DriverPS5_Context *ctx, PS5StatePacketAlt_t *packet, Uint64 timestamp)
{
- static const float TOUCHPAD_SCALEX = 1.0f / 1920;
- static const float TOUCHPAD_SCALEY = 1.0f / 1070;
+ static const float TOUCHPAD_SCALEX = 5.20833333e-4f; // 1.0f / 1920
+ static const float TOUCHPAD_SCALEY = 9.34579439e-4f; // 1.0f / 1070
bool touchpad_down;
int touchpad_x, touchpad_y;