From 0f20f387fcb2e2802e7b47796200d69124d48ffa Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Wed, 7 Aug 2024 21:05:59 +0300 Subject: [PATCH] Update SDL3 --- Source/Engine/Engine/Screen.cpp | 8 +- Source/Engine/Input/Mouse.h | 3 +- Source/Engine/Platform/SDL/SDLInput.cpp | 11 +- Source/Engine/Platform/SDL/SDLPlatform.cpp | 1 + Source/Engine/Platform/SDL/SDLWindow.cpp | 73 +-- Source/Engine/Platform/SDL/SDLWindow.h | 5 +- Source/ThirdParty/SDL/SDL3/SDL_audio.h | 51 +- Source/ThirdParty/SDL/SDL3/SDL_camera.h | 26 +- Source/ThirdParty/SDL/SDL3/SDL_clipboard.h | 24 +- Source/ThirdParty/SDL/SDL3/SDL_events.h | 84 +-- Source/ThirdParty/SDL/SDL3/SDL_filesystem.h | 22 +- Source/ThirdParty/SDL/SDL3/SDL_gamepad.h | 83 +-- Source/ThirdParty/SDL/SDL3/SDL_guid.h | 9 +- Source/ThirdParty/SDL/SDL3/SDL_haptic.h | 15 +- Source/ThirdParty/SDL/SDL3/SDL_hints.h | 613 +++++++++++++----- Source/ThirdParty/SDL/SDL3/SDL_init.h | 138 ++++ Source/ThirdParty/SDL/SDL3/SDL_iostream.h | 6 +- Source/ThirdParty/SDL/SDL3/SDL_joystick.h | 23 +- Source/ThirdParty/SDL/SDL3/SDL_keyboard.h | 166 +++-- Source/ThirdParty/SDL/SDL3/SDL_keycode.h | 2 - Source/ThirdParty/SDL/SDL3/SDL_locale.h | 9 +- Source/ThirdParty/SDL/SDL3/SDL_log.h | 42 +- Source/ThirdParty/SDL/SDL3/SDL_mouse.h | 56 +- Source/ThirdParty/SDL/SDL3/SDL_mutex.h | 10 +- Source/ThirdParty/SDL/SDL3/SDL_oldnames.h | 8 +- Source/ThirdParty/SDL/SDL3/SDL_pen.h | 3 - Source/ThirdParty/SDL/SDL3/SDL_properties.h | 10 +- Source/ThirdParty/SDL/SDL3/SDL_rect.h | 19 + Source/ThirdParty/SDL/SDL3/SDL_render.h | 49 +- Source/ThirdParty/SDL/SDL3/SDL_revision.h | 4 +- Source/ThirdParty/SDL/SDL3/SDL_sensor.h | 11 +- Source/ThirdParty/SDL/SDL3/SDL_stdinc.h | 9 +- Source/ThirdParty/SDL/SDL3/SDL_storage.h | 9 +- Source/ThirdParty/SDL/SDL3/SDL_surface.h | 127 +++- Source/ThirdParty/SDL/SDL3/SDL_system.h | 17 +- Source/ThirdParty/SDL/SDL3/SDL_test_common.h | 13 +- Source/ThirdParty/SDL/SDL3/SDL_thread.h | 3 - Source/ThirdParty/SDL/SDL3/SDL_timer.h | 10 +- Source/ThirdParty/SDL/SDL3/SDL_touch.h | 22 +- Source/ThirdParty/SDL/SDL3/SDL_video.h | 97 +-- .../Tools/Flax.Build/Deps/Dependencies/SDL.cs | 4 +- 41 files changed, 1211 insertions(+), 684 deletions(-) diff --git a/Source/Engine/Engine/Screen.cpp b/Source/Engine/Engine/Screen.cpp index 735b5db18..fa2a5d37c 100644 --- a/Source/Engine/Engine/Screen.cpp +++ b/Source/Engine/Engine/Screen.cpp @@ -119,11 +119,11 @@ void Screen::SetCursorVisible(const bool value) // Just enable relative mode when cursor is constrained and not visible if (CursorLock != CursorLockMode::None && !CursorVisible && focused) { - Input::Mouse->SetRelativeMode(true); + Input::Mouse->SetRelativeMode(true, win); } else if (CursorLock == CursorLockMode::None || CursorVisible || !focused) { - Input::Mouse->SetRelativeMode(false); + Input::Mouse->SetRelativeMode(false, win); } } @@ -158,11 +158,11 @@ void Screen::SetCursorLock(CursorLockMode mode) bool focused = win && Engine::HasGameViewportFocus(); if (CursorLock != CursorLockMode::None && !CursorVisible && focused) { - Input::Mouse->SetRelativeMode(true); + Input::Mouse->SetRelativeMode(true, win); } else if (CursorLock == CursorLockMode::None || CursorVisible || !focused) { - Input::Mouse->SetRelativeMode(false); + Input::Mouse->SetRelativeMode(false, win); } } diff --git a/Source/Engine/Input/Mouse.h b/Source/Engine/Input/Mouse.h index 3d3c95dd9..9f0af6c31 100644 --- a/Source/Engine/Input/Mouse.h +++ b/Source/Engine/Input/Mouse.h @@ -136,7 +136,8 @@ public: /// The cursor will be hidden while in relative mode. /// /// The new relative mode state. - virtual void SetRelativeMode(bool relativeMode) + /// The window. + virtual void SetRelativeMode(bool relativeMode, Window* window) { _relativeMode = relativeMode; } diff --git a/Source/Engine/Platform/SDL/SDLInput.cpp b/Source/Engine/Platform/SDL/SDLInput.cpp index a83689cac..2aafdf1e5 100644 --- a/Source/Engine/Platform/SDL/SDLInput.cpp +++ b/Source/Engine/Platform/SDL/SDLInput.cpp @@ -377,7 +377,7 @@ public: OnMouseMoved(newPosition); } - void SetRelativeMode(bool relativeMode) final override + void SetRelativeMode(bool relativeMode, Window* window) final override { if (relativeMode == _relativeMode) return; @@ -385,15 +385,12 @@ public: if (relativeMode) SDL_GetGlobalMouseState(&oldPosition.X, &oldPosition.Y); - Mouse::SetRelativeMode(relativeMode); - if (SDL_SetRelativeMouseMode(relativeMode ? SDL_TRUE : SDL_FALSE) != 0) + Mouse::SetRelativeMode(relativeMode, window); + if (SDL_SetWindowRelativeMouseMode(static_cast(window)->_window, relativeMode ? SDL_TRUE : SDL_FALSE) != 0) LOG(Error, "Failed to set mouse relative mode: {0}", String(SDL_GetError())); if (!relativeMode) - { - SDL_WarpMouseGlobal(oldPosition.X, oldPosition.Y); - OnMouseMoved(oldPosition); - } + SetMousePosition(oldPosition); } }; diff --git a/Source/Engine/Platform/SDL/SDLPlatform.cpp b/Source/Engine/Platform/SDL/SDLPlatform.cpp index 258c15a36..cf17f1597 100644 --- a/Source/Engine/Platform/SDL/SDLPlatform.cpp +++ b/Source/Engine/Platform/SDL/SDLPlatform.cpp @@ -276,6 +276,7 @@ Rectangle SDLPlatform::GetVirtualDesktopBounds() SDL_GetDisplayBounds(display, &rect); bounds = Rectangle::Union(bounds, Rectangle(static_cast(rect.x), static_cast(rect.y), static_cast(rect.w), static_cast(rect.h))); } + SDL_free((void*)displays); return bounds; } diff --git a/Source/Engine/Platform/SDL/SDLWindow.cpp b/Source/Engine/Platform/SDL/SDLWindow.cpp index 9df87a572..38c086d8b 100644 --- a/Source/Engine/Platform/SDL/SDLWindow.cpp +++ b/Source/Engine/Platform/SDL/SDLWindow.cpp @@ -34,7 +34,12 @@ #endif #define DefaultDPI 96 -SDLWindow* lastEventWindow = nullptr; + +namespace +{ + SDLWindow* LastEventWindow = nullptr; + static SDL_Cursor* Cursors[SDL_NUM_SYSTEM_CURSORS] = { nullptr }; +} void* GetNativeWindowPointer(SDL_Window* window); SDL_HitTestResult OnWindowHitTest(SDL_Window* win, const SDL_Point* area, void* data); @@ -236,7 +241,7 @@ SDLWindow::SDLWindow(const CreateWindowSettings& settings) } #endif - lastEventWindow = this; + LastEventWindow = this; #if PLATFORM_LINUX // Initialize using the shared Display instance from SDL @@ -293,8 +298,8 @@ void* SDLWindow::GetX11Display() const SDLWindow::~SDLWindow() { - if (lastEventWindow == this) - lastEventWindow = nullptr; + if (LastEventWindow == this) + LastEventWindow = nullptr; if (_window == nullptr) return; @@ -374,47 +379,20 @@ SDL_HitTestResult OnWindowHitTest(SDL_Window* win, const SDL_Point* area, void* SDLWindow* SDLWindow::GetWindowFromEvent(const SDL_Event& event) { - SDL_WindowID windowId; - if (event.type >= SDL_EVENT_WINDOW_FIRST && event.type <= SDL_EVENT_WINDOW_LAST) - windowId = event.window.windowID; - else if (event.type == SDL_EVENT_KEY_DOWN || event.type == SDL_EVENT_KEY_UP) - windowId = event.key.windowID; - else if (event.type == SDL_EVENT_TEXT_EDITING) - windowId = event.edit.windowID; - else if (event.type == SDL_EVENT_TEXT_INPUT) - windowId = event.text.windowID; - else if (event.type == SDL_EVENT_MOUSE_MOTION) - windowId = event.motion.windowID; - else if (event.type == SDL_EVENT_MOUSE_BUTTON_DOWN || event.type == SDL_EVENT_MOUSE_BUTTON_UP) - windowId = event.button.windowID; - else if (event.type == SDL_EVENT_MOUSE_WHEEL) - windowId = event.wheel.windowID; - else if (event.type == SDL_EVENT_FINGER_MOTION || event.type == SDL_EVENT_FINGER_DOWN || event.type == SDL_EVENT_FINGER_UP) - windowId = event.tfinger.windowID; - else if (event.type == SDL_EVENT_PEN_DOWN || event.type == SDL_EVENT_PEN_UP) - windowId = event.ptip.windowID; - else if (event.type == SDL_EVENT_PEN_MOTION) - windowId = event.pmotion.windowID; - else if (event.type == SDL_EVENT_PEN_BUTTON_DOWN || event.type == SDL_EVENT_PEN_BUTTON_UP) - windowId = event.pbutton.windowID; - else if (event.type == SDL_EVENT_DROP_BEGIN || event.type == SDL_EVENT_DROP_FILE || event.type == SDL_EVENT_DROP_TEXT || event.type == SDL_EVENT_DROP_COMPLETE || event.type == SDL_EVENT_DROP_POSITION) - windowId = event.drop.windowID; - else if (event.type >= SDL_EVENT_USER && event.type <= SDL_EVENT_LAST) - windowId = event.user.windowID; - else + SDL_Window* window = SDL_GetWindowFromEvent(&event); + if (window == nullptr) return nullptr; - - if (lastEventWindow == nullptr || windowId != lastEventWindow->_windowId) - lastEventWindow = GetWindowWithId(windowId); - return lastEventWindow; + if (LastEventWindow == nullptr || window != LastEventWindow->_window) + LastEventWindow = GetWindowWithSDLWindow(window); + return LastEventWindow; } -SDLWindow* SDLWindow::GetWindowWithId(uint32 windowId) +SDLWindow* SDLWindow::GetWindowWithSDLWindow(SDL_Window* window) { WindowsManager::WindowsLocker.Lock(); for (auto win : WindowsManager::Windows) { - if (win->_windowId == windowId) + if (win->_window == window) return win; } WindowsManager::WindowsLocker.Unlock(); @@ -426,7 +404,6 @@ void SDLWindow::HandleEvent(SDL_Event& event) if (_isClosing) return; - // NOTE: Update window handling in SDLWindow::GetWindowFromEvent when any new events are added here switch (event.type) { case SDL_EVENT_WINDOW_EXPOSED: @@ -1012,7 +989,7 @@ void SDLWindow::StartTrackingMouse(bool useMouseScreenOffset) // For viewport camera mouse tracking we want to use relative mode for best precision if (_cursor == CursorType::Hidden) - Input::Mouse->SetRelativeMode(true); + Input::Mouse->SetRelativeMode(true, this); } } @@ -1031,7 +1008,7 @@ void SDLWindow::EndTrackingMouse() LOG(Warning, "SDL_CaptureMouse: {0}", String(SDL_GetError())); } - Input::Mouse->SetRelativeMode(false); + Input::Mouse->SetRelativeMode(false, this); } void SDLWindow::StartClippingCursor(const Rectangle& bounds) @@ -1090,21 +1067,19 @@ void SDLWindow::CheckForWindowResize() OnResize(width, height); } -void SDLWindow::UpdateCursor() const +void SDLWindow::UpdateCursor() { - static SDL_Cursor* cursors[SDL_NUM_SYSTEM_CURSORS] = { nullptr }; - if (_cursor == CursorType::Hidden) { SDL_HideCursor(); if (_isTrackingMouse) - Input::Mouse->SetRelativeMode(true); + Input::Mouse->SetRelativeMode(true, this); return; } SDL_ShowCursor(); //if (_isTrackingMouse) - // Input::Mouse->SetRelativeMode(false); + // Input::Mouse->SetRelativeMode(false, this); int32 index = SDL_SYSTEM_CURSOR_DEFAULT; switch (_cursor) @@ -1147,9 +1122,9 @@ void SDLWindow::UpdateCursor() const break; } - if (cursors[index] == nullptr) - cursors[index] = SDL_CreateSystemCursor(static_cast(index)); - SDL_SetCursor(cursors[index]); + if (Cursors[index] == nullptr) + Cursors[index] = SDL_CreateSystemCursor(static_cast(index)); + SDL_SetCursor(Cursors[index]); } #endif diff --git a/Source/Engine/Platform/SDL/SDLWindow.h b/Source/Engine/Platform/SDL/SDLWindow.h index 7897fdfeb..126989a6f 100644 --- a/Source/Engine/Platform/SDL/SDLWindow.h +++ b/Source/Engine/Platform/SDL/SDLWindow.h @@ -21,6 +21,7 @@ class FLAXENGINE_API SDLWindow : public WindowBase #endif { friend SDLPlatform; + friend class SDLMouse; #if PLATFORM_LINUX friend LinuxPlatform; friend MessageBox; @@ -55,10 +56,10 @@ public: private: static SDLWindow* GetWindowFromEvent(const SDL_Event& event); - static SDLWindow* GetWindowWithId(uint32 windowId); + static SDLWindow* GetWindowWithSDLWindow(SDL_Window* window); void HandleEvent(SDL_Event& event); void CheckForWindowResize(); - void UpdateCursor() const; + void UpdateCursor(); #if PLATFORM_LINUX DragDropEffect DoDragDropWayland(const StringView& data); diff --git a/Source/ThirdParty/SDL/SDL3/SDL_audio.h b/Source/ThirdParty/SDL/SDL3/SDL_audio.h index 629cc3a95..f25959c3b 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_audio.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_audio.h @@ -400,9 +400,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); * "coreaudio" or "wasapi". These never have Unicode characters, and are not * meant to be proper names. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param index the index of the audio driver; the value ranges from 0 to * SDL_GetNumAudioDrivers() - 1. * \returns the name of the audio driver at the requested index, or NULL if an @@ -424,9 +421,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioDriver(int index); * "coreaudio" or "wasapi". These never have Unicode characters, and are not * meant to be proper names. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the name of the current audio driver or NULL if no driver has been * initialized. * @@ -450,13 +444,11 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentAudioDriver(void); * If this function returns NULL, to signify an error, `*count` will be set to * zero. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of device instance IDs or NULL on error; call - * SDL_GetError() for more information. + * SDL_GetError() for more information. This should be freed with + * SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * @@ -465,7 +457,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentAudioDriver(void); * \sa SDL_OpenAudioDevice * \sa SDL_GetAudioRecordingDevices */ -extern SDL_DECLSPEC const SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevices(int *count); +extern SDL_DECLSPEC SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevices(int *count); /** * Get a list of currently-connected audio recording devices. @@ -481,13 +473,11 @@ extern SDL_DECLSPEC const SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevice * If this function returns NULL, to signify an error, `*count` will be set to * zero. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of device instance IDs, or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * @@ -496,14 +486,11 @@ extern SDL_DECLSPEC const SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevice * \sa SDL_OpenAudioDevice * \sa SDL_GetAudioPlaybackDevices */ -extern SDL_DECLSPEC const SDL_AudioDeviceID * SDLCALL SDL_GetAudioRecordingDevices(int *count); +extern SDL_DECLSPEC SDL_AudioDeviceID * SDLCALL SDL_GetAudioRecordingDevices(int *count); /** * Get the human-readable name of a specific audio device. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param devid the instance ID of the device to query. * \returns the name of the audio device, or NULL on failure; call * SDL_GetError() for more information. @@ -562,13 +549,11 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid * Audio devices usually have no remapping applied. This is represented by * returning NULL, and does not signify an error. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param devid the instance ID of the device to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as - * the current output spec's channels, or NULL if default. + * the current output spec's channels, or NULL if default. This + * should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * @@ -576,7 +561,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC const int * SDLCALL SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count); +extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count); /** * Open a specific audio device. @@ -836,7 +821,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid); * stream's format at any time. * * \param devid an audio device to bind a stream to. - * \param streams an array of audio streams to unbind. + * \param streams an array of audio streams to bind. * \param num_streams number streams listed in the `streams` array. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. @@ -1113,13 +1098,11 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, * Audio streams default to no remapping applied. This is represented by * returning NULL, and does not signify an error. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param stream the SDL_AudioStream to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as - * the current output spec's channels, or NULL if default. + * the current output spec's channels, or NULL if default. This + * should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. @@ -1128,7 +1111,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC const int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count); +extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count); /** * Get the current output channel map of an audio stream. @@ -1139,13 +1122,11 @@ extern SDL_DECLSPEC const int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_Au * Audio streams default to no remapping applied. This is represented by * returning NULL, and does not signify an error. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param stream the SDL_AudioStream to query. * \param count On output, set to number of channels in the map. Can be NULL. * \returns an array of the current channel mapping, with as many elements as - * the current output spec's channels, or NULL if default. + * the current output spec's channels, or NULL if default. This + * should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. @@ -1154,7 +1135,7 @@ extern SDL_DECLSPEC const int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_Au * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC const int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream *stream, int *count); +extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream *stream, int *count); /** * Set the current input channel map of an audio stream. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_camera.h b/Source/ThirdParty/SDL/SDL3/SDL_camera.h index 590214cec..46dcee1de 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_camera.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_camera.h @@ -134,9 +134,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumCameraDrivers(void); * "coremedia" or "android". These never have Unicode characters, and are not * meant to be proper names. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param index the index of the camera driver; the value ranges from 0 to * SDL_GetNumCameraDrivers() - 1. * \returns the name of the camera driver at the requested index, or NULL if @@ -157,9 +154,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraDriver(int index); * "coremedia" or "android". These never have Unicode characters, and are not * meant to be proper names. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the name of the current camera driver or NULL if no driver has * been initialized. * @@ -172,13 +166,11 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentCameraDriver(void); /** * Get a list of currently connected camera devices. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of cameras returned, may * be NULL. * \returns a 0 terminated array of camera instance IDs or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * @@ -186,7 +178,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentCameraDriver(void); * * \sa SDL_OpenCamera */ -extern SDL_DECLSPEC const SDL_CameraID * SDLCALL SDL_GetCameras(int *count); +extern SDL_DECLSPEC SDL_CameraID * SDLCALL SDL_GetCameras(int *count); /** * Get the list of native formats/sizes a camera supports. @@ -210,14 +202,13 @@ extern SDL_DECLSPEC const SDL_CameraID * SDLCALL SDL_GetCameras(int *count); * there _is_ a camera until the user has given you permission to check * through a scary warning popup. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param devid the camera device instance ID to query. * \param count a pointer filled in with the number of elements in the list, * may be NULL. * \returns a NULL terminated array of pointers to SDL_CameraSpec or NULL on - * failure; call SDL_GetError() for more information. + * failure; call SDL_GetError() for more information. This is a + * single allocation that should be freed with SDL_free() when it is + * no longer needed. * * \threadsafety It is safe to call this function from any thread. * @@ -226,14 +217,11 @@ extern SDL_DECLSPEC const SDL_CameraID * SDLCALL SDL_GetCameras(int *count); * \sa SDL_GetCameras * \sa SDL_OpenCamera */ -extern SDL_DECLSPEC const SDL_CameraSpec * const * SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count); +extern SDL_DECLSPEC SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count); /** * Get the human-readable device name for a camera. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the camera device instance ID. * \returns a human-readable device name or NULL on failure; call * SDL_GetError() for more information. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_clipboard.h b/Source/ThirdParty/SDL/SDL3/SDL_clipboard.h index 4318b6132..ccd32011c 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_clipboard.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_clipboard.h @@ -62,18 +62,16 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); * This functions returns empty string if there was not enough memory left for * a copy of the clipboard's content. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the clipboard text on success or an empty string on failure; call - * SDL_GetError() for more information. + * SDL_GetError() for more information. This should be freed with + * SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasClipboardText * \sa SDL_SetClipboardText */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetClipboardText(void); +extern SDL_DECLSPEC char * SDLCALL SDL_GetClipboardText(void); /** * Query whether the clipboard exists and contains a non-empty text string. @@ -107,18 +105,16 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text); * This functions returns empty string if there was not enough memory left for * a copy of the primary selection's content. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the primary selection text on success or an empty string on - * failure; call SDL_GetError() for more information. + * failure; call SDL_GetError() for more information. This should be + * freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasPrimarySelectionText * \sa SDL_SetPrimarySelectionText */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetPrimarySelectionText(void); +extern SDL_DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void); /** * Query whether the primary selection exists and contains a non-empty text @@ -221,17 +217,15 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearClipboardData(void); * \param mime_type the mime type to read from the clipboard. * \param size a pointer filled in with the length of the returned data. * \returns the retrieved data buffer or NULL on failure; call SDL_GetError() - * for more information. - * - * This returns temporary memory which will be automatically freed - * later, and can be claimed with SDL_ClaimTemporaryMemory(). + * for more information. This should be freed with SDL_free() when it + * is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasClipboardData * \sa SDL_SetClipboardData */ -extern SDL_DECLSPEC const void * SDLCALL SDL_GetClipboardData(const char *mime_type, size_t *size); +extern SDL_DECLSPEC void * SDLCALL SDL_GetClipboardData(const char *mime_type, size_t *size); /** * Query whether there is data in the clipboard for the provided mime type. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_events.h b/Source/ThirdParty/SDL/SDL3/SDL_events.h index 280c2a4a1..6e5a305e5 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_events.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_events.h @@ -79,28 +79,28 @@ typedef enum SDL_EventType /* Application events */ SDL_EVENT_QUIT = 0x100, /**< User-requested quit */ - /* These application events have special meaning on iOS, see README-ios.md for details */ - SDL_EVENT_TERMINATING, /**< The application is being terminated by the OS + /* These application events have special meaning on iOS and Android, see README-ios.md and README-android.md for details */ + SDL_EVENT_TERMINATING, /**< The application is being terminated by the OS. This event must be handled in a callback set with SDL_AddEventWatch(). Called on iOS in applicationWillTerminate() Called on Android in onDestroy() */ - SDL_EVENT_LOW_MEMORY, /**< The application is low on memory, free memory if possible. + SDL_EVENT_LOW_MEMORY, /**< The application is low on memory, free memory if possible. This event must be handled in a callback set with SDL_AddEventWatch(). Called on iOS in applicationDidReceiveMemoryWarning() - Called on Android in onLowMemory() + Called on Android in onTrimMemory() */ - SDL_EVENT_WILL_ENTER_BACKGROUND, /**< The application is about to enter the background + SDL_EVENT_WILL_ENTER_BACKGROUND, /**< The application is about to enter the background. This event must be handled in a callback set with SDL_AddEventWatch(). Called on iOS in applicationWillResignActive() Called on Android in onPause() */ - SDL_EVENT_DID_ENTER_BACKGROUND, /**< The application did enter the background and may not get CPU for some time + SDL_EVENT_DID_ENTER_BACKGROUND, /**< The application did enter the background and may not get CPU for some time. This event must be handled in a callback set with SDL_AddEventWatch(). Called on iOS in applicationDidEnterBackground() Called on Android in onPause() */ - SDL_EVENT_WILL_ENTER_FOREGROUND, /**< The application is about to enter the foreground + SDL_EVENT_WILL_ENTER_FOREGROUND, /**< The application is about to enter the foreground. This event must be handled in a callback set with SDL_AddEventWatch(). Called on iOS in applicationWillEnterForeground() Called on Android in onResume() */ - SDL_EVENT_DID_ENTER_FOREGROUND, /**< The application is now interactive + SDL_EVENT_DID_ENTER_FOREGROUND, /**< The application is now interactive. This event must be handled in a callback set with SDL_AddEventWatch(). Called on iOS in applicationDidBecomeActive() Called on Android in onResume() */ @@ -130,6 +130,7 @@ typedef enum SDL_EventType SDL_EVENT_WINDOW_MOVED, /**< Window has been moved to data1, data2 */ SDL_EVENT_WINDOW_RESIZED, /**< Window has been resized to data1xdata2 */ SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED,/**< The pixel size of the window has changed to data1xdata2 */ + SDL_EVENT_WINDOW_METAL_VIEW_RESIZED,/**< The pixel size of a Metal view associated with the window has changed */ SDL_EVENT_WINDOW_MINIMIZED, /**< Window has been minimized */ SDL_EVENT_WINDOW_MAXIMIZED, /**< Window has been maximized */ SDL_EVENT_WINDOW_RESTORED, /**< Window has been restored to normal size and position */ @@ -142,6 +143,7 @@ typedef enum SDL_EventType SDL_EVENT_WINDOW_ICCPROF_CHANGED, /**< The ICC profile of the window's display has changed */ SDL_EVENT_WINDOW_DISPLAY_CHANGED, /**< Window has been moved to display data1 */ SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED, /**< Window display scale has been changed */ + SDL_EVENT_WINDOW_SAFE_AREA_CHANGED, /**< The window safe area has been changed */ SDL_EVENT_WINDOW_OCCLUDED, /**< The window has been occluded */ SDL_EVENT_WINDOW_ENTER_FULLSCREEN, /**< The window has entered fullscreen mode */ SDL_EVENT_WINDOW_LEAVE_FULLSCREEN, /**< The window has left fullscreen mode */ @@ -350,9 +352,6 @@ typedef struct SDL_KeyboardEvent * will be inserted into the editing text. The length is the number of UTF-8 * characters that will be replaced by new typing. * - * The text string is temporary memory which will be automatically freed - * later, and can be claimed with SDL_ClaimTemporaryMemory(). - * * \since This struct is available since SDL 3.0.0. */ typedef struct SDL_TextEditingEvent @@ -369,9 +368,6 @@ typedef struct SDL_TextEditingEvent /** * Keyboard IME candidates event structure (event.edit_candidates.*) * - * The candidates are temporary memory which will be automatically freed - * later, and can be claimed with SDL_ClaimTemporaryMemory(). - * * \since This struct is available since SDL 3.0.0. */ typedef struct SDL_TextEditingCandidatesEvent @@ -389,9 +385,6 @@ typedef struct SDL_TextEditingCandidatesEvent /** * Keyboard text input event structure (event.text.*) * - * The text string is temporary memory which will be automatically freed - * later, and can be claimed with SDL_ClaimTemporaryMemory(). - * * This event will never be delivered unless text input is enabled by calling * SDL_StartTextInput(). Text input is disabled by default! * @@ -787,10 +780,6 @@ typedef struct SDL_PenButtonEvent * An event used to drop text or request a file open by the system * (event.drop.*) * - * The source and data strings are temporary memory which will be - * automatically freed later, and can be claimed with - * SDL_ClaimTemporaryMemory(). - * * \since This struct is available since SDL 3.0.0. */ typedef struct SDL_DropEvent @@ -1229,7 +1218,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event); * \param userdata what was passed as `userdata` to SDL_SetEventFilter() or * SDL_AddEventWatch, etc. * \param event the event that triggered the callback. - * \returns 1 to permit event to be added to the queue, and 0 to disallow it. + * \returns SDL_TRUE to permit event to be added to the queue, and SDL_FALSE to disallow it. * When used with SDL_AddEventWatch, the return value is ignored. * * \threadsafety SDL may call this callback at any time from any thread; the @@ -1241,14 +1230,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event); * \sa SDL_SetEventFilter * \sa SDL_AddEventWatch */ -typedef int (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event); +typedef SDL_bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event); /** * Set up a filter to process all events before they change internal state and * are posted to the internal event queue. * - * If the filter function returns 1 when called, then the event will be added - * to the internal queue. If it returns 0, then the event will be dropped from + * If the filter function returns SDL_TRUE when called, then the event will be added + * to the internal queue. If it returns SDL_FALSE, then the event will be dropped from * the queue, but the internal state will still be updated. This allows * selective filtering of dynamically arriving events. * @@ -1357,7 +1346,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter, void /** * Run a specific filter function on the current event queue, removing any - * events for which the filter returns 0. + * events for which the filter returns SDL_FALSE. * * See SDL_SetEventFilter() for more information. Unlike SDL_SetEventFilter(), * this function does not change the filter permanently, it only uses the @@ -1412,47 +1401,18 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EventEnabled(Uint32 type); extern SDL_DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); /** - * Allocate temporary memory. + * Get window associated with an event. * - * You can use this to allocate memory that will be automatically freed later, - * after event processing is complete. - * - * \param size the amount of memory to allocate. - * \returns a pointer to the memory allocated or NULL on failure; call - * SDL_GetError() for more information. - * - * \threadsafety It is safe to call this function from any thread. + * \param event an event containing a `windowID`. + * \returns the associated window on success or NULL if there is none. * * \since This function is available since SDL 3.0.0. * - * \sa SDL_ClaimTemporaryMemory + * \sa SDL_PollEvent + * \sa SDL_WaitEvent + * \sa SDL_WaitEventTimeout */ -extern SDL_DECLSPEC void * SDLCALL SDL_AllocateTemporaryMemory(size_t size); - -/** - * Claim ownership of temporary memory. - * - * Some functions return temporary memory which SDL will automatically clean - * up. If you want to hold onto it for a long time or beyond the current - * function scope, you can call this function to get a pointer that you own, - * and can free using SDL_free() when you're done. - * - * If the memory isn't temporary, this will return NULL, and you don't have - * ownership of the memory. - * - * \param mem a pointer allocated with SDL_AllocateTemporaryMemory(). - * \returns a pointer to the memory now owned by the application, which must - * be freed using SDL_free(), or NULL if the memory is not temporary - * or is not owned by this thread. - * - * \threadsafety It is safe to call this function from any thread. - * - * \since This function is available since SDL 3.0.0. - * - * \sa SDL_AllocateTemporaryMemory - * \sa SDL_free - */ -extern SDL_DECLSPEC void * SDLCALL SDL_ClaimTemporaryMemory(const void *mem); +extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromEvent(const SDL_Event *event); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/Source/ThirdParty/SDL/SDL3/SDL_filesystem.h b/Source/ThirdParty/SDL/SDL3/SDL_filesystem.h index ff6ba13e6..756a52dcc 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_filesystem.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_filesystem.h @@ -68,9 +68,6 @@ extern "C" { * The returned path is guaranteed to end with a path separator ('\\' on * Windows, '/' on most other platforms). * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns an absolute path in UTF-8 encoding to the application data * directory. NULL will be returned on error or when the platform * doesn't implement this functionality, call SDL_GetError() for more @@ -124,20 +121,18 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetBasePath(void); * The returned path is guaranteed to end with a path separator ('\\' on * Windows, '/' on most other platforms). * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param org the name of your organization. * \param app the name of your application. * \returns a UTF-8 string of the user directory in platform-dependent * notation. NULL if there's a problem (creating directory failed, - * etc.). + * etc.). This should be freed with SDL_free() when it is no longer + * needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetBasePath */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetPrefPath(const char *org, const char *app); +extern SDL_DECLSPEC char * SDLCALL SDL_GetPrefPath(const char *org, const char *app); /** * The type of the OS-provided default folder for a specific purpose. @@ -225,9 +220,6 @@ typedef enum SDL_Folder * The returned path is guaranteed to end with a path separator ('\\' on * Windows, '/' on most other platforms). * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * If NULL is returned, the error may be obtained with SDL_GetError(). * * \param folder the type of folder to find. @@ -369,9 +361,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo * * convenience, but if `count` is non-NULL, on return it will contain the * number of items in the array, not counting the NULL terminator. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param path the path of the directory to enumerate. * \param pattern the pattern that files in the directory must match. Can be * NULL. @@ -379,13 +368,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo * * \param count on return, will be set to the number of items in the returned * array. Can be NULL. * \returns an array of strings on success or NULL on failure; call - * SDL_GetError() for more information. + * SDL_GetError() for more information. This is a single allocation + * that should be freed with SDL_free() when it is no longer needed. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * const * SDLCALL SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count); +extern SDL_DECLSPEC char ** SDLCALL SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/Source/ThirdParty/SDL/SDL3/SDL_gamepad.h b/Source/ThirdParty/SDL/SDL3/SDL_gamepad.h index 52031e02a..cec068446 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_gamepad.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_gamepad.h @@ -389,46 +389,41 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReloadGamepadMappings(void); /** * Get the current gamepad mappings. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of mappings returned, can * be NULL. * \returns an array of the mapping strings, NULL-terminated, or NULL on - * failure; call SDL_GetError() for more information. + * failure; call SDL_GetError() for more information. This is a + * single allocation that should be freed with SDL_free() when it is + * no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * const * SDLCALL SDL_GetGamepadMappings(int *count); +extern SDL_DECLSPEC char ** SDLCALL SDL_GetGamepadMappings(int *count); /** * Get the gamepad mapping string for a given GUID. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param guid a structure containing the GUID for which a mapping is desired. * \returns a mapping string or NULL on failure; call SDL_GetError() for more - * information. + * information. This should be freed with SDL_free() when it is no + * longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetJoystickGUIDForID * \sa SDL_GetJoystickGUID */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID guid); +extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID guid); /** * Get the current mapping of a gamepad. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * Details about mappings are discussed with SDL_AddGamepadMapping(). * * \param gamepad the gamepad you want to get the current mapping for. * \returns a string that has the gamepad's mapping or NULL if no mapping is - * available; call SDL_GetError() for more information. + * available; call SDL_GetError() for more information. This should + * be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * @@ -437,7 +432,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID g * \sa SDL_GetGamepadMappingForGUID * \sa SDL_SetGamepadMapping */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad); +extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad); /** * Set the current mapping of a joystick or gamepad. @@ -471,20 +466,18 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasGamepad(void); /** * Get a list of currently connected gamepads. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of gamepads returned, may * be NULL. * \returns a 0 terminated array of joystick instance IDs or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasGamepad * \sa SDL_OpenGamepad */ -extern SDL_DECLSPEC const SDL_JoystickID * SDLCALL SDL_GetGamepads(int *count); +extern SDL_DECLSPEC SDL_JoystickID * SDLCALL SDL_GetGamepads(int *count); /** * Check if the given joystick is supported by the gamepad interface. @@ -505,9 +498,6 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsGamepad(SDL_JoystickID instance_id); * * This can be called before any gamepads are opened. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the joystick instance ID. * \returns the name of the selected gamepad. If no name can be found, this * function returns NULL; call SDL_GetError() for more information. @@ -524,9 +514,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadNameForID(SDL_JoystickID * * This can be called before any gamepads are opened. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the joystick instance ID. * \returns the path of the selected gamepad. If no path can be found, this * function returns NULL; call SDL_GetError() for more information. @@ -564,8 +551,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndexForID(SDL_JoystickID in * * \since This function is available since SDL 3.0.0. * - * \sa SDL_GetGamepadGUID - * \sa SDL_GetGamepadGUIDString + * \sa SDL_GUIDToString * \sa SDL_GetGamepads */ extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_GetGamepadGUIDForID(SDL_JoystickID instance_id); @@ -658,18 +644,16 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetRealGamepadTypeForID(SDL_Joys * * This can be called before any gamepads are opened. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the joystick instance ID. - * \returns the mapping string. Returns NULL if no mapping is available. + * \returns the mapping string. Returns NULL if no mapping is available. This + * should be freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetGamepads * \sa SDL_GetGamepadMapping */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadMappingForID(SDL_JoystickID instance_id); +extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMappingForID(SDL_JoystickID instance_id); /** * Open a gamepad for use. @@ -758,9 +742,6 @@ extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_GetGamepadID(SDL_Gamepad *gamepad /** * Get the implementation-dependent name for an opened gamepad. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param gamepad a gamepad identifier previously returned by * SDL_OpenGamepad(). * \returns the implementation dependent name for the gamepad, or NULL if @@ -775,9 +756,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadName(SDL_Gamepad *gamepad /** * Get the implementation-dependent path for an opened gamepad. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param gamepad a gamepad identifier previously returned by * SDL_OpenGamepad(). * \returns the implementation dependent path for the gamepad, or NULL if @@ -903,9 +881,6 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetGamepadFirmwareVersion(SDL_Gamepad *ga * * Returns the serial number of the gamepad, or NULL if it is not available. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param gamepad the gamepad object to query. * \returns the serial number, or NULL if unavailable. * @@ -1023,17 +998,16 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadEventsEnabled(void); /** * Get the SDL joystick layer bindings for a gamepad. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param gamepad a gamepad. * \param count a pointer filled in with the number of bindings returned. * \returns a NULL terminated array of pointers to bindings or NULL on - * failure; call SDL_GetError() for more information. + * failure; call SDL_GetError() for more information. This is a + * single allocation that should be freed with SDL_free() when it is + * no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const SDL_GamepadBinding * const * SDLCALL SDL_GetGamepadBindings(SDL_Gamepad *gamepad, int *count); +extern SDL_DECLSPEC SDL_GamepadBinding ** SDLCALL SDL_GetGamepadBindings(SDL_Gamepad *gamepad, int *count); /** * Manually pump gamepad updates if not using the loop. @@ -1067,9 +1041,6 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetGamepadTypeFromString(const c /** * Convert from an SDL_GamepadType enum to a string. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param type an enum value for a given SDL_GamepadType. * \returns a string for the given type, or NULL if an invalid type is * specified. The string returned is of the format used by @@ -1106,9 +1077,6 @@ extern SDL_DECLSPEC SDL_GamepadAxis SDLCALL SDL_GetGamepadAxisFromString(const c /** * Convert from an SDL_GamepadAxis enum to a string. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param axis an enum value for a given SDL_GamepadAxis. * \returns a string for the given axis, or NULL if an invalid axis is * specified. The string returned is of the format used by @@ -1182,9 +1150,6 @@ extern SDL_DECLSPEC SDL_GamepadButton SDLCALL SDL_GetGamepadButtonFromString(con /** * Convert from an SDL_GamepadButton enum to a string. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param button an enum value for a given SDL_GamepadButton. * \returns a string for the given button, or NULL if an invalid button is * specified. The string returned is of the format used by @@ -1471,9 +1436,6 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseGamepad(SDL_Gamepad *gamepad); * Return the sfSymbolsName for a given button on a gamepad on Apple * platforms. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param gamepad the gamepad to query. * \param button a button on the gamepad. * \returns the sfSymbolsName or NULL if the name can't be found. @@ -1487,9 +1449,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadAppleSFSymbolsNameForButt /** * Return the sfSymbolsName for a given axis on a gamepad on Apple platforms. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param gamepad the gamepad to query. * \param axis an axis on the gamepad. * \returns the sfSymbolsName or NULL if the name can't be found. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_guid.h b/Source/ThirdParty/SDL/SDL3/SDL_guid.h index e0d519b9f..285b2376e 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_guid.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_guid.h @@ -66,18 +66,15 @@ typedef struct SDL_GUID { /** * Get an ASCII string representation for a given SDL_GUID. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param guid the SDL_GUID you wish to convert to string. - * \returns the string representation of the GUID or NULL on failure; call - * SDL_GetError() for more information. + * \param pszGUID buffer in which to write the ASCII string. + * \param cbGUID the size of pszGUID, should be at least 33 bytes. * * \since This function is available since SDL 3.0.0. * * \sa SDL_StringToGUID */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GUIDToString(SDL_GUID guid); +extern SDL_DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID); /** * Convert a GUID string into a SDL_GUID structure. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_haptic.h b/Source/ThirdParty/SDL/SDL3/SDL_haptic.h index 05263475e..1d0a54efe 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_haptic.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_haptic.h @@ -45,6 +45,7 @@ * SDL_HapticID *haptics = SDL_GetHaptics(NULL); * if (haptics) { * haptic = SDL_OpenHaptic(haptics[0]); + * SDL_free(haptics); * } * if (haptic == NULL) * return -1; @@ -931,28 +932,23 @@ typedef Uint32 SDL_HapticID; /** * Get a list of currently connected haptic devices. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of haptic devices * returned, may be NULL. * \returns a 0 terminated array of haptic device instance IDs or NULL on - * failure; call SDL_GetError() for more information. + * failure; call SDL_GetError() for more information. This should be + * freed with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_OpenHaptic */ -extern SDL_DECLSPEC const SDL_HapticID * SDLCALL SDL_GetHaptics(int *count); +extern SDL_DECLSPEC SDL_HapticID * SDLCALL SDL_GetHaptics(int *count); /** * Get the implementation dependent name of a haptic device. * * This can be called before any haptic devices are opened. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the haptic device instance ID. * \returns the name of the selected haptic device. If no name can be found, * this function returns NULL; call SDL_GetError() for more @@ -1016,9 +1012,6 @@ extern SDL_DECLSPEC SDL_HapticID SDLCALL SDL_GetHapticID(SDL_Haptic *haptic); /** * Get the implementation dependent name of a haptic device. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param haptic the SDL_Haptic obtained from SDL_OpenJoystick(). * \returns the name of the selected haptic device. If no name can be found, * this function returns NULL; call SDL_GetError() for more diff --git a/Source/ThirdParty/SDL/SDL3/SDL_hints.h b/Source/ThirdParty/SDL/SDL3/SDL_hints.h index 373a039a2..7f4391c4c 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_hints.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_hints.h @@ -102,21 +102,6 @@ extern "C" { */ #define SDL_HINT_ANDROID_BLOCK_ON_PAUSE "SDL_ANDROID_BLOCK_ON_PAUSE" -/** - * A variable to control whether SDL will pause audio in background. - * - * The variable can be set to the following values: - * - * - "0": Not paused, requires that SDL_HINT_ANDROID_BLOCK_ON_PAUSE be set to - * "0" - * - "1": Paused. (default) - * - * This hint should be set before SDL is initialized. - * - * \since This hint is available since SDL 3.0.0. - */ -#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO "SDL_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO" - /** * A variable to control whether we trap the Android back button to handle it * manually. @@ -147,43 +132,8 @@ extern "C" { * together, as well as match applications with associated desktop settings * and icons. * - * On Wayland this corresponds to the "app ID" window property and on X11 this - * corresponds to the WM_CLASS property. Windows inherit the value of this - * hint at creation time. Changing this hint after a window has been created - * will not change the app ID or class of existing windows. - * - * For *nix platforms, this string should be formatted in reverse-DNS notation - * and follow some basic rules to be valid: - * - * - The application ID must be composed of two or more elements separated by - * a period (.) character. - * - Each element must contain one or more of the alphanumeric characters - * (A-Z, a-z, 0-9) plus underscore (_) and hyphen (-) and must not start - * with a digit. Note that hyphens, while technically allowed, should not be - * used if possible, as they are not supported by all components that use - * the ID, such as D-Bus. For maximum compatibility, replace hyphens with an - * underscore. - * - The empty string is not a valid element (ie: your application ID may not - * start or end with a period and it is not valid to have two periods in a - * row). - * - The entire ID must be less than 255 characters in length. - * - * Examples of valid app ID strings: - * - * - org.MyOrg.MyApp - * - com.your_company.your_app - * - * Desktops such as GNOME and KDE require that the app ID string matches your - * application's .desktop file name (e.g. if the app ID string is - * 'org.MyOrg.MyApp', your application's .desktop file should be named - * 'org.MyOrg.MyApp.desktop'). - * - * If you plan to package your application in a container such as Flatpak, the - * app ID should match the name of your Flatpak container as well. - * - * If not set, SDL will attempt to use the application executable name. If the - * executable name cannot be retrieved, the generic string "SDL_App" will be - * used. + * This will override SDL_PROP_APP_METADATA_IDENTIFIER_STRING, if set by the + * application. * * This hint should be set before SDL is initialized. * @@ -192,7 +142,7 @@ extern "C" { #define SDL_HINT_APP_ID "SDL_APP_ID" /** - * Specify an application name. + * A variable setting the application name. * * This hint lets you specify the application name sent to the OS when * required. For example, this will often appear in volume control applets for @@ -200,12 +150,8 @@ extern "C" { * screensaver. You should use a string that describes your program ("My Game * 2: The Revenge") * - * Setting this to "" or leaving it unset will have SDL use a reasonable - * default: probably the application's name or "SDL Application" if SDL - * doesn't have any better information. - * - * Note that, for audio streams, this can be overridden with - * SDL_HINT_AUDIO_DEVICE_APP_NAME. + * This will override SDL_PROP_APP_METADATA_NAME_STRING, if set by the + * application. * * This hint should be set before SDL is initialized. * @@ -251,6 +197,20 @@ extern "C" { */ #define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION" +/** + * Specify the default ALSA audio device name. + * + * This variable is a specific audio device to open when the "default" audio + * device is used. By default if 4 channel audio is requested, the + * "plug:surround40" device will be opened and if 6 channel audio is requested + * the "plug:surround51" device will be opened. + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE "SDL_AUDIO_ALSA_DEFAULT_DEVICE" + /** * A variable controlling the audio category on iOS and macOS. * @@ -270,27 +230,17 @@ extern "C" { #define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY" /** - * Specify an application name for an audio device. + * A variable controlling the default audio channel count. * - * Some audio backends (such as PulseAudio) allow you to describe your audio - * stream. Among other things, this description might show up in a system - * control panel that lets the user adjust the volume on specific audio - * streams instead of using one giant master volume slider. - * - * This hints lets you transmit that information to the OS. The contents of - * this hint are used while opening an audio device. You should use a string - * that describes your program ("My Game 2: The Revenge") - * - * Setting this to "" or leaving it unset will have SDL use a reasonable - * default: this will be the name set with SDL_HINT_APP_NAME, if that hint is - * set. Otherwise, it'll probably the application's name or "SDL Application" - * if SDL doesn't have any better information. + * If the application doesn't specify the audio channel count when opening the + * device, this hint can be used to specify a default channel count that will + * be used. This defaults to "1" for recording and "2" for playback devices. * * This hint should be set before an audio device is opened. * * \since This hint is available since SDL 3.0.0. */ -#define SDL_HINT_AUDIO_DEVICE_APP_NAME "SDL_AUDIO_DEVICE_APP_NAME" +#define SDL_HINT_AUDIO_CHANNELS "SDL_AUDIO_CHANNELS" /** * Specify an application icon name for an audio device. @@ -390,6 +340,41 @@ extern "C" { */ #define SDL_HINT_AUDIO_DEVICE_STREAM_ROLE "SDL_AUDIO_DEVICE_STREAM_ROLE" +/** + * Specify the input file when recording audio using the disk audio driver. + * + * This defaults to "sdlaudio-in.raw" + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_DISK_INPUT_FILE "SDL_AUDIO_DISK_INPUT_FILE" + +/** + * Specify the output file when playing audio using the disk audio driver. + * + * This defaults to "sdlaudio.raw" + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_DISK_OUTPUT_FILE "SDL_AUDIO_DISK_OUTPUT_FILE" + +/** + * A variable controlling the audio rate when using the disk audio driver. + * + * The disk audio driver normally simulates real-time for the audio rate that + * was specified, but you can use this variable to adjust this rate higher or + * lower down to 0. The default value is "1.0". + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_DISK_TIMESCALE "SDL_AUDIO_DISK_TIMESCALE" + /** * A variable that specifies an audio backend to use. * @@ -404,6 +389,54 @@ extern "C" { */ #define SDL_HINT_AUDIO_DRIVER "SDL_AUDIO_DRIVER" +/** + * A variable controlling the audio rate when using the dummy audio driver. + * + * The dummy audio driver normally simulates real-time for the audio rate that + * was specified, but you can use this variable to adjust this rate higher or + * lower down to 0. The default value is "1.0". + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_DUMMY_TIMESCALE "SDL_AUDIO_DUMMY_TIMESCALE" + +/** + * A variable controlling the default audio format. + * + * If the application doesn't specify the audio format when opening the + * device, this hint can be used to specify a default format that will be + * used. + * + * The variable can be set to the following values: - "U8": Unsigned 8-bit + * audio - "S8": Signed 8-bit audio - "S16LE": Signed 16-bit little-endian + * audio - "S16BE": Signed 16-bit big-endian audio - "S16": Signed 16-bit + * native-endian audio (default) - "S32LE": Signed 32-bit little-endian audio + * - "S32BE": Signed 32-bit big-endian audio - "S32": Signed 32-bit + * native-endian audio - "F32LE": Floating point little-endian audio - + * "F32BE": Floating point big-endian audio - "F32": Floating point + * native-endian audio + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_FORMAT "SDL_AUDIO_FORMAT" + +/** + * A variable controlling the default audio frequency. + * + * If the application doesn't specify the audio frequency when opening the + * device, this hint can be used to specify a default frequency that will be + * used. This defaults to "44100". + * + * This hint should be set before an audio device is opened. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_AUDIO_FREQUENCY "SDL_AUDIO_FREQUENCY" + /** * A variable that causes SDL to not ignore audio "monitors". * @@ -661,6 +694,23 @@ extern "C" { */ #define SDL_HINT_ENABLE_SCREEN_KEYBOARD "SDL_ENABLE_SCREEN_KEYBOARD" +/** + * A variable containing a list of evdev devices to use if udev is not + * available. + * + * The list of devices is in the form: + * + * deviceclass:path[,deviceclass:path[,...]] + * + * where device class is an integer representing the SDL_UDEV_deviceclass and + * path is the full path to the event device. + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_EVDEV_DEVICES "SDL_EVDEV_DEVICES" + /** * A variable controlling verbosity of the logging of SDL events pushed onto * the internal queue. @@ -906,6 +956,56 @@ extern "C" { */ #define SDL_HINT_GDK_TEXTINPUT_TITLE "SDL_GDK_TEXTINPUT_TITLE" +/** + * A variable to control whether HIDAPI uses libusb for device access. + * + * By default libusb will only be used for a few devices that require direct + * USB access, and this can be controlled with + * SDL_HINT_HIDAPI_LIBUSB_WHITELIST. + * + * The variable can be set to the following values: + * + * - "0": HIDAPI will not use libusb for device access. + * - "1": HIDAPI will use libusb for device access if available. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_HIDAPI_LIBUSB "SDL_HIDAPI_LIBUSB" + +/** + * A variable to control whether HIDAPI uses libusb only for whitelisted + * devices. + * + * By default libusb will only be used for a few devices that require direct + * USB access. + * + * The variable can be set to the following values: + * + * - "0": HIDAPI will use libusb for all device access. + * - "1": HIDAPI will use libusb only for whitelisted devices. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_HIDAPI_LIBUSB_WHITELIST "SDL_HIDAPI_LIBUSB_WHITELIST" + +/** + * A variable to control whether HIDAPI uses udev for device detection. + * + * The variable can be set to the following values: + * + * - "0": HIDAPI will poll for device changes. + * - "1": HIDAPI will use udev for device detection. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_HIDAPI_UDEV "SDL_HIDAPI_UDEV" + /** * A variable to control whether SDL_hid_enumerate() enumerates all HID * devices or only controllers. @@ -2012,7 +2112,7 @@ extern "C" { * layout. e.g. pressing the key associated with SDL_SCANCODE_A on a Russian * keyboard would yield 'a' instead of 'Ñ„'. * - * The default value for this hint is "french_numbers" + * The default value for this hint is "french_numbers,latin_letters" * * Some platforms like Emscripten only provide modified keycodes and the * options are not used. @@ -2205,6 +2305,38 @@ extern "C" { */ #define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME "SDL_MOUSE_DOUBLE_CLICK_TIME" +/** + * A variable controlling whether warping a hidden mouse cursor will activate + * relative mouse mode. + * + * When this hint is set and the mouse cursor is hidden, SDL will emulate + * mouse warps using relative mouse mode. This can provide smoother and more + * reliable mouse motion for some older games, which continuously calculate + * the distance travelled by the mouse pointer and warp it back to the center + * of the window, rather than using relative mouse motion. + * + * Note that relative mouse mode may have different mouse acceleration + * behavior than pointer warps. + * + * If your game or application needs to warp the mouse cursor while hidden for + * other purposes, such as drawing a software cursor, it should disable this + * hint. + * + * The variable can be set to the following values: + * + * - "0": Attempts to warp the mouse will always be made. + * - "1": Some mouse warps will be emulated by forcing relative mouse mode. + * (default) + * + * If not set, this is automatically enabled unless an application uses + * relative mouse mode directly. + * + * This hint can be set anytime. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE "SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE" + /** * Allow mouse click events when clicking to focus an SDL window. * @@ -2365,6 +2497,24 @@ extern "C" { */ #define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS" +/** + * A variable controlling whether the keyboard should be muted on the console. + * + * Normally the keyboard is muted while SDL applications are running so that + * keyboard input doesn't show up as key strokes on the console. This hint + * allows you to turn that off for debugging purposes. + * + * The variable can be set to the following values: + * + * - "0": Allow keystrokes to go through to the console. + * - "1": Mute keyboard input so it doesn't show up on the console. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_MUTE_CONSOLE_KEYBOARD "SDL_MUTE_CONSOLE_KEYBOARD" + /** * Tell SDL not to catch the SIGINT or SIGTERM signals on POSIX platforms. * @@ -2380,6 +2530,16 @@ extern "C" { */ #define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS" +/** + * Specify the OpenGL library to load. + * + * This hint should be set before creating an OpenGL window or creating an + * OpenGL context. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_OPENGL_LIBRARY "SDL_OPENGL_LIBRARY" + /** * A variable controlling what driver to use for OpenGL ES contexts. * @@ -2665,6 +2825,8 @@ extern "C" { * A variable to control whether the return key on the soft keyboard should * hide the soft keyboard on Android and iOS. * + * This hint sets the default value of SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN. + * * The variable can be set to the following values: * * - "0": The return key will be handled as a key event. (default) @@ -2970,6 +3132,19 @@ extern "C" { */ #define SDL_HINT_VIDEO_DRIVER "SDL_VIDEO_DRIVER" +/** + * A variable controlling whether the dummy video driver saves output frames. + * + * - "0": Video frames are not saved to disk. (default) + * - "1": Video frames are saved to files in the format "SDL_windowX-Y.bmp", + * where X is the window ID, and Y is the frame number. + * + * This hint can be set anytime. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VIDEO_DUMMY_SAVE_FRAMES "SDL_VIDEO_DUMMY_SAVE_FRAMES" + /** * If eglGetPlatformDisplay fails, fall back to calling eglGetDisplay. * @@ -3034,6 +3209,23 @@ extern "C" { */ #define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS" +/** + * A variable controlling whether the offscreen video driver saves output + * frames. + * + * This only saves frames that are generated using software rendering, not + * accelerated OpenGL rendering. + * + * - "0": Video frames are not saved to disk. (default) + * - "1": Video frames are saved to files in the format "SDL_windowX-Y.bmp", + * where X is the window ID, and Y is the frame number. + * + * This hint can be set anytime. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VIDEO_OFFSCREEN_SAVE_FRAMES "SDL_VIDEO_OFFSCREEN_SAVE_FRAMES" + /** * A variable controlling whether all window operations will block until * complete. @@ -3078,34 +3270,6 @@ extern "C" { */ #define SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR "SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR" -/** - * Enable or disable hidden mouse pointer warp emulation, needed by some older - * games. - * - * Wayland requires the pointer confinement protocol to warp the mouse, but - * that is just a hint that the compositor is free to ignore, and warping the - * the pointer to or from regions outside of the focused window is prohibited. - * When this hint is set and the pointer is hidden, SDL will emulate mouse - * warps using relative mouse mode. This is required for some older games - * (such as Source engine games), which warp the mouse to the centre of the - * screen rather than using relative mouse motion. Note that relative mouse - * mode may have different mouse acceleration behaviour than pointer warps. - * - * The variable can be set to the following values: - * - * - "0": Attempts to warp the mouse will be made, if the appropriate protocol - * is available. - * - "1": Some mouse warps will be emulated by forcing relative mouse mode. - * - * If not set, this is automatically enabled unless an application uses - * relative mouse mode directly. - * - * This hint can be set anytime. - * - * \since This hint is available since SDL 3.0.0. - */ -#define SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP "SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP" - /** * A variable controlling whether video mode emulation is enabled under * Wayland. @@ -3261,6 +3425,20 @@ extern "C" { */ #define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING" +/** + * A variable controlling whether SDL uses DirectColor visuals. + * + * The variable can be set to the following values: + * + * - "0": Disable DirectColor visuals. + * - "1": Enable DirectColor visuals. (default) + * + * This hint should be set before initializing the video subsystem. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VIDEO_X11_NODIRECTCOLOR "SDL_VIDEO_X11_NODIRECTCOLOR" + /** * A variable forcing the content scaling factor for X11 displays. * @@ -3272,6 +3450,15 @@ extern "C" { */ #define SDL_HINT_VIDEO_X11_SCALING_FACTOR "SDL_VIDEO_X11_SCALING_FACTOR" +/** + * A variable forcing the visual ID used for X11 display modes. + * + * This hint should be set before initializing the video subsystem. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VIDEO_X11_VISUALID "SDL_VIDEO_X11_VISUALID" + /** * A variable forcing the visual ID chosen for new X11 windows. * @@ -3295,6 +3482,90 @@ extern "C" { */ #define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" +/** + * A variable controlling whether touch should be enabled on the back panel of + * the PlayStation Vita. + * + * The variable can be set to the following values: + * + * - "0": Disable touch on the back panel. + * - "1": Enable touch on the back panel. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VITA_ENABLE_BACK_TOUCH "SDL_VITA_ENABLE_BACK_TOUCH" + +/** + * A variable controlling whether touch should be enabled on the front panel + * of the PlayStation Vita. + * + * The variable can be set to the following values: + * + * - "0": Disable touch on the front panel. + * - "1": Enable touch on the front panel. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VITA_ENABLE_FRONT_TOUCH "SDL_VITA_ENABLE_FRONT_TOUCH" + +/** + * A variable controlling the module path on the PlayStation Vita. + * + * This hint defaults to "app0:module" + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VITA_MODULE_PATH "SDL_VITA_MODULE_PATH" + +/** + * A variable controlling whether to perform PVR initialization on the + * PlayStation Vita. + * + * - "0": Skip PVR initialization. + * - "1": Perform the normal PVR initialization. (default) + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VITA_PVR_INIT "SDL_VITA_PVR_INIT" + +/** + * A variable overriding the resolution reported on the PlayStation Vita. + * + * The variable can be set to the following values: + * + * - "544": 544p (default) + * - "720": 725p for PSTV + * - "1080": 1088i for PSTV + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VITA_RESOLUTION "SDL_VITA_RESOLUTION" + +/** + * A variable controlling whether OpenGL should be used instead of OpenGL ES + * on the PlayStation Vita. + * + * The variable can be set to the following values: + * + * - "0": Use OpenGL ES. (default) + * - "1": Use OpenGL. + * + * This hint should be set before SDL is initialized. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VITA_PVR_OPENGL "SDL_VITA_PVR_OPENGL" + /** * A variable controlling which touchpad should generate synthetic mouse * events. @@ -3311,6 +3582,27 @@ extern "C" { */ #define SDL_HINT_VITA_TOUCH_MOUSE_DEVICE "SDL_VITA_TOUCH_MOUSE_DEVICE" +/** + * A variable overriding the display index used in SDL_Vulkan_CreateSurface() + * + * The display index starts at 0, which is the default. + * + * This hint should be set before calling SDL_Vulkan_CreateSurface() + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VULKAN_DISPLAY "SDL_VULKAN_DISPLAY" + +/** + * Specify the Vulkan library to load. + * + * This hint should be set before creating a Vulkan window or calling + * SDL_Vulkan_LoadLibrary(). + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_VULKAN_LIBRARY "SDL_VULKAN_LIBRARY" + /** * A variable controlling how the fact chunk affects the loading of a WAVE * file. @@ -3343,6 +3635,18 @@ extern "C" { */ #define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK" +/** + * A variable controlling the maximum number of chunks in a WAVE file. + * + * This sets an upper bound on the number of chunks in a WAVE file to avoid + * wasting time on malformed or corrupt WAVE files. This defaults to "10000". + * + * This hint should be set before calling SDL_LoadWAV() or SDL_LoadWAV_IO() + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_WAVE_CHUNK_LIMIT "SDL_WAVE_CHUNK_LIMIT" + /** * A variable controlling how the size of the RIFF chunk affects the loading * of a WAVE file. @@ -3354,7 +3658,7 @@ extern "C" { * Note that files that have trailing data unrelated to the WAVE file or * corrupt files may slow down the loading process without a reliable * boundary. By default, SDL stops after 10000 chunks to prevent wasting time. - * Use the environment variable SDL_WAVE_CHUNK_LIMIT to adjust this value. + * Use SDL_HINT_WAVE_CHUNK_LIMIT to adjust this value. * * The variable can be set to the following values: * @@ -3533,27 +3837,6 @@ extern "C" { */ #define SDL_HINT_WINDOWS_RAW_KEYBOARD "SDL_WINDOWS_RAW_KEYBOARD" -/** - * A variable controlling whether SDL uses Critical Sections for mutexes on - * Windows. - * - * On Windows 7 and newer, Slim Reader/Writer Locks are available. They offer - * better performance, allocate no kernel resources and use less memory. SDL - * will fall back to Critical Sections on older OS versions or if forced to by - * this hint. - * - * The variable can be set to the following values: - * - * - "0": Use SRW Locks when available, otherwise fall back to Critical - * Sections. (default) - * - "1": Force the use of Critical Sections in all cases. - * - * This hint should be set before SDL is initialized. - * - * \since This hint is available since SDL 3.0.0. - */ -#define SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS "SDL_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS" - /** * A variable controlling whether SDL uses Kernel Semaphores on Windows. * @@ -3780,6 +4063,17 @@ extern "C" { */ #define SDL_HINT_X11_WINDOW_TYPE "SDL_X11_WINDOW_TYPE" +/** + * Specify the XCB library to load for the X11 driver. + * + * This defaults to "libX11-xcb.so" + * + * This hint should be set before initializing the video subsystem. + * + * \since This hint is available since SDL 3.0.0. + */ +#define SDL_HINT_X11_XCB_LIBRARY "SDL_X11_XCB_LIBRARY" + /** * A variable controlling whether XInput should be used for controller * handling. @@ -3818,7 +4112,10 @@ typedef enum SDL_HintPriority * \param name the hint to set. * \param value the value of the hint variable. * \param priority the SDL_HintPriority level for the hint. - * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. * @@ -3826,9 +4123,9 @@ typedef enum SDL_HintPriority * \sa SDL_ResetHint * \sa SDL_SetHint */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, - const char *value, - SDL_HintPriority priority); +extern SDL_DECLSPEC int SDLCALL SDL_SetHintWithPriority(const char *name, + const char *value, + SDL_HintPriority priority); /** * Set a hint with normal priority. @@ -3839,7 +4136,10 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, * * \param name the hint to set. * \param value the value of the hint variable. - * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. * @@ -3847,8 +4147,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, * \sa SDL_ResetHint * \sa SDL_SetHintWithPriority */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, - const char *value); +extern SDL_DECLSPEC int SDLCALL SDL_SetHint(const char *name, const char *value); /** * Reset a hint to the default value. @@ -3858,14 +4157,17 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, * change. * * \param name the hint to set. - * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetHint * \sa SDL_ResetHints */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResetHint(const char *name); +extern SDL_DECLSPEC int SDLCALL SDL_ResetHint(const char *name); /** * Reset all hints to the default values. @@ -3874,6 +4176,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResetHint(const char *name); * variable, or NULL if the environment isn't set. Callbacks will be called * normally with this change. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_ResetHint @@ -3883,12 +4187,16 @@ extern SDL_DECLSPEC void SDLCALL SDL_ResetHints(void); /** * Get the value of a hint. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param name the hint to query. * \returns the string value of a hint or NULL if the hint isn't set. * + * \threadsafety It is safe to call this function from any thread, however the + * return value only remains valid until the hint is changed; if + * another thread might do so, the app should supply locks + * and/or make a copy of the string. Note that using a hint + * callback instead is always thread-safe, as SDL holds a lock + * on the thread subsystem during the callback. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetHint @@ -3904,6 +4212,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); * \returns the boolean value of a hint or the provided default value if the * hint does not exist. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetHint @@ -3912,37 +4222,48 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value); /** - * Type definition of the hint callback function. + * A callback used to send notifications of hint value changes. + * + * This is called an initial time during SDL_AddHintCallback with the hint's + * current value, and then again each time the hint's value changes. * * \param userdata what was passed as `userdata` to SDL_AddHintCallback(). * \param name what was passed as `name` to SDL_AddHintCallback(). * \param oldValue the previous hint value. * \param newValue the new value hint is to be set to. * + * \threadsafety This callback is fired from whatever thread is setting a new + * hint value. SDL holds a lock on the hint subsystem when + * calling this callback. + * * \since This datatype is available since SDL 3.0.0. + * + * \sa SDL_AddHintCallback */ typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); /** * Add a function to watch a particular hint. * + * The callback function is called _during_ this function, to provide it an + * initial value, and again each time the hint's value changes. + * * \param name the hint to watch. - * \param callback an SDL_HintCallback function that will be called when the + * \param callback An SDL_HintCallback function that will be called when the * hint value changes. * \param userdata a pointer to pass to the callback function. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \threadsafety It is **NOT** safe to call this function from two threads at - * once. + * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. * * \sa SDL_DelHintCallback */ extern SDL_DECLSPEC int SDLCALL SDL_AddHintCallback(const char *name, - SDL_HintCallback callback, - void *userdata); + SDL_HintCallback callback, + void *userdata); /** * Remove a function watching a particular hint. @@ -3952,13 +4273,15 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddHintCallback(const char *name, * hint value changes. * \param userdata a pointer being passed to the callback function. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_AddHintCallback */ extern SDL_DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name, - SDL_HintCallback callback, - void *userdata); + SDL_HintCallback callback, + void *userdata); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/Source/ThirdParty/SDL/SDL3/SDL_init.h b/Source/ThirdParty/SDL/SDL3/SDL_init.h index 18d5d8956..6b5181600 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_init.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_init.h @@ -105,12 +105,18 @@ typedef Uint32 SDL_InitFlags; * call SDL_Quit() to force shutdown). If a subsystem is already loaded then * this call will increase the ref-count and return. * + * Consider reporting some basic metadata about your application before + * calling SDL_Init, using either SDL_SetAppMetadata() or + * SDL_SetAppMetadataProperty(). + * * \param flags subsystem initialization flags. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. * + * \sa SDL_SetAppMetadata + * \sa SDL_SetAppMetadataProperty * \sa SDL_InitSubSystem * \sa SDL_Quit * \sa SDL_SetMainReady @@ -182,6 +188,138 @@ extern SDL_DECLSPEC SDL_InitFlags SDLCALL SDL_WasInit(SDL_InitFlags flags); */ extern SDL_DECLSPEC void SDLCALL SDL_Quit(void); +/** + * Specify basic metadata about your app. + * + * You can optionally provide metadata about your app to SDL. This is not + * required, but strongly encouraged. + * + * There are several locations where SDL can make use of metadata (an "About" + * box in the macOS menu bar, the name of the app can be shown on some audio + * mixers, etc). Any piece of metadata can be left as NULL, if a specific + * detail doesn't make sense for the app. + * + * This function should be called as early as possible, before SDL_Init. + * Multiple calls to this function are allowed, but various state might not + * change once it has been set up with a previous call to this function. + * + * Passing a NULL removes any previous metadata. + * + * This is a simplified interface for the most important information. You can + * supply significantly more detailed metadata with + * SDL_SetAppMetadataProperty(). + * + * \param appname The name of the application ("My Game 2: Bad Guy's + * Revenge!"). + * \param appversion The version of the application ("1.0.0beta5" or a git + * hash, or whatever makes sense). + * \param appidentifier A unique string in reverse-domain format that + * identifies this app ("com.example.mygame2"). + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_SetAppMetadataProperty + */ +extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadata(const char *appname, const char *appversion, const char *appidentifier); + +/** + * Specify metadata about your app through a set of properties. + * + * You can optionally provide metadata about your app to SDL. This is not + * required, but strongly encouraged. + * + * There are several locations where SDL can make use of metadata (an "About" + * box in the macOS menu bar, the name of the app can be shown on some audio + * mixers, etc). Any piece of metadata can be left out, if a specific detail + * doesn't make sense for the app. + * + * This function should be called as early as possible, before SDL_Init. + * Multiple calls to this function are allowed, but various state might not + * change once it has been set up with a previous call to this function. + * + * Once set, this metadata can be read using SDL_GetMetadataProperty(). + * + * These are the supported properties: + * + * - `SDL_PROP_APP_METADATA_NAME_STRING`: The human-readable name of the + * application, like "My Game 2: Bad Guy's Revenge!". This will show up + * anywhere the OS shows the name of the application separately from window + * titles, such as volume control applets, etc. This defaults to "SDL + * Application". + * - SDL_PROP_APP_METADATA_VERSION_STRING`: The version of the app that is + * running; there are no rules on format, so "1.0.3beta2" and "April 22nd, + * 2024" and a git hash are all valid options. This has no default. + * - `SDL_PROP_APP_METADATA_IDENTIFIER_STRING`: A unique string that + * identifies this app. This must be in reverse-domain format, like + * "com.example.mygame2". This string is used by desktop compositors to + * identify and group windows together, as well as match applications with + * associated desktop settings and icons. If you plan to package your + * application in a container such as Flatpak, the app ID should match the + * name of your Flatpak container as well. This has no default. + * - SDL_PROP_APP_METADATA_CREATOR_STRING`: The human-readable name of the + * creator/developer/maker of this app, like "MojoWorkshop, LLC" + * - SDL_PROP_APP_METADATA_COPYRIGHT_STRING`: The human-readable copyright + * notice, like "Copyright (c) 2024 MojoWorkshop, LLC" or whatnot. Keep this + * to one line, don't paste a copy of a whole software license in here. This + * has no default. + * - SDL_PROP_APP_METADATA_URL_STRING`: A URL to the app on the web. Maybe a + * product page, or a storefront, or even a GitHub repository, for user's + * further information This has no default. + * - SDL_PROP_APP_METADATA_TYPE_STRING`: The type of application this is. + * Currently this string can be "game" for a video game, "mediaplayer" for a + * media player, or generically "application" if nothing else applies. + * Future versions of SDL might add new types. This defaults to + * "application". + * + * \param name the name of the metadata property to set. + * \param value the value of the property, or NULL to remove that property. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_GetAppMetadataProperty + * \sa SDL_SetAppMetadata + */ +extern SDL_DECLSPEC int SDLCALL SDL_SetAppMetadataProperty(const char *name, const char *value); + +#define SDL_PROP_APP_METADATA_NAME_STRING "SDL.app.metadata.name" +#define SDL_PROP_APP_METADATA_VERSION_STRING "SDL.app.metadata.version" +#define SDL_PROP_APP_METADATA_IDENTIFIER_STRING "SDL.app.metadata.identifier" +#define SDL_PROP_APP_METADATA_CREATOR_STRING "SDL.app.metadata.creator" +#define SDL_PROP_APP_METADATA_COPYRIGHT_STRING "SDL.app.metadata.copyright" +#define SDL_PROP_APP_METADATA_URL_STRING "SDL.app.metadata.url" +#define SDL_PROP_APP_METADATA_TYPE_STRING "SDL.app.metadata.type" + +/** + * Get metadata about your app. + * + * This returns metadata previously set using SDL_SetAppMetadata() or + * SDL_SetAppMetadataProperty(). See SDL_SetAppMetadataProperty() for the list + * of available properties and their meanings. + * + * \param name the name of the metadata property to get. + * \returns the current value of the metadata property, or the default if it + * is not set, NULL for properties with no default. + * + * \threadsafety It is safe to call this function from any thread, although + * the string returned is not protected and could potentially be + * freed if you call SDL_SetAppMetadataProperty() to set that + * property from another thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_SetAppMetadata + * \sa SDL_SetAppMetadataProperty + */ +extern SDL_DECLSPEC const char * SDLCALL SDL_GetAppMetadataProperty(const char *name); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/Source/ThirdParty/SDL/SDL3/SDL_iostream.h b/Source/ThirdParty/SDL/SDL3/SDL_iostream.h index 430cd3e40..fce0e1245 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_iostream.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_iostream.h @@ -481,9 +481,9 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_TellIO(SDL_IOStream *context); * * This function reads up `size` bytes from the data source to the area * pointed at by `ptr`. This function may read less bytes than requested. It - * will return zero when the data stream is completely read, or on error. To - * determine if there was an error or all data was read, call - * SDL_GetIOStatus(). + * will return zero when the data stream is completely read, and + * SDL_GetIOStatus() will return SDL_IO_STATUS_EOF, or on error, and + * SDL_GetIOStatus() will return SDL_IO_STATUS_ERROR. * * \param context a pointer to an SDL_IOStream structure. * \param ptr a pointer to a buffer to read data into. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_joystick.h b/Source/ThirdParty/SDL/SDL3/SDL_joystick.h index df874b89f..1a1707664 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_joystick.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_joystick.h @@ -201,29 +201,24 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasJoystick(void); /** * Get a list of currently connected joysticks. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of joysticks returned, may * be NULL. * \returns a 0 terminated array of joystick instance IDs or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasJoystick * \sa SDL_OpenJoystick */ -extern SDL_DECLSPEC const SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *count); +extern SDL_DECLSPEC SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *count); /** * Get the implementation dependent name of a joystick. * * This can be called before any joysticks are opened. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the joystick instance ID. * \returns the name of the selected joystick. If no name can be found, this * function returns NULL; call SDL_GetError() for more information. @@ -240,9 +235,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickNameForID(SDL_JoystickID * * This can be called before any joysticks are opened. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the joystick instance ID. * \returns the path of the selected joystick. If no path can be found, this * function returns NULL; call SDL_GetError() for more information. @@ -662,9 +654,6 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetJoystickProperties(SDL_Joyst /** * Get the implementation dependent name of a joystick. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the name of the selected joystick. If no name can be found, this * function returns NULL; call SDL_GetError() for more information. @@ -678,9 +667,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickName(SDL_Joystick *joyst /** * Get the implementation dependent path of a joystick. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the path of the selected joystick. If no path can be found, this * function returns NULL; call SDL_GetError() for more information. @@ -798,9 +784,6 @@ extern SDL_DECLSPEC Uint16 SDLCALL SDL_GetJoystickFirmwareVersion(SDL_Joystick * * * Returns the serial number of the joystick, or NULL if it is not available. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \returns the serial number of the selected joystick, or NULL if * unavailable. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_keyboard.h b/Source/ThirdParty/SDL/SDL3/SDL_keyboard.h index bb280ce14..d4f9b22cd 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_keyboard.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_keyboard.h @@ -73,29 +73,24 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasKeyboard(void); * power buttons, etc. You should wait for input from a device before you * consider it actively in use. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of keyboards returned, may * be NULL. * \returns a 0 terminated array of keyboards instance IDs or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetKeyboardNameForID * \sa SDL_HasKeyboard */ -extern SDL_DECLSPEC const SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *count); +extern SDL_DECLSPEC SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *count); /** * Get the name of a keyboard. * * This function returns "" if the keyboard doesn't have a name. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the keyboard instance ID. * \returns the name of the selected keyboard or NULL on failure; call * SDL_GetError() for more information. @@ -189,61 +184,27 @@ extern SDL_DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void); */ extern SDL_DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); -/** - * Get the key code corresponding to the given scancode according to a default - * en_US keyboard layout. - * - * See SDL_Keycode for details. - * - * \param scancode the desired SDL_Scancode to query. - * \param modstate the modifier state to use when translating the scancode to - * a keycode. - * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. - * - * \since This function is available since SDL 3.0.0. - * - * \sa SDL_GetKeyName - * \sa SDL_GetScancodeFromKey - */ -extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate); - /** * Get the key code corresponding to the given scancode according to the * current keyboard layout. * - * See SDL_Keycode for details. + * If you want to get the keycode as it would be delivered in key events, + * including options specified in SDL_HINT_KEYCODE_OPTIONS, then you should + * pass `key_event` as SDL_TRUE. Otherwise this function simply translates the + * scancode based on the given modifier state. * * \param scancode the desired SDL_Scancode to query. * \param modstate the modifier state to use when translating the scancode to * a keycode. + * \param key_event SDL_TRUE if the keycode will be used in key events. * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. * * \since This function is available since SDL 3.0.0. * - * \sa SDL_GetDefaultKeyFromScancode * \sa SDL_GetKeyName * \sa SDL_GetScancodeFromKey */ -extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate); - -/** - * Get the scancode corresponding to the given key code according to a default - * en_US keyboard layout. - * - * Note that there may be multiple scancode+modifier states that can generate - * this keycode, this will just return the first one found. - * - * \param key the desired SDL_Keycode to query. - * \param modstate a pointer to the modifier state that would be used when the - * scancode generates this key, may be NULL. - * \returns the SDL_Scancode that corresponds to the given SDL_Keycode. - * - * \since This function is available since SDL 3.0.0. - * - * \sa SDL_GetScancodeFromKey - * \sa SDL_GetScancodeName - */ -extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetDefaultScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate); +extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, SDL_bool key_event); /** * Get the scancode corresponding to the given key code according to the @@ -259,7 +220,6 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetDefaultScancodeFromKey(SDL_Keyco * * \since This function is available since SDL 3.0.0. * - * \sa SDL_GetDefaultScancodeFromKey * \sa SDL_GetKeyFromScancode * \sa SDL_GetScancodeName */ @@ -284,9 +244,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetScancodeName(SDL_Scancode scancode, const /** * Get a human-readable name for a scancode. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * **Warning**: The returned name is by design not stable across platforms, * e.g. the name for `SDL_SCANCODE_LGUI` is "Left GUI" under Linux but "Left * Windows" under Microsoft Windows, and some scancodes like @@ -326,14 +283,8 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *nam /** * Get a human-readable name for a key. * - * Both lowercase and uppercase alphabetic keycodes have uppercase names, e.g. - * SDL_Keycode 'a' and 'A' both have the name "A". - * * If the key doesn't have a name, this function returns an empty string (""). * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param key the desired SDL_Keycode to query. * \returns a UTF-8 encoded string of the key name. * @@ -378,11 +329,110 @@ extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); * \since This function is available since SDL 3.0.0. * * \sa SDL_SetTextInputArea + * \sa SDL_StartTextInputWithProperties * \sa SDL_StopTextInput * \sa SDL_TextInputActive */ extern SDL_DECLSPEC int SDLCALL SDL_StartTextInput(SDL_Window *window); +/** + * Text input type. + * + * These are the valid values for SDL_PROP_TEXTINPUT_TYPE_NUMBER. Not every + * value is valid on every platform, but where a value isn't supported, a + * reasonable fallback will be used. + * + * \since This enum is available since SDL 3.0.0. + * + * \sa SDL_StartTextInputWithProperties + */ +typedef enum SDL_TextInputType +{ + SDL_TEXTINPUT_TYPE_TEXT, /**< The input is text */ + SDL_TEXTINPUT_TYPE_TEXT_NAME, /**< The input is a person's name */ + SDL_TEXTINPUT_TYPE_TEXT_EMAIL, /**< The input is an e-mail address */ + SDL_TEXTINPUT_TYPE_TEXT_USERNAME, /**< The input is a username */ + SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN, /**< The input is a secure password that is hidden */ + SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE, /**< The input is a secure password that is visible */ + SDL_TEXTINPUT_TYPE_NUMBER, /**< The input is a number */ + SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN, /**< The input is a secure PIN that is hidden */ + SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE /**< The input is a secure PIN that is visible */ +} SDL_TextInputType; + +/** + * Auto capitalization type. + * + * These are the valid values for + * SDL_PROP_TEXTINPUT_AUTOCAPITALIZATION_NUMBER. Not every value is valid on + * every platform, but where a value isn't supported, a reasonable fallback + * will be used. + * + * \since This enum is available since SDL 3.0.0. + * + * \sa SDL_StartTextInputWithProperties + */ +typedef enum SDL_Capitalization +{ + SDL_CAPITALIZE_NONE, /**< No auto-capitalization will be done */ + SDL_CAPITALIZE_SENTENCES, /**< The first letter of sentences will be capitalized */ + SDL_CAPITALIZE_WORDS, /**< The first letter of words will be capitalized */ + SDL_CAPITALIZE_LETTERS /**< All letters will be capitalized */ +} SDL_Capitalization; + +/** + * Start accepting Unicode text input events in a window, with properties + * describing the input. + * + * This function will enable text input (SDL_EVENT_TEXT_INPUT and + * SDL_EVENT_TEXT_EDITING events) in the specified window. Please use this + * function paired with SDL_StopTextInput(). + * + * Text input events are not received by default. + * + * On some platforms using this function shows the screen keyboard. + * + * These are the supported properties: + * + * - `SDL_PROP_TEXTINPUT_TYPE_NUMBER` - an SDL_TextInputType value that + * describes text being input, defaults to SDL_TEXTINPUT_TYPE_TEXT. + * - `SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER` - an SDL_Capitalization value + * that describes how text should be capitalized, defaults to + * SDL_CAPITALIZE_SENTENCES for normal text entry, SDL_CAPITALIZE_WORDS for + * SDL_TEXTINPUT_TYPE_TEXT_NAME, and SDL_CAPITALIZE_NONE for e-mail + * addresses, usernames, and passwords. + * - `SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN` - true to enable auto completion + * and auto correction, defaults to SDL_TRUE. + * - `SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN` - true if multiple lines of text + * are allowed. This defaults to SDL_TRUE if SDL_HINT_RETURN_KEY_HIDES_IME + * is "0" or is not set, and defaults to SDL_FALSE if + * SDL_HINT_RETURN_KEY_HIDES_IME is "1". + * + * On Android you can directly specify the input type: + * + * - `SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER` - the text input type to + * use, overriding other properties. This is documented at + * https://developer.android.com/reference/android/text/InputType + * + * \param window the window to enable text input. + * \param props the properties to use. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_SetTextInputArea + * \sa SDL_StartTextInput + * \sa SDL_StopTextInput + * \sa SDL_TextInputActive + */ +extern SDL_DECLSPEC int SDLCALL SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props); + +#define SDL_PROP_TEXTINPUT_TYPE_NUMBER "SDL.textinput.type" +#define SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER "SDL.textinput.capitalization" +#define SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN "SDL.textinput.autocorrect" +#define SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN "SDL.textinput.multiline" +#define SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER "SDL.textinput.android.inputtype" + /** * Check whether or not Unicode text input events are enabled for a window. * diff --git a/Source/ThirdParty/SDL/SDL3/SDL_keycode.h b/Source/ThirdParty/SDL/SDL3/SDL_keycode.h index d8b2004d1..2d03a3d68 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_keycode.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_keycode.h @@ -43,8 +43,6 @@ * to SDLK_0...SDLK_9 on AZERTY layouts. * * \since This datatype is available since SDL 3.0.0. - * - * \sa SDL_KeyCode */ typedef Uint32 SDL_Keycode; diff --git a/Source/ThirdParty/SDL/SDL3/SDL_locale.h b/Source/ThirdParty/SDL/SDL3/SDL_locale.h index 84281e923..85d77500c 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_locale.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_locale.h @@ -89,17 +89,16 @@ typedef struct SDL_Locale * if possible, and you can call this function again to get an updated copy of * preferred locales. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of locales returned, may * be NULL. * \returns a NULL terminated array of locale pointers, or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This is a single + * allocation that should be freed with SDL_free() when it is no + * longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const SDL_Locale * const * SDLCALL SDL_GetPreferredLocales(int *count); +extern SDL_DECLSPEC SDL_Locale ** SDLCALL SDL_GetPreferredLocales(int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/Source/ThirdParty/SDL/SDL3/SDL_log.h b/Source/ThirdParty/SDL/SDL3/SDL_log.h index 171cce844..078ab9dbe 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_log.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_log.h @@ -29,9 +29,27 @@ * it will only be sent out if it has that minimum priority or higher. * * SDL's own logs are sent below the default priority threshold, so they are - * quiet by default. If you're debugging SDL you might want: + * quiet by default. * - * SDL_SetLogPriorities(SDL_LOG_PRIORITY_WARN); + * You can change the log verbosity programmatically using + * SDL_SetLogPriority() or with SDL_SetHint(SDL_HINT_LOGGING, ...), or with + * the "SDL_LOGGING" environment variable. This variable is a comma separated + * set of category=level tokens that define the default logging levels for SDL + * applications. + * + * The category can be a numeric category, one of "app", "error", "assert", + * "system", "audio", "video", "render", "input", "test", or `*` for any + * unspecified category. + * + * The level can be a numeric level, one of "verbose", "debug", "info", + * "warn", "error", "critical", or "quiet" to disable that category. + * + * You can omit the category if you want to set the logging level for all + * categories. + * + * If this hint isn't set, the default log levels are equivalent to: + * + * `app=info,assert=warn,test=verbose,*=error` * * Here's where the messages go on different platforms: * @@ -163,6 +181,26 @@ extern SDL_DECLSPEC SDL_LogPriority SDLCALL SDL_GetLogPriority(int category); */ extern SDL_DECLSPEC void SDLCALL SDL_ResetLogPriorities(void); +/** + * Set the text prepended to log messages of a given priority. + * + * By default SDL_LOG_PRIORITY_INFO and below have no prefix, and + * SDL_LOG_PRIORITY_WARN and higher have a prefix showing their priority, e.g. + * "WARNING: ". + * + * \param priority the SDL_LogPriority to modify. + * \param prefix the prefix to use for that log priority, or NULL to use no + * prefix. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_SetLogPriorities + * \sa SDL_SetLogPriority + */ +extern SDL_DECLSPEC int SDLCALL SDL_SetLogPriorityPrefix(SDL_LogPriority priority, const char *prefix); + /** * Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO. * diff --git a/Source/ThirdParty/SDL/SDL3/SDL_mouse.h b/Source/ThirdParty/SDL/SDL3/SDL_mouse.h index 8ddc37495..814858ea5 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_mouse.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_mouse.h @@ -135,29 +135,24 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasMouse(void); * You should wait for input from a device before you consider it actively in * use. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of mice returned, may be * NULL. * \returns a 0 terminated array of mouse instance IDs or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetMouseNameForID * \sa SDL_HasMouse */ -extern SDL_DECLSPEC const SDL_MouseID * SDLCALL SDL_GetMice(int *count); +extern SDL_DECLSPEC SDL_MouseID * SDLCALL SDL_GetMice(int *count); /** * Get the name of a mouse. * * This function returns "" if the mouse doesn't have a name. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the mouse instance ID. * \returns the name of the selected mouse, or NULL on failure; call * SDL_GetError() for more information. @@ -293,23 +288,36 @@ extern SDL_DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, extern SDL_DECLSPEC int SDLCALL SDL_WarpMouseGlobal(float x, float y); /** - * Set relative mouse mode. + * Set relative mouse mode for a window. * - * While the mouse is in relative mode, the cursor is hidden, the mouse + * While the window has focus and relative mouse mode is enabled, the cursor is hidden, the mouse * position is constrained to the window, and SDL will report continuous * relative mouse motion even if the mouse is at the edge of the window. * - * This function will flush any pending mouse motion. + * This function will flush any pending mouse motion for this window. * + * \param window the window to change. * \param enabled SDL_TRUE to enable relative mode, SDL_FALSE to disable. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. * - * \sa SDL_GetRelativeMouseMode + * \sa SDL_GetWindowRelativeMouseMode */ -extern SDL_DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); +extern SDL_DECLSPEC int SDLCALL SDL_SetWindowRelativeMouseMode(SDL_Window *window, SDL_bool enabled); + +/** + * Query whether relative mouse mode is enabled for a window. + * + * \param window the window to query. + * \returns SDL_TRUE if relative mode is enabled for a window or SDL_FALSE otherwise. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_SetWindowRelativeMouseMode + */ +extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowRelativeMouseMode(SDL_Window *window); /** * Capture the mouse and to track input outside an SDL window. @@ -326,7 +334,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); * mouse while the user is dragging something, until the user releases a mouse * button. It is not recommended that you capture the mouse for long periods * of time, such as the entire time your app is running. For that, you should - * probably use SDL_SetRelativeMouseMode() or SDL_SetWindowMouseGrab(), + * probably use SDL_SetWindowRelativeMouseMode() or SDL_SetWindowMouseGrab(), * depending on your goals. * * While captured, mouse events still report coordinates relative to the @@ -357,17 +365,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); */ extern SDL_DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled); -/** - * Query whether relative mouse mode is enabled. - * - * \returns SDL_TRUE if relative mode is enabled or SDL_FALSE otherwise. - * - * \since This function is available since SDL 3.0.0. - * - * \sa SDL_SetRelativeMouseMode - */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void); - /** * Create a cursor using the specified bitmap data and mask (in MSB format). * @@ -418,6 +415,15 @@ extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor(const Uint8 * data, /** * Create a color cursor. * + * If this function is passed a surface with alternate representations, the + * surface will be interpreted as the content to be used for 100% display + * scale, and the alternate representations will be used for high DPI + * situations. For example, if the original surface is 32x32, then on a 2x + * macOS display or 200% display scale on Windows, a 64x64 version of the + * image will be used, if available. If a matching version of the image isn't + * available, the closest size image will be scaled to the appropriate size + * and be used instead. + * * \param surface an SDL_Surface structure representing the cursor image. * \param hot_x the x position of the cursor hot spot. * \param hot_y the y position of the cursor hot spot. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_mutex.h b/Source/ThirdParty/SDL/SDL3/SDL_mutex.h index aed836dc4..eea003092 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_mutex.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_mutex.h @@ -544,7 +544,7 @@ typedef struct SDL_Semaphore SDL_Semaphore; * \since This function is available since SDL 3.0.0. * * \sa SDL_DestroySemaphore - * \sa SDL_PostSemaphore + * \sa SDL_SignalSemaphore * \sa SDL_TryWaitSemaphore * \sa SDL_GetSemaphoreValue * \sa SDL_WaitSemaphore @@ -583,7 +583,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_Semaphore *sem); * * \since This function is available since SDL 3.0.0. * - * \sa SDL_PostSemaphore + * \sa SDL_SignalSemaphore * \sa SDL_TryWaitSemaphore * \sa SDL_WaitSemaphoreTimeout */ @@ -604,7 +604,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_WaitSemaphore(SDL_Semaphore *sem); * * \since This function is available since SDL 3.0.0. * - * \sa SDL_PostSemaphore + * \sa SDL_SignalSemaphore * \sa SDL_WaitSemaphore * \sa SDL_WaitSemaphoreTimeout */ @@ -626,7 +626,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem); * * \since This function is available since SDL 3.0.0. * - * \sa SDL_PostSemaphore + * \sa SDL_SignalSemaphore * \sa SDL_TryWaitSemaphore * \sa SDL_WaitSemaphore */ @@ -645,7 +645,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Sin * \sa SDL_WaitSemaphore * \sa SDL_WaitSemaphoreTimeout */ -extern SDL_DECLSPEC int SDLCALL SDL_PostSemaphore(SDL_Semaphore *sem); +extern SDL_DECLSPEC int SDLCALL SDL_SignalSemaphore(SDL_Semaphore *sem); /** * Get the current value of a semaphore. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_oldnames.h b/Source/ThirdParty/SDL/SDL3/SDL_oldnames.h index 88642d056..cd895d5ea 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_oldnames.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_oldnames.h @@ -444,7 +444,7 @@ #define SDL_CondWaitTimeout SDL_WaitConditionTimeout #define SDL_CreateCond SDL_CreateCondition #define SDL_DestroyCond SDL_DestroyCondition -#define SDL_SemPost SDL_PostSemaphore +#define SDL_SemPost SDL_SignalSemaphore #define SDL_SemTryWait SDL_TryWaitSemaphore #define SDL_SemValue SDL_GetSemaphoreValue #define SDL_SemWait SDL_WaitSemaphore @@ -618,6 +618,8 @@ #define SDL_GDKGetTaskQueue SDL_GetGDKTaskQueue #define SDL_LinuxSetThreadPriority SDL_SetLinuxThreadPriority #define SDL_LinuxSetThreadPriorityAndPolicy SDL_SetLinuxThreadPriorityAndPolicy +#define SDL_OnApplicationDidBecomeActive SDL_OnApplicationDidEnterForeground +#define SDL_OnApplicationWillResignActive SDL_OnApplicationWillEnterBackground #define SDL_WinRTGetDeviceFamily SDL_GetWinRTDeviceFamily #define SDL_GetWinRTFSPathUTF8 SDL_GetWinRTFSPath #define SDL_iOSSetAnimationCallback SDL_SetiOSAnimationCallback @@ -1063,7 +1065,7 @@ #define SDL_CondWaitTimeout SDL_CondWaitTimeout_renamed_SDL_WaitConditionTimeout #define SDL_CreateCond SDL_CreateCond_renamed_SDL_CreateCondition #define SDL_DestroyCond SDL_DestroyCond_renamed_SDL_DestroyCondition -#define SDL_SemPost SDL_SemPost_renamed_SDL_PostSemaphore +#define SDL_SemPost SDL_SemPost_renamed_SDL_SignalSemaphore #define SDL_SemTryWait SDL_SemTryWait_renamed_SDL_TryWaitSemaphore #define SDL_SemValue SDL_SemValue_renamed_SDL_GetSemaphoreValue #define SDL_SemWait SDL_SemWait_renamed_SDL_WaitSemaphore @@ -1237,6 +1239,8 @@ #define SDL_GDKGetTaskQueue SDL_GDKGetTaskQueue_renamed_SDL_GetGDKTaskQueue #define SDL_LinuxSetThreadPriority SDL_LinuxSetThreadPriority_renamed_SDL_SetLinuxThreadPriority #define SDL_LinuxSetThreadPriorityAndPolicy SDL_LinuxSetThreadPriorityAndPolicy_renamed_SDL_SetLinuxThreadPriorityAndPolicy +#define SDL_OnApplicationDidBecomeActive SDL_OnApplicationDidBecomeActive_renamed_SDL_OnApplicationDidEnterForeground +#define SDL_OnApplicationWillResignActive SDL_OnApplicationWillResignActive_renamed_SDL_OnApplicationWillEnterBackground #define SDL_WinRTGetDeviceFamily SDL_WinRTGetDeviceFamily_renamed_SDL_GetWinRTDeviceFamily #define SDL_GetWinRTFSPathUTF8 SDL_GetWinRTFSPathUTF8_renamed_SDL_GetWinRTFSPath #define SDL_iOSSetAnimationCallback SDL_iOSSetAnimationCallback_renamed_SDL_SetiOSAnimationCallback diff --git a/Source/ThirdParty/SDL/SDL3/SDL_pen.h b/Source/ThirdParty/SDL/SDL3/SDL_pen.h index 8fcad1cc6..c02c0081f 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_pen.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_pen.h @@ -224,9 +224,6 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PenConnected(SDL_PenID instance_id); /** * Retrieves a human-readable description for a SDL_PenID. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the pen to query. * \returns a string that contains the name of the pen, intended for human * consumption. The string might or might not be localised, depending diff --git a/Source/ThirdParty/SDL/SDL3/SDL_properties.h b/Source/ThirdParty/SDL/SDL3/SDL_properties.h index b649fd1bf..b3e061adc 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_properties.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_properties.h @@ -378,16 +378,18 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetPointerProperty(SDL_PropertiesID props /** * Get a string property from a group of properties. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param props the properties to query. * \param name the name of the property to query. * \param default_value the default value of the property. * \returns the value of the property, or `default_value` if it is not set or * not a string property. * - * \threadsafety It is safe to call this function from any thread. + * \threadsafety It is safe to call this function from any thread, although + * the data returned is not protected and could potentially be + * freed if you call SDL_SetStringProperty() or + * SDL_ClearProperty() on these properties from another thread. + * If you need to avoid this, use SDL_LockProperties() and + * SDL_UnlockProperties(). * * \since This function is available since SDL 3.0.0. * diff --git a/Source/ThirdParty/SDL/SDL3/SDL_rect.h b/Source/ThirdParty/SDL/SDL3/SDL_rect.h index 9735bc2a4..058330098 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_rect.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_rect.h @@ -112,6 +112,25 @@ typedef struct SDL_FRect } SDL_FRect; +/** + * Convert an SDL_Rect to SDL_FRect + * + * \param rect a pointer to an SDL_Rect. + * \param frect a pointer filled in with the floating point representation of + * `rect`. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + */ +SDL_FORCE_INLINE void SDL_RectToFRect(const SDL_Rect *rect, SDL_FRect *frect) +{ + frect->x = (float)rect->x; + frect->y = (float)rect->y; + frect->w = (float)rect->w; + frect->h = (float)rect->h; +} + /** * Determine whether a point resides inside a rectangle. * diff --git a/Source/ThirdParty/SDL/SDL3/SDL_render.h b/Source/ThirdParty/SDL/SDL3/SDL_render.h index 78fc1f928..c02b71e9b 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_render.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_render.h @@ -154,9 +154,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); * "direct3d12" or "metal". These never have Unicode characters, and are not * meant to be proper names. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param index the index of the rendering driver; the value ranges from 0 to * SDL_GetNumRenderDrivers() - 1. * \returns the name of the rendering driver at the requested index, or NULL @@ -325,9 +322,6 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetRenderWindow(SDL_Renderer *rende /** * Get the name of a renderer. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param renderer the rendering context. * \returns the name of the selected renderer, or NULL on failure; call * SDL_GetError() for more information. @@ -1443,6 +1437,26 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SD */ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderViewportSet(SDL_Renderer *renderer); +/** + * Get the safe area for rendering within the current viewport. + * + * Some devices have portions of the screen which are partially obscured or + * not interactive, possibly due to on-screen controls, curved edges, camera + * notches, TV overscan, etc. This function provides the area of the current + * viewport which is safe to have interactible content. You should continue + * rendering into the rest of the render target, but it should not contain + * visually important or interactible content. + * + * \param renderer the rendering context. + * \param rect a pointer filled in with the area that is safe for interactive + * content. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 3.0.0. + */ +extern SDL_DECLSPEC int SDLCALL SDL_GetRenderSafeArea(SDL_Renderer *renderer, SDL_Rect *rect); + /** * Set the clip rectangle for rendering on the specified target. * @@ -1905,17 +1919,21 @@ extern SDL_DECLSPEC int SDLCALL SDL_RenderTextureTiled(SDL_Renderer *renderer, S * Perform a scaled copy using the 9-grid algorithm to the current rendering * target at subpixel precision. * - * The pixels in the texture are split into a 3x3 grid, using the corner size - * for each corner, and the sides and center making up the remaining pixels. - * The corners are then scaled using `scale` and fit into the corners of the - * destination rectangle. The sides and center are then stretched into place - * to cover the remaining destination rectangle. + * The pixels in the texture are split into a 3x3 grid, using the different + * corner sizes for each corner, and the sides and center making up the + * remaining pixels. The corners are then scaled using `scale` and fit into + * the corners of the destination rectangle. The sides and center are then + * stretched into place to cover the remaining destination rectangle. * * \param renderer the renderer which should copy parts of a texture. * \param texture the source texture. * \param srcrect the SDL_Rect structure representing the rectangle to be used * for the 9-grid, or NULL to use the entire texture. - * \param corner_size the size, in pixels, of the corner in `srcrect`. + * \param left_width the width, in pixels, of the left corners in `srcrect`. + * \param right_width the width, in pixels, of the right corners in `srcrect`. + * \param top_height the height, in pixels, of the top corners in `srcrect`. + * \param bottom_height the height, in pixels, of the bottom corners in + * `srcrect`. * \param scale the scale used to transform the corner of `srcrect` into the * corner of `dstrect`, or 0.0f for an unscaled copy. * \param dstrect a pointer to the destination rectangle, or NULL for the @@ -1927,7 +1945,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_RenderTextureTiled(SDL_Renderer *renderer, S * * \sa SDL_RenderTexture */ -extern SDL_DECLSPEC int SDLCALL SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float corner_size, float scale, const SDL_FRect *dstrect); +extern SDL_DECLSPEC int SDLCALL SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect); /** * Render a list of triangles, optionally using a texture and indices into the @@ -2039,15 +2057,16 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_RenderReadPixels(SDL_Renderer *ren * * \since This function is available since SDL 3.0.0. * + * \sa SDL_CreateRenderer * \sa SDL_RenderClear + * \sa SDL_RenderFillRect + * \sa SDL_RenderFillRects * \sa SDL_RenderLine * \sa SDL_RenderLines * \sa SDL_RenderPoint * \sa SDL_RenderPoints * \sa SDL_RenderRect * \sa SDL_RenderRects - * \sa SDL_RenderFillRect - * \sa SDL_RenderFillRects * \sa SDL_SetRenderDrawBlendMode * \sa SDL_SetRenderDrawColor */ diff --git a/Source/ThirdParty/SDL/SDL3/SDL_revision.h b/Source/ThirdParty/SDL/SDL3/SDL_revision.h index f673014d1..49503e19e 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_revision.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_revision.h @@ -31,9 +31,9 @@ /* #undef SDL_VENDOR_INFO */ #ifdef SDL_VENDOR_INFO -#define SDL_REVISION "SDL-ff7a60d (" SDL_VENDOR_INFO ")" +#define SDL_REVISION "SDL-627cb8acd (" SDL_VENDOR_INFO ")" #else -#define SDL_REVISION "SDL-ff7a60d" +#define SDL_REVISION "SDL-627cb8acd" #endif #endif /* SDL_revision_h_ */ diff --git a/Source/ThirdParty/SDL/SDL3/SDL_sensor.h b/Source/ThirdParty/SDL/SDL3/SDL_sensor.h index 89b1bfd6d..2d4aa468d 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_sensor.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_sensor.h @@ -149,20 +149,18 @@ typedef enum SDL_SensorType * \param count a pointer filled in with the number of sensors returned, may * be NULL. * \returns a 0 terminated array of sensor instance IDs or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const SDL_SensorID * SDLCALL SDL_GetSensors(int *count); +extern SDL_DECLSPEC SDL_SensorID * SDLCALL SDL_GetSensors(int *count); /** * Get the implementation dependent name of a sensor. * * This can be called before any sensors are opened. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param instance_id the sensor instance ID. * \returns the sensor name, or NULL if `instance_id` is not valid. * @@ -232,9 +230,6 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSensorProperties(SDL_Sensor /** * Get the implementation dependent name of a sensor. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param sensor the SDL_Sensor object. * \returns the sensor name or NULL on failure; call SDL_GetError() for more * information. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_stdinc.h b/Source/ThirdParty/SDL/SDL3/SDL_stdinc.h index 022daf899..14e075099 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_stdinc.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_stdinc.h @@ -91,8 +91,9 @@ void *alloca(size_t); /** * The number of elements in an array. * - * NOTE: This macro double-evaluates the argument, so you should never have - * side effects in the parameter. + * This macro looks like it double-evaluates the argument, but it does so + * inside of `sizeof`, so there are no side-effects here, as expressions do + * not actually run any code in these cases. * * \since This macro is available since SDL 3.0.0. */ @@ -664,6 +665,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumAllocations(void); extern SDL_DECLSPEC const char * SDLCALL SDL_getenv(const char *name); extern SDL_DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); +extern SDL_DECLSPEC int SDLCALL SDL_unsetenv(const char *name); typedef int (SDLCALL *SDL_CompareCallback)(const void *a, const void *b); extern SDL_DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, SDL_CompareCallback compare); @@ -2962,8 +2964,9 @@ size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size); /* Starting LLVM 16, the analyser errors out if these functions do not have their prototype defined (clang-diagnostic-implicit-function-declaration) */ -#include #include +#include +#include #define SDL_malloc malloc #define SDL_calloc calloc diff --git a/Source/ThirdParty/SDL/SDL3/SDL_storage.h b/Source/ThirdParty/SDL/SDL3/SDL_storage.h index f95030adf..7fc58a887 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_storage.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_storage.h @@ -401,9 +401,6 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetStorageSpaceRemaining(SDL_Storage *sto * convenience, but if `count` is non-NULL, on return it will contain the * number of items in the array, not counting the NULL terminator. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param storage a storage container. * \param path the path of the directory to enumerate. * \param pattern the pattern that files in the directory must match. Can be @@ -413,14 +410,16 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetStorageSpaceRemaining(SDL_Storage *sto * array. Can be NULL. * \returns an array of strings on success or NULL on failure; call * SDL_GetError() for more information. The caller should pass the - * returned pointer to SDL_free when done with it. + * returned pointer to SDL_free when done with it. This is a single + * allocation that should be freed with SDL_free() when it is no + * longer needed. * * \threadsafety It is safe to call this function from any thread, assuming * the `storage` object is thread-safe. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const char * const * SDLCALL SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count); +extern SDL_DECLSPEC char ** SDLCALL SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/Source/ThirdParty/SDL/SDL3/SDL_surface.h b/Source/ThirdParty/SDL/SDL3/SDL_surface.h index 8074e2e1b..57745ac0f 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_surface.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_surface.h @@ -306,6 +306,87 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface, SDL_ */ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_GetSurfacePalette(SDL_Surface *surface); +/** + * Add an alternate version of a surface. + * + * This function adds an alternate version of this surface, usually used for + * content with high DPI representations like cursors or icons. The size, + * format, and content do not need to match the original surface, and these + * alternate versions will not be updated when the original surface changes. + * + * This function adds a reference to the alternate version, so you should call + * SDL_DestroySurface() on the image after this call. + * + * \param surface the SDL_Surface structure to update. + * \param image a pointer to an alternate SDL_Surface to associate with this + * surface. + * \returns SDL_TRUE if alternate versions are available or SDL_TRUE + * otherwise. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_RemoveSurfaceAlternateImages + * \sa SDL_GetSurfaceImages + * \sa SDL_SurfaceHasAlternateImages + */ +extern SDL_DECLSPEC int SDLCALL SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image); + +/** + * Return whether a surface has alternate versions available. + * + * \param surface the SDL_Surface structure to query. + * \returns SDL_TRUE if alternate versions are available or SDL_TRUE + * otherwise. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_AddSurfaceAlternateImage + * \sa SDL_RemoveSurfaceAlternateImages + * \sa SDL_GetSurfaceImages + */ +extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasAlternateImages(SDL_Surface *surface); + +/** + * Get an array including all versions of a surface. + * + * This returns all versions of a surface, with the surface being queried as + * the first element in the returned array. + * + * Freeing the array of surfaces does not affect the surfaces in the array. + * They are still referenced by the surface being queried and will be cleaned + * up normally. + * + * \param surface the SDL_Surface structure to query. + * \param count a pointer filled in with the number of surface pointers + * returned, may be NULL. + * \returns a NULL terminated array of SDL_Surface pointers or NULL on + * failure; call SDL_GetError() for more information. This should be + * freed with SDL_free() when it is no longer needed. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_AddSurfaceAlternateImage + * \sa SDL_RemoveSurfaceAlternateImages + * \sa SDL_SurfaceHasAlternateImages + */ +extern SDL_DECLSPEC SDL_Surface ** SDLCALL SDL_GetSurfaceImages(SDL_Surface *surface, int *count); + +/** + * Remove all alternate versions of a surface. + * + * This function removes a reference from all the alternative versions, + * destroying them if this is the last reference to them. + * + * \param surface the SDL_Surface structure to update. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_AddSurfaceAlternateImage + * \sa SDL_GetSurfaceImages + * \sa SDL_SurfaceHasAlternateImages + */ +extern SDL_DECLSPEC void SDLCALL SDL_RemoveSurfaceAlternateImages(SDL_Surface *surface); + /** * Set up a surface for directly accessing the pixels. * @@ -679,6 +760,9 @@ extern SDL_DECLSPEC int SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMo /** * Creates a new surface identical to the existing surface. * + * If the original surface has alternate images, the new surface will have a + * reference to them as well. + * * The returned surface should be freed with SDL_DestroySurface(). * * \param surface the surface to duplicate. @@ -691,6 +775,25 @@ extern SDL_DECLSPEC int SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMo */ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_DuplicateSurface(SDL_Surface *surface); +/** + * Creates a new surface identical to the existing surface, scaled to the + * desired size. + * + * The returned surface should be freed with SDL_DestroySurface(). + * + * \param surface the surface to duplicate and scale. + * \param width the width of the new surface. + * \param height the height of the new surface. + * \param scaleMode the SDL_ScaleMode to be used. + * \returns a copy of the surface or NULL on failure; call SDL_GetError() for + * more information. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_DestroySurface + */ +extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ScaleSurface(SDL_Surface *surface, int width, int height, SDL_ScaleMode scaleMode); + /** * Copy an existing surface to a new surface of the specified format. * @@ -702,6 +805,9 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_DuplicateSurface(SDL_Surface *surf * If you are converting to an indexed surface and want to map colors to a * palette, you can use SDL_ConvertSurfaceAndColorspace() instead. * + * If the original surface has alternate images, the new surface will have a + * reference to them as well. + * * \param surface the existing SDL_Surface structure to convert. * \param format the new pixel format. * \returns the new SDL_Surface structure that is created or NULL on failure; @@ -722,6 +828,9 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface(SDL_Surface *surfac * and returns the new surface. This will perform any pixel format and * colorspace conversion needed. * + * If the original surface has alternate images, the new surface will have a + * reference to them as well. + * * \param surface the existing SDL_Surface structure to convert. * \param format the new pixel format. * \param palette an optional palette to use for indexed formats, may be NULL. @@ -1031,7 +1140,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SD * \param dst the SDL_Surface structure that is the blit target. * \param dstrect the SDL_Rect structure representing the target rectangle in * the destination surface, may not be NULL. - * \param scaleMode scale algorithm to be used. + * \param scaleMode the SDL_ScaleMode to be used. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * @@ -1106,15 +1215,19 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, * which may be of a different format. * * The pixels in the source surface are split into a 3x3 grid, using the - * corner size for each corner, and the sides and center making up the - * remaining pixels. The corners are then scaled using `scale` and fit into - * the corners of the destination rectangle. The sides and center are then - * stretched into place to cover the remaining destination rectangle. + * different corner sizes for each corner, and the sides and center making up + * the remaining pixels. The corners are then scaled using `scale` and fit + * into the corners of the destination rectangle. The sides and center are + * then stretched into place to cover the remaining destination rectangle. * * \param src the SDL_Surface structure to be copied from. * \param srcrect the SDL_Rect structure representing the rectangle to be used * for the 9-grid, or NULL to use the entire surface. - * \param corner_size the size, in pixels, of the corner in `srcrect`. + * \param left_width the width, in pixels, of the left corners in `srcrect`. + * \param right_width the width, in pixels, of the right corners in `srcrect`. + * \param top_height the height, in pixels, of the top corners in `srcrect`. + * \param bottom_height the height, in pixels, of the bottom corners in + * `srcrect`. * \param scale the scale used to transform the corner of `srcrect` into the * corner of `dstrect`, or 0.0f for an unscaled blit. * \param scaleMode scale algorithm to be used. @@ -1132,7 +1245,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, * * \sa SDL_BlitSurface */ -extern SDL_DECLSPEC int SDLCALL SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int corner_size, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect); +extern SDL_DECLSPEC int SDLCALL SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int left_width, int right_width, int top_height, int bottom_height, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect); /** * Map an RGB triple to an opaque pixel value for a surface. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_system.h b/Source/ThirdParty/SDL/SDL3/SDL_system.h index 489101929..9e79e7940 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_system.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_system.h @@ -320,6 +320,7 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetAndroidActivity(void); /** * Query Android API level of the current device. * + * - API level 35: Android 15 (VANILLA_ICE_CREAM) * - API level 34: Android 14 (UPSIDE_DOWN_CAKE) * - API level 33: Android 13 (TIRAMISU) * - API level 32: Android 12L (S_V2) @@ -410,9 +411,6 @@ extern SDL_DECLSPEC void SDLCALL SDL_SendAndroidBackButton(void); * * https://developer.android.com/reference/android/content/Context#getFilesDir() * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the path used for internal storage or NULL on failure; call * SDL_GetError() for more information. * @@ -452,9 +450,6 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetAndroidExternalStorageState(void); * * https://developer.android.com/reference/android/content/Context#getExternalFilesDir() * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the path used for external storage for this application on success * or NULL on failure; call SDL_GetError() for more information. * @@ -476,9 +471,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidExternalStoragePath(void) * * https://developer.android.com/reference/android/content/Context#getCacheDir() * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the path used for caches for this application on success or NULL * on failure; call SDL_GetError() for more information. * @@ -631,9 +623,6 @@ typedef enum SDL_WinRT_DeviceFamily * * https://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param pathType the type of path to retrieve, one of SDL_WinRT_Path. * \returns a UTF-8 string (8-bit, multi-byte) containing the path, or NULL if * the path is not available for any reason; call SDL_GetError() for @@ -716,7 +705,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidReceiveMemoryWarning(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationWillResignActive(void); +extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationWillEnterBackground(void); /** * Let iOS apps with external event handling report @@ -767,7 +756,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void); +extern SDL_DECLSPEC void SDLCALL SDL_OnApplicationDidEnterForeground(void); #ifdef SDL_PLATFORM_IOS diff --git a/Source/ThirdParty/SDL/SDL3/SDL_test_common.h b/Source/ThirdParty/SDL/SDL3/SDL_test_common.h index a7ec4dfca..a162a3de5 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_test_common.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_test_common.h @@ -156,6 +156,8 @@ SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, SDL_InitFlags flags) /** * Free the common state object. * + * You should call SDL_Quit() before calling this function. + * * \param state The common state object to destroy */ void SDLTest_CommonDestroyState(SDLTest_CommonState *state); @@ -206,9 +208,16 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state); SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv); /** - * Common event handler for test windows if you use a standard SDL_main. + * Print the details of an event. * - * This will free data from the event, like the string in a drop event! + * This is automatically called by SDLTest_CommonEvent() as needed. + * + * \param event The event to print. + */ +void SDLTest_PrintEvent(const SDL_Event *event); + +/** + * Common event handler for test windows if you use a standard SDL_main. * * \param state The common state used to create test window. * \param event The event to handle. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_thread.h b/Source/ThirdParty/SDL/SDL3/SDL_thread.h index 86aa6cf66..f6ec760c4 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_thread.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_thread.h @@ -330,9 +330,6 @@ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadWithPropertiesRuntime(S /** * Get the thread name as it was specified in SDL_CreateThread(). * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param thread the thread to query. * \returns a pointer to a UTF-8 string that names the specified thread, or * NULL if it doesn't have a name. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_timer.h b/Source/ThirdParty/SDL/SDL3/SDL_timer.h index cd3cc3a11..1c7ccff48 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_timer.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_timer.h @@ -137,7 +137,8 @@ typedef Uint32 SDL_TimerID; * The callback function is passed the current timer interval and returns the * next timer interval, in milliseconds. If the returned value is the same as * the one passed in, the periodic alarm continues, otherwise a new alarm is - * scheduled. If the callback returns 0, the periodic alarm is cancelled. + * scheduled. If the callback returns 0, the periodic alarm is canceled and + * will be removed. * * \param userdata an arbitrary pointer provided by the app through * SDL_AddTimer, for its own use. @@ -164,7 +165,7 @@ typedef Uint32 (SDLCALL *SDL_TimerCallback)(void *userdata, SDL_TimerID timerID, * The callback function is passed the current timer interval and the user * supplied parameter from the SDL_AddTimer() call and should return the next * timer interval. If the value returned from the callback is 0, the timer is - * canceled. + * canceled and will be removed. * * The callback is run on a separate thread, and for short timeouts can * potentially be called before this function returns. @@ -200,7 +201,8 @@ extern SDL_DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_TimerC * The callback function is passed the current timer interval and returns the * next timer interval, in nanoseconds. If the returned value is the same as * the one passed in, the periodic alarm continues, otherwise a new alarm is - * scheduled. If the callback returns 0, the periodic alarm is cancelled. + * scheduled. If the callback returns 0, the periodic alarm is canceled and + * will be removed. * * \param userdata an arbitrary pointer provided by the app through * SDL_AddTimer, for its own use. @@ -227,7 +229,7 @@ typedef Uint64 (SDLCALL *SDL_NSTimerCallback)(void *userdata, SDL_TimerID timerI * The callback function is passed the current timer interval and the user * supplied parameter from the SDL_AddTimerNS() call and should return the * next timer interval. If the value returned from the callback is 0, the - * timer is canceled. + * timer is canceled and will be removed. * * The callback is run on a separate thread, and for short timeouts can * potentially be called before this function returns. diff --git a/Source/ThirdParty/SDL/SDL3/SDL_touch.h b/Source/ThirdParty/SDL/SDL3/SDL_touch.h index fac421fde..6889f3697 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_touch.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_touch.h @@ -59,7 +59,7 @@ typedef enum SDL_TouchDeviceType * * \since This struct is available since SDL 3.0.0. * - * \sa SDL_GetTouchFinger + * \sa SDL_GetTouchFingers */ typedef struct SDL_Finger { @@ -83,24 +83,19 @@ typedef struct SDL_Finger * Therefore the returned list might be empty, although devices are available. * After using all devices at least once the number will be correct. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of devices returned, may * be NULL. * \returns a 0 terminated array of touch device IDs or NULL on failure; call - * SDL_GetError() for more information. + * SDL_GetError() for more information. This should be freed with + * SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const SDL_TouchID * SDLCALL SDL_GetTouchDevices(int *count); +extern SDL_DECLSPEC SDL_TouchID * SDLCALL SDL_GetTouchDevices(int *count); /** * Get the touch device name as reported from the driver. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param touchID the touch device instance ID. * \returns touch device name, or NULL on failure; call SDL_GetError() for * more information. @@ -122,18 +117,17 @@ extern SDL_DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_Touch /** * Get a list of active fingers for a given touch device. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param touchID the ID of a touch device. * \param count a pointer filled in with the number of fingers returned, can * be NULL. * \returns a NULL terminated array of SDL_Finger pointers or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This is a single + * allocation that should be freed with SDL_free() when it is no + * longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const SDL_Finger * const * SDLCALL SDL_GetTouchFingers(SDL_TouchID touchID, int *count); +extern SDL_DECLSPEC SDL_Finger ** SDLCALL SDL_GetTouchFingers(SDL_TouchID touchID, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/Source/ThirdParty/SDL/SDL3/SDL_video.h b/Source/ThirdParty/SDL/SDL3/SDL_video.h index 36e216d31..97844ef29 100644 --- a/Source/ThirdParty/SDL/SDL3/SDL_video.h +++ b/Source/ThirdParty/SDL/SDL3/SDL_video.h @@ -155,7 +155,8 @@ typedef Uint64 SDL_WindowFlags; #define SDL_WINDOW_MODAL SDL_UINT64_C(0x0000000000001000) /**< window is modal */ #define SDL_WINDOW_HIGH_PIXEL_DENSITY SDL_UINT64_C(0x0000000000002000) /**< window uses high pixel density back buffer if possible */ #define SDL_WINDOW_MOUSE_CAPTURE SDL_UINT64_C(0x0000000000004000) /**< window has mouse captured (unrelated to MOUSE_GRABBED) */ -#define SDL_WINDOW_ALWAYS_ON_TOP SDL_UINT64_C(0x0000000000008000) /**< window should always be above others */ +#define SDL_WINDOW_MOUSE_RELATIVE_MODE SDL_UINT64_C(0x0000000000008000) /**< window has relative mode enabled */ +#define SDL_WINDOW_ALWAYS_ON_TOP SDL_UINT64_C(0x0000000000010000) /**< window should always be above others */ #define SDL_WINDOW_UTILITY SDL_UINT64_C(0x0000000000020000) /**< window should be treated as a utility window, not showing in the task bar and window list */ #define SDL_WINDOW_TOOLTIP SDL_UINT64_C(0x0000000000040000) /**< window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window */ #define SDL_WINDOW_POPUP_MENU SDL_UINT64_C(0x0000000000080000) /**< window should be treated as a popup menu, requires a parent window */ @@ -349,9 +350,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); * "x11" or "windows". These never have Unicode characters, and are not meant * to be proper names. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param index the index of a video driver. * \returns the name of the video driver with the given **index**. * @@ -368,9 +366,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetVideoDriver(int index); * "x11" or "windows". These never have Unicode characters, and are not meant * to be proper names. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \returns the name of the current video driver or NULL if no driver has been * initialized. * @@ -393,17 +388,15 @@ extern SDL_DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme(void); /** * Get a list of currently connected displays. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of displays returned, may * be NULL. * \returns a 0 terminated array of display instance IDs or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This should be freed + * with SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count); +extern SDL_DECLSPEC SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count); /** * Return the primary display. @@ -449,9 +442,6 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetDisplayProperties(SDL_Displa /** * Get the name of a display in UTF-8 encoding. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param displayID the instance ID of the display to query. * \returns the name of a display or NULL on failure; call SDL_GetError() for * more information. @@ -559,20 +549,19 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetDisplayContentScale(SDL_DisplayID displ * - refresh rate -> highest to lowest * - pixel density -> lowest to highest * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param displayID the instance ID of the display to query. * \param count a pointer filled in with the number of display modes returned, * may be NULL. * \returns a NULL terminated array of display mode pointers or NULL on - * failure; call SDL_GetError() for more information. + * failure; call SDL_GetError() for more information. This is a + * single allocation that should be freed with SDL_free() when it is + * no longer needed. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDisplays */ -extern SDL_DECLSPEC const SDL_DisplayMode * const * SDLCALL SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count); +extern SDL_DECLSPEC SDL_DisplayMode ** SDLCALL SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count); /** * Get the closest match to the requested display mode. @@ -591,16 +580,17 @@ extern SDL_DECLSPEC const SDL_DisplayMode * const * SDLCALL SDL_GetFullscreenDis * for the desktop refresh rate. * \param include_high_density_modes boolean to include high density modes in * the search. - * \returns a pointer to the closest display mode equal to or larger than the - * desired mode, or NULL on failure; call SDL_GetError() for more - * information. + * \param mode a pointer filled in with the closest display mode equal to or + * larger than the desired mode. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDisplays * \sa SDL_GetFullscreenDisplayModes */ -extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, SDL_bool include_high_density_modes); +extern SDL_DECLSPEC int SDLCALL SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, SDL_bool include_high_density_modes, SDL_DisplayMode *mode); /** * Get information about the desktop's display mode. @@ -773,17 +763,15 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreenMode( /** * Get the raw ICC profile data for the screen the window is currently on. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param window the window to query. * \param size the size of the ICC profile. * \returns the raw ICC profile data on success or NULL on failure; call - * SDL_GetError() for more information. + * SDL_GetError() for more information. This should be freed with + * SDL_free() when it is no longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC const void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size); +extern SDL_DECLSPEC void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size); /** * Get the pixel format associated with the window. @@ -800,17 +788,16 @@ extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetWindowPixelFormat(SDL_Window /** * Get a list of valid windows. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param count a pointer filled in with the number of windows returned, may * be NULL. * \returns a NULL terminated array of SDL_Window pointers or NULL on failure; - * call SDL_GetError() for more information. + * call SDL_GetError() for more information. This is a single + * allocation that should be freed with SDL_free() when it is no + * longer needed. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_Window * const * SDLCALL SDL_GetWindows(int *count); +extern SDL_DECLSPEC SDL_Window ** SDLCALL SDL_GetWindows(int *count); /** * Create a window with the specified dimensions and flags. @@ -1335,9 +1322,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetWindowTitle(SDL_Window *window, const cha /** * Get the title of a window. * - * This returns temporary memory which will be automatically freed later, and - * can be claimed with SDL_ClaimTemporaryMemory(). - * * \param window the window to query. * \returns the title of the window in UTF-8 format or "" if there is no * title. @@ -1351,6 +1335,15 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetWindowTitle(SDL_Window *window); /** * Set the icon for a window. * + * If this function is passed a surface with alternate representations, the + * surface will be interpreted as the content to be used for 100% display + * scale, and the alternate representations will be used for high DPI + * situations. For example, if the original surface is 32x32, then on a 2x + * macOS display or 200% display scale on Windows, a 64x64 version of the + * image will be used, if available. If a matching version of the image isn't + * available, the closest size image will be scaled to the appropriate size + * and be used instead. + * * \param window the window to change. * \param icon an SDL_Surface structure containing the icon for the window. * \returns 0 on success or a negative error code on failure; call @@ -1480,6 +1473,26 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int */ extern SDL_DECLSPEC int SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, int *h); +/** + * Get the safe area for this window. + * + * Some devices have portions of the screen which are partially obscured or + * not interactive, possibly due to on-screen controls, curved edges, camera + * notches, TV overscan, etc. This function provides the area of the window + * which is safe to have interactible content. You should continue rendering + * into the rest of the window, but it should not contain visually important + * or interactible content. + * + * \param window the window to query. + * \param rect a pointer filled in with the client area that is safe for + * interactive content. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 3.0.0. + */ +extern SDL_DECLSPEC int SDLCALL SDL_GetWindowSafeArea(SDL_Window *window, SDL_Rect *rect); + /** * Request that the aspect ratio of a window's client area be set. * @@ -2522,7 +2535,7 @@ extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_GL_GetProcAddress(const char * * \since This function is available since SDL 3.0.0. * - * \sa SDL_GL_GetCurrentEGLDisplay + * \sa SDL_EGL_GetCurrentDisplay */ extern SDL_DECLSPEC SDL_FunctionPointer SDLCALL SDL_EGL_GetProcAddress(const char *proc); @@ -2671,7 +2684,7 @@ extern SDL_DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_EGLDisplay SDLCALL SDL_EGL_GetCurrentEGLDisplay(void); +extern SDL_DECLSPEC SDL_EGLDisplay SDLCALL SDL_EGL_GetCurrentDisplay(void); /** * Get the currently active EGL config. @@ -2681,7 +2694,7 @@ extern SDL_DECLSPEC SDL_EGLDisplay SDLCALL SDL_EGL_GetCurrentEGLDisplay(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_EGLConfig SDLCALL SDL_EGL_GetCurrentEGLConfig(void); +extern SDL_DECLSPEC SDL_EGLConfig SDLCALL SDL_EGL_GetCurrentConfig(void); /** * Get the EGL surface associated with the window. @@ -2692,7 +2705,7 @@ extern SDL_DECLSPEC SDL_EGLConfig SDLCALL SDL_EGL_GetCurrentEGLConfig(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_EGLSurface SDLCALL SDL_EGL_GetWindowEGLSurface(SDL_Window *window); +extern SDL_DECLSPEC SDL_EGLSurface SDLCALL SDL_EGL_GetWindowSurface(SDL_Window *window); /** * Sets the callbacks for defining custom EGLAttrib arrays for EGL @@ -2716,7 +2729,7 @@ extern SDL_DECLSPEC SDL_EGLSurface SDLCALL SDL_EGL_GetWindowEGLSurface(SDL_Windo * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC void SDLCALL SDL_EGL_SetEGLAttributeCallbacks(SDL_EGLAttribArrayCallback platformAttribCallback, +extern SDL_DECLSPEC void SDLCALL SDL_EGL_SetAttributeCallbacks(SDL_EGLAttribArrayCallback platformAttribCallback, SDL_EGLIntArrayCallback surfaceAttribCallback, SDL_EGLIntArrayCallback contextAttribCallback); diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/SDL.cs b/Source/Tools/Flax.Build/Deps/Dependencies/SDL.cs index 71dc3b9de..17a40709c 100644 --- a/Source/Tools/Flax.Build/Deps/Dependencies/SDL.cs +++ b/Source/Tools/Flax.Build/Deps/Dependencies/SDL.cs @@ -88,8 +88,8 @@ namespace Flax.Deps.Dependencies Path.Combine(root, "include", "SDL3"), }; - CloneGitRepoFastSince(root, "https://github.com/libsdl-org/SDL.git", new System.DateTime(2024, 7, 15)); - GitResetToCommit(root, "ff7a60db85f53c249cbd277915452b4c67323765"); + CloneGitRepoFastSince(root, "https://github.com/libsdl-org/SDL.git", new DateTime(2024, 8, 5)); + GitResetToCommit(root, "627cb8acd09e6cbf8362d808634a26f37382c73d"); foreach (var platform in options.Platforms) {