Commit graph

39 commits

Author SHA1 Message Date
Ozkan Sezer 06b305d232 dynapi: cast GetProcAddress() result to void* 2023-02-03 17:40:40 +03:00
Ozkan Sezer 6a52017724 SDL_dynapi.c: add extern "C" guards, just in case.. 2023-01-12 14:01:02 +03:00
Sam Lantinga 0479df53ca Updated copyright for 2023 2023-01-09 09:48:21 -08:00
Ozkan Sezer 0a8f9777a7 SDL_dynapi.c: LoadLibraryA() returns HMODULE. 2022-12-30 11:11:10 +03:00
Sylvain 09ee811f4b Small format changed (using clang-format 15.0.2-1)
(cherry picked from commit 778b8926b4)
2022-12-01 08:29:15 -08:00
Sam Lantinga b8d85c6939 Update for SDL3 coding style (#6717)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.

In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.

The script I ran for the src directory is added as build-scripts/clang-format-src.sh

This fixes:
#6592
#6593
#6594

(cherry picked from commit 5750bcb174)
2022-11-30 12:57:41 -08:00
Ryan C. Gordon 69f0223474
dynapi: Abstract out the environment variable name.
(cherry picked from commit cc487ffb801f862aec7e2b415e74c563c4d528d5)
2022-11-29 14:15:20 -05:00
Ryan C. Gordon 2d7816e358
dynapi: Disable support for API call logging by default.
We can manually enable it if necessary, but it bloats the library to
leave it on just in case.

Fixes #6381.
2022-10-12 09:59:31 -04:00
Ryan C. Gordon 17322e2be6
dynapi: Optionally log every call into the SDL API.
This will only log things going through dynapi, which means it won't
do anything if dynapi is disabled for a given build, but also things
that call the `*_REAL` version of an API won't log either (which is
to say, if an internal piece of SDL calls a public API, it won't log
it, but if an application calls that same entry point, it will).

Since this just inserts a different function pointer, unless you
explicitly request this at runtime, it won't add any overhead, and,
of course, the entire thing can be turned off with a single #define
so it doesn't even add extra unused code to the shared library if
the kill switch is flipped.
2022-10-10 13:17:07 -04:00
chalonverse f317d619cc
Xbox GDKX support (#5869)
* Xbox GDK support (14 squashed commits)

* Added basic keyboard testing

* Update readme

* Code review fixes

* Fixed issue where controller add/removal wasn't working (since the device notification events don't work on Xbox, have to use the joystick thread to poll XInput)
2022-07-01 13:59:14 -07:00
Sam Lantinga 1d1fb95a61 Removed double va_end() 2022-06-28 06:21:45 -07:00
Sylvain f815580dde
Fix SIGSEV in SDL_error. Re-apply same pattern on this uncompiled code (see #5795) 2022-06-28 13:09:38 +02:00
Sam Lantinga cbd0187475 Removed the limit on the size of the SDL error message
Also added SDL_GetOriginalMemoryFunctions()

Fixes https://github.com/libsdl-org/SDL/issues/5795
2022-06-27 16:59:50 -07:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Cameron Cawley 25a614bc3e Add SDL_asprintf and SDL_vasprintf 2021-09-22 11:53:46 -07:00
Sam Lantinga 432ee7d8ad Fixed building SDL_dynapi.c without stdio support 2021-09-22 09:29:21 -07:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Sam Lantinga a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Sylvain Becker 3d100df36f Readability: remove const-qualifation from function declaration
const-qualification of parameters only has an effect in function definitions
2019-10-30 15:43:49 +01:00
Ryan C. Gordon ec04110d8e dynapi: Deal with failure cases better, other fixes.
Fixes Bugzilla #4803.
2019-10-14 12:41:06 -04:00
Ozkan Sezer ceee7def84 minor build fixes. 2019-07-31 00:05:28 +03:00
Sam Lantinga 5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Ozkan Sezer cbacb0f1ea add missing include. 2018-10-14 23:50:50 +03:00
Ryan C. Gordon e2619f1dcf dynapi: don't let system loader resolve the initializer to the wrong version.
Fixes problems launching Firewatch on Linux (which statically links SDL but
also dynamically loads a system-wide copy from a plugin shared library) with
a newer SDL build.
2018-05-17 12:50:46 -04:00
sezero 40b27fd51b revert the recent typecast assignment changes (see bug #4079)
also change the void* typedefs for the two vulkan function
pointers added in vulkan_internal.h  into generic function
pointer typedefs.
2018-02-12 17:00:00 +03:00
Sam Lantinga 90e72bf4e2 Fixed ISO C99 compatibility
SDL now builds with gcc 7.2 with the following command line options:
-Wall -pedantic-errors -Wno-deprecated-declarations -Wno-overlength-strings --std=c99
2018-01-30 18:08:34 -08:00
Sam Lantinga e3cc5b2c6b Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga 37ce9f2773 Fixed typedef redefinition errors when including both SDL_vulkan.h and vulkan.h
You should always include vulkan/vulkan.h first, then include SDL_vulkan.h
2017-08-27 23:13:15 -07:00
Sam Lantinga b7c5d15152 SDL_dynapi.c: add missing SDLCALL to macros. 2017-08-27 18:53:30 -07:00
Sam Lantinga a38f127e88 Swapped conditional arguments for standard SDL readability 2017-08-27 18:52:43 -07:00
Ryan C. Gordon 8c39d1d0b5 OS/2: fixed inverted logic bug (thanks, Ozkan!). 2017-08-25 12:27:18 -04:00
Ryan C. Gordon 2213077a95 OS/2: proper fix for dynapi (thanks, Ozkan!). 2017-08-25 11:31:12 -04:00
Ryan C. Gordon a3890ff6d7 dynapi: fill in OS/2 loading code (thanks, Ozkan!).
Partially fixes Bugzilla #3765.
2017-08-22 15:50:39 -04:00
Ryan C. Gordon 22241ed0b0 Support for QNX 7.0 (thanks, Elad!).
Fixes Bugzilla #3686.
2017-07-01 17:50:47 -04:00
Sam Lantinga 45b774e3f7 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga 9a8642bd6a Fixed bug 3478 - Patch Haiku to use dlopen instead of load_add_on
Kai Sterker

SDL2 on Haiku so far uses Haiku-specific APIs for loading dynamic objects as add-ons, instead of using dlopen to load them as libraries. This, for example, leads to SDL_mixer not being able to load its audio backends, when compiled with standard settings.

As discussed at https://www.freelists.org/post/haikuports/SDL2-mixer-ogg-music-not-playing-and-other-stuff,2 , the best way to deal with this would be using dlopen instead of load_add_on. The following patch implements this change by dropping the Haiku-specific bits and using dlopen instead.
2016-11-01 10:30:46 -07:00
Ryan C. Gordon fa8c83c1c1 Remove almost all instances of "volatile" keyword.
As Tiffany pointed out in Bugzilla, volatile is not useful for thread safety:

https://software.intel.com/en-us/blogs/2007/11/30/volatile-almost-useless-for-multi-threaded-programming/

Some of these volatiles didn't need to be, some were otherwise protected by
spinlocks or mutexes, and some got moved over to SDL_atomic_t data, etc.

Fixes Bugzilla #3220.
2016-01-03 06:50:50 -05:00
Sam Lantinga 42065e785d Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Philipp Wiesemann 0e45984fa0 Fixed crash if initialization of EGL failed but was tried again later.
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().
2015-06-21 17:33:46 +02:00