Commit Graph

1311 Commits (bed6c5b81fea2ce87059237f2a292e0b970e4eb2)

Author SHA1 Message Date
Sam Lantinga b374105975 Replaced SDL_GetTextureDXGIResource() with texture properties
Fixes https://github.com/libsdl-org/SDL/issues/8529
2023-11-10 20:38:13 -08:00
Sam Lantinga a5a47d3bee Fixed crash if there is no controller mapping 2023-11-10 16:39:32 -08:00
Sam Lantinga 2991b9f6ac SDL now represents gamepad buttons as positional elements with a separate label
This gives applications and binding systems a clearer view of what the hardware is so they can make intelligent decisions about how to present things to the user.

Gamepad mappings continue to use abxy for the face buttons for simplicity and compatibility with earlier versions of SDL, however the "SDL_GAMECONTROLLER_USE_BUTTON_LABELS" hint no longer has any effect.

Fixes https://github.com/libsdl-org/SDL/issues/6117
2023-11-10 12:21:43 -08:00
Sylvain d8600f717e Pointer as bool (libsdl-org#7214) 2023-11-09 14:18:36 -08:00
Sylvain 59f93e20a7 Add SDL Video Capture, with back-end for linux/macos/ios/android 2023-11-09 08:36:23 -08:00
Anonymous Maarten a6541166bc cmake: also install pdb files of static libraries 2023-11-09 02:17:07 +01:00
Sam Lantinga 1934417b4d Show the existing mapping when a controller is connected 2023-11-08 12:38:54 -08:00
Sam Lantinga fd4a2cce9e SDL_syswm.h has been removed and replaced with window properties 2023-11-08 12:01:48 -08:00
Sam Lantinga aea6e6de6f Simplified SDL_SetProperty() and added SDL_SetPropertyWithCleanup()
Most of the time people won't need to set a cleanup callback, so we can simplify the more commonly used API.
2023-11-08 12:01:48 -08:00
Sam Lantinga a1941fad6c Replaced SDL_RenderGetD3D11Device(), SDL_RenderGetD3D12Device(), and SDL_RenderGetD3D9Device() with renderer properties. 2023-11-08 12:01:48 -08:00
Ryan C. Gordon 2f92807087
vulkan: SDL_Vulkan_CreateSurface now accepts an app-provided allocator.
Fixes #3638.
2023-11-06 13:31:20 -05:00
Ryan C. Gordon c53843a961
docs: Remove Doxygen `\brief` tags.
Doxygen and the wiki bridge don't need them; they'll both just use the first
line/sentence instead.

Fixes #8446.
2023-11-06 10:26:06 -05:00
Sam Lantinga f7d40b7594 Added 10-bit pixel formats in addition to SDL_PIXELFORMAT_ARGB2101010
Added SDL_PIXELFORMAT_XRGB2101010, SDL_PIXELFORMAT_XBGR2101010, SDL_PIXELFORMAT_ABGR2101010

Fixes https://github.com/libsdl-org/SDL/issues/3553
2023-11-06 00:41:09 -08:00
Frank Praznik 21ff699251 test: Fix popup test crash on exit
If the done signal is emitted by the common event handler, the window and all of its children have already been destroyed, so don't try to render with invalid renderer objects.
2023-11-05 12:29:22 -05:00
Sam Lantinga 70c149c88f Automatically clean up memory associated with events 2023-11-05 09:14:11 -08:00
Sam Lantinga 75ea3a8d32 Dynamically allocate long text for SDL_EVENT_TEXT_INPUT events
This prevents input text from being split across Unicode combining or modifier characters, and in practice allocations will rarely happen.
2023-11-04 20:55:10 -07:00
Sam Lantinga f9d11807c0 Added SDL_RWprintf() and SDL_RWvprintf() to do formatted printing to an SDL_rwops stream
Fixes https://github.com/libsdl-org/SDL/issues/2390
2023-11-04 16:46:08 -07:00
Sam Lantinga 7e445da569 Added SDL_CleanupEvent()
This is used to free any dynamically allocated memory in events.
2023-11-04 06:47:24 -07:00
Ivan Mogilko c4bf05fd9d Added subsystem refcount tests to testautomation 2023-11-04 00:52:08 -07:00
Sam Lantinga f3261fedcc Code cleanup now that SDL_bool is equivalent to a C boolean expression 2023-11-03 09:54:04 -07:00
ilyas-taouaou d0d8b28df1 Change SDL_Vulkan_GetInstanceExtensions 2023-11-02 14:27:36 -04:00
Ryan C. Gordon 9c664b0062
main: Added _optional_ callback entry points.
This lets apps optionally have a handful of callbacks for their entry points instead of a single main function. If used, the actual main/SDL_main/whatever entry point will be implemented in the single-header library SDL_main.h and the app will implement four separate functions:

First:

    int SDL_AppInit(int argc, char **argv);

This will be called once before anything else. argc/argv work like they always do. If this returns 0, the app runs. If it returns < 0, the app calls SDL_AppQuit and terminates with an exit code that reports an error to the platform. If it returns > 0, the app calls SDL_AppQuit and terminates with an exit code that reports success to the platform. This function should not go into an infinite mainloop; it should do any one-time startup it requires and then return.

Then:

     int SDL_AppIterate(void);

This is called over and over, possibly at the refresh rate of the display or some other metric that the platform dictates. This is where the heart of your app runs. It should return as quickly as reasonably possible, but it's not a "run one memcpy and that's all the time you have" sort of thing. The app should do any game updates, and render a frame of video. If it returns < 0, SDL will call SDL_AppQuit and terminate the process with an exit code that reports an error to the platform. If it returns > 0, the app calls SDL_AppQuit and terminates with an exit code that reports success to the platform. If it returns 0, then SDL_AppIterate will be called again at some regular frequency. The platform may choose to run this more or less (perhaps less in the background, etc), or it might just call this function in a loop as fast as possible. You do not check the event queue in this function (SDL_AppEvent exists for that).

Next:

    int SDL_AppEvent(const SDL_Event *event);

This will be called once for each event pushed into the SDL queue. This may be called from any thread, and possibly in parallel to SDL_AppIterate. The fields in event do not need to be free'd (as you would normally need to do for SDL_EVENT_DROP_FILE, etc), and your app should not call SDL_PollEvent, SDL_PumpEvent, etc, as SDL will manage this for you. Return values are the same as from SDL_AppIterate(), so you can terminate in response to SDL_EVENT_QUIT, etc.

Finally:

    void SDL_AppQuit(void);

This is called once before terminating the app--assuming the app isn't being forcibly killed or crashed--as a last chance to clean up. After this returns, SDL will call SDL_Quit so the app doesn't have to (but it's safe for the app to call it, too). Process termination proceeds as if the app returned normally from main(), so atexit handles will run, if your platform supports that.

The app does not implement SDL_main if using this. To turn this on, define SDL_MAIN_USE_CALLBACKS before including SDL_main.h. Defines like SDL_MAIN_HANDLED and SDL_MAIN_NOIMPL are also respected for callbacks, if the app wants to do some sort of magic main implementation thing.

In theory, on most platforms these can be implemented in the app itself, but this saves some #ifdefs in the app and lets everyone struggle less against some platforms, and might be more efficient in the long run, too.

On some platforms, it's possible this is the only reasonable way to go, but we haven't actually hit one that 100% requires it yet (but we will, if we want to write a RetroArch backend, for example).

Using the callback entry points works on every platform, because on platforms that don't require them, we can fake them with a simple loop in an internal implementation of the usual SDL_main.

The primary way we expect people to write SDL apps is with SDL_main, and this is not intended to replace it. If the app chooses to use this, it just removes some platform-specific details they might have to otherwise manage, and maybe removes a barrier to entry on some future platform.

Fixes #6785.
Reference PR #8247.
2023-11-01 18:40:41 -04:00
Ryan C. Gordon dcc8805c21
testaudio: Fixed compiler warning on Visual Studio. 2023-10-30 13:09:56 -04:00
Ryan C. Gordon 899eb0d042 thread: Locking mutexes and rwlocks are now void functions.
Almost nothing checks these return values, and there's no reason a valid
lock should fail to operate. The cases where a lock isn't valid (it's a
bogus pointer, it was previously destroyed, a thread is unlocking a lock it
doesn't own, etc) are undefined behavior and always were, and should be
treated as an application bug.

Reference Issue #8096.
2023-10-26 08:57:34 -04:00
Sam Lantinga 39a961ba41 Added support for "%[]" sscanf syntax
Fixes https://github.com/libsdl-org/SDL/issues/8423
2023-10-24 17:28:15 -07:00
Ryan C. Gordon c6f08c2553
testaudio: Removed debugging code. 2023-10-16 15:25:34 -04:00
Ryan C. Gordon d5dac0ad27
testaudio: Deal with a texture being unexpectedly NULL when scaling.
This happens to work because our current textures are all 128x128, but in
theory one shouldn't hit this case anyhow...right?!

Reference Issue #8344.
2023-10-16 14:03:58 -04:00
Ryan C. Gordon b19e68c8ec
testaudio: Properly display playback progress, regardless of data source. 2023-10-16 13:56:43 -04:00
Ryan C. Gordon 354611a0c6
testaudio: Fixed some bugs Valgrind pointed out. 2023-10-16 10:04:02 -04:00
Ryan C. Gordon 1c6d996108
testaudio: if the SDL_Renderer is already gone, don't destroy SDL_Textures. 2023-10-14 23:17:59 -04:00
Ryan C. Gordon b17151eb16
testaudio: Don't crash if renderer is NULL (happens during shutdown). 2023-10-14 13:43:22 -04:00
Anonymous Maarten 382751c4b5 testffmpeg: print usage of options to change audio/video codec 2023-10-13 02:30:14 +02:00
Sam Lantinga f91bde64d5 testffmpeg: Only enable blending if we're using a texture format that supports it 2023-10-12 14:26:46 -07:00
Sam Lantinga 516d6f9efc testffmpeg: added support for YUVA formats using swscale
Fixes https://github.com/libsdl-org/SDL/issues/8377
2023-10-12 14:10:25 -07:00
Sam Lantinga d18f910248 testffmpeg: added the ability to specify audio and video codecs 2023-10-12 11:38:14 -07:00
Sam Lantinga bf64fecf19 testffmpeg: allow resizing of the video window 2023-10-12 00:04:00 -07:00
Sam Lantinga efa9a45048 Clarified that testffmpeg will resize the window to the video size 2023-10-11 23:38:08 -07:00
Sam Lantinga 4368f70ff9 Added properties to various SDL objects
The following objects now have properties that can be user modified:
* SDL_AudioStream
* SDL_Gamepad
* SDL_Joystick
* SDL_RWops
* SDL_Renderer
* SDL_Sensor
* SDL_Surface
* SDL_Texture
* SDL_Window
2023-10-11 22:38:00 -07:00
Sam Lantinga 973c8b3273 Added SDL properties API
Fixes https://github.com/libsdl-org/SDL/issues/7799
2023-10-11 22:38:00 -07:00
Anonymous Maarten 1ae33f6751 cmake: optionally install pdb's 2023-10-12 02:26:48 +02:00
Sam Lantinga c552cc6847 We don't require the audio system to be initialized for audio format conversion
This is helpful for tools pipelines where audio devices are never used.
2023-10-11 09:23:23 -07:00
Ryan C. Gordon bb2f767f5d
testaudio: Make program usable without a 3-button mouse. 2023-10-11 10:02:07 -04:00
Anonymous Maarten ebfbd7327b testffmpeg: use SDL_test to parse arguments and track memory 2023-10-10 21:58:10 +02:00
Anonymous Maarten ee53e4d319 cmake: check ffmpeg capability instead of version 2023-10-10 21:58:10 +02:00
Sam Lantinga adcace6f95 Added a "--software" option to testffmpeg
This allows easy performance comparison between hardware and software decoding
2023-10-10 04:07:22 -07:00
Ozkan Sezer 86ada8a9f0 fix testffmpeg.c build. 2023-10-10 14:02:40 +03:00
Sam Lantinga 303f4e965c testffmpeg works with ffmpeg 5.1.3 and newer 2023-10-10 03:58:57 -07:00
Sam Lantinga 2bd478ae65 Added SDL_GetTextureDXGIResource() to get the DXGI resource associated with a render texture.
Also switched the D3D11 and D3D12 renderers to use real NV12 textures for NV12 data.

The combination of these two changes allows us to implement 0-copy video decode and playback for D3D11 in testffmpeg without any access to the renderer internals.
2023-10-10 03:32:46 -07:00
Sam Lantinga a842446f62 Added support for 0-copy decode and display using D3D11
FIXME: We need a way to do this that doesn't involve reaching into the D3D11 texture internals
2023-10-10 03:32:46 -07:00
Sam Lantinga d830cd140b Added support for 0-copy decode and display using Apple VideoToolbox 2023-10-10 03:32:46 -07:00
Sam Lantinga 1bf913b29a Added support for 0-copy decode and display using VAAPI and EGL 2023-10-10 03:32:46 -07:00
Sam Lantinga ce8161e0cf Make sure we're building with ffmpeg 6.0 or newer 2023-10-10 03:32:46 -07:00
Sam Lantinga ed6381b68d Allow setting any number of sprites over the video
Default to no sprites over the video
2023-10-10 03:32:46 -07:00
Anonymous Maarten ebf5e08fa1 cmake: use *_STATIC_* variables when linking to a static ffmpeg 2023-10-10 03:32:46 -07:00
Sam Lantinga 88f2fb9dcf Added an example of video decoding with ffmpeg 2023-10-10 03:32:46 -07:00
Simon McVittie 04edb38cdf shape: Use SDL[Test]_ReadSurfacePixel
This avoids assuming that the pixels are suitably aligned for direct
access, which there's no guarantee that they are; in particular,
3-bytes-per-pixel RGB images are likely to have 3 out of 4 pixels
misaligned. On x86, dereferencing a misaligned pointer does what you
would expect, but on other architectures it's undefined whether it will
work, crash with SIGBUS, or silently give a wrong answer.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-10-10 03:23:20 -07:00
Anonymous Maarten 183606d3d4 testdrawchessboard: clean up renderer and window 2023-10-05 13:41:01 +02:00
Frank Praznik 64ec208479 Fix log message spelling 2023-10-02 19:47:39 -04:00
Frank Praznik 9111c5e178 tests: Disable mouse warp test under Wayland
Wayland does not allow warping the mouse pointer, thus these tests are unreliable and should be skipped.
2023-10-02 19:44:02 -04:00
Simon McVittie 6248472c0c test: Accept small numerical differences in more mathematical tests
We can't rely on irrational numbers like pi being represented exactly,
particularly when compiling for i386, where the i387 floating-point
interface carries out calculations in registers that have higher
precision than the actual double-precision variable. The 1980s were a
strange time.

Resolves: https://github.com/libsdl-org/SDL/issues/8311
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-09-28 09:37:12 -07:00
Anonymous Maarten f5886f11d0 cmake: let every test depends on pretest 2023-09-25 18:02:40 +02:00
Anonymous Maarten f45761908a Move check for SDL_Delay upper bounds to testtimer 2023-09-25 18:02:40 +02:00
Anonymous Maarten 474c8d0073 testautomation: don't do float equality tests 2023-09-25 18:02:40 +02:00
Anonymous Maarten 85e3099ba4 testautomation: only require accelated renderer with non-dummy video driver 2023-09-25 18:02:40 +02:00
Anonymous Maarten 0e955a9127 cmake: run testautomation with CTest 2023-09-25 18:02:40 +02:00
Ryan C. Gordon e0b0f9a36e
testaudio: Fix mouseover testing.
Not sure how this line got lost.
2023-09-20 17:02:44 -04:00
Ryan C. Gordon b656720bc6 loopwave: Use SDL_GetAudioStreamQueued() for more accurate results. 2023-09-20 10:15:03 -04:00
Anonymous Maarten 4c3e84897f testspriteminimal: make standalone by embedding icon.bmp 2023-09-19 17:58:25 +02:00
Anonymous Maarten 2a01f9dcb5 tests: plug leaks when running with --trackmem
(using SDL_VIDEO_DRIVER=x11/wayland on Linux)
2023-09-19 17:58:25 +02:00
Brick a62e62f97a Refactored SDL_audiocvt.c 2023-09-17 13:13:23 -07:00
Ryan C. Gordon 2f43f7bc53
audio: Allow querying of device buffer size. 2023-09-13 11:03:17 -04:00
Ryan C. Gordon 8b26e95f91
audio: Change SDL_AudioStreamCallback
Now it offers the total requested bytes in addition to the amount
immediately needed (and immediately needed might be zero if the stream
already has enough queued to satisfy the request.
2023-09-13 10:11:23 -04:00
Sam Lantinga cd633b9a88 Renamed SDL_IsAudioDevicePaused() to SDL_AudioDevicePaused()
This aligns with the SDL3 convention of removing "Is" from self-explanatory function names

Also improved some documentation in SDL_audio.h
2023-09-12 12:11:09 -07:00
Ryan C. Gordon 3a992af446 audio: Added a postmix callback to logical devices.
You can see it in action in testaudio by mousing over a logical device; it
will show a visualizer for the current PCM (whatever is currently being
recorded on a capture device, or whatever is being mixed for output on
playback devices).

Fixes #8122.
2023-09-09 16:26:37 -04:00
Anonymous Maarten a2e17852d9 cmake: make sure SDL_GetPrefPath is run before testfilesystem
60 seconds timeout ought to be sufficient.
2023-09-08 09:05:58 -04:00
Ryan C. Gordon ad1313e751
testaudio: Patched to compile.
(this was a piece of PR #8213 that accidentally creeped into main.)
2023-09-07 16:03:49 -04:00
Ryan C. Gordon 5747ddc012
testaudio: Clean up some messy memory management. 2023-09-07 10:50:11 -04:00
Brick f2ca9a615b Added SDL_AUDIO_FRAMESIZE 2023-09-05 17:56:58 -07:00
Brick 53122593f8 Added SDL_AUDIO_BYTESIZE 2023-09-05 17:56:58 -07:00
Sam Lantinga 3a932141e4 Restore audio format binary compatibility with SDL 2.0 2023-09-04 10:16:53 -07:00
Sam Lantinga 233789b0d1 Audio types have the same naming convention as other SDL endian types, e.g. [S|U][BITS][LE|BE]
Native endian types have no LE/BE suffix
2023-09-04 09:48:44 -07:00
Brick 0e552761b7 Renamed AudioStreamSpeed to AudioStreamFrequencyRatio 2023-09-04 07:46:18 -07:00
Brick 47bcb078f5 Fixed some incorrect SDL_AUDIO_F32 uses 2023-09-04 07:46:18 -07:00
Brick 2833f2e7b5 Fixed OOB access in audio_convertAccuracy test 2023-09-04 07:46:18 -07:00
Brick 28b28bd8f4 Added audio_formatChange test 2023-09-01 14:38:45 -04:00
Brick 5394a805f4 Improved testaudiostreamdynamicresample
Tweaked color palette
2023-09-01 14:38:45 -04:00
Anonymous Maarten 1b03a2430a testsurround: fix order of arguments of callback 2023-08-28 00:12:59 +02:00
Ryan C. Gordon 58c859f64d audio: Rename SDL_GetAudioStreamBinding to SDL_GetAudioStreamDevice. 2023-08-27 16:54:30 -04:00
Ryan C. Gordon 1e775e0eef audio: Replace SDL_CreateAndBindAudioStream with SDL_OpenAudioDeviceStream.
This is meant to offer a simplified API for people that are either migrating
directly from SDL2 with minimal effort or just want to make noise without
any of the fancy new API features.

Users of this API can just deal with a single SDL_AudioStream as their only
object/handle into the audio subsystem.

They are still allowed to open multiple devices (or open the same device
multiple times), but cannot change stream bindings on logical devices opened
through this function.

Destroying the single audio stream will also close the logical device behind
the scenes.
2023-08-27 16:54:30 -04:00
Brick ea68bb8027 Add some additional checks to audio_convertAudio 2023-08-27 13:08:15 -07:00
Brick b1d63be538 Fixed audio_resampleLoss test 2023-08-27 13:08:15 -07:00
Sam Lantinga 34860b932b Fixed testautomation --filter pixels_allocFreeFormat 2023-08-25 08:06:08 -07:00
Brick 958b3cfaea Tweaked and enabled audio_convertAudio test 2023-08-25 08:43:56 -04:00
Brick 7dbb9b65b1 audio_convertAccuracy: Shuffle the data in case of a bad SIMD implementation 2023-08-25 08:43:56 -04:00
Brick f6a4080ff5 audio_resampleLoss: Add support for multiple channels 2023-08-25 08:43:56 -04:00
Brick 4f894e748e audio_resampleLoss: SDL_GetAudioStreamData now returns the correct length 2023-08-25 08:43:56 -04:00
Brick e6c878824c Fixed ResampleAudio interpolation factor calculation 2023-08-22 08:34:22 -04:00
Brick 4983638630 Misc audio tweaks/cleanup 2023-08-21 16:02:54 -04:00
Brick d2b9c8b80d Fixed maths in testaudiostreamdynamicresample (and just show the actual scale) 2023-08-21 16:02:54 -04:00
Brick b9541b9eab Improved ResampleAudio
* filterindex2 was off-by-one
* Generate ResamplerFilter using doubles
* Transpose ResamplerFilter to improve access patterns
2023-08-21 16:02:54 -04:00
Brick cdaa19869d Track offset within the current sample when resampling 2023-08-21 16:02:54 -04:00
Brick 300d1ec3ed Added audio_convertAccuracy test 2023-08-14 15:07:18 -04:00
Brick 32cecc2eac Fixed assertion in audio_convertAudio 2023-08-14 15:07:18 -04:00
Anonymous Maarten 6607a3cfac Disable cache in python http server
Co-authored-by: Érico Porto <ericoporto2008@gmail.com>
2023-08-14 03:50:06 +02:00
Anonymous Maarten a5d9db0cd0 cmake: build tests for UWP 2023-08-12 17:37:52 +02:00
Anonymous Maarten ea8757a748 Make testaudiostreamdynamicresample compatible with emscripten 2023-08-12 17:37:20 +02:00
Anonymous Maarten 1a7a74fb2e cmake: build emscripten tests as html page 2023-08-12 17:37:20 +02:00
Anonymous Maarten 64d570f027 Add minimal http server for emscripten test apps 2023-08-12 17:37:20 +02:00
Ryan C. Gordon f290c85b22
testaudiocapture: Make sure we convert captured audio to output format.
Fixes #8114.
2023-08-11 16:52:23 -04:00
Simon McVittie efe15588d5 Relabel back paddles as left or right
The sequence order of the four paddles is not obvious, with SDL and Xbox
controllers swapping the order of P2 and P3 relative to each other.
If we group them into left and right, then it becomes more obvious.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-09 11:03:30 -07:00
Ryan C. Gordon 1022fd6e04
testaudio: the test framework opens an audio device at startup; close it.
Not opening a device at all would be more desirable, though.
2023-08-08 21:42:48 -04:00
Simon McVittie 55cf1abaa6 test: Don't flag testsurround as suitable for non-interactive use
According to #8088 it has no value as an automated test, and by
default it takes long enough to hit the default test timeout.

Resolves: #8088
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-08 08:45:57 -07:00
Sam Lantinga b903ccf945 SDL_rwops read/write functions return size_t again
The current status is stored in the SDL_rwops 'status' field to be able to determine whether a 0 return value is caused by end of file, an error, or a non-blocking source not being ready.

The functions to read sized datatypes now return SDL_bool so you can detect read errors.

Fixes https://github.com/libsdl-org/SDL/issues/6729
2023-08-07 20:36:21 -07:00
Brick c03f5b4b69 Fixed rounding up in SDL_PrintFloat
This wasn't caught by the 9.9999999 case, because that value is actually just equal to 10.0
2023-08-07 14:15:19 -07:00
Ryan C. Gordon e7d56dd0b2
audio: Renamed new API SDL_UnpauseAudioDevice to SDL_ResumeAudioDevice. 2023-08-05 19:20:14 -04:00
Ryan C. Gordon be5f66c84e
testaudio: Fixed soundboard icon, which had a colorkey issue. 2023-08-03 21:35:38 -04:00
Ryan C. Gordon 5ca3c50bf0
testaudio: Fix compiler warning. 2023-08-02 15:23:37 -04:00
Ryan C. Gordon 1b1f02c5aa
testaudio: Apparently compilers don't like this possibly being NULL now...? 2023-08-02 15:07:40 -04:00
Ryan C. Gordon 2de9253b6c
test: Added testaudio 2023-08-02 15:02:32 -04:00
Ryan C. Gordon 0eda582160
testaudiostreamdynamicresample: Load sample.wav correctly. 2023-07-30 23:00:52 -04:00
Ryan C. Gordon b0edd23c00
testsurround: Log available audio output devices at the start. 2023-07-30 11:57:30 -04:00
Ryan C. Gordon 54af687210
testautomation_audio.c: Patched to compile. :/ 2023-07-30 11:56:40 -04:00
Ryan C. Gordon 5e82090662
testautomation_audio.c: Apparently we aren't updating test code for C99 atm. 2023-07-30 11:56:40 -04:00
Ryan C. Gordon 66bcee2ca9
testaudiostreamdynamicresample.c: Fixed MSVC compiler warning. 2023-07-30 11:56:38 -04:00
Ryan C. Gordon c58d95c343
wasapi: Reworked for new SDL3 audio API, other win32 fixes.
The WinRT code has _also_ be updated, but it has not been
tested or compiled, yet.
2023-07-30 11:56:35 -04:00
Ryan C. Gordon 00ed6f8827
test: Fixed compiler warnings for unused vars. 2023-07-30 11:56:08 -04:00
Ryan C. Gordon 11dfc4d737
test: Update testautomation_audio for SDL3 audio API. 2023-07-30 11:56:00 -04:00
Ryan C. Gordon 29afc2e42b
test: Update testresample for SDL3 audio API. 2023-07-30 11:56:00 -04:00
Ryan C. Gordon 3a02eecced
test: Update testsurround for SDL3 audio API. 2023-07-30 11:56:00 -04:00
Ryan C. Gordon e1c78718d4
test: testaudiocapture is updated for the SDL3 audio API. 2023-07-30 11:56:00 -04:00
Ryan C. Gordon bb1cbbd33a
test: Update testaudioinfo for SDL3 audio API. 2023-07-30 11:55:58 -04:00
Ryan C. Gordon 5d4e9e5f80
test: Updated testaudiostreamdynamicresample to SDL3 audio API. 2023-07-30 11:55:58 -04:00
Ryan C. Gordon f883b9fc64
test: Updated testaudiohotplug to SDL3 audio API. 2023-07-30 11:55:57 -04:00
Ryan C. Gordon 47b0321ebf
test: Removed loopwavequeue.c; obsolete in SDL3. 2023-07-30 11:55:57 -04:00
Ryan C. Gordon f598626e46
test: loopwave shouldn't use an audiostream callback. 2023-07-30 11:55:56 -04:00
Ryan C. Gordon b03c493fc4
test: Updated testmultiaudio to new SDL3 audio API 2023-07-30 11:55:56 -04:00
Ryan C. Gordon fe1daf6fb5
audio: Mark disconnected default devices as "zombies".
Zombie devices just sit there doing nothing until a new default device
is chosen, and then they migrate all their logical devices before being
destroyed.

This lets the system deal with the likely outcome of a USB headset being
the default audio device, and when its cable is yanked out, the backend
will likely announce this _before_ it chooses a new default (or, perhaps,
the only device in the system got yanked out and there _isn't_ a new
default to be had until the user plugs the cable back in).

This lets the audio device hold on without disturbing the app until it can
seamlessly migrate audio, and it also means the backend does not have to
be careful in how it announces device events, since SDL will manage the
time between a device loss and its replacement.

Note that this _only_ applies to things opened as the default device
(SDL_AUDIO_DEVICE_DEFAULT_OUTPUT, etc). If those USB headphones are the
default, and one SDL_OpenAudioDevice() call asked for them specifically and
the other just said "give me the system default," the explicitly requested
open will get a device-lost notification immediately. The other open will
live on as a zombie until it can migrate to the new default.

This drops the complexity of the PulseAudio hotplug thread dramatically,
back to what it was previously, since it no longer needs to fight against
Pulse's asychronous nature, but just report device disconnects and new
default choices as they arrive.

loopwave has been updated to not check for device removals anymore; since
it opens the default device, this is now managed for it; it no longer
needs to close and reopen a device, and as far as it knows, the device
is never lost in the first place.
2023-07-30 11:55:56 -04:00
Ryan C. Gordon ee10bab3cd
audio: An enormous amount of work on managing default devices. 2023-07-30 11:55:55 -04:00
Ryan C. Gordon 26525f5fd3
audio: Readd SDL_AudioSpec, but just with format/channels/freq fields. 2023-07-30 11:55:52 -04:00
Ryan C. Gordon 56b1bc2198
audio: SDL_AudioStream now has callbacks for Get and Put operations.
This allows code to feed a stream (or feed from a stream) on-demand,
which is to say: it can efficiently simulate the SDL2 audio callback.
2023-07-30 11:55:51 -04:00
Ryan C. Gordon 905c4fff5b
audio: First shot at the SDL3 audio subsystem redesign!
This is a work in progress! (and this commit will probably get
force-pushed over at some point).
2023-07-30 11:55:51 -04:00
Ozkan Sezer d3f2de7f29 fixed typo in prev. patch. 2023-07-28 07:35:04 +03:00
Ozkan Sezer 12b35c6a46 test/testnativecocoa.m: fixed deprecation warnings. 2023-07-28 07:20:50 +03:00
Frank Praznik f8e8dff7ee tests: Fix automated window grab and positioning tests under Wayland/XWayland
When using the Wayland video driver or X11 under XWayland, create a renderer and present a frame as part of window creation, as Wayland requires that a frame be presented for the window to be fully mapped and displayed onscreen. This fixes the grab and expected window size tests.

This also disables the window positioning tests when running under the Wayland driver, as Wayland does not allow application windows to position themselves in the desktop space, which renders the tests unreliable and subject to spurious failure.
2023-07-26 10:08:27 -04:00
Sam Lantinga b8d91252c6 Fixed automation tests using the dummy video driver 2023-07-25 11:48:10 -07:00
Sam Lantinga 8adab0b88a Removed invalid assert in testatomic 2023-07-22 18:39:39 -07:00
Anonymous Maarten 3ab4665956 cmake: bump minimum required CMake version to 3.16
main features:

- No more sdl-build-options/sdl-shared-build-options/sdl-global-options
- Dependency information is stored on SDL3-collector for sdl3.pc
- Use helper functions to modify the SDL targets;
    - sdl_sources to add sources
    - sdl_glob_sources to add glob soruces
    - sdl_link_dependency to add a link dependency that might also
      appear in sdl3.pc/SDL3Config.cmake
    - sdl_compile_definitions to add macro's
    - sdl_compile_options for compile options
    - sdl_include_directories for include directories
  They avoid repeated checks for existence of the SDL targets
- A nice feature of the previous is the ability to generate
  a sdl3.pc or SDL3Config.cmake that describes its dependencies
  accurately.

various:

- remove duplicate libc symbol list
- add CheckVulkan
- remove unused HAVE_MPROTECT
- add checks for getpagesize
2023-07-20 17:58:06 +02:00
Anonymous Maarten a4bb4eef73 cmake: create Android jars + apks for tests 2023-07-20 16:54:29 +02:00
Sam Lantinga 58882425fc Use the lower index axis if the controller generates two axes for a single element
The Flydigi Apex and Vader controllers fire both axis 4 and 5 for the right thumbstick Y axis, for example.
2023-07-19 09:48:32 -07:00
Sam Lantinga 255f297439 Fixed crash if SetMappingValue() is passed a NULL key 2023-07-19 09:23:08 -07:00
Sam Lantinga 732218c222 Changed binding order to match Steam 2023-07-18 22:04:55 -07:00
Sam Lantinga 53882a2ed2 Map the buttons in ABXY order 2023-07-18 17:36:40 -07:00
Anonymous Maarten b1a0bc3fb0 testlocale: only ininitialize video when needed 2023-07-19 00:14:38 +02:00
Anonymous Maarten e620925728 testlocale: don't pass SDL_INIT_VIDEO to SDL_Init 2023-07-18 22:48:14 +02:00
Frank Praznik ef4ce8cec5 test: Add flag to suspend drawing when occluded
Add the flag "--suspend-when-occluded" to testgl, testgles2, and testsprite, which, when used, will suspend rendering and throttle the event loop when the occlusion flag is set on the window.
2023-07-18 16:42:05 -04:00
Sam Lantinga 9db2cb3513 Added SDL_ReloadGamepadMappings() to reset the SDL gamepad mappings 2023-07-18 12:50:10 -07:00
Sam Lantinga dfc6e8825e Improved reliability of gamepad message ordering
The gamepad vs joystick events always happen in this order:
SDL_EVENT_JOYSTICK_ADDED
SDL_EVENT_GAMEPAD_ADDED
SDL_EVENT_GAMEPAD_REMAPPED
SDL_EVENT_GAMEPAD_REMOVED
SDL_EVENT_JOYSTICK_REMOVED

Whenever a mapping is changed, any controller affected by that mapping will generate a gamepad event. You will only get one SDL_EVENT_GAMEPAD_REMAPPED event per controller per batch of mapping changes, where SDL_AddGamepadMappingsFromFile() and SDL_AddGamepadMapping() are each a batch of changes.
2023-07-18 11:52:56 -07:00
Sam Lantinga 0a4e6f6d29 Added SDL_strnlen() and SDL_wcsnlen() 2023-07-17 19:37:51 -07:00
Sam Lantinga eb8b5ed3a4 Fixed crash when the joystick can't be opened 2023-07-17 17:35:38 -07:00
Sam Lantinga b271e92c6e Added the ability to specify a gamepad type in the mapping
Also renamed most cases of SDL_GAMEPAD_TYPE_UNKNOWN to SDL_GAMEPAD_TYPE_STANDARD, and SDL_GetGamepadType() will return SDL_GAMEPAD_TYPE_UNKNOWN only if the gamepad is invalid.
2023-07-17 12:59:56 -07:00
Sam Lantinga 57820071a4 Added the ability to rename your controller 2023-07-16 15:57:32 -07:00
Sam Lantinga 08db0e8f64 Allow clicking on the gamepad image to bind elements 2023-07-16 15:57:32 -07:00
Sam Lantinga 8f21be87fc Allow using A and B to navigate the controller binding flow 2023-07-16 15:57:32 -07:00
Sam Lantinga f3fe579cf0 Sort the entries in the controller mapping 2023-07-16 15:57:32 -07:00
Sam Lantinga 787786bdbc testcontroller: memory management cleanup
Also saved the guide button for last in the binding flow, since it may not be present on the controller or available from the OS
2023-07-16 15:57:32 -07:00
Anonymous Maarten 87ccb886fe cmake: remove ability to build tests as a standalone project 2023-07-16 20:22:41 +02:00
Anonymous Maarten 80da0cf06d cmake: convert bmp images to c headers using python script
A pure CMake script was too slow
2023-07-16 16:31:06 +02:00
Sam Lantinga 1a4995371b Use light text for button labels so they show up well over the activity highlight 2023-07-16 04:32:12 -07:00
Sam Lantinga ae0fce3f01 testcontroller: show face button labels over the activity highlight 2023-07-16 04:32:12 -07:00
Sam Lantinga 505a8dfb15 testcontroller replaces gamepadmap 2023-07-16 04:32:12 -07:00
Sam Lantinga 8296242f2e We don't need to be verbose about gamepad events now that we can visualize them 2023-07-16 04:32:12 -07:00
Sam Lantinga d90b938f0f Additional work on binding mode for testcontroller 2023-07-16 04:32:12 -07:00
Sam Lantinga 57cfd1e106 Removed SDL_GAMEPAD_TYPE_VIRTUAL, SDL_GAMEPAD_TYPE_AMAZON_LUNA, SDL_GAMEPAD_TYPE_GOOGLE_STADIA, and SDL_GAMEPAD_TYPE_NVIDIA_SHIELD
Removing SDL_GAMEPAD_TYPE_VIRTUAL allows a virtual controller to emulate another gamepad type. The other controller types can be treated as generic controllers by applications without special glyph or functionality treatment.
2023-07-16 04:32:12 -07:00
Sam Lantinga 689555a400 Added gamepad BMP files used as sources for the header files 2023-07-16 04:32:12 -07:00
Sam Lantinga 404e030b39 Added binding mode to testcontroller 2023-07-16 04:32:12 -07:00
Sam Lantinga 6c2472d459 Relicensed testutils to match other test code
Permission granted in 76a7b629bf (commitcomment-121408342)
2023-07-16 04:32:12 -07:00
Sam Lantinga cd99ae47ef Improved button labels, based on controller style 2023-07-16 04:32:12 -07:00
Sam Lantinga ee34805053 Added ABXY button labels to the gamepad image 2023-07-16 04:32:12 -07:00
Sam Lantinga e674d81844 Show the gamepad bindings in testcontroller 2023-07-16 04:32:12 -07:00
Sam Lantinga ca492dff18 Renamed testgamepad to testcontroller
The program does more than just test gamepads, and will eventually map them as well.
2023-07-16 04:32:12 -07:00
Sam Lantinga d2d26c7b1e testgamepad replaces testjoystick 2023-07-16 04:32:12 -07:00
Sam Lantinga 34876c390f testgamepad works for joysticks as well as gamepads 2023-07-16 04:32:12 -07:00
Sam Lantinga fdff3b16d6 Fixed build 2023-07-11 10:44:57 -07:00
Sam Lantinga 45cd4b8038 Added button background 2023-07-11 10:26:22 -07:00
Sam Lantinga 4feb2f4b1a Added a button to copy the gamepad mapping to the clipboard 2023-07-11 10:20:08 -07:00
Sam Lantinga 2e3404db01 Added SDL_GetGamepadPowerLevel() to get the power level directly from a gamepad 2023-07-11 10:20:08 -07:00
Sam Lantinga 9885f4d245 Reduced the size of the gamepad front and back images 2023-07-11 10:20:08 -07:00
Sam Lantinga 30a9fffbd4 Fixed array out of bounds access 2023-07-10 22:08:12 -07:00
Sam Lantinga 8ba850bef2 Show battery status on screen in testgamepad 2023-07-10 20:29:09 -07:00
Sam Lantinga 5b9f2d0942 Fixed build 2023-07-10 19:41:45 -07:00
Sam Lantinga e425fdd416 Added the controller name and info to the testgamepad window
Also added instructions for using the Virtual Controller
2023-07-10 19:13:51 -07:00
Sam Lantinga 50277a0355 Show touchpad and sensor output on screen in testgamepad 2023-07-10 18:05:31 -07:00
Sam Lantinga d44ada59fb Added joystick and gamepad element display in testgamepad 2023-07-10 17:06:42 -07:00
Sam Lantinga 4a53dc5b8d Added touchpad visualization for testgamepad 2023-07-10 11:36:32 -07:00
Sam Lantinga 5ce967a579 Apply the display content scale to the gamepad test window 2023-07-10 09:37:20 -07:00
Simon McVittie 8b12585e1d testevdev: Add some examples of PDP third-party Switch controllers
Thanks: Ravi Kanodia
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-07-10 08:59:18 -07:00
Sam Lantinga efd530827a Return from main() instead of calling exit() 2023-07-09 20:42:00 -07:00
Sam Lantinga 8f5ec2f596 Added shared code between testgamepad and gamepadmap
The goal is to eventually create a single program that can do mapping and testing of game controllers.
2023-07-09 19:24:36 -07:00
Sam Lantinga 1528e7c3c9 Fixed mapping a controller other than the first one 2023-07-06 12:36:26 -07:00
Sam Lantinga f4bd17deee Fixed %p formatting when there is following text 2023-07-06 08:04:20 -07:00
Sam Lantinga c1b11ad54e Expanded automated clipboard tests 2023-07-05 20:06:59 -07:00
Sam Lantinga c63aa9545e Fixed printf formatting for "%p" and added a unit test to check it 2023-07-05 20:06:59 -07:00
Sam Lantinga 35876da3c4 Clipboard data API revamp
The clipboard data API is now supported on all platforms, at least for internal use.
2023-07-05 20:06:59 -07:00
Sam Lantinga 00fc50557e Make sure logical presentation is complete before destroying the logical render target
Fixes "testautomation --filter render_testLogicalSize"
2023-07-03 18:29:48 -07:00
Sam Lantinga 3bd5e5ca3c Removed spurious casts 2023-07-03 16:18:33 -07:00
luzpaz 65e1d568ef Fix various typos (docs/build scripts/tests) 2023-07-03 08:35:37 -07:00
Sam Lantinga e264bb5178 Rename SDL_PIXELFORMAT_RGB888 and SDL_PIXELFORMAT_BGR888 to SDL_PIXELFORMAT_XRGB8888 and SDL_PIXELFORMAT_XBGR8888 for clarity
Fixes https://github.com/libsdl-org/SDL/issues/7903
2023-07-01 17:58:34 -07:00
Sylvain 1827a0bf62 Remove some use of C runtime functions in testevdev 2023-06-23 11:08:08 +02:00
Sam Lantinga 6306ee9f42 List the available haptic devices in testhaptic 2023-06-20 09:33:59 -07:00
Ozkan Sezer e4f53e6b21 testevdev.c: comment out two unused data to fix build. 2023-06-17 01:01:10 +03:00
Simon McVittie d584592822 linux: If the kernel specifically tells us the device type, trust it
If a device is positively identified as an accelerometer, pointing stick
or clickpad, then we don't need to second-guess it.

In practice this does not change the result for any device in our
test data, so add some artificial records that exercise this.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 08:54:41 -07:00
Simon McVittie 0d5aa70e62 linux: Pass evdev properties when guessing device type
In newer kernels, devices that can be positively identified as a
particular device type (for example accelerometers) get a property
bit set. Plumb this information through into the function, but don't
use it for anything just yet.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 08:54:41 -07:00
Simon McVittie a4ce721d7a testevdev: Allow device properties to be fully populated
The props array was too small for the highest property bits to be set,
although in practice this didn't matter since only the lower-order bits
have a meaning. Make it consistent with all the others.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 08:54:41 -07:00
Simon McVittie fa0ca3d41e linux: Distinguish between "device with keys" and a full keyboard
udev distinguishes between ID_INPUT_KEY, a device with any keyboard keys
at all (including for example USB numeric keypads, Bluetooth headsets
with volume control buttons, and some game controllers; and
ID_INPUT_KEYBOARD, a reasonably fully-featured keyboard that you could
use for general-purpose text entry. If we do the same here, then it's
useful input to our heuristics for identifying devices: for example,
a device with ID_INPUT_KEY could reasonably be a gamepad, but a device
with ID_INPUT_KEYBOARD certainly isn't.

Resolves: https://github.com/libsdl-org/SDL/issues/7827
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 08:49:31 -07:00
Simon McVittie 9b7a9ca666 testevdev: Add some more laptop built-in devices
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 07:27:48 -07:00
Simon McVittie 00b6db68de testevdev: Add some EVIOCGNAME and USB name strings to test data
We don't currently use these for anything, but we might start using
them as input to our heuristics as part of #7697.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 07:27:48 -07:00
Simon McVittie 3772d6cc99 testevdev: Add raw HID report descriptors where available
We don't currently use these in our device-classification heuristic,
but it could be a useful input in future.

Thanks to Sam Lantinga, Ben Fradella, kevenwyld and schlegp for
providing some of these.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 07:27:48 -07:00
Simon McVittie 2b7556fea2 testevdev: Correct typo in bus type for Xbox Series S|X via Bluetooth
All Bluetooth devices are bus type 0x0005.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 07:27:48 -07:00
Simon McVittie c13e511844 testevdev: Try to correct Wii devices guessed from kernel source
The comments here disagreed with the actual bytes. According to
https://elixir.bootlin.com/linux/v6.3.7/source/drivers/hid/hid-wiimote-modules.c,
the Balance Board reports BTN_A and ABS_HAT0X, HAT0Y, HAT1X and HAT1Y.
This means the comments here were correct, but the .abs bits shown
were in the wrong byte.

Matching the Wii U Pro Controller against the same kernel source, it
appears to be correct: it's the same representation as a PS3 gamepad,
except that it lacks the Z and RZ axes for analogue triggers.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 06:38:12 -07:00
Simon McVittie ffdafcd880 testevdev: Verify most Wii devices against real hardware
Some of the test data previously seen here was guessed from kernel
source code, and not all of it was correct. The following devices have
now been verified against `evemu-describe` output with Linux 6.3
(thanks to Jeremy Whiting for collecting this):

- basic Wiimote
    - buttons
    - 3-axis accelerometer
    - infra-red sensor for Sensor Bar location (precise aim)
- Motion Plus accessory (3-axis gyroscope)
- Nunchuck accessory (joystick, 2 buttons, second 3-axis accelerometer)
- Classic Controller accessory (a complete traditional gamepad)

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 06:38:12 -07:00
Simon McVittie 16b57d2ff1 testevdev: Add details of another driving simulator controller
Thanks to Ben Fradella.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-15 12:21:36 -07:00
Simon McVittie 2b00751206 testevdev: Expand test data for X-Box One Elite 2
This slightly newer device than the one from #7814 is functionally
equivalent when connected via USB. When connected via Bluetooth, it has
a different button mapping.

Thanks to Sam Lantinga.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-15 08:16:28 -07:00
Sam Lantinga 2e465ae31b Revert "Added SDL_nextafter() and SDL_nextafterf()"
This reverts commit bc5d074818.

It's not clear that we need these yet, so I'm going to remove them for now.
2023-06-14 11:05:10 -07:00
Sylvain 0f24956b0a testautomation_hints.c: free hint memory 2023-06-13 23:12:01 +02:00
Sylvain 2c3717881f testautomation_events.c: initialize "timestamp" to solve "conditional jump or move depends on uninitialised value" 2023-06-13 23:03:32 +02:00
Simon McVittie 56ba7f2ff0 testevdev: Add details of X-Box One Elite 2 via USB
Thanks to iacore for capturing these.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-13 10:33:13 -07:00
Simon McVittie 74484511eb testevdev: Provide a pointer to more information about adding test-cases
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-13 10:33:13 -07:00
Sam Lantinga bc5d074818 Added SDL_nextafter() and SDL_nextafterf() 2023-06-13 10:32:21 -07:00
Linus Probert 6ab846b688 clipboard: Fixes additional x11 clipboard bugs found in tests 2023-06-12 10:57:06 -07:00
Sam Lantinga 0103ec1126 Fixed accidental commit 2023-06-10 08:44:08 -07:00
Sam Lantinga 281018f169 Make it clear that you can't mix 2D rendering and the window surface API
Also added functions to query and destroy the window surface so you can switch between modes if you want.

See https://github.com/pygame-community/pygame-ce/issues/2190 for more details.
2023-06-10 08:39:20 -07:00
Simon McVittie d9c17e7055 testevdev: Add details of some more 8BitDo devices
Thanks to Jeremy Whiting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie a2ed083285 testevdev: Describe several equivalent devices
https://github.com/ValveSoftware/steam-devices/pull/34 lists several
more devices that are functionally equivalent to this one from the
point of view of their evdev metadata. Thanks to apgrc.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie f4a53e78c8 testevdev: Add test data for a DualSense (PS5) gamepad
Also make details of PS4 gamepads (which are very similar from an evdev
point of view) more specific.

Thanks to Sam Lantinga and Jeremy Whiting for recording these.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie 2fb1df1551 testevdev: Add test data for Nintendo Switch Joy-Cons via Bluetooth
Thanks to Jeremy Whiting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie 8a82e06075 testevdev: Add test data for Microsoft Xbox Series S|X Controller
Like the Stadia controller, this is unusual because it represents the
Share button as the Record key from a multimedia keyboard (as of Linux
6.2.11 with the xpad driver). Thanks to Jeremy Whiting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie ff01b43459 testevdev: Add Google Stadia controller
This is a bit unusual because it has a small number of what would
ordinarily be keyboard keys. Thanks to Jeremy Whiting for recording
this.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie 9ad0b8b47f testevdev: Add test data for another Switch Pro Controller
A newer evemu-describe transcript has this same controller with its
buttons mapped differently, presumably a result of driver changes in
the Linux kernel. Either way, we should recognise it as a gamepad.
Thanks to Jeremy Whiting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie 7b526d0cad testevdev: Finish incomplete data for Switch Pro Controller via USB
This didn't include any buttons, which I assume was because I
transcribed them incorrectly rather than reflecting reality. Confirmed
against another Switch Pro Controller on a more recent kernel (thanks
to Jeremy Whiting).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie 4c33ef94c6 testevdev: Note a functionally-equivalent device
We don't need to re-test the heuristic with the same input data, but
knowing that another device has equivalent evdev metadata is useful
information to record. Thanks to Jeremy Whiting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Simon McVittie 4c035dc1e3 testevdev: Add another laptop touchpad
This was reported by Rémi Bernon as an example of older SDL's non-udev
code path going wrong for touchpads when the invoking user happens to
be in the input group, which I believe was fixed by fdd945f2.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-08 11:03:10 -07:00
Ozkan Sezer e9e4a9175f testautomation_guid.c: fix integer warning in 32 bit builds. 2023-05-31 04:50:02 +03:00
Anonymous Maarten b4291412a4 tests: build tests with C90 standard
C90 mode is disabled for:
- testautomation: use of isnan/isfinite
- testlock: use of kill
- testvulkan: use of c++ style strings in vulkan.h
2023-05-27 01:49:07 +02:00
Sam Lantinga 128ca70160 Added support for printing wide strings using "%ls" syntax 2023-05-26 13:58:10 -07:00
Sam Lantinga cb73bed6eb SDL API renaming: SDL TLS functions
Fixes https://github.com/libsdl-org/SDL/issues/7743
2023-05-26 08:33:15 -07:00
Sam Lantinga c9d8a04945 Added SDL_swprintf() and SDL_vswprintf() 2023-05-26 08:19:04 -07:00
Simon McVittie a828f5897e testevdev: Add some driving sim controllers from Proton issue reports
Ideally we'd detect these as "joysticks" (or more generally, gaming
controllers), but in most cases their evdev flags are indistinguishable
from an accelerometer or gyro, so the only way to achieve this would be
a table of known devices that doesn't currently exist.

One exception is the one that reports a THROTTLE axis and TRIGGER, THUMB
buttons, which would be reasonable to detect via the joystick heuristic.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-23 08:53:19 -07:00
Simon McVittie c88b1d1ca0 testevdev: Add the ability to mark a device entry as unimplemented
There are some devices for which SDL's device classification heuristic
is known not to give the ideal result. Add a way to incorporate these
into our test data, so that when the heuristic is improved we can
detect them as their intended device type, without making the test fail
before that has been implemented.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-23 08:53:19 -07:00
Simon McVittie 22e6319fed testevdev: Add data for some game controllers submitted to steam-devices
This will ensure that detection of these devices doesn't regress.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-23 08:52:53 -07:00
Ozkan Sezer 5c019bc97e style fixes for SDL_PROC macros. 2023-05-19 14:10:02 +03:00
Sam Lantinga a66cad79c1 SDL_GetClosestFullscreenDisplayMode() now takes a boolean whether to include high density modes
Also changed the match to prioritize resolution over refresh rate
2023-05-18 12:15:23 -07:00
Sam Lantinga d1ee44b65e Add the pixel density to the display mode list in testwm 2023-05-18 07:34:16 -07:00
Sam Lantinga c699f3d1d8 Updated SDL high DPI support
We have gotten feedback that abstracting the coordinate system based on the display scale is unexpected and it is difficult to adapt existing applications to the proposed API.

The new approach is to provide the coordinate systems that people expect, but provide additional information that will help applications properly handle high DPI situations.

The concepts needed for high DPI support are documented in README-highdpi.md. An example of automatically adapting the content to display scale changes can be found in SDL_test_common.c, where auto_scale_content is checked.

Also, the SDL_WINDOW_ALLOW_HIGHDPI window flag has been replaced by the SDL_HINT_VIDEO_ENABLE_HIGH_PIXEL_DENSITY hint.

Fixes https://github.com/libsdl-org/SDL/issues/7709
2023-05-17 12:58:00 -07:00
Linus Probert 19adfa3ad9 wayland: Add support for images in clipboard.
Re-writes the clipboard data handling in wayland to an on demand
solution where callbacks are provided to generate/provide the clipboard
data when requested by the OS.
2023-05-12 07:54:56 -07:00
Brick 079ae065f1 Added SDL prefix AUDIO_* constants 2023-05-02 08:09:06 -07:00
Sam Lantinga 87ad71f9b2 Rename SDL mutex, semaphore and condition variable types to match SDL 3.0 naming convention 2023-04-28 12:08:33 -07:00
Sam Lantinga 61c0c009ab Rename SDL semaphore and condition variable functions to match SDL 3.0 naming convention
Fixes https://github.com/libsdl-org/SDL/issues/7642
2023-04-28 12:08:33 -07:00
Ryan C. Gordon e474047ff8 rwlock: Added SDL_rwlock API for shared locks. 2023-04-27 21:54:02 -04:00
Ryan C. Gordon e5a6c24c82 audio: Redesigned audio conversion code for SDL3.
- SDL_AudioCVT is gone, even internally.
- libsamplerate is gone (I suspect our resampler is finally Good Enough).
- Cleanups and improvements to audio conversion interfaces.
- SDL_AudioStream can change its input/output format/rate/channels on the fly!
2023-04-27 18:35:15 -04:00
Sylvain bbdde648d8 Android: let main return normally for testautomation 2023-04-14 12:26:12 +02:00
Simon McVittie c335e3db82 test/template.test.in: Pass SDL_NONINTERACTIVE_ARGUMENTS to installed-tests
Otherwise they'll try to run with no arguments, and fail, when run by
ginsttest-runner.

Fixes: 81ca9d61 "cmake+test: add more automated tests + use properties"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-04-12 15:04:11 +00:00
Ozkan Sezer dfff017fc6 testaudiocapture.c: added missing return statement to main() 2023-04-12 12:56:10 +03:00
Sylvain 0a33ed7a2b testaudiocapture: let main exit normally 2023-04-12 11:43:20 +02:00
Sylvain c101e719fd testprogram: let main() return normally, don't exit for platform (eg Android) where there is some cleanup afterward. 2023-04-12 11:37:26 +02:00
Sam Lantinga 2aa2fa5449 Added SDL_CreateWindowWithPosition()
It turns out there's a race condition on X11 where the window could be placed by the window manager while being placed by the application, so we need to have the initial position available at window creation.
2023-03-31 17:21:44 -07:00
Anonymous Maarten b6ae281e97 Use #ifdef/#ifndef instead of #if defined/#if \!defined 2023-03-30 21:35:01 +00:00
Anonymous Maarten 3472dc11d6
Fix uses of undefined macro identifiers (-Wundef)
* Fix -Wundef warnings due to use of unguarded SDL_LOADSO_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WINDOWS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_ANDROID

* Fix -Wundef warnings due to use of unguarded SDL_LOADSO_DUMMY

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_COCOA

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_UIKIT

* Fix -Wundef warnings due to use of unguarded SDL_TIMERS_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_EVENTS_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_TIMER_DUMMY

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_SENSOR_DISABLED

* Fix -Wundef warnings due to use of unguarded __ANDROID__

* Fix -Wundef warnings due to use of unguarded __IOS__

* Fix -Wundef warnings due to use of unguarded EMULATE_CAS

* Fix -Wundef warnings due to use of unguarded SDL_ATOMIC_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_THREADS_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_SNDIO

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_NETBSD

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_WASAPI

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DSOUND

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_HAIKU

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_COREAUDIO

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_AAUDIO

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_OPENSLES

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_ANDROID

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PS2

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PSP

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_VITA

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_N3DS

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_EMSCRIPTEN

* Fix -Wundef warnings due to use of unguarded SDL_NEON_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_ALTIVEC_BLITTERS

* Fix -Wundef warnings due to use of unguarded __VITA__

* Fix -Wundef warnings due to use of unguarded __3DS__

* Fix -Wundef warnings due to use of unguarded SDL_DYNAPI_PROC_NO_VARARGS

* Fix -Wundef warnings due to use of unguarded __APPLE__

* Fix -Wundef warnings due to use of unguarded __WINRT__

* Fix -Wundef warnings due to use of unguarded SDL_HIDAPI_DISABLED

* Fix -Wundef warnings due to use of unguarded __TVOS__

* Fix -Wundef warnings due to use of unguarded HAVE_DRIVER_BACKEND

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_XINPUT

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_WGI

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_DINPUT

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_MFI

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_EMSCRIPTEN

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_PS2

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_PSP

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_VITA

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_N3DS

* Fix -Wundef warnings due to use of unguarded __MACOS__

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WINRT

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RPI

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PVR_OGL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VIVANTE

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D11

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D12

* Fix -Wundef warnings due to use of unguarded SDL_RENDER_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_METAL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_PS2

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_PSP

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_VITA_GXM

* Fix -Wundef warnings due to use of unguarded SDL_ARM_SIMD_BLITTERS

* Fix -Wundef warnings due to use of unguarded SDL_ARM_NEON_BLITTERS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_HAIKU

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_PS2

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_PSP

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VITA

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_N3DS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_KMSDRM

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RISCOS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_EMSCRIPTEN

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_NGAGE

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_METAL

* Fix -Wundef warnings due to use of unguarded SDL_LSX_INTRINSICS

* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_NP_H

* Fix -Wundef warnings due to use of unguarded __RISCOS__

* Fix -Wundef warnings due to use of unguarded FAKE_RECURSIVE_MUTEX

* Fix -Wundef warnings due to use of unguarded USE_POSIX_SPAWN

* textureData is only needed when SDL is built with YUV support

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_ALSA

* Fix -Wundef warnings due to use of unguarded SDL_SSE3_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_SSE4_2_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_SSE4_1_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_AVX512F_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_SSE2_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_AVX_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_AVX2_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_SSE_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_MMX_INTRINSICS

* Fix -Wundef warnings due to use of unguarded HAVE_CLOCK_GETTIME

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DISK

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DUMMY

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_DUMMY

* Fix -Wundef warnings due to use of unguarded HAVE_GCC_ATOMICS

* Fix -Wundef warnings due to use of unguarded HAVE_GCC_SYNC_LOCK_TEST_AND_SET

* Fix -Wundef warnings due to use of unguarded SDL_USE_LIBDBUS

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_JACK

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_VIRTUAL

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_LINUX

* Fix -Wundef warnings due to use of unguarded HAVE_LIBC

* Fix -Wundef warnings due to disabling SDL_LIBC

* Fix -Wundef warnings due to use of unguarded HAVE_PLATFORM_BACKEND

* Fix -Wundef warnings due to use of unguarded DEBUG

* Fix -Wundef warnings due to use of unguarded HAVE_LINUX_INPUT_H

* Fix -Werror=unused-variable when building with SDL_LIBC=OFF

* Fix -Wundef warnings due to use of unguqrded SDL_USE_LIBUDEV

* Use SDL alloc functions in libusb/hid.c

* Fix -Wundef warnings due to use of unguarded HAVE_LIBUDEV_H

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VULKAN

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_OFFSCREEN

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_OGL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_GLX

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES2

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_OGL_ES2

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_OSS

* Remove SDL_AUDIO_DRIVER_SUNAUDIO reference since it is never set

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PIPEWIRE

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PULSEAUDIO

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XCURSOR

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XDBE

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XFIXES

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XINPUT2

* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH

* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XRANDR

* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XSCRNSAVER

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XSHAPE

* Don't call XShape functions when XShape is diabled

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WAYLAND

* Fix -Wundef warnings due to use of unuarded SDL_VIDEO_DRIVER_X11

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RISCOS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_EGL

* Disable array when compiled with SDL_EVENTS=OFF

* Fix -Wundef warnings due to use of unguarded SDL_INPUT_LINUXEV

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_WINDOWS

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PS2

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PSP

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_VITA

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_N3DS

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_STDCPP

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_NGAGE

* Fix -Wundef warnings due to use of unguarded __WINDOWS__

* Fix -Wundef warnings due to use of unguarded __WINGDK__

* Fix -Wundef warnings due to use of unguarded __ANDROID__

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_GENERIC_COND_SUFFIX

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PIB

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PVR

* Fix -Wundef warnings due to use of unguarded SDL_FILE_DISABLED

* Fix -Wundef warnings due to use of unguarded __XBOXONE__

* Fix -Wundef warnings due to use of unguarded __XBOXSERIES__

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_WGL

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_QNX

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DISK

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_QNX

* Fix -Wundef warnings due to use of unguarded DEBUG_RAZOR

* Fix -Wundef warnings due to use of unguarded WINAPI_FAMILY_PHONE_APP

* Fix -Wundef warnings due to use of unguarded SDL_MAC_NO_SANDBOX

* Fix -Wundef warnings due to use of unguarded __(IPHONE|APPLETV|MAC)_OS_VERSION_MAX_ALLOWED

* Fix C4090 warning ('function': different 'const' qualifiers)

* ci: use -isystem for include dirs of pspdev toolchain

* cmake: add -Wundef option

* Fix remaining -Wundef warnings due to use of unguarded SDL_VIDEO_VULKAN and SDL_VIDEO_METAL

* Fix -Wundef warnings due to use of unguarded __MACOS__

* DEBUG_CONVERT is guaranteed to be defined in src/audio/SDL_audiocvt.c

* Fix -Wundef warnings due to use of unguarded HAVE_NANOSLEEP

* Fix -Wundef warnings due to use of unguarded HAVE_DXGI_H

* Fix -Wundef warnings due to use of unguarded HAVE_LINUX_INPUT_H

* fix SDL_VIDEO_DRIVER_WAYLAND

* fix SDL_VIDEO_DRIVER_X11

* Fix -Wundef warnings due to use of unguarded HAVE_MMDEVICEAPI_H

* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_SETNAME_NP

* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_SET_NAME_NP

* Fix -Wundef warnings due to use of unguarded HAVE_SETJMP

* Fix -Wundef warnings due to use of unguarded HAVE_SIGNAL_H

* Fix -Wundef warnings due to use of unguarded HAVE_TPCSHRD_H

* Fix -Wundef warnings due to use of unguarded MACOSX_COREAUDIO

* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_DINPUT

* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_IOKIT

* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_XINPUT

* Fix -Wundef warnings due to use of unguarded SDL_IPHONE_KEYBOARD

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_RAWINPUT

* Fix -Wundef warnings due to use of unguarded SDL_POWER_ANDROID

* Fix -Wundef warnings due to use of unguarded SDL_POWER_EMSCRIPTEN

* Fix -Wundef warnings due to use of unguarded SDL_POWER_HAIKU

* Fix -Wundef warnings due to use of unguarded SDL_POWER_LINUX

* Fix -Wundef warnings due to use of unguarded SDL_POWER_MACOSX

* Fix -Wundef warnings due to use of unguarded SDL_POWER_PSP

* Fix -Wundef warnings due to use of unguarded SDL_POWER_UIKIT

* Fix -Wundef warnings due to use of unguarded SDL_POWER_VITA

* Fix -Wundef warnings due to use of unguarded SDL_POWER_WINDOWS

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD_RECURSIVE_MUTEX

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VIVANTE_VDK

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WAYLAND

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_CGL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_EGL

* Fix -Wundef warnings due to use of unguarded __MACOS__

* Fix -Wundef warnings due to use of unguarded __OpenBSD__

* Fix -Wundef warnings due to use of unguarded __FreeBSD__

* Fix -Wundef warnings due to use of unguarded __MWERKS__

* Fix -Wundef warnings due to use of unguarded __WIN32__

* Fix -Wundef warnings due to use of unguarded SDL_IPHONE_LAUNCHSCREEN

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES2

* Remove unused HAVE_CONST, HAVE_INLINE and HAVE_VOLATILE

* Revert "Use SDL alloc functions in libusb/hid.c"

This reverts commit 847c64b00da12ca08bef9e947eb948e378eeaef8.

* Handle FAKE_RECURSIVE_MUTEX in similar way as SDL2

* Don't use defined in macro
2023-03-29 21:49:01 +00:00
Anonymous Maarten 11c70406c3 testautomation_audio: fix -Wimplicit-fallthrough warning 2023-03-28 16:59:27 +00:00
Anonymous Maarten e1b8a03239 testsurround: fix channel names
Used table in include/SDL3/SDL_audio.h as reference.
2023-03-28 16:59:27 +00:00
Anonymous Maarten cb076b83ff cmake: fix testnative for Macos 2023-03-28 04:01:50 +02:00
Anonymous Maarten 1259a60731 cmake: build tests as library on Android 2023-03-28 01:30:55 +02:00
Anonymous Maarten b8b852a55b cmake: testnative can also be built on non-Linux 2023-03-28 00:43:54 +02:00
Sylvain d3faec0b6e testcommon/automation: add [--audio driver] option
allow to use --audio --video --renderer for testautomation
2023-03-27 10:23:18 +02:00
Anonymous Maarten b0a5182e84 Sunset SDL_HasRDTSC 2023-03-27 06:12:49 +00:00
Anonymous Maarten 46f5c1fe6a Move and rename SDL_rdtsc macro to testautomation 2023-03-27 06:12:49 +00:00
Anonymous Maarten d392ce516a testautomation_math: avoid equality tests with INFINITY
Fixes this warning:
 warning: comparison with infinity always evaluates to false in fast floating point modes [-Wtautological-constant-compare]
2023-03-27 06:12:49 +00:00
Anonymous Maarten e2f51bf38e SDL_intrin.h: add SDL_rdtsc macro 2023-03-27 06:12:49 +00:00
capehill b8c88cc584 testgles2_sdf: Call correct function to get shader info log 2023-03-26 22:29:49 +02:00
capehill d5fac067cd testdisplayinfo: use correct index variable 2023-03-26 21:14:18 +02:00
Sylvain 693558a894 testautomation_video: fix memory leak 2023-03-24 09:52:05 +01:00
Sylvain 3ccfd361cb Fix video_getSetWindowPosition() that fail when checking events,
because testautomation_events.c() didn't finish to poll all events before
2023-03-24 09:52:05 +01:00
Sylvain 5976b79c1c testautomation: create no window, so that testautomation_mouse.c::mouse_getMouseFocus() pass
(more precisely, the last test,  when the window is destroyed, focus window should report null)
2023-03-24 09:52:05 +01:00
Sylvain f30a182de2 Fix video_getSetWindowGrab(): need to raise the window, and wait for focus gained 2023-03-24 09:52:05 +01:00
Sylvain d4d26e0ddb testautomation_video: if SDL_SetWindowSize/Position isn't honored, we should check there is an event
x11: send the events if various occasions
2023-03-24 09:52:05 +01:00
Anonymous Maarten c30903882b cmake+tests: include SDL_build_config.h in select tests + add include paths 2023-03-21 23:03:02 +03:00
Ozkan Sezer 262b13431d testautomation_intrinsics.c (sse2): change _mm_store_pd to _mm_storeu_pd
fixes segmentation faults
2023-03-21 23:03:02 +03:00
Ozkan Sezer 7a54d363cf testautomation_intrinsics.c: correct call to check SSE4.1 presence. 2023-03-21 23:03:02 +03:00
Ozkan Sezer 6c9780720b cmake: added configuration options for AVX2, AVX512F, SSE4.1, and SSE4.2
adjusted SDL_intrin.h and testautomation_intrinsics.c accordingly.
2023-03-21 23:03:02 +03:00
Anonymous Maarten 5775d5e112 Add intrinsics test automation 2023-03-21 23:03:02 +03:00
Anonymous Maarten 81ca9d61d6 cmake+test: add more automated tests + use properties 2023-03-21 02:19:19 +01:00
Anonymous Maarten 115460a930 torturethread: sleep a bit in SubThreadFunc to avoid starvation
testtorture, built by MinGW from msys2, got blocked indefinitely.
2023-03-21 02:19:19 +01:00
Anonymous Maarten 6a9c692bb9 testsem: don't re-parse positional argument twice 2023-03-21 02:19:19 +01:00
Anonymous Maarten 4a6528e3f0 testprograms: parse arguments using SDLTest_CommonState 2023-03-17 17:54:16 +01:00
Anonymous Maarten 8bea41f737 testthread: parse arguments using SDLTest_CommonState + add arguments 2023-03-17 17:54:16 +01:00
Anonymous Maarten 64b739bc1e testlock: parse arguments using SDLTest_CommonState + extra arguments 2023-03-17 17:54:16 +01:00
Anonymous Maarten 4d86a83fa9 testver: don't allow any arguments 2023-03-17 17:54:16 +01:00
Anonymous Maarten 0268881e30 testspriteminimal: don't allow any arguments 2023-03-17 17:54:16 +01:00
Anonymous Maarten 08d5235da0 testintersections: check integer argument + no global done + get final tick before SDL shutdown 2023-03-17 17:54:16 +01:00
Anonymous Maarten 6e2851878f testhittesting: use SDLTest_Common for creating window(s) and renderer(s) 2023-03-17 17:54:16 +01:00
Anonymous Maarten 75da730a88 testfile: fix reference values 2023-03-17 17:54:16 +01:00