@@ -966,8 +966,8 @@ if(SDL_LIBC)
bcopy
calloc ceil ceilf copysign copysignf cos cosf
_Exit exp expf
- fabs fabsf floor floorf fmod fmodf fopen64 free fseeko fseeko64
- getenv
+ fabs fabsf fdatasync floor floorf fmod fmodf fopen64 free fseeko fseeko64
+ getenv gethostname
_i64toa index itoa
log log10 log10f logf lround lroundf _ltoa
malloc memcmp memcpy memmove memset modf modff
@@ -229,6 +229,12 @@ typedef enum SDL_EventType
SDL_EVENT_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
SDL_EVENT_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
+ /* Reserved events for private platforms */
+ SDL_EVENT_PRIVATE0 = 0x4000,
+ SDL_EVENT_PRIVATE1,
+ SDL_EVENT_PRIVATE2,
+ SDL_EVENT_PRIVATE3,
+
/* Internal events */
SDL_EVENT_POLL_SENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
@@ -49,7 +49,11 @@
#include <SDL3/SDL_events.h>
#ifndef SDL_MAIN_HANDLED
- #ifdef SDL_PLATFORM_WIN32
+ #if defined(SDL_PLATFORM_PRIVATE_MAIN)
+ /* Private platforms may have their own ideas about entry points. */
+ #include "SDL_main_private.h"
+ #elif defined(SDL_PLATFORM_WIN32)
/* On Windows SDL provides WinMain(), which parses the command line and passes
the arguments to your main function.
@@ -68,7 +68,11 @@
unless the real entry point needs to be somewhere else entirely, like Android where it's in Java code */
#if (!defined(SDL_MAIN_USE_CALLBACKS) || defined(SDL_MAIN_CALLBACK_STANDARD)) && !defined(SDL_MAIN_EXPORTED)
- #if defined(SDL_PLATFORM_WINDOWS)
+ #include "SDL_main_impl_private.h"
+ #elif defined(SDL_PLATFORM_WINDOWS)
/* these defines/typedefs are needed for the WinMain() definition */
#ifndef WINAPI
@@ -31,7 +31,9 @@
*/
/* Add any platform that doesn't build using the configure system. */
-#if defined(SDL_PLATFORM_WIN32)
+#if defined(SDL_PLATFORM_PRIVATE)
+#include "SDL_build_config_private.h"
+#elif defined(SDL_PLATFORM_WIN32)
#include "SDL_build_config_windows.h"
#elif defined(SDL_PLATFORM_WINGDK)
#include "SDL_build_config_wingdk.h"
@@ -75,8 +75,10 @@
#cmakedefine HAVE_MALLOC 1
#cmakedefine HAVE_CALLOC 1
#cmakedefine HAVE_REALLOC 1
+#cmakedefine HAVE_FDATASYNC 1
#cmakedefine HAVE_FREE 1
#cmakedefine HAVE_GETENV 1
+#cmakedefine HAVE_GETHOSTNAME 1
#cmakedefine HAVE_SETENV 1
#cmakedefine HAVE_PUTENV 1
#cmakedefine HAVE_UNSETENV 1
@@ -57,8 +57,10 @@
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
+#define HAVE_FDATASYNC 1
#define HAVE_FREE 1
#define HAVE_GETENV 1
+#define HAVE_GETHOSTNAME 1
#define HAVE_PUTENV 1
#define HAVE_SETENV 1
#define HAVE_UNSETENV 1
@@ -60,8 +60,10 @@
@@ -49,8 +49,10 @@
@@ -54,8 +54,10 @@
@@ -135,6 +135,7 @@ typedef unsigned int uintptr_t;
#define HAVE_ABS 1
#define HAVE_MEMSET 1
@@ -75,6 +75,7 @@
#define HAVE_LIBC 1
@@ -662,7 +662,9 @@ const char *SDL_GetRevision(void)
// Get the name of the platform
const char *SDL_GetPlatform(void)
{
-#if defined(SDL_PLATFORM_AIX)
+ return SDL_PLATFORM_PRIVATE_NAME;
+#elif defined(SDL_PLATFORM_AIX)
return "AIX";
#elif defined(SDL_PLATFORM_ANDROID)
return "Android";
@@ -245,7 +245,9 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
state = (SDL_AssertState)selected;
}
} else {
-#ifdef SDL_PLATFORM_EMSCRIPTEN
+#ifdef SDL_PLATFORM_PRIVATE_ASSERT
+ SDL_PRIVATE_PROMPTASSERTION();
+#elif defined(SDL_PLATFORM_EMSCRIPTEN)
// This is nasty, but we can't block on a custom UI.
for (;;) {
bool okay = true;
@@ -20,7 +20,7 @@
#include "SDL_internal.h"
-#if defined(SDL_PLATFORM_UNIX) || defined(SDL_PLATFORM_APPLE)
+#ifdef HAVE_GETHOSTNAME
#include <unistd.h>
#endif
@@ -299,7 +299,7 @@ int SDL_URIToLocal(const char *src, char *dst)
const size_t src_len = hostname_end - (src + 1);
size_t hostname_len;
char hostname[257];
if (gethostname(hostname, 255) == 0) {
hostname[256] = '\0';
@@ -26,6 +26,9 @@
// Available audio drivers
static const AudioBootStrap *const bootstrap[] = {
+#ifdef SDL_AUDIO_DRIVER_PRIVATE
+ &PRIVATEAUDIO_bootstrap,
+#endif
#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO
#ifdef SDL_AUDIO_DRIVER_PIPEWIRE
&PIPEWIRE_PREFERRED_bootstrap,
@@ -353,6 +353,7 @@ typedef struct AudioBootStrap
} AudioBootStrap;
// Not all of these are available in a given build. Use #ifdefs, etc.
+extern AudioBootStrap PRIVATEAUDIO_bootstrap;
extern AudioBootStrap PIPEWIRE_PREFERRED_bootstrap;
extern AudioBootStrap PIPEWIRE_bootstrap;
extern AudioBootStrap PULSEAUDIO_bootstrap;
@@ -27,8 +27,6 @@
#define DEBUG_CAMERA 0
-typedef struct SDL_Camera SDL_Camera;
-
/* Backends should call this as devices are added to the system (such as
a USB camera being plugged in), and should also be called for
for every device found during DetectDevices(). */
@@ -43,7 +43,9 @@
#include "TargetConditionals.h"
-#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE // probably not useful on iOS.
+#if defined(SDL_PLATFORM_PRIVATE) // probably not useful on private platforms.
+#define SDL_DYNAMIC_API 0
+#elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE // probably not useful on iOS.
#define SDL_DYNAMIC_API 0
#elif defined(SDL_PLATFORM_ANDROID) // probably not useful on Android.
@@ -370,10 +370,8 @@ static int SDL_fdatasync(int fd)
result = fcntl(fd, F_FULLFSYNC);
#elif defined(SDL_PLATFORM_HAIKU)
result = fsync(fd);
-#elif defined(_POSIX_SYNCHRONIZED_IO) // POSIX defines this if fdatasync() exists, so we don't need a CMake test.
-#ifndef SDL_PLATFORM_RISCOS // !!! FIXME: however, RISCOS doesn't have the symbol...maybe we need to link to an extra library or something?
+#elif defined(HAVE_FDATASYNC)
result = fdatasync(fd);
-#endif
return result;
@@ -29,6 +29,9 @@
Alternatively, you can use the app located in test/controllermap
static const char *s_GamepadMappings[] = {
+#ifdef SDL_JOYSTICK_PRIVATE
+ SDL_PRIVATE_GAMEPAD_DEFINITIONS
#ifdef SDL_JOYSTICK_XINPUT
"xinput,*,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
@@ -52,6 +52,9 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = {
#ifdef SDL_JOYSTICK_HIDAPI // Highest priority driver for supported devices
&SDL_HIDAPI_JoystickDriver,
+ &SDL_PRIVATE_JoystickDriver,
#ifdef SDL_JOYSTICK_GAMEINPUT // Higher priority than other Windows drivers
&SDL_GAMEINPUT_JoystickDriver,
@@ -240,6 +240,7 @@ typedef struct SDL_JoystickDriver
#define SDL_LED_MIN_REPEAT_MS 5000
// The available joystick drivers
+extern SDL_JoystickDriver SDL_PRIVATE_JoystickDriver;
extern SDL_JoystickDriver SDL_ANDROID_JoystickDriver;
extern SDL_JoystickDriver SDL_BSD_JoystickDriver;
extern SDL_JoystickDriver SDL_DARWIN_JoystickDriver;
@@ -26,7 +26,9 @@
#include <pthread_np.h>
+#ifdef HAVE_SIGNAL_H
#include <signal.h>
#include <errno.h>
#ifdef SDL_PLATFORM_LINUX
@@ -55,11 +57,13 @@
#include <kernel/OS.h>
// List of signals to mask in the subthreads
static const int sig_list[] = {
SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGCHLD, SIGWINCH,
SIGVTALRM, SIGPROF, 0
};
static void *RunThread(void *data)
@@ -117,8 +121,10 @@ bool SDL_SYS_CreateThread(SDL_Thread *thread,
void SDL_SYS_SetupThread(const char *name)
int i;
sigset_t mask;
if (name) {
#if (defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_LINUX)) && defined(HAVE_DLOPEN)
@@ -154,12 +160,14 @@ void SDL_SYS_SetupThread(const char *name)
// Mask asynchronous signals for this thread
sigemptyset(&mask);
for (i = 0; sig_list[i]; ++i) {
sigaddset(&mask, sig_list[i]);
pthread_sigmask(SIG_BLOCK, &mask, 0);
#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
// Allow ourselves to be asynchronously cancelled
@@ -300,7 +300,9 @@ void SDL_EGL_UnloadLibrary(SDL_VideoDevice *_this)
static bool SDL_EGL_LoadLibraryInternal(SDL_VideoDevice *_this, const char *egl_path)
SDL_SharedObject *egl_dll_handle = NULL;
+#if !defined(SDL_VIDEO_STATIC_ANGLE) && !defined(SDL_VIDEO_DRIVER_VITA)
SDL_SharedObject *opengl_dll_handle = NULL;
const char *path = NULL;
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
const char *d3dcompiler;
@@ -426,9 +428,6 @@ static bool SDL_EGL_LoadLibraryInternal(SDL_VideoDevice *_this, const char *egl_
_this->egl_data->egl_dll_handle = egl_dll_handle;
-#ifdef SDL_VIDEO_DRIVER_VITA
- _this->egl_data->opengl_dll_handle = opengl_dll_handle;
// Load new function pointers
LOAD_FUNC(PFNEGLGETDISPLAYPROC, eglGetDisplay);
@@ -498,6 +498,7 @@ typedef struct VideoBootStrap
} VideoBootStrap;
+extern VideoBootStrap PRIVATE_bootstrap;
extern VideoBootStrap COCOA_bootstrap;
extern VideoBootStrap X11_bootstrap;
extern VideoBootStrap WINDOWS_bootstrap;
@@ -71,6 +71,9 @@
// Available video drivers
static VideoBootStrap *bootstrap[] = {
+#ifdef SDL_VIDEO_DRIVER_PRIVATE
+ &PRIVATE_bootstrap,
#ifdef SDL_VIDEO_DRIVER_COCOA
&COCOA_bootstrap,