From a8dd7a10fa19c658a17e91d41600514c3eec7e6c Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 22 Nov 2022 18:35:49 +0100 Subject: [PATCH 01/19] android.mk: LOCAL_EXPORT_C_INCLUDES does not need to add include subfolder --- Android.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Android.mk b/Android.mk index 06146cd40..facc54afb 100644 --- a/Android.mk +++ b/Android.mk @@ -12,7 +12,7 @@ LOCAL_MODULE := SDL2 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)/include +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) LOCAL_SRC_FILES := \ $(subst $(LOCAL_PATH)/,, \ From 3bf150e90028a8ec9bd2f273b0aa603eee17e043 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 22 Nov 2022 10:53:28 -0800 Subject: [PATCH 02/19] Revert "Added Linux mappings for the Logitech G29 in PS3 and PS4 modes" This reverts commit 33a68f575f484723aa326f8a2d96f2b8a084da4a. We don't want the G29 to show up as a gamepad, Steam will create a virtual Xbox controller for it, which breaks racing games. (cherry picked from commit e3d430b83eb7c754c789fb23184feb745c2b99a8) --- src/joystick/SDL_gamecontrollerdb.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index 32c59c837..b62694c25 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -654,8 +654,6 @@ static const char *s_ControllerMappings [] = "030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "030000006d0400004fc2000011010000,Logitech G29 Racing Wheel,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b24,leftshoulder:b5,leftstick:b11,lefttrigger:b7,rightshoulder:b4,rightstick:b10,righttrigger:b6,start:b9,x:b1,y:b3,", - "030000006d04000060c2000010010000,Logitech G29 Racing Wheel,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,", "030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b6,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b10,rightx:a3,righty:a4,start:b8,x:b3,y:b4,", "03000000c62400002b89000011010000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", From 479e972e561fc4bb40293946c1b9b299e4de9785 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 22 Nov 2022 10:56:44 -0800 Subject: [PATCH 03/19] Removed G29 from controller_type.c We don't want the G29 to show up as a gamepad, Steam will create a virtual Xbox controller for it, which breaks racing games. (cherry picked from commit dce6ed56d72b436f15c044b05097ddebbc166701) --- src/joystick/controller_type.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/joystick/controller_type.c b/src/joystick/controller_type.c index b51f27f6a..80ce1185e 100644 --- a/src/joystick/controller_type.c +++ b/src/joystick/controller_type.c @@ -32,7 +32,7 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x0079, 0x1844 ), k_eControllerType_PS3Controller, NULL }, // From SDL { MAKE_CONTROLLER_ID( 0x044f, 0xb315 ), k_eControllerType_PS3Controller, NULL }, // Firestorm Dual Analog 3 { MAKE_CONTROLLER_ID( 0x044f, 0xd007 ), k_eControllerType_PS3Controller, NULL }, // Thrustmaster wireless 3-1 - { MAKE_CONTROLLER_ID( 0x046d, 0xc24f ), k_eControllerType_PS3Controller, NULL }, // Logitech G29 (PS3) + //{ MAKE_CONTROLLER_ID( 0x046d, 0xc24f ), k_eControllerType_PS3Controller, NULL }, // Logitech G29 (PS3) { MAKE_CONTROLLER_ID( 0x054c, 0x0268 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller { MAKE_CONTROLLER_ID( 0x056e, 0x200f ), k_eControllerType_PS3Controller, NULL }, // From SDL { MAKE_CONTROLLER_ID( 0x056e, 0x2013 ), k_eControllerType_PS3Controller, NULL }, // JC-U4113SBK @@ -87,7 +87,7 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x8888, 0x0308 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller { MAKE_CONTROLLER_ID( 0x0079, 0x181b ), k_eControllerType_PS4Controller, NULL }, // Venom Arcade Stick - XXX:this may not work and may need to be called a ps3 controller - { MAKE_CONTROLLER_ID( 0x046d, 0xc260 ), k_eControllerType_PS4Controller, NULL }, // Logitech G29 (PS4) + //{ MAKE_CONTROLLER_ID( 0x046d, 0xc260 ), k_eControllerType_PS4Controller, NULL }, // Logitech G29 (PS4) { MAKE_CONTROLLER_ID( 0x054c, 0x05c4 ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Controller { MAKE_CONTROLLER_ID( 0x054c, 0x05c5 ), k_eControllerType_PS4Controller, NULL }, // STRIKEPAD PS4 Grip Add-on { MAKE_CONTROLLER_ID( 0x054c, 0x09cc ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Slim Controller From 72823dd0cd658d9f1165ae35d5f813bffd0961b4 Mon Sep 17 00:00:00 2001 From: Joshua Root Date: Thu, 24 Nov 2022 06:32:49 +1100 Subject: [PATCH 04/19] SDL_cocoaopengl.h: ensure CVDisplayLinkRef is defined The typedef seems to be pulled in coincidentally with newer SDKs, but older ones need to import the header explicitly. (cherry picked from commit d2910904fb4062c313636c7595e971f1bf248075) --- src/video/cocoa/SDL_cocoaopengl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/video/cocoa/SDL_cocoaopengl.h b/src/video/cocoa/SDL_cocoaopengl.h index 7b900dee6..fe8a8e51c 100644 --- a/src/video/cocoa/SDL_cocoaopengl.h +++ b/src/video/cocoa/SDL_cocoaopengl.h @@ -27,6 +27,7 @@ #include "SDL_atomic.h" #import +#import /* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */ #ifdef __clang__ From 66620bd1082be97e8d59257895182fc5c2172b52 Mon Sep 17 00:00:00 2001 From: Joshua Root Date: Sun, 28 Aug 2022 00:52:19 +1000 Subject: [PATCH 05/19] Check build-time SDK in LoadMainMenuNibIfAvailable Fixes building against OS X 10.7 SDK. (cherry picked from commit f8cebeea599ae65f36d388257a9d9a8ed8ada576) --- src/video/cocoa/SDL_cocoaevents.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index 4903a8a04..ed2aaa6c6 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/src/video/cocoa/SDL_cocoaevents.m @@ -333,6 +333,7 @@ GetApplicationName(void) static bool LoadMainMenuNibIfAvailable(void) { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 NSDictionary *infoDict; NSString *mainNibFileName; bool success = false; @@ -350,6 +351,9 @@ LoadMainMenuNibIfAvailable(void) } return success; +#else + return false; +#endif } static void From 9925ee52d77893d614ebe1a3b19a4f168d6a15ba Mon Sep 17 00:00:00 2001 From: Joshua Root Date: Thu, 24 Nov 2022 07:37:36 +1100 Subject: [PATCH 06/19] SDL_mfijoystick.m: fix build with Xcode < 9 Fixes #6601. (cherry picked from commit 53ca1f77029289a58f1a9963a00b637b903f494d) --- src/joystick/iphoneos/SDL_mfijoystick.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/joystick/iphoneos/SDL_mfijoystick.m b/src/joystick/iphoneos/SDL_mfijoystick.m index 8f207afb2..86e481067 100644 --- a/src/joystick/iphoneos/SDL_mfijoystick.m +++ b/src/joystick/iphoneos/SDL_mfijoystick.m @@ -639,11 +639,16 @@ static int IOS_JoystickInit(void) { #if defined(__MACOSX__) +#if _SDL_HAS_BUILTIN(__builtin_available) if (@available(macOS 10.16, *)) { /* Continue with initialization on macOS 11+ */ } else { return 0; } +#else + /* No @available, must be an older macOS version */ + return 0; +#endif #endif @autoreleasepool { From da1bddd27c30818570a558c16c977ad67d9debdd Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Wed, 23 Nov 2022 18:11:50 -0500 Subject: [PATCH 07/19] wayland: Fix libdecor_dispatch signature The function returns an int, not a bool. (cherry picked from commit f47169fcba8a27bb0740b6b4993989ff9262c21f) --- src/video/wayland/SDL_waylandsym.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/wayland/SDL_waylandsym.h b/src/video/wayland/SDL_waylandsym.h index 8b31d8cac..4ff726e99 100644 --- a/src/video/wayland/SDL_waylandsym.h +++ b/src/video/wayland/SDL_waylandsym.h @@ -211,7 +211,7 @@ SDL_WAYLAND_SYM(bool, libdecor_configuration_get_content_size, (struct libdecor_ int *)) SDL_WAYLAND_SYM(bool, libdecor_configuration_get_window_state, (struct libdecor_configuration *,\ enum libdecor_window_state *)) -SDL_WAYLAND_SYM(bool, libdecor_dispatch, (struct libdecor *, int)) +SDL_WAYLAND_SYM(int, libdecor_dispatch, (struct libdecor *, int)) #endif #undef SDL_WAYLAND_MODULE From bf70a3760631400eb7778b51a31d8b8f453aa2c0 Mon Sep 17 00:00:00 2001 From: Joshua Root Date: Thu, 24 Nov 2022 11:06:37 +1100 Subject: [PATCH 08/19] vulkan_metal.h: Make compatible with ObjC ARC Fixes #6598 (cherry picked from commit 239423e205496997a387b4f265b1cdaf5acd18cb) --- src/video/khronos/vulkan/vulkan_metal.h | 26 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/video/khronos/vulkan/vulkan_metal.h b/src/video/khronos/vulkan/vulkan_metal.h index 11b964091..898d3f298 100644 --- a/src/video/khronos/vulkan/vulkan_metal.h +++ b/src/video/khronos/vulkan/vulkan_metal.h @@ -26,6 +26,14 @@ extern "C" { typedef void CAMetalLayer; #endif +#define SDL_UNSAFE_UNRETAINED +#if defined(__OBJC__) && defined(__has_feature) +#if __has_feature(objc_arc) +#undef SDL_UNSAFE_UNRETAINED +#define SDL_UNSAFE_UNRETAINED __unsafe_unretained +#endif +#endif + #define VK_EXT_METAL_SURFACE_SPEC_VERSION 1 #define VK_EXT_METAL_SURFACE_EXTENSION_NAME "VK_EXT_metal_surface" typedef VkFlags VkMetalSurfaceCreateFlagsEXT; @@ -33,7 +41,7 @@ typedef struct VkMetalSurfaceCreateInfoEXT { VkStructureType sType; const void* pNext; VkMetalSurfaceCreateFlagsEXT flags; - const CAMetalLayer* pLayer; + const CAMetalLayer SDL_UNSAFE_UNRETAINED *pLayer; } VkMetalSurfaceCreateInfoEXT; typedef VkResult (VKAPI_PTR *PFN_vkCreateMetalSurfaceEXT)(VkInstance instance, const VkMetalSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); @@ -111,27 +119,27 @@ typedef struct VkExportMetalObjectsInfoEXT { typedef struct VkExportMetalDeviceInfoEXT { VkStructureType sType; const void* pNext; - MTLDevice_id mtlDevice; + MTLDevice_id SDL_UNSAFE_UNRETAINED mtlDevice; } VkExportMetalDeviceInfoEXT; typedef struct VkExportMetalCommandQueueInfoEXT { VkStructureType sType; const void* pNext; VkQueue queue; - MTLCommandQueue_id mtlCommandQueue; + MTLCommandQueue_id SDL_UNSAFE_UNRETAINED mtlCommandQueue; } VkExportMetalCommandQueueInfoEXT; typedef struct VkExportMetalBufferInfoEXT { VkStructureType sType; const void* pNext; VkDeviceMemory memory; - MTLBuffer_id mtlBuffer; + MTLBuffer_id SDL_UNSAFE_UNRETAINED mtlBuffer; } VkExportMetalBufferInfoEXT; typedef struct VkImportMetalBufferInfoEXT { VkStructureType sType; const void* pNext; - MTLBuffer_id mtlBuffer; + MTLBuffer_id SDL_UNSAFE_UNRETAINED mtlBuffer; } VkImportMetalBufferInfoEXT; typedef struct VkExportMetalTextureInfoEXT { @@ -141,14 +149,14 @@ typedef struct VkExportMetalTextureInfoEXT { VkImageView imageView; VkBufferView bufferView; VkImageAspectFlagBits plane; - MTLTexture_id mtlTexture; + MTLTexture_id SDL_UNSAFE_UNRETAINED mtlTexture; } VkExportMetalTextureInfoEXT; typedef struct VkImportMetalTextureInfoEXT { VkStructureType sType; const void* pNext; VkImageAspectFlagBits plane; - MTLTexture_id mtlTexture; + MTLTexture_id SDL_UNSAFE_UNRETAINED mtlTexture; } VkImportMetalTextureInfoEXT; typedef struct VkExportMetalIOSurfaceInfoEXT { @@ -169,13 +177,13 @@ typedef struct VkExportMetalSharedEventInfoEXT { const void* pNext; VkSemaphore semaphore; VkEvent event; - MTLSharedEvent_id mtlSharedEvent; + MTLSharedEvent_id SDL_UNSAFE_UNRETAINED mtlSharedEvent; } VkExportMetalSharedEventInfoEXT; typedef struct VkImportMetalSharedEventInfoEXT { VkStructureType sType; const void* pNext; - MTLSharedEvent_id mtlSharedEvent; + MTLSharedEvent_id SDL_UNSAFE_UNRETAINED mtlSharedEvent; } VkImportMetalSharedEventInfoEXT; typedef void (VKAPI_PTR *PFN_vkExportMetalObjectsEXT)(VkDevice device, VkExportMetalObjectsInfoEXT* pMetalObjectsInfo); From 00731eb01122be18589e7241a0d2e713c4e793aa Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Wed, 23 Nov 2022 23:11:25 -0500 Subject: [PATCH 09/19] wayland: Fix build when not using the shared Wayland libraries Explicitly include the Wayland protocol headers when statically linking against the Wayland libraries or older system headers might be used instead of the local versions. (cherry picked from commit 836eb224428aca3bdab2a6bf56d347262e475b15) --- src/video/wayland/SDL_waylanddyn.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h index 12341e16f..887c51d1c 100644 --- a/src/video/wayland/SDL_waylanddyn.h +++ b/src/video/wayland/SDL_waylanddyn.h @@ -166,6 +166,13 @@ void SDL_WAYLAND_UnloadSymbols(void); #else /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ +/* + * These must be included before libdecor.h, otherwise the libdecor header + * pulls in the system Wayland protocol headers instead of ours. + */ +#include "wayland-client-protocol.h" +#include "wayland-egl.h" + #ifdef HAVE_LIBDECOR_H #include #endif From c76a31341cf7b9c35bda34f692935b5fbaacc1b4 Mon Sep 17 00:00:00 2001 From: Sylvain Becker Date: Thu, 24 Nov 2022 16:07:03 +0100 Subject: [PATCH 10/19] SDL_mfijoystick.m: remove VLA, so that projects can be built with error on vla --- src/joystick/iphoneos/SDL_mfijoystick.m | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/joystick/iphoneos/SDL_mfijoystick.m b/src/joystick/iphoneos/SDL_mfijoystick.m index 86e481067..2ffdab5f5 100644 --- a/src/joystick/iphoneos/SDL_mfijoystick.m +++ b/src/joystick/iphoneos/SDL_mfijoystick.m @@ -956,6 +956,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) #endif if (controller.extendedGamepad) { + SDL_bool isstack; GCExtendedGamepad *gamepad = controller.extendedGamepad; /* Axis order matches the XInput Windows mappings. */ @@ -969,9 +970,14 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) }; /* Button order matches the XInput Windows mappings. */ - Uint8 buttons[joystick->nbuttons]; + Uint8 *buttons = SDL_small_alloc(Uint8, joystick->nbuttons, &isstack); int button_count = 0; + if (buttons == NULL) { + SDL_OutOfMemory(); + return; + } + /* These buttons are part of the original MFi spec */ buttons[button_count++] = gamepad.buttonA.isPressed; buttons[button_count++] = gamepad.buttonB.isPressed; @@ -1088,12 +1094,20 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) } #endif /* ENABLE_MFI_SENSORS */ + SDL_small_free(buttons, isstack); } else if (controller.gamepad) { + SDL_bool isstack; GCGamepad *gamepad = controller.gamepad; /* Button order matches the XInput Windows mappings. */ - Uint8 buttons[joystick->nbuttons]; + Uint8 *buttons = SDL_small_alloc(Uint8, joystick->nbuttons, &isstack); int button_count = 0; + + if (buttons == NULL) { + SDL_OutOfMemory(); + return; + } + buttons[button_count++] = gamepad.buttonA.isPressed; buttons[button_count++] = gamepad.buttonB.isPressed; buttons[button_count++] = gamepad.buttonX.isPressed; @@ -1108,6 +1122,8 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) for (i = 0; i < button_count; i++) { SDL_PrivateJoystickButton(joystick, i, buttons[i]); } + + SDL_small_free(buttons, isstack); } #if TARGET_OS_TV else if (controller.microGamepad) { From b97d2ed6c5c2ac0c2e59a340734b8be6a0552575 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 24 Nov 2022 20:39:55 +0100 Subject: [PATCH 11/19] cmake: add X11 include dir to check dirs --- cmake/sdlchecks.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 3686f01d9..65a98efbe 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -400,6 +400,7 @@ endmacro() # - SDL_X11_SHARED opt # - HAVE_SDL_LOADSO opt macro(CheckX11) + cmake_push_check_state(RESET) if(SDL_X11) foreach(_LIB X11 Xext Xcursor Xi Xfixes Xrandr Xrender Xss) FindLibraryAndSONAME("${_LIB}") @@ -422,6 +423,7 @@ macro(CheckX11) if(X_INCLUDEDIR) list(APPEND EXTRA_CFLAGS "-I${X_INCLUDEDIR}") + list(APPEND CMAKE_REQUIRED_INCLUDES ${X_INCLUDEDIR}) endif() find_file(HAVE_XCURSOR_H NAMES "X11/Xcursor/Xcursor.h" HINTS "${X_INCLUDEDIR}") @@ -597,6 +599,7 @@ macro(CheckX11) # Prevent Mesa from including X11 headers list(APPEND EXTRA_CFLAGS "-DMESA_EGL_NO_X11_HEADERS -DEGL_NO_X11") endif() + cmake_pop_check_state() endmacro() macro(WaylandProtocolGen _SCANNER _CODE_MODE _XML _PROTL) From 859cb13ef8d2a7beb8111348766fdd3e223dc426 Mon Sep 17 00:00:00 2001 From: Michael Fitzmayer Date: Thu, 24 Nov 2022 21:53:17 +0100 Subject: [PATCH 12/19] Add bitdraw.h, remove non-working stub class (cherry picked from commit 67f31a19a8eb06ee80bccb9ec8cc8c34aa635b3d) --- src/video/ngage/SDL_ngagevideo.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/video/ngage/SDL_ngagevideo.h b/src/video/ngage/SDL_ngagevideo.h index af8e8d857..e74038bb2 100644 --- a/src/video/ngage/SDL_ngagevideo.h +++ b/src/video/ngage/SDL_ngagevideo.h @@ -30,16 +30,7 @@ #include #include #include - -class CFbsDrawDevice : public CBase -{ -public: -public: - IMPORT_C static CFbsDrawDevice* NewScreenDeviceL(TScreenInfoV01 aInfo,TDisplayMode aDispMode); -public: - virtual void Update() {} - virtual void UpdateRegion(const TRect&) {} -}; +#include "bitdraw.h" // CFbsDrawDevice #define _THIS SDL_VideoDevice *_this From 5edd6846dbafa11d2a3257d44f0404295321bb3c Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 26 Nov 2022 13:57:12 -0500 Subject: [PATCH 13/19] cocoa: Patched to compile on macOS SDK < 10.10. Fixes #6586. (cherry picked from commit fa5adcafd52303fde86c64094462303404259d75) --- src/video/cocoa/SDL_cocoaopengl.h | 3 +++ src/video/cocoa/SDL_cocoaopengl.m | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/video/cocoa/SDL_cocoaopengl.h b/src/video/cocoa/SDL_cocoaopengl.h index fe8a8e51c..9330b5744 100644 --- a/src/video/cocoa/SDL_cocoaopengl.h +++ b/src/video/cocoa/SDL_cocoaopengl.h @@ -59,6 +59,9 @@ struct SDL_GLDriverData - (SDL_Window*)window; - (void)explicitUpdate; - (void)dealloc; + +@property (retain, nonatomic) NSOpenGLPixelFormat* openglPixelFormat; // macOS 10.10 has -[NSOpenGLContext pixelFormat] but this handles older OS releases. + @end /* OpenGL functions */ diff --git a/src/video/cocoa/SDL_cocoaopengl.m b/src/video/cocoa/SDL_cocoaopengl.m index 607f30716..2cdbc17e9 100644 --- a/src/video/cocoa/SDL_cocoaopengl.m +++ b/src/video/cocoa/SDL_cocoaopengl.m @@ -76,6 +76,7 @@ DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const { self = [super initWithFormat:format shareContext:share]; if (self) { + self.openglPixelFormat = format; SDL_AtomicSet(&self->dirty, 0); self->window = NULL; SDL_AtomicSet(&self->swapIntervalSetting, 0); @@ -100,7 +101,7 @@ DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const - (void)movedToNewScreen { if (self->displayLink) { - CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(self->displayLink, [self CGLContextObj], [[self pixelFormat] CGLPixelFormatObj]); + CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(self->displayLink, [self CGLContextObj], [[self openglPixelFormat] CGLPixelFormatObj]); } } From 92057e683e7eb788903b24e1f8894580a2511424 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 26 Nov 2022 13:09:50 -0800 Subject: [PATCH 14/19] Temporary hack to address performance issues in https://github.com/libsdl-org/SDL/issues/6581#issuecomment-1327987916 (thanks @icculus!) (cherry picked from commit 9c8369e097b229997875c0aeb4dc9cfdcde0e2b2) --- src/SDL.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/SDL.c b/src/SDL.c index 6297159e4..cde3434a9 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -519,13 +519,21 @@ SDL_Quit(void) void SDL_GetVersion(SDL_version * ver) { + static SDL_bool check_hint = SDL_TRUE; + static SDL_bool legacy_version = SDL_FALSE; + if (!ver) { return; } SDL_VERSION(ver); - if (SDL_GetHintBoolean("SDL_LEGACY_VERSION", SDL_FALSE)) { + if (check_hint) { + check_hint = SDL_FALSE; + legacy_version = SDL_GetHintBoolean("SDL_LEGACY_VERSION", SDL_FALSE); + } + + if (legacy_version) { /* Prior to SDL 2.24.0, the patch version was incremented with every release */ ver->patch = ver->minor; ver->minor = 0; From f4080637c4420365fc6bb8738b1751f29de238dd Mon Sep 17 00:00:00 2001 From: Joshua Root Date: Sun, 27 Nov 2022 11:27:19 +1100 Subject: [PATCH 15/19] Fix build with Xcode < 7 The _Nullable attribute is not available in older versions. (cherry picked from commit 9a64aa6f95298bf459f8b9dca583df7064956cd9) --- src/video/cocoa/SDL_cocoaopengl.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/video/cocoa/SDL_cocoaopengl.m b/src/video/cocoa/SDL_cocoaopengl.m index 2cdbc17e9..58df449a3 100644 --- a/src/video/cocoa/SDL_cocoaopengl.m +++ b/src/video/cocoa/SDL_cocoaopengl.m @@ -44,6 +44,16 @@ #pragma clang diagnostic ignored "-Wdeprecated-declarations" #endif +/* _Nullable is available starting Xcode 7 */ +#ifdef __has_feature +#if __has_feature(nullability) +#define HAS_FEATURE_NULLABLE +#endif +#endif +#ifndef HAS_FEATURE_NULLABLE +#define _Nullable +#endif + static SDL_bool SDL_opengl_async_dispatch = SDL_FALSE; static void SDLCALL From 79373c5a5c54db51e55df95fa61fe8e3a3d50751 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Sun, 27 Nov 2022 22:46:54 +0100 Subject: [PATCH 16/19] SDL_ResampleAudio: Fix float accumulation error While 78f97108f9dad22db6708f28322561eb9828fc36 reduced the accumulation error, it was still big enough to cause distortions. Fixes #6196. (cherry picked from commit 8145212103264b04c20cdb50b430f3c99b44e9b4) --- src/audio/SDL_audiocvt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index 196013e11..69427c5ef 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -202,7 +202,6 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate, typedef float ResampleFloatType; const ResampleFloatType finrate = (ResampleFloatType) inrate; - const ResampleFloatType outtimeincr = ((ResampleFloatType) 1.0f) / ((ResampleFloatType) outrate); const ResampleFloatType ratio = ((float) outrate) / ((float) inrate); const int paddinglen = ResamplerPadding(inrate, outrate); const int framelen = chans * (int)sizeof (float); @@ -247,7 +246,7 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate, *(dst++) = outsample; } - outtime = outtimeincr * i; + outtime = ((ResampleFloatType) i) / ((ResampleFloatType) outrate); } return outframes * chans * sizeof (float); From 45c7d838d4e0cb62343ee2dc80209e5e6838c4d7 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 29 Nov 2022 17:47:30 +0100 Subject: [PATCH 17/19] cmake: use target_link_libraries to pass -Wl,--undefined=WinMain (cherry-picked from commit e2060de714481ed58b6a2e781f7439090003a7b4) --- CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 021b66cd5..4a52e4223 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3241,11 +3241,10 @@ if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) target_link_libraries(SDL2main PRIVATE shell32) endif() if(MINGW OR CYGWIN) - cmake_minimum_required(VERSION 3.13) if(CMAKE_SIZEOF_VOID_P EQUAL 4) - target_link_options(SDL2main PUBLIC "$<$,EXECUTABLE>:-Wl,--undefined=_WinMain@16>") + target_link_libraries(SDL2main PUBLIC "$<$,EXECUTABLE>:-Wl,--undefined=_WinMain@16>") else() - target_link_options(SDL2main PUBLIC "$<$,EXECUTABLE>:-Wl,--undefined=WinMain>") + target_link_libraries(SDL2main PUBLIC "$<$,EXECUTABLE>:-Wl,--undefined=WinMain>") endif() endif() if (NOT ANDROID) From 2879f2aeba32f8f26899e82e00020e3c17240fe7 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 30 Nov 2022 14:37:34 -0800 Subject: [PATCH 18/19] Fixed crash if GetRectDisplayIndex() is called before SDL_VideoInit() (cherry picked from commit d87048fd5a7dff55c4cb205dd29e527c9cc51225) --- src/video/SDL_video.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 0804c9cfb..0809706c2 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1157,25 +1157,27 @@ GetRectDisplayIndex(int x, int y, int w, int h) center.x = x + w / 2; center.y = y + h / 2; - for (i = 0; i < _this->num_displays; ++i) { - SDL_Rect display_rect; - SDL_GetDisplayBounds(i, &display_rect); + if (_this) { + for (i = 0; i < _this->num_displays; ++i) { + SDL_Rect display_rect; + SDL_GetDisplayBounds(i, &display_rect); - /* Check if the window is fully enclosed */ - if (SDL_EnclosePoints(¢er, 1, &display_rect, NULL)) { - return i; - } + /* Check if the window is fully enclosed */ + if (SDL_EnclosePoints(¢er, 1, &display_rect, NULL)) { + return i; + } - /* Snap window center to the display rect */ - closest_point_on_display = center; - SDL_GetClosestPointOnRect(&display_rect, &closest_point_on_display); + /* Snap window center to the display rect */ + closest_point_on_display = center; + SDL_GetClosestPointOnRect(&display_rect, &closest_point_on_display); - delta.x = center.x - closest_point_on_display.x; - delta.y = center.y - closest_point_on_display.y; - dist = (delta.x*delta.x + delta.y*delta.y); - if (dist < closest_dist) { - closest = i; - closest_dist = dist; + delta.x = center.x - closest_point_on_display.x; + delta.y = center.y - closest_point_on_display.y; + dist = (delta.x * delta.x + delta.y * delta.y); + if (dist < closest_dist) { + closest = i; + closest_dist = dist; + } } } From f17058b562c8a1090c0c996b42982721ace90903 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 1 Dec 2022 11:54:51 -0800 Subject: [PATCH 19/19] Updated to version 2.26.1 for release --- CMakeLists.txt | 2 +- Makefile.os2 | 2 +- Makefile.w32 | 2 +- Xcode/SDL/Info-Framework.plist | 4 ++-- Xcode/SDL/SDL.xcodeproj/project.pbxproj | 8 ++++---- .../app/src/main/java/org/libsdl/app/SDLActivity.java | 2 +- configure | 2 +- configure.ac | 2 +- include/SDL_version.h | 2 +- src/main/windows/version.rc | 8 ++++---- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a52e4223..1f0bd15f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,7 +86,7 @@ endif() # See docs/release_checklist.md set(SDL_MAJOR_VERSION 2) set(SDL_MINOR_VERSION 26) -set(SDL_MICRO_VERSION 0) +set(SDL_MICRO_VERSION 1) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") # Set defaults preventing destination file conflicts diff --git a/Makefile.os2 b/Makefile.os2 index 2e38ed0d4..4c821fb3c 100644 --- a/Makefile.os2 +++ b/Makefile.os2 @@ -15,7 +15,7 @@ LIBNAME = SDL2 MAJOR_VERSION = 2 MINOR_VERSION = 26 -MICRO_VERSION = 0 +MICRO_VERSION = 1 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) DESCRIPTION = Simple DirectMedia Layer 2 diff --git a/Makefile.w32 b/Makefile.w32 index 82609036b..3f0e3e4d6 100644 --- a/Makefile.w32 +++ b/Makefile.w32 @@ -6,7 +6,7 @@ LIBNAME = SDL2 MAJOR_VERSION = 2 MINOR_VERSION = 26 -MICRO_VERSION = 0 +MICRO_VERSION = 1 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) LIBHOME = . diff --git a/Xcode/SDL/Info-Framework.plist b/Xcode/SDL/Info-Framework.plist index 09bae6c16..c1b2c03a7 100644 --- a/Xcode/SDL/Info-Framework.plist +++ b/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.26.0 + 2.26.1 CFBundleSignature SDLX CFBundleVersion - 2.26.0 + 2.26.1 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index b59a594fb..e8ff333c1 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -9529,7 +9529,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEPLOYMENT_POSTPROCESSING = YES; DYLIB_COMPATIBILITY_VERSION = 2601.0.0; - DYLIB_CURRENT_VERSION = 2601.0.0; + DYLIB_CURRENT_VERSION = 2601.1.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -9614,7 +9614,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = dwarf; DYLIB_COMPATIBILITY_VERSION = 2601.0.0; - DYLIB_CURRENT_VERSION = 2601.0.0; + DYLIB_CURRENT_VERSION = 2601.1.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -9863,7 +9863,7 @@ DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 2601.0.0; - DYLIB_CURRENT_VERSION = 2601.0.0; + DYLIB_CURRENT_VERSION = 2601.1.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; @@ -9915,7 +9915,7 @@ DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 2601.0.0; - DYLIB_CURRENT_VERSION = 2601.0.0; + DYLIB_CURRENT_VERSION = 2601.1.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu11; diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 90e3ac60b..97f7cb514 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 2; private static final int SDL_MINOR_VERSION = 26; - private static final int SDL_MICRO_VERSION = 0; + private static final int SDL_MICRO_VERSION = 1; /* // Display InputType.SOURCE/CLASS of events and devices // diff --git a/configure b/configure index 87c576def..f099b0480 100755 --- a/configure +++ b/configure @@ -3454,7 +3454,7 @@ orig_CFLAGS="$CFLAGS" # See docs/release_checklist.md SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=26 -SDL_MICRO_VERSION=0 +SDL_MICRO_VERSION=1 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` diff --git a/configure.ac b/configure.ac index cc30f9a16..91f2401b1 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ dnl Set various version strings - taken gratefully from the GTk sources # See docs/release_checklist.md SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=26 -SDL_MICRO_VERSION=0 +SDL_MICRO_VERSION=1 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` diff --git a/include/SDL_version.h b/include/SDL_version.h index e85fceb34..786b112ee 100644 --- a/include/SDL_version.h +++ b/include/SDL_version.h @@ -59,7 +59,7 @@ typedef struct SDL_version */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 26 -#define SDL_PATCHLEVEL 0 +#define SDL_PATCHLEVEL 1 /** * Macro to determine SDL version program was compiled against. diff --git a/src/main/windows/version.rc b/src/main/windows/version.rc index fb2c26890..bc5088f89 100644 --- a/src/main/windows/version.rc +++ b/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,26,0,0 - PRODUCTVERSION 2,26,0,0 + FILEVERSION 2,26,1,0 + PRODUCTVERSION 2,26,1,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 26, 0, 0\0" + VALUE "FileVersion", "2, 26, 1, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2022 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 26, 0, 0\0" + VALUE "ProductVersion", "2, 26, 1, 0\0" END END BLOCK "VarFileInfo"