Compare commits

..

563 commits

Author SHA1 Message Date
Sam Lantinga
b84a1e6a4d Make sure hidapi is built for the release DMG 2020-03-01 18:16:15 -08:00
Sam Lantinga
01469496eb We already have a hidapi implementation for Windows, we don't need libusb 2020-03-01 17:53:30 -08:00
Sam Lantinga
f002c5c73f Updated version to 2.0.12 for release candidate build 2020-03-01 14:58:16 -08:00
Sam Lantinga
d09e1783a9 Fixed bug 4996 - Mac: XBoxOne Bluetooth rumble isn't working
rofferom

I have an annoying issue on MacOS about XBoxOne Bluetooth rumble (Vendor: 0x045e, Product: 0x02fd).

When 360controller is installed, rumble is working correctly. However, Bluetooth rumble isn't working at all, with or without 360controller installed (although it is working with Chrome + https://html5gamepad.com).

I looked at the code, and it seems that XBox controllers are managed in MacOS in this file: SDL_hidapi_xbox360.c. The XBoxOne file is disabled for MacOS in SDL_hidjoystick_c.h.

The function HIDAPI_DriverXbox360_Rumble() is called correctly, and hid_write() returns no error.

I have tried a stupid test. I took the rumble packet from 360controller: ec4e88eb2d/XBOBTFF/FFDriver.cpp (L620). With the patch I have attached, I manage to have rumble working on Bluetooth (with some stupid vibration level, but it proves it can if the packet is changed).

But it breaks the USB rumble with 360controller. A comment in the function makes an explicit reference to 360controller, I think that's why I have broken this specific usecase.

I don't know what is the correct way to fix this, but it seems that the current implementation has a missing case for Bluetooth support.


Note that I also tested master this morning, and I have another issue:
    if (!device->ffservice) {
        return SDL_Unsupported();
    }

test fails in DARWIN_JoystickRumble(). This test has been done quickly, I'm not totaly confident about its accuracy.
2020-03-01 14:52:49 -08:00
Romain Roffé
802ddf478e mac: Fix gamepad detection 2020-03-01 13:01:53 -08:00
Sam Lantinga
b378f68cd6 Fixed whitespace 2020-03-01 13:00:50 -08:00
Sam Lantinga
cd69970c24 Fixed bug 4369 - Going fullscreen with green knob in MacOS freezes app for 15 seconds.
Elmar

creating a fullscreen window with SDL_CreateWindow(..SDL_WINDOW_FULLSCREEN_DESKTOP..) in MacOS works fine, except if it was triggered by the user with the green knob in the top left window title bar.

Then "something" is different, and SDL_CreateWindow hangs for 15-20 seconds (tested in MacOS 10.13 and 10.14).

Responsible for the hang is this code in SDL_cocoawindow.m - Cocoa_SetWindowFullscreenSpace:

        const int maxattempts = 3;
        int attempt = 0;
        while (++attempt <= maxattempts) {
            /* Wait for the transition to complete, so application changes
             take effect properly (e.g. setting the window size, etc.)
             */
            const int limit = 10000;
            int count = 0;
            while ([data->listener isInFullscreenSpaceTransition]) {
                if ( ++count == limit ) {
                    /* Uh oh, transition isn't completing. Should we assert? */
                    break;
                }
                SDL_Delay(1);
                SDL_PumpEvents();
            }
            if ([data->listener isInFullscreenSpace] == (state ? YES : NO))
                break;
            /* Try again, the last attempt was interrupted by user gestures */
            if (![data->listener setFullscreenSpace:(state ? YES : NO)])
                break; /* ??? */
        }

One trivial workaround is to change 'const int limit = 10000' to 500. Then the freeze is so short that it doesn't look like a freeze to the user.

Looking further into the problem, I observed that the function Cocoa_SetWindowFullscreenSpace recursively calls itself via some ObjectiveC messages. I managed to extract a callstack for this (copied below): Note how Cocoa_SetWindowFullscreenSpace in stack line 22 calls SDL_PumpEvents, which eventually arrives at  SDL_SendWindowEvent, which calls SDL_UpdateFullscreenMode (stack line 0), which then calls Cocoa_SetWindowFullscreenSpace again (not shown). This recursive second call is the one that hangs.

Another "solution" that worked for me was to add a flag to SDL_Window that is set in Cocoa_SetWindowFullscreenSpace and causes this function to return immediately if called from itself.

Obviously, this is also an ugly hack, but I don't have enough time to dive into this crazy Cocoa/ObjectiveC business deep enough to find a proper solution. But hopefully it's easy for one of the experts around.

Note that there is a "failure to go fullscreen"-message involved, maybe using the green knob causes this failure at first.

I can unfortunately not provide a minimum example.

Best regards,
Elmar

0   com.yasara.View               	0x00000001007495af SDL_UpdateFullscreenMode + 207
1   com.yasara.View               	0x00000001006e2591 SDL_SendWindowEvent + 401
2   com.yasara.View               	0x0000000100775a72 -[Cocoa_WindowListener windowDidResize:] + 370
3   com.yasara.View               	0x0000000100776550 -[Cocoa_WindowListener windowDidExitFullScreen:] + 512
4   com.apple.AppKit              	0x00007fff3180a2a4 -[_NSWindowEnterFullScreenTransitionController failedToEnterFullScreen] + 692
5   com.apple.AppKit              	0x00007fff31c59737 -[_NSEnterFullScreenTransitionController _doFailedToEnterFullScreen] + 349
6   com.apple.AppKit              	0x00007fff3172aa53 __NSFullScreenDockConnectionSendEnterForSpace_block_invoke + 135
7   libxpc.dylib                  	0x00007fff6114b9b1 _xpc_connection_reply_callout + 36
8   libxpc.dylib                  	0x00007fff6114b938 _xpc_connection_call_reply_async + 82
9   libdispatch.dylib             	0x00007fff60ec7e39 _dispatch_client_callout3 + 8
10  libdispatch.dylib             	0x00007fff60ede3b0 _dispatch_mach_msg_async_reply_invoke + 322
11  libdispatch.dylib             	0x00007fff60ed2e25 _dispatch_main_queue_callback_4CF + 807
12  com.apple.CoreFoundation      	0x00007fff33d39e8b __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
13  com.apple.CoreFoundation      	0x00007fff33d3959a __CFRunLoopRun + 2335
14  com.apple.CoreFoundation      	0x00007fff33d38a28 CFRunLoopRunSpecific + 463
15  com.apple.HIToolbox           	0x00007fff32fd1b35 RunCurrentEventLoopInMode + 293
16  com.apple.HIToolbox           	0x00007fff32fd1774 ReceiveNextEventCommon + 371
17  com.apple.HIToolbox           	0x00007fff32fd15e8 _BlockUntilNextEventMatchingListInModeWithFilter + 64
18  com.apple.AppKit              	0x00007fff3128deb7 _DPSNextEvent + 997
19  com.apple.AppKit              	0x00007fff3128cc56 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1362
20  com.yasara.View               	0x000000010076fab2 Cocoa_PumpEvents + 290
21  com.yasara.View               	0x00000001006dd1c7 SDL_PumpEvents_REAL + 23
22  com.yasara.View               	0x00000001007795cf Cocoa_SetWindowFullscreenSpace + 223
23  com.yasara.View               	0x000000010074970b SDL_UpdateFullscreenMode + 555
24  com.yasara.View               	0x00000001006e2476 SDL_SendWindowEvent + 118
25  com.yasara.View               	0x0000000100774ff7 -[Cocoa_WindowListener resumeVisibleObservation] + 135
26  com.yasara.View               	0x000000010077664c Cocoa_ShowWindow + 188
27  com.yasara.View               	0x0000000100749492 SDL_FinishWindowCreation + 546
28  com.yasara.View               	0x0000000100748da5 SDL_CreateWindow_REAL + 1573
29  com.yasara.View               	0x000000010010d9b1 vga_setvideomode + 1347
30  com.yasara.View               	0x00000001003f0d46 mod_initscreen + 2614
31  com.yasara.View               	0x00000001003f344b mod_reinitscreen + 460
32  com.yasara.View               	0x00000001003f370d mod_resizescreen + 383
33  com.yasara.View               	0x0000000100418e39 mod_main + 815
34  com.yasara.View               	0x000000010029ca5d main2 + 5766
35  com.yasara.View               	0x000000010011d1b7 main.main_cpuok + 19
2020-03-01 12:58:50 -08:00
Sam Lantinga
6a6b941e58 Fixed bug 4992 - UWP/WinRT does not set thread priority when using SDL_SetThreadPriority
Ethan Lee

Attached is a diff that I used to get SetThreadPriority working locally. I still have no idea what the minimum SDK version is since Microsoft never documented it, but it's worth pointing out that they're much more aggressive about using the latest VS and UWP SDK anyway (for example, an updated Xbox is no longer compatible with VS2017, and updates are required to have a network connection of any kind).
2020-03-01 12:50:42 -08:00
Sam Lantinga
3e79ac2a16 Fixed trying to handle the HORI Wireless Switch Pad when connected via USB 2020-02-27 13:53:32 -08:00
Sam Lantinga
d7b703adbb Xbox One controller rumble doesn't need synchronization if you use a packet counter of 0 2020-02-27 09:33:32 -08:00
Sam Lantinga
1bb0c43749 Temporarily disabled NEON optimizations added for bug 4365
The ABGR to ARGB blit results in an empty surface, this needs to be looked at.
2020-02-27 09:32:03 -08:00
Sam Lantinga
93c0e32357 Fixed bug 5005 - warnings in kmsdrm
Malte Kießling

At the moment i get following warnings from kmsdrm:

 * in SDL_kmsdrmvideo.c KMSDRM_DestroySurfaces is return type int, but thats never returned or checked against
 * in SDL_kmsdrmvideo.c KMSDRM_DestroySurfaces the variable viddata is not used
 * in SDL_kmsdrmopengles.c KMSDRM_GLES_LoadLibrary a cast to NativeDisplayType is missing

I attached a patch for them :)
2020-02-27 08:20:34 -08:00
Sam Lantinga
6331aebaaf Fixed bug 4987 - Can't build on MinGW a recent state (15'th February, 2020): conflicting types 2020-02-27 08:18:20 -08:00
Ryan C. Gordon
3d1b93ed7d cmake: Forgot to add this file to revision control.
Fixes Bugzilla #5003.

--HG--
extra : rebase_source : bf8f9f7b3f96ae9a7c11d634487ca83712487c27
extra : histedit_source : 05eb4076f48da86a74c93a9bb5fb3a7228624bf0
2020-02-25 14:52:03 -05:00
Sylvain Becker
233d05a1f2 Fix compilation C90 mixed declarations and code (Thanks Cameron Gutman !) 2020-02-25 06:53:51 +01:00
Sylvain Becker
9b5850bdb7 Better fix to set the palette opaque, when there is also a colorkey
(see bug 3827)
2020-02-24 21:57:03 +01:00
Sam Lantinga
ea119534c0 Don't call setPreferredOutputNumberOfChannels on iOS, it breaks audio output 2020-02-24 12:07:18 -08:00
Sam Lantinga
2a669e967a Fixed surround sound support on Apple TV 2020-02-24 10:25:57 -08:00
Sylvain Becker
0b991f8e16 Fix: set to opaque when a palette surface is converted to an alpha format. 2020-02-23 23:07:15 +01:00
Sylvain Becker
1b4134df89 Fix regression: when a palette + colorkey is converted, it needs a blend mode.
- Regression of test_1.c of bug 3827, after fix from bug 4798.
- Blending is also needed when the palette contains alpha value, but not necessarily colorkey.
- Clean up SDL_ConvertColorkeyToAlpha which doesn't seem to need 'ignore_alpha' parameter any-more.

(see bug 3827)
2020-02-23 22:38:08 +01:00
Ryan C. Gordon
3324453465 cocoa: Make sure wait for button enable can't be infinite. 2020-02-23 14:49:03 -05:00
Ryan C. Gordon
e939635f84 cocoa: Removed a debug printf that was accidentally committed. 2020-02-23 14:48:48 -05:00
Sylvain Becker
5a0ed0a7e4 Fixed bug 4999 - Palette surface always promoted to alpha (Thanks Cameron Gutman!)
MSVC Static analysis: Incorrect alpha_value check in SDL_render.c
(see also bug 4425)
2020-02-23 09:59:52 +01:00
Ryan C. Gordon
e0661f0cdf cmake: more proper sdl2-config.cmake work (thanks, Alexander!)
Fixes Bugzilla #4970.

--HG--
extra : amend_source : 58e7991ac25965c177e3f11346396f19e2ca6c5d
2020-02-21 15:52:35 -05:00
Ryan C. Gordon
4814d83a17 cmake: Backed out changeset d62544e5fa7a
This is being replaced by a different patch (see Bugzilla #4970).
2020-02-21 15:51:04 -05:00
Ryan C. Gordon
74335f35e8 cocoa: When exiting a fullscreen space, wait for window state to normalize.
A good metric of this is when the titlebar's "minimize" button is reenabled,
which doesn't happen by the time windowDidExitFullscreen triggers.

This fixes minimizing a fullscreen window on macOS.

Fixes Bugzilla #4177.

--HG--
extra : rebase_source : d3b71427a15165cd0ca0edb9bd3e74da6dd861e6
2020-02-21 14:50:09 -05:00
Sam Lantinga
ebc08484de Fixed support for third party Xbox 360 wireless controller dongle 2020-02-19 08:26:00 -08:00
Ryan C. Gordon
a3d9b5e227 dynapi: Fixed build on non-Android platforms. 2020-02-18 01:44:07 -05:00
Sam Lantinga
99068e7cfe Added Android SDK conditionals to game controller mappings
The Nintendo Switch Pro controller has a different mapping on Android 10 and newer
2020-02-17 14:15:47 -08:00
Sam Lantinga
a76493a35b Made SDL_GetAndroidSDKVersion() available for applications 2020-02-17 13:54:45 -08:00
Ryan C. Gordon
e6e4be9fc1 opengl: Backed out hg changeset 0c915d307499
This is the OpenGL line drawing fix for Bugzilla #3182, but there's some
disagreement about what the renderers should do here, so I'm backing this out
until after 2.0.12 ships, and then we'll reevaluate all the renderer backends
to decide what's correct, and make them all work the same.
2020-02-17 16:15:04 -05:00
Ryan C. Gordon
59af901bbd x11: Wait a bit in SDL_SetWindowSize() to see if window manager vetoed change.
Same idea as the fix for Bugzilla #4646.

Fixes Bugzilla #4727.

--HG--
extra : rebase_source : 4dd57085a593f68553f921ba574607c01e8c08b9
2020-02-17 16:11:18 -05:00
Ryan C. Gordon
6b6ba6d243 x11: Don't delay an extra 10ms if we were just going to break out of the loop.
--HG--
extra : rebase_source : 0c11959078675b6204e643cd859d63b6871ee79d
2020-02-17 15:02:37 -05:00
Ryan C. Gordon
e647acf78d x11: Don't wait for the window to move if it's already in the place we want it.
--HG--
extra : rebase_source : b7ad35263159d7ac5c6c005c9bb0c9dc96bb8a18
2020-02-17 15:00:02 -05:00
Sam Lantinga
2a440598ca Further improvements for bug 4128 - CMAKE: Generated target import file contains incorrect include path
Mohamed

It would be useful to be able to do either `#include "SDL2/SDL.h"` or `#include "SDL.h"`. This patch allows that and adds compatibility with other build systems. It also allows differentiating between SDL1 and SDL2.
2020-02-16 00:08:36 -08:00
Sam Lantinga
5639c05fe4 Fixed bug 4987 - Can't build on MinGW a recent state: conflicting types
Vitaly Novichkov

Recent attempt to build a recent HG state of SDL2 via AppVeyor gives the failure:

30821858/job/359gqvypi2f18nok

```
C:\projects\sdl-mixer-x\build-MinGW-w32-MinSizeRel-Win32-VB6-Binding\external\AudioCodecs\src\AudioCodecs-build\external\SDL2\src\SDL2HG\src\dynapi\SDL_dynapi_procs.h:56:29: error: conflicting types for 'SDL_CreateThread'
 SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c),(a,b,c),return)
2020-02-15 16:39:38 -08:00
Sam Lantinga
d5b3d8d150 Added some extra permissions and features likely to be used by SDL applications 2020-02-14 18:21:58 -08:00
Cameron Cawley
952060f329 test: Improved detection of OpenGL support 2020-02-08 19:34:51 +00:00
Cameron Cawley
2b9013fd76 Improved CPU detection on ARM platforms 2020-02-04 16:46:22 +00:00
Cameron Cawley
5e683ff94c Add basic support for compiling on RISC OS 2020-02-13 20:50:47 +00:00
Cameron Cawley
6a3ddc7b5f testfilesystem: Don't exit the application if SDL_GetBasePath isn't supported 2020-02-13 22:58:04 +00:00
Sam Lantinga
6df9e0ec2f Fixed bug 4980 - Build fails for SDL_kmsdrm*.c
Malte Kießling

Since https://hg.libsdl.org/SDL/rev/045f218436fe / bug 4966 i cannot build SDL anymore. The error i get is, essentially, caused by -Werror=declaration-after-statement in SDL_kmsdrmvideo.c and SDL_kmsdrmopengles.c
2020-02-14 16:17:17 -08:00
Sam Lantinga
f862a7305c Fixed bug 4986 - Memory leak in HIDAPI_JoystickConnected
meyraud705

Memory allocated for device->joysticks on line 589 of SDL_hidapijoystick.c is never freed.

Also, use memmove because memory is overlapping.
2020-02-14 16:15:46 -08:00
Sam Lantinga
342c1f5aa3 Fixed audio not coming out of the phone speakers while recording on iOS 2020-02-14 15:19:34 -08:00
Sam Lantinga
a5da847282 Fixed re-setting the audio session category when closing an audio device 2020-02-14 14:18:12 -08:00
Ryan C. Gordon
b88ebe6a95 cmake: Add PACKAGE_VERSION and SDL2_VERSION to sdl2-config.cmake.in
Fixes Bugzilla #4970.
2020-02-14 13:37:32 -05:00
Ryan C. Gordon
5cea2bb70e x11: SDL_SetWindowPosition should try to wait for the window manager.
Wait up to 100 milliseconds, since the window manager might alter or
outright veto the window change...or not respond at all.

In a well-functioning system, though, this should help make sure
that SDL_SetWindowPosition's results match reality.

Fixes Bugzilla #4646.
2020-02-14 13:17:18 -05:00
Ryan C. Gordon
5403dbd4a5 wayland: Don't delay pending surface resize handling on Vulkan.
OpenGL apparently needs to not do any drawing between wl_egl_window_resize
and eglSwapBuffers, but Vulkan apps don't use SDL to present, so they
never call into an equivalent of SDL_GL_SwapWindow where our Wayland code
was handling pending resize work.

Fixes Bugzilla #4722.

--HG--
extra : rebase_source : 123396f1b250a880cf9f47a7fc8895538ea7272d
2020-02-14 00:58:36 -05:00
Ryan C. Gordon
9ba80451dd wayland: Don't force the window into OpenGL mode if we want Vulkan.
--HG--
extra : rebase_source : c880cfc11efe459e8a8f735889929c7c8d1fae3d
2020-02-14 01:08:21 -05:00
Sam Lantinga
a430e13434 Fixed opening audio on Android from the Steam Link shell activity 2020-02-13 16:10:52 -08:00
Sam Lantinga
bf21c9aec1 Resolved conflict and added Android_JNI_RequestPermission() 2020-02-13 10:19:05 -08:00
Sam Lantinga
d62d7ebd0c Improved fix for bug 4748 - Calling WIN_UpdateClipCursor() / WIN_UpdateClipCursorForWindows() on WIN_PumpEvents() causes beeping and choppy mouse cursor movement, right-click doesn't work 2020-02-12 12:26:27 -08:00
Ryan C. Gordon
5c22af2fa8 test: Reimplemented SDLTest_CommonUsage() to restore binary compatibility.
Fixes Bugzilla #4975.
2020-02-12 13:09:38 -05:00
Ryan C. Gordon
48148ca586 mac: Wait a bit before activating app at startup.
This is obnoxious and wrong, but the patch that activates the Dock before
activating the app fixes the _menu_ not responding on Catalina, but the
first window created by the app won't have keyboard focus without a small
delay inserted.

This obviously needs a better solution, but it gets it limping along correctly
for now.
2020-02-12 13:08:29 -05:00
Sam Lantinga
9a6fe8b14b Fixed relative mode mouse events stopping if you click on the title bar 2020-02-11 21:19:05 -08:00
Sam Lantinga
294e05087e Fixed iOS and Android build 2020-02-11 16:23:43 -08:00
Sam Lantinga
06433488e1 Implemented OpenSL-ES audio recording on Android 2020-02-11 16:14:02 -08:00
Sam Lantinga
f26e92cc2b Attempt to make version detection safe for Mac OS X < 10.10 2020-02-11 10:35:14 -08:00
Sam Lantinga
e373060c8b Workaround for bug 4822 - Broken visual output in full screen mode with OS X 10.15
sjordan

We did some investigations into a different direction which I would like to share. As mentioned previously the scaling setting in the preferences play an important role for our problem and they also hint towards an issue with point/pixel scaling factors.

We found an interesting correlation between our fail case and the behavior of [nsWindow.screen backingScaleFactor]. It turns out that whenever we encounter the fail case the scale factor is zero when we print it quickly after calling SDL_CreateWindow. After some time the value changes to a non-zero value. In the success case the scaling factor is nonzero 'immediately'. Note that we don't use that factor. We also find that the window backingScaleFactor does not show the strange behavior even in the fail case.

We have also attempted to find out whether any event triggers the transition from zero to non-zero. We found the transition happening when we call SDL_PollEvent. We can even force this to happen by explicitly adding a SDL_PollEvent at an early stage, but it will only happen if a certain amount of time elapsed, so we need to add some sleep before the call to trigger the transition at an earlier stage. All that seems to imply that the transition happens async and that SDL_PollEvent merely causes the system to update its internal state at that time.

We have also verified that the scaling setting in the preferences does NOT directly correlate to the scaling factor behavior. We find that a particular scaling setting can lead to a fail case for one resolution and a success case for another resolution. This shows that the scaling setting alone does not determine whether the problem will appear or not.

We have also verified on another Mac with 10.14 that the scaling factor is always non-zero and we always have the success case.

I have no idea how to interpret this initial-zero behavior and haven't found any usable information on the screen backing scale factor. It seems as 10.15 does some stuff more async than before and maybe the problem could be caused by unfortunate timings. I would be very interested to hear your opinion about that.

...

Finally we found the cause of all our problems: it's the origin hack in Cocoa_SetWindowFullscreen:

        /* Hack to fix origin on Mac OS X 10.4 */
        NSRect screenRect = [[nswindow screen] frame];
        if (screenRect.size.height >= 1.0f) {
            rect.origin.y += (screenRect.size.height - rect.size.height);
        }

If we comment this one out our game and testdraw2 do behave correctly.

It turns out that if a window is not fully contained in the screen, it's screen property becomes zero and therefore we saw a zero when printing the backing scale factor (although it's not clear why it became nonzero later).

We suggest to add a runtime check which skips this code for 10.15 (or possibly earlier if you happen to know that the hack is not needed for certain older versions).

More info: consider the line

NSRect screenRect = [[nswindow screen] frame];

in Cocoa_SetWindowFullscreen. We found that this rect has the dimensions of the desktop
on our OS X 10.15 setup. This is true both for the success case and the fail case. It seems as the success case is actually a fail case in disguise.

On the other Mac with OS X 10.14 the same rect has the dimension of the newly created screen. This is what I would expect, because at that time the window has already been created successfully and there should be a newly created screen associated to the window.

What are the cases in which the whole origin conversion code for the fullscreen case is supposed to have a non-trivial result?

Today we found that if we print the dimensions of [nswindow screen] later, then we find them to be correct. So the conclusion seems to be that OS X 10.15 does indeed do the window/screen setup more async than before and that the origin correction code uses the [nswindow screen] at a time where the window/screen setup isn't finalized yet.
2020-02-11 10:21:31 -08:00
Sam Lantinga
b886d3e04d Fixed bug 4748 - Calling WIN_UpdateClipCursor() / WIN_UpdateClipCursorForWindows() on WIN_PumpEvents() causes beeping and choppy mouse cursor movement, right-click doesn't work
The problem here was calling ClipCursor() continuously in a tight loop. Fixed by only calling ClipCursor() if the clip area needs to be updated.
2020-02-11 10:08:22 -08:00
Sam Lantinga
b44b56594a Don't add a frame to borderless windows.
It was done to allow hotkey resizing of borderless windows, but Windows will sometimes draw it, regardless of our WM_* message handling. See bug 4466 for more details.
2020-02-11 09:41:55 -08:00
Sam Lantinga
901b499fef Fixed bug 4709 - incorrect (not) handling of windows on-screen cursor keys
Alex Denisov

When using Win10 on-screen keyboard (tooltip.exe), the left and right cursor keys in it do not produce SDLK_LEFT and SDLK_RIGHT events.

Windows messages generated by the on-screen keyboard, for some reason, have their scancodes set to zeroes. Here is the log from Spy++:

WM_KEYDOWN nVirtKey:VK_LEFT cRepeat:1 ScanCode:00 fExtended:0 fAltDown:0 fRepeat:0 fUp:0
WM_KEYUP nVirtKey:VK_LEFT cRepeat:1 ScanCode:00 fExtended:0 fAltDown:0 fRepeat:1 fUp:1

Regular physical keyboard produces VK_LEFT (ScanCode:4B) and VK_RIGHT (ScanCode:4D) which are interpreted correctly.

With on-screen keyboard, the switch statement in VKeytoScancode() does not check for VK_LEFT and VK_RIGHT, returning SDL_SCANCODE_UNKNOWN, which in turn does not get mapped to anything (because the scan codes are zeroes).
2020-02-11 08:36:13 -08:00
Sam Lantinga
fbf6d7e237 Make it possible for the application to use different C runtime begin/end thread functions 2020-02-11 08:26:46 -08:00
Sam Lantinga
25ff055ca2 Make sure SDL_CreateThread has the same signature regardless of how the DLL was created. 2020-02-11 08:01:44 -08:00
Ryan C. Gordon
1beeec74ae wayland: Fix building with -fno-common (which is now the default in GCC 10).
Fixes Bugzilla #4957.

--HG--
extra : rebase_source : 64466e107af6f0a6c825ba2e89fb45c30b531fd5
2020-02-10 23:48:06 -05:00
Sam Lantinga
6d2f81225b Fixed compile warning 2020-02-10 13:59:05 -08:00
Fabrice Fontaine
856c909a25 src/core/linux/SDL_threadprio.c: fix build without threads
Add an include on SDL_error.h to avoid the following build failure
without threads:

/home/buildroot/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabihf/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabihf/bin/ld: build/.libs/SDL_threadprio.o: in function `SDL_LinuxSetThreadPriority_REAL':
SDL_threadprio.c:(.text+0x0): undefined reference to `SDL_Unsupported'

Fixes:
 - http://autobuild.buildroot.org/results/7f7712c5bd47de4a3fcec1e0d0526fd5a3ecd532

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-02-10 13:56:53 -08:00
Ryan C. Gordon
a76b80af17 opengl: Build out full GL_LINES and respect the diamond-exit rule.
Likewise for the GLES1 and GLES2 renderers.

This solves the missing pixel at the end of a line and removes all the
heuristics for various platforms/drivers. It's possible we could still use
GL_LINE_STRIP with this and save some vertex buffer space, assuming this
doesn't upset some driver somewhere, but this seems to be a clean fix that
makes the GL renderers match the software renderer output.

Diamond-exit rule explanation:
http://graphics-software-engineer.blogspot.com/2012/04/rasterization-rules.html

Fixes Bugzilla #3182.

--HG--
extra : rebase_source : c1728587ab719e93fc95e8b8af79413b3cae93b6
2020-02-10 12:53:54 -05:00
Sam Lantinga
8077909889 The scissor rect needs to be updated when the viewport changes in the Metal renderer 2020-02-10 09:42:53 -08:00
Sam Lantinga
0f44ae0f88 Fixed bug 4966 - KMSDRM: Add dynamic modeset support
Anthony Pesch

* Remove triple buffering support. As far as I can tell, this goes against the libdrm API; the EGL implementations themselves control the buffering. Removing it isn't absolutely necessary as it seemingly works on the Pi at least, but I noticed this while doing my work and explained my reasoning in the commit.

* Replace the crtc_ready logic which allocates an extra bo to perform the initial CRTC configuration (which is required before calling drmModePageFlip) with a call to drmModeSetCrtc after the front and back buffers are allocated, avoiding this allocation.

* Standardized the SDL_*Data variable names and null checks to improve readability. Given that there were duplicate fields in each SDL_*Data structure, having generic names such as "data" at times was very confusing.

* Removed unused fields from the SDL_*Data structures and moves all display related fields out of SDL_VideoData and into SDL_DisplayData. Not required since the code only supports a single display right now, but this was helpful in reading and understanding the code initially.

* Implement KMSDRM_GetDisplayModes / KMSDRM_SetDisplayMode to provide dynamic modeset support.

These changes have been tested on a Raspberry Pi 4 and a Dell XPS laptop with an HD 520.

As an update, I went back over the triple buffer changes and left them in. I didn't entirely get the code originally, I had just seen it calling KMSDRM_gbm_surface_lock_front_buffer twice for a single swap and had removed it because I was paranoid of bugs stemming from it while working on the modeset changes.

I've made a few small changes to the logic that had thrown me off originally and rebased the changes:
* The condition wrapping the call to release buffer was incorrect.
* The first call to KMSDRM_gbm_surface_lock_front_buffer has been removed. I don't understand why it existed.
* Added additional comments describing what was going on in the code (as it does fix the buffer release pattern of the original code before it).
2020-02-09 11:44:22 -08:00
Sam Lantinga
b727f93948 Fixed NullPointerException 2020-02-07 20:20:37 -08:00
Sam Lantinga
a345c092da Removed VID/PID 0x1532/0x0037, which was listed in the Linux kernel as a Razer Sabertooth, because at least one variant of the Razer DeathAdder mouse shows up with this VID/PID.
Specifically the Razer DeathAdder 2013 has this VID/PID
2020-02-07 20:19:32 -08:00
Sam Lantinga
66548a8bff Fixed bug 4968 - NULL passed to memcpy in WriteProprietary in SDL_hidapi_switch.c
meyraud705

In SDL_hidapi_switch.c

line 443: Function BTrySetupUSB call WriteProprietary with pBuf=NULL and ucLen=0
line 376: WriteProprietary check its input (!pBuf && ucLen > 0) || ucLen > sizeof(packet.rgucProprietaryData): ucLen is 0 so it passes
line 382: WriteProprietary call memcpy with pBuf=NULL
2020-02-07 11:49:56 -08:00
Sam Lantinga
39547c8367 Use the triggers to test rumble for more fine grained vibration feedback 2020-02-07 11:45:32 -08:00
Sam Lantinga
ee7b76f6ad Use the asynchronous HIDAPI rumble code for Nintendo Switch Pro controllers 2020-02-07 11:44:57 -08:00
Sam Lantinga
65ee09a29d Update for bug 4923 - Calling SDL_GameControllerRumble() often takes 8 ms
meyraud705

Dualshock4 on bluetooth need 78 bytes for the rumble data while SDL_HIDAPI_RumbleRequest can only hold 64 bytes.

'volatile' is not meant for thread synchronization.

The list of rumble request could grow infinitely if user call SDL_JoystickRumble too much. The documentation says "Each call to this function cancels any previous rumble effect", so overwriting pending request seem like a good idea.
2020-02-07 11:02:34 -08:00
David Ludwig
fdfa4783eb macOS: fix crash if and when joystick-init-on-add fails 2020-02-05 13:16:17 -05:00
Sam Lantinga
a8c1a21887 Updated the Android Xbox One Wireless Controller mapping for the latest Xbox controller firmware update 2020-02-05 09:29:46 -08:00
Sam Lantinga
6cd18f7cb9 Catch both PS3 and PS4 motion controls and don't treat them as a game controller 2020-02-04 18:36:23 -08:00
Sam Lantinga
12b7c0a718 Fixed Visual Studio build 2020-02-04 16:05:39 -08:00
Sam Lantinga
033cbd059b Added SDL_hidapi_rumble.c to the macOS, iOS and tvOS builds 2020-02-04 15:42:49 -08:00
Sam Lantinga
c9f0264cf3 Added SDL_hidapi_rumble.c to the Visual Studio project 2020-02-04 15:35:01 -08:00
David Ludwig
4ec6f86dcc FIX for SDL-4927: CFRetain+CFRelease a game controller's IOKit object
This fixes a crash whereby SDL could crash on macOS/Darwin, if and when a
USB game controller gets unplugged.  SDL was not retaining a reference
to the controller's OS/IOKit-provided 'device object', and was capable
of trying to use it, after a device was hot-unplugged.
2020-01-30 18:03:34 -05:00
Sam Lantinga
df5bd6eab0 Added missing files from previous commit 2020-02-04 15:27:25 -08:00
Sam Lantinga
af5eac78cd Fixed long delay on main thread caused by blocking rumble writes in HIDAPI drivers
There is now a thread that handles all HIDAPI rumble requests and a lock that guarantees that we're not reading and writing the device at the same time.
2020-02-04 15:26:56 -08:00
Sam Lantinga
e42b19fbe7 Moved rumble expiration to the main joystick handling level, and prevent sending the driver layer duplicate rumble requests. 2020-02-04 12:48:53 -08:00
Sjoerd Simons
fd93d66339 Correct joystick hat indexes on linux
The index and indices were swapped; Which is fine as long as there are
no gaps in the ABS_HAT* event availability but otherwise things do get confused.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2020-02-04 07:23:44 -08:00
Sam Lantinga
d996900e94 Fixed bug 4965 - Update the .hgignore file
Cameron Cawley

This adds a number of files used by the build systems to the .hgignore file. Most of them are for CMake, but there are other additions as well.
2020-02-03 16:38:07 -08:00
Sam Lantinga
6afe8a7c68 Fixed bug 4758 - hgignore clion build artifacts
Malte

clion builds into cmake-build-debug, cmake-build-release etc. by default. Also, it creates the .idea forlder in wich it places some (mostly local) config.

Since SDL is perfectly buildable from within the IDE, i think it'd be nice to have the build and ide artifacts ignored by hg.
2020-02-03 16:34:33 -08:00
Sam Lantinga
abc7ba38df Fixed bug 4833 - Use EGL for X11?
Martin Fiedler

To be precise, this is about *desktop OpenGL* on X11. For OpenGL ES, EGL is already used (as it's the only way to get an OpenGL ES context), as Sylvain noted above.

To shine some light on why this is needed:
In 99% of all cases, using GLX on X11 is fine, even though it's effectively deprecated in favor of EGL [1]. However, there's at least one use case that *requires* the OpenGL context being created with EGL instead of GLX, and that's DRM_PRIME interoperability: The function glEGLImageTargetTexture2DOES simply doesn't work with GLX. (Currently, Mesa actually crashes when trying that.)
Some example code:
https://gist.github.com/kajott/d1b29c613be30893c855621edd1f212e
Runs on Intel and open-source AMD drivers just fine (others unconfirmed), but with #define USE_EGL 0 (i.e. forcing it to GLX), it crashes. The same happens when using SDL for window and context creation.

The good news is that most of the pieces for EGL support on X11 are already in place: SDL_egl.c is pretty complete (and used for desktop OpenGL on Wayland, for example), and SDL_x11opengl.c has the aforementioned OpenGL-ES-on-EGL support. However, when it comes to desktop OpenGL, it's hardcoded to fall back to GLX.

I'm not advocating to make EGL the default for desktop OpenGL on X11; don't fix what ain't broken. But something like an SDL_HINT_VIDEO_X11_FORCE_EGL would be very appreciated to make use cases like the above work with SDL.


[1] source: Eric Anholt, major Linux graphics stack developer, 7 years ago already - see last paragraph of https://www.phoronix.com/scan.php?page=news_item&px=MTE3MTI
2020-02-03 08:06:52 -08:00
Sam Lantinga
03d12f8b27 Fixed bug 4917 - Wayland: handle discrete pointer axis events
Luis Caceres

The current handling of Wayland mouse pointer events only handles wl_pointer.axis events, which, according to the Wayland documentation, deal with mouse wheel scroll events on a continuous scale. While this is reasonable for some input sources (e.g. touchpad two-finger scrolling), it is not for mouse wheel clicks which generate wl_pointer.axis events with large deltas.

This patch adds handling for wl_pointer.axis_discrete and wl_pointer.frame events and prefers to report SDL_MouseWheelEvent in discrete units if they are available. This means that for mouse wheel scrolling we count in clicks, but for touchpad two-finger scrolling we still use whatever units Wayland uses. This behaviour is closer to that of the X11 backend.

Since these events are only available since version 5 of the wl_seat interface, this patch also checks for this and falls back to the previous behaviour if its not available. I also had to add definitions for some of the pointer and keyboard events specified in versions 2-5 but these are just stubs and do nothing.
2020-02-03 00:57:12 -08:00
Sam Lantinga
a36dd13a17 Fixed the hidapi Info.plist for submission to the Apple App Store 2020-02-03 00:51:35 -08:00
Sam Lantinga
cfd79a1d7d Fixed build warnings on Android 2020-02-01 09:23:04 -08:00
Sam Lantinga
fc2b49e423 Map the right pad on the Steam Controller to the right stick in the game controller API 2020-01-31 14:09:23 -08:00
Sam Lantinga
cc3c1b3a14 Build the hidapi framework and weak link it on Mac OS X 2020-01-31 13:09:20 -08:00
Sam Lantinga
170f13b447 Weak link the hidapi framework on iOS and tvOS 2020-01-31 10:45:04 -08:00
Sam Lantinga
4d8d167149 Build hidapi as a framework on iOS, so it can be linked by the application as well. 2020-01-30 16:02:56 -08:00
Sam Lantinga
2b5945f9e8 Fixed build 2020-01-30 14:58:41 -08:00
Sam Lantinga
4c9d146dd8 More Xcode project improvements 2020-01-30 14:53:18 -08:00
Sam Lantinga
1ea93f060e Export SDL functions for iOS application delegates 2020-01-30 14:51:33 -08:00
Ryan C. Gordon
b0b11fbda9 test: Common framework now accepts --usable-bounds command line argument. 2020-01-30 13:47:48 -05:00
Ryan C. Gordon
20bbf48239 test: change path in a comment from '\\' to '/' char. Nothing serious here. 2020-01-30 13:47:19 -05:00
Sam Lantinga
3d0db544bf Added missing file from previous commit 2020-01-29 20:09:59 -08:00
Sam Lantinga
6a79b6a734 Added a unified Xcode project for macOS, iOS and tvOS 2020-01-29 20:09:18 -08:00
Sam Lantinga
3b021949fa Fixed compiler warning 2020-01-29 20:09:16 -08:00
Sam Lantinga
455ec28f0f Added SDL_hidapi_steam.c to the iOS and tvOS dylib build targets 2020-01-29 20:09:14 -08:00
Sam Lantinga
1e33532e50 There are lots of unused macros in the Steam controller code 2020-01-29 20:09:12 -08:00
Sam Lantinga
8a6c3acb7e Added support for the Steam Controller on mobile devices 2020-01-29 20:09:11 -08:00
Sam Lantinga
443729e39d Miscellaneous pending fixes 2020-01-29 20:09:08 -08:00
Sam Lantinga
b3e4cf8e4f Fixed member order to make more sense 2020-01-28 21:41:13 -08:00
Sam Lantinga
a8f3dbf7be Fixed wired PS4 controller support on Android 2020-01-28 17:11:17 -08:00
Ryan C. Gordon
b1dd63a269 x11: Use XSync when changing window position instead of XFlush.
Attempt to fix regression in Bugzilla #4646.
2020-01-28 13:51:24 -05:00
Ryan C. Gordon
508fce096a cocoa: Fix command line apps' menu bar not working on macOS Catalina.
Fixes Bugzilla #4937.
2020-01-27 17:15:12 -05:00
Ryan C. Gordon
5308e7993a darwin: Don't pass NULL device refs to IOHIDDeviceGetValue().
Possibly fixes Bugzilla #4961.
2020-01-27 15:44:48 -05:00
Ryan C. Gordon
c7d5f21176 video: Added a hint to override the display's usable bounds. 2020-01-27 10:58:30 -05:00
Sam Lantinga
3f01bf0a7a Fixed bug 4898 - No rumble because of integer overflow in SDL_JoystickRumble
meyraud705

Switch hidapi and xinput also need to check for overflow, attached a patch for them.
2020-01-26 12:48:35 -08:00
Sam Lantinga
6db8daca3e Don't enumerate devices we can't open 2020-01-26 12:40:32 -08:00
Sam Lantinga
89cf11c987 Fixed disabling the Xbox 360 wireless HIDAPI driver 2020-01-26 10:32:39 -08:00
Sam Lantinga
604d10b517 Always release devices in onPause in case we're going to be force stopped, and for consistency with interacting with other activities that might use the controller 2020-01-26 00:37:48 -08:00
Sam Lantinga
4181e6f181 Fixed compiler warnings 2020-01-23 22:24:24 -08:00
Sam Lantinga
fb59a7e956 Fixed mapping for both versions of the Xbox One Elite Series 2 controller firmware connecting over Bluetooth 2020-01-23 12:53:43 -08:00
Sam Lantinga
195a231caa Added mapping for the Xbox One controller connected via the wireless dongle using xow 2020-01-23 12:53:41 -08:00
Sam Lantinga
11096b51bc Turn off rumble on drivers which don't respect the replay.length value 2020-01-23 12:53:39 -08:00
Sam Lantinga
db64b5bcd6 SDL_LEAN_AND_MEAN defaults off 2020-01-23 01:03:23 -08:00
Sam Lantinga
fb74de4aad Added a single SDL_LEAN_AND_MEAN define to turn on minimal SDL builds
Protected more code with #ifdefs to reduce the size of minimal shared library builds
2020-01-23 01:00:52 -08:00
Sam Lantinga
a93c8d814a Fixed compile warning 2020-01-23 00:32:34 -08:00
Sam Lantinga
b39a795160 Added support for the paddles on the Xbox One Elite Series 1 controller 2020-01-22 11:28:35 -08:00
Sylvain Becker
b5d5e0cd20 Documentation of the footprint #defines 2020-01-22 15:23:44 +01:00
Ryan C. Gordon
9602ea47ed audio: Fixed a '//' style comment. 2020-01-21 17:40:16 -05:00
Ryan C. Gordon
6ee83a5626 audio: Calculate a legitimate SDL_AudioSpec::silence in SDL_LoadWAV_RW().
--HG--
extra : rebase_source : df12ee7fe34175ae2645925f5ba0fdf9d831ea9e
2020-01-21 15:49:37 -05:00
Sylvain Becker
fa93bdd2b9 Add #define SDL_HAVE_BLIT_N_RGB565 to compile out RGB565 LUT 2020-01-21 22:06:09 +01:00
Sylvain Becker
082ca2c747 A few #defines to reduce SDL2 footprint.
Only applied when library is statically linked
2020-01-21 21:33:40 +01:00
Sam Lantinga
ff0611aca9 The Xbox One 0x01 initialization packet is an ack packet 2020-01-20 13:53:40 -08:00
Sam Lantinga
1056ac9d31 Refactored code so SDL_GetJoystickGameControllerType() is called less during controller detection 2020-01-19 11:43:36 -08:00
Sam Lantinga
9c09177e2e Added missing file from previous commit 2020-01-18 11:21:42 -08:00
Sam Lantinga
694ebfdff3 Added support for detecting previously unknown Xbox 360 and Xbox One controllers using the HIDAPI driver with libusb and Android 2020-01-18 11:21:14 -08:00
Sam Lantinga
3c9d888dff There are multiple bindings for XBox One controller model 1708, depending on firmware revision 2020-01-17 11:09:57 -08:00
Sam Lantinga
e67d3e73a0 Added support for the NACON GC-400ES 2020-01-17 11:07:19 -08:00
Sam Lantinga
419b65f816 On Mac OSX there are spurious hat events at program start, so skip these 2020-01-17 11:06:02 -08:00
Sam Lantinga
d0f97f6537 Reattach the kernel driver after closing USB controllers 2020-01-17 10:43:14 -08:00
Sylvain Becker
a87e8ff1a6 Android: prevents rare crashes when app goes to background or ends.
Make sure the thread is actually paused, and context backep-up, before
SurfaceView is destroyed (eg surfaceDestroyed() actually returns).

Add a timeout when surfaceDestroyed() is called, and check 'backup_done' variable.

It prevents crashes like:

  #00  pc 000000000000c0d0  /system/lib64/libutils.so (android::RefBase::incStrong(void const*) const+8)
  #01  pc 000000000000c7f4  /vendor/lib64/egl/eglSubDriverAndroid.so (EglAndroidWindowSurface::UpdateBufferList(ANativeWindowBuffer*)+284)
  #02  pc 000000000000c390  /vendor/lib64/egl/eglSubDriverAndroid.so (EglAndroidWindowSurface::DequeueBuffer()+240)
  #03  pc 000000000000bb10  /vendor/lib64/egl/eglSubDriverAndroid.so (EglAndroidWindowSurface::GetBuffer(EglSubResource*, EglMemoryDesc*)+64)
  #04  pc 000000000032732c  /vendor/lib64/egl/libGLESv2_adreno.so (EglWindowSurface::UpdateResource(EsxContext*)+116)
  #05  pc 0000000000326dd0  /vendor/lib64/egl/libGLESv2_adreno.so (EglWindowSurface::GetResource(EsxContext*, EsxResource**, EsxResource**, int)+56)
  #06  pc 00000000002ae484  /vendor/lib64/egl/libGLESv2_adreno.so (EsxContext::AcquireBackBuffer(int)+364)
  #07  pc 0000000000249680  /vendor/lib64/egl/libGLESv2_adreno.so (EsxContext::Clear(unsigned int, unsigned int, unsigned int, EsxClearValues*)+1800)
  #08  pc 00000000002cb52c  /vendor/lib64/egl/libGLESv2_adreno.so (EsxGlApiParamValidate::GlClear(EsxDispatch*, unsigned int)+132)
2020-01-17 12:41:54 +01:00
Sylvain Becker
8cf14d6373 Fixed bug 4246 - Android: orientation between portrait<->landscape doesn't work
Improve handling of landscape/portrait orientation. Promote to SCREEN_ORIENTATION_SENSOR_* when needed.
Android window can be somehow resizable.
If SDL_WINDOW_RESIZABLE is set, window size change is allowed, for instance when orientation changes (provided the hint allows it).
2020-01-17 12:04:18 +01:00
Sam Lantinga
6b6170caf6 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Sam Lantinga
5fff262f77 Fixed bug 4929 - Software renderer produces bugs when optimizations are turned on with Visual C++ 2019
Konrad

I took the liberty of rewriting this function a bit as it seemed to be unnecessary extended with ifs regarding flags (we can check everything in one pass which seem to be the thing which confuses Visual C++ 2019 as well).

Also, I have made CPU features an int instead of uint because if we check it against flags which are all ints it might as well just be int (no signed/unsigned bitwise comparison).
2020-01-16 15:54:20 -08:00
Sam Lantinga
25c5d56c04 Added support for the paddles on the Xbox One Elite Series 2 controller 2020-01-16 15:32:41 -08:00
Sam Lantinga
40811164b0 Improved Xbox One controller initialization 2020-01-16 15:32:39 -08:00
Sam Lantinga
7328bbad9e Fixed bug 4903 - Lack of color multiply with alpha (SDL_BLENDMODE_MOD + SDL_BLENDMODE_BLEND) blending mode for all renderers
Konrad

This kind of blending is rather quite useful and in my opinion should be available for all renderers. I do need it myself, but since I didn't want to use a custom blending mode which is supported only by certain renderers (e.g. not in software which is quite important for me) I did write implementation of SDL_BLENDMODE_MUL for all renderers altogether.

SDL_BLENDMODE_MUL implements following equation:

dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
dstA = (srcA * dstA) + (dstA * (1-srcA))

Background:

https://i.imgur.com/UsYhydP.png

Blended texture:

https://i.imgur.com/0juXQcV.png

Result for SDL_BLENDMODE_MOD:

https://i.imgur.com/wgNSgUl.png

Result for SDL_BLENDMODE_MUL:

https://i.imgur.com/Veokzim.png

I think I did cover all possibilities within included patch, but I didn't write any tests for SDL_BLENDMODE_MUL, so it would be lovely if someone could do it.
2020-01-16 08:52:59 -08:00
Sam Lantinga
0cb537758c Improved Xbox One controller initialization sequence
This sequence works across Microsoft, PowerA, PDP, and HORI controllers.
The newer Microsoft XBox firmware requires synchronizing the rumble sequence number, when SDL sees it after the initial connect
The Razer Wildcat controller requires waiting for init responses before continuing the initialization sequence.
The PDP Battlefield 1 controller takes over a second to be ready for initialization, and if initialization is attempted before then, it will fail.
2020-01-15 22:18:31 -08:00
Sam Lantinga
f1e568d3d0 Added support for the HORI Fighting Commander 2020-01-15 22:18:29 -08:00
Sam Lantinga
5b2a9cbafa Added D-PAD bindings for the Linux Steam Controller 2020-01-13 22:05:58 -08:00
Sam Lantinga
5e165b3bae Fixed compiler warning 2020-01-13 22:05:56 -08:00
Sam Lantinga
e1565fc8da Fixed deadlock in HIDAPI joystick system 2020-01-13 22:05:54 -08:00
Sam Lantinga
6ad79df252 Free the joystick player index when the joystick is removed 2020-01-13 15:35:54 -08:00
Sam Lantinga
ed187bc102 Added support for claiming individiual interfaces on USB devices on Android
This is needed for supporting multiple wireless Xbox 360 controllers
2020-01-13 15:35:52 -08:00
David Ludwig
e3cfa32791 Emscripten: build fix for testoverlay2.c
--HG--
extra : rebase_source : 9aae22ee4e151f5ebbbc93c7701787723378b7e7
2020-01-13 11:46:17 -05:00
Sam Lantinga
a32f50d3f1 Fixed error formatting 2020-01-13 08:12:10 -08:00
Sam Lantinga
a0f8072797 Send the full Xbox One controller sequence for Microsoft controllers
This switches Bluetooth controllers back into USB report mode for the latest Xbox One S and Xbox One Elite Series 2 firmware
2020-01-12 17:22:24 -08:00
Sam Lantinga
0119b26859 Fixed NEON detection on arm64 CPUs
This probably breaks RISCOS, but we need a better fix from Cameron Cawley for this
2020-01-11 22:03:06 -08:00
Sam Lantinga
9f8f58970e Worked around an issue where the kernel would lose the force feedback effect 2020-01-11 13:38:50 -08:00
Sam Lantinga
eac8622569 Add the destination format to the error when conversion isn't possible 2020-01-11 04:38:13 -08:00
Sam Lantinga
f63770922e The Xbox One S Bluetooth controller with older firmware uses b16 as the guide button. The same controller with newer firmware uses b12 as the guide button. Map both buttons so both firmware revisions will work with the same mapping. 2020-01-11 04:34:28 -08:00
Sam Lantinga
4d689c2a25 The Amlogic TVB-906X is Android TV 2020-01-11 04:34:23 -08:00
Sam Lantinga
6fad317398 Only initialize Xbox One controllers once they're ready for initialization (or if they are silent until init)
This fixes the Hyperkin Duke Xbox One controller showing the Xbox startup animation every time an SDL application launches
2020-01-09 14:53:34 -08:00
Sam Lantinga
c76bfc125b Fixed crash when unplugging a HIDAPI controller 2020-01-09 14:53:30 -08:00
Sam Lantinga
0a7fc0f837 Added support for the updated Hyperkin Duke Xbox One controller 2020-01-08 18:55:53 -08:00
Sam Lantinga
1474479300 Fixed handling the 8BitDo M30 in Nintendo Switch mode 2020-01-07 16:47:56 -08:00
Sam Lantinga
59b174ed8a Added support for the 8BitDo M30 GamePad 2020-01-07 18:43:40 -08:00
Cameron Cawley
176539d9db riscos: Add CPU feature detection 2020-01-06 20:26:52 +00:00
Sam Lantinga
073cb5abd1 Added support for the 8Bitdo FC30 Pro 2020-01-06 12:18:51 -08:00
Sam Lantinga
22b126541f Fixed bug 4928 - CMakeLists.txt: put cmake package helpers in proper libdir
Tiago O.

Use LIB_SUFFIX variable to determine the correct path.
2020-01-06 07:06:58 -08:00
"Dmitry V. Levin"
a86389ebc1 X11_InitKeyboard: do not call XAutoRepeatOn unnecessarily
Use XGetKeyboardControl to initialize the current XKeyboardState, and
skip XAutoRepeatOn invocation if global_auto_repeat is AutoRepeatModeOn.

This fixes SDL2 when the X11 client is untrusted.
2020-01-04 11:05:06 -08:00
"Dmitry V. Levin"
8d5f91014a have_mitshm: use XShmQueryExtension to check for MIT-SHM extension
Do not try to guess MIT_SHM extension availability from the string
returned by XDisplayName, use the appropriate API instead.

This fixes SDL2 inside hasher.
2020-01-04 11:03:04 -08:00
Michael Forney
887f98ae5d wayland: support wl_data_device_manager version < 3 2019-12-29 23:10:39 -08:00
Sam Lantinga
4dac206154 Added support for the Hyperkin Duke controller 2020-01-01 08:13:40 -08:00
Sam Lantinga
4a9801918a Fixed bug 4357 - iosbuild.sh broken with SDL 2.0.9
Christoph Charles

The new source files for coremotion sensors don't seem to have been included correctly in configure.in. This leads to the build script ios-build.sh to fail at link time, complaining about missing symbols, namely about missing SDL_COREMOTION_SensorDriver.
2019-12-31 10:40:30 -08:00
Sam Lantinga
9fb5983ebe Fixed GameCube controller axis and trigger ranges and X and B button being swapped 2019-12-30 17:56:56 -08:00
Sam Lantinga
16c3b3b338 Fixed bug 4920 - Wider support for seconds of battery life left on Linux platforms using sys interface
Murad

On my system, SDL_GetPowerInfo() returns -1 seconds of battery life left. I have quickly investigated that in my case SDL uses sys interface to get battery data. It tries to read "time_to_empty_now" file which is not always present. However, it is still possible to calculate remaining lifetime using "energy_now" and "power_now" files. This is what my simple patch (included as attachment) tries to accomplish.
Best wishes.
2019-12-30 13:21:47 -08:00
Sam Lantinga
256cfd4477 Fixed bug 4918 - SDL failed to build due to error LNK2019: unresolved external symbol memset referenced in function SDL_SetJoystickIDForPlayerIndex with MSVC x64 on Windows
LinGao

We build SDL with Visual studio 2017 compiler on Windows Server 2016, but it failed to build due to error LNK2019: unresolved external symbol memset referenced in function SDL_SetJoystickIDForPlayerIndex with MSVC x64 on Windows on latest default branch. And we found that it can be first reproduced on 6c431d30a6df changeset. Could you please help have a look about this issue? Thanks in advance!

Steps to Reproduce:
1.hg clone https://hg.libsdl.org/SDL D:\SDL\src
2.Open a VS 2017 x64 command prompt as admin and browse to D:\SDL
3.msbuild /p:Configuration=Release /p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17134.0 VisualC\SDL.sln /t:Rebuild

Actual result:
 Creating library D:\SDL\src\VisualC\x64\Release\SDL2.lib and object D:\SDL\src\VisualC\x64\Release\SDL2.exp
SDL_joystick.obj : error LNK2019: unresolved external symbol memset referenced in function SDL_SetJoystickIDForPlayerIndex [D:\SDL\src\VisualC\SDL\SDL.vcxproj]
D:\SDL\src\VisualC\x64\Release\SDL2.dll : fatal error LNK1120: 1 unresolved externals [D:\SDL\src\VisualC\SDL\SDL.vcxproj]
Done Building Project "D:\SDL\src\VisualC\SDL\SDL.vcxproj" (Rebuild target(s)) -- FAILED.
2019-12-30 13:18:57 -08:00
Sam Lantinga
440864883d Removed unnecessary setlocale() on Mac
240bad3b66
2019-12-30 11:09:03 -08:00
Sam Lantinga
af2ef9e019 Added support for the Nintendo GameCube adapter, tested on Steam Link hardware 2019-12-30 09:44:32 -08:00
Ozkan Sezer
6861da9ef2 SDL_x11events.c (X11_DispatchEvent): remove FIXME and use SDL_strtokr(). 2019-12-27 23:01:10 +03:00
Ozkan Sezer
cbf70cfa54 Fix build error in SDL_render_metal.m (bug #4916.)
Patch provided by Konrad. Error was introduced by commit 35f99d918ca2 for bug #4914.
2019-12-23 19:55:10 +03:00
Sylvain Becker
fa8d0cced7 SDL_ScaleMode: fix compilation GLES renderer 2019-12-23 16:47:00 +01:00
Ryan C. Gordon
179bc26a62 direct3d11: Always set vertex buffers when updating them (thanks, Konrad!).
Fixes Bugzilla #4913.
2019-12-22 20:48:43 -05:00
Sam Lantinga
b6744ae1c2 Fixed bug 4910 - Missing joystick-driver type check in haptic
meyraud705

On Linux and MacOS, some haptic system functions access joystick->hw_data without checking the driver type.
2019-12-22 13:56:50 -08:00
Cameron Gutman
591bf09c87 Use IOHIDManagerRegisterDeviceRemovalCallback() to monitor for HID removal
The function we currently use, IOHIDDeviceRegisterRemovalCallback(), often
fails on Catalina with a "__CFRunLoopModeFindSourceForMachPort returned NULL"
error message. Once a removal callback is missed, we will eventually crash when
the joystick is closed attempting to use the invalid IOHIDDeviceRef.

https://forums.developer.apple.com/thread/124444
2019-12-20 22:25:49 -08:00
Sam Lantinga
1b32b0934a Fixed bug 4911 - Build broken when hidapi enabled
meyraud705

SDL_hidapi.c is added twice to 'SOURCES' which causes "multiple definition error" when linking.
2019-12-22 13:42:20 -08:00
Sam Lantinga
b88aaba9c1 Fixed bug 4914 - Expose SDL_ScaleMode and add SDL_SetTextureScaleMode/SDL_GetTextureScaleMode
Konrad

This was something rather trivial to add, but asked at least several times before (I did google about it as well).

It should be possible to dynamically change scaling mode of the texture. It is actually trivial task, but until now it was only possible with a hint before creating a texture.

I needed it for my game as well, so I took the liberty of writing it myself.

This patch adds following functions:

SDL_SetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode scaleMode);
SDL_GetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode *scaleMode);

That way you can change texture scaling on the fly.
2019-12-22 13:39:44 -08:00
Zack Middleton
0d52bf57d7 Fix shutting down HIDAPI device with multiple joysticks
Using Wii U GameCube USB adapter with multiple controllers attached and
restarting SDL input in a game results in extra joysticks with NULL name.

HIDAPI_CleanupDeviceDriver() shut down joysticks by iterating through
device->num_joysticks but each HIDAPI_JoystickDisconnected() decreases
device->num_joysticks and shifts joysticks array down. Resulting in only
half of controllers being shutdown. It worked with only 1 controller
attached though.

Disconnect HIDAPI device joystick 0 until there are none left.
2019-12-22 13:15:11 -08:00
Sam Lantinga
404d56d564 Fixed windows build 2019-12-21 22:33:21 -08:00
Sylvain Becker
cc7a10af34 Android: same way as in nativePause(), resume events are sent from SDL thread 2019-12-21 22:40:33 +01:00
Sylvain Becker
4247051270 Android: fix call of glFinish without context.
Message in the log, when going to background:
"call to OpenGL ES API with no current context (logged once per thread)"

Because of SDL_WINDOWEVENT_MINIMIZED is sent from the Java Activity thread.
It calls SDL_RendererEventWatch(), _WindowEvent() and glFinish() without context.

Solution is to move sending of SDL_WINDOWEVENT_MINIMIZED to the SDL thread.
2019-12-21 21:18:02 +01:00
Sam Lantinga
d53cdbda64 Added support for the Hori Dragon Quest Slime Controller 2019-12-20 21:40:28 -08:00
Sam Lantinga
026b3a0502 Fixed duplicate controller entries on Mac OS X when using libusb, due to the HID interface number not being available in the Mac OS X HID code. 2019-12-20 21:00:16 -08:00
Sam Lantinga
c759387989 Automatically assign player indexes to game controllers, and allow changing the player index for game controllers and joysticks.
Added the functions SDL_JoystickFromPlayerIndex(), SDL_JoystickSetPlayerIndex(), SDL_GameControllerFromPlayerIndex(), and SDL_GameControllerSetPlayerIndex()
2019-12-20 20:12:03 -08:00
Sylvain Becker
c4b62cfd9d Android: fix IllegalStateException in onBackPressed()
Rare exception, not catch-able, which appears when the activity gets in a broken
state.

java.lang.IllegalStateException:
  at android.app.FragmentManagerImpl.checkStateLoss (FragmentManagerImpl.java:1323)
  at android.app.FragmentManagerImpl.popBackStackImmediate (FragmentManagerImpl.java:493)
  at android.app.Activity.onBackPressed (Activity.java:2215)
  at org.libsdl.app.SDLActivity.onBackPressed (SDLActivity.java)
  at android.app.Activity.onKeyUp (Activity.java:2193)
  at android.view.KeyEvent.dispatch (KeyEvent.java:2685)
  at android.app.Activity.dispatchKeyEvent (Activity.java:2423)
  at org.libsdl.app.SDLActivity.dispatchKeyEvent (SDLActivity.java)
2019-12-20 15:58:59 +01:00
Ozkan Sezer
4bebd710c5 fix xcode project file permissions 2019-12-20 14:33:37 +03:00
Paul Cercueil
9b7675d26e kmsdrm: Fix busy-loop within libc's dlopen()
For some obscure reason, the order in which the libdrm/libgbm libraries
are loaded matters.

Without this fix, the first call to check_modesetting() will work and
load then unload all symbols properly, but the second call to this
function will lock up as soon as dlopen() is called on libdrm.

Swapping the order in which the libdrm and libgbm libraries are loaded
is enough to fix (or work around?) this issue.

Fixes #4891:
https://bugzilla.libsdl.org/show_bug.cgi?id=4891

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2019-12-19 21:47:43 -08:00
Sam Lantinga
53fc83833c Make sure the Xbox 360 driver doesn't try to talk to the wireless controllers 2019-12-19 21:45:44 -08:00
Sam Lantinga
3a677a597a Fixed rare infinite rumble in HIDAPI controller driver 2019-12-19 18:03:28 -08:00
Sam Lantinga
c036e9abd5 Fixed GameCube rumble 2019-12-19 18:00:08 -08:00
Sam Lantinga
418e577f33 Added support for the Nintendo GameCube Controller, using the Mayflash GameCube adapter. 2019-12-19 16:14:22 -08:00
Sam Lantinga
fdfdaf1dc5 Fixed compiler warning 2019-12-19 15:58:16 -08:00
Sam Lantinga
9b213b6e89 Backed out debug code 2019-12-19 15:21:44 -08:00
Sam Lantinga
6e81827e7c Added new HIDAPI driver files to the Xcode projects 2019-12-19 15:18:50 -08:00
Sam Lantinga
21fecce4cf Added new HIDAPI driver files to the Visual Studio project 2019-12-19 15:12:36 -08:00
Sam Lantinga
053b8072d1 Added missing files from previous commits 2019-12-19 15:02:12 -08:00
Sam Lantinga
b560b700c4 Added an untested driver for the Nintendo GameCube adapter, based on code contributed by Ethan Lee 2019-12-19 15:01:35 -08:00
Sam Lantinga
3092fedc53 Added support for wireless Xbox 360 controllers using the HIDAPI driver 2019-12-19 15:01:32 -08:00
Sam Lantinga
f57af100a0 Refactored HIDAPI controller code to support dongles and hubs that dynamically attach controllers 2019-12-19 15:01:30 -08:00
Sylvain Becker
55181836c4 Fixed bug 4906 - Pressing Back button terminates app after SDL_StartTextInput 2019-12-19 13:54:03 +01:00
Sam Lantinga
93d3c202dc Fixed compiler warning 2019-12-19 04:31:00 -08:00
Sam Lantinga
f85f872ffa Added Android support for the Hyperkin X91 and the SteelSeries Stratus Duo 2019-12-17 12:03:57 -08:00
Sam Lantinga
c8e1fc78c4 Added support for the SteelSeries Stratus Duo 2019-12-16 17:11:23 -08:00
Sam Lantinga
a5d0b5b7f0 Update for bug 4883 - Add approximation for display DPI on iOS
Aaron Barany

I realized I made a minor mistake in my patch: I changed the constructor prototype for SDL_DisplayData, but didn't update the declaration in the .h file. The compiler and linker don't complain, but it would probably be best to fix in case a later change runs into a problem from the mismatch. I have attached a patch to fix this.
2019-12-16 10:26:36 -08:00
Sam Lantinga
d131b3ddc1 Fixed bug 4898 - No rumble because of integer overflow in SDL_JoystickRumble
meyraud705

On a Dualshock 4 controller using hidapi driver, calling SDL_JoystickRumble with a duration too long (SDL_HAPTIC_INFINITY for example) causes the rumble to stop immediately.

This happens because of integer overflow on line 301 of SDL_hidapi_ps4.c
(https://hg.libsdl.org/SDL/file/99ecd178999f/src/joystick/hidapi/SDL_hidapi_ps4.c#l301), which sets expiration time in the past.
2019-12-16 10:20:03 -08:00
Sam Lantinga
f403f9cb0f Fixed binding D-pad on NES30 controller 2019-12-12 19:07:26 -08:00
Sam Lantinga
f0835c2350 Added mappings for the Razer Serval on Windows and Mac OSX 2019-12-13 16:12:41 -08:00
Sam Lantinga
58651287b9 Added support for the 8Bitdo NES30 GamePad in wired mode 2019-12-13 16:12:39 -08:00
Sam Lantinga
56ac21844c Enable the LED on PowerA Xbox One controllers 2019-12-13 16:12:37 -08:00
Sam Lantinga
02463ccfff Added support for the BDA XB1 Spectra Pro 2019-12-13 16:12:35 -08:00
Sam Lantinga
fbcacffa2a Identified the BDA XB1 Classic Controller 2019-12-13 16:12:33 -08:00
Sam Lantinga
ccbde816a1 Added general remapping of controller manufacturer 2019-12-13 16:07:25 -08:00
Sam Lantinga
dde1bd4cdc Added support for the HORI PAD A 2019-12-13 16:07:22 -08:00
Sam Lantinga
8ac86ac57e Strip trailing whitespace on controller manufacturer identification 2019-12-12 19:14:37 -08:00
Sam Lantinga
1cc6f31e2d Fixed Xbox 360 Controller support using libusb on Linux 2019-12-12 14:26:34 -08:00
Sam Lantinga
7b73e5ebb4 Fixed comment typo 2019-12-12 14:25:02 -08:00
Sylvain Becker
de82351aaa Android: use SDL_arraysize() 2019-12-12 20:33:11 +01:00
Sylvain Becker
72b24b1874 Android: use 'RegisterNatives' to export the native methods
"The advantages of RegisterNatives are that you get up-front checking
that the symbols exist, plus you can have smaller and faster shared
libraries by not exporting anything but JNI_OnLoad"

https://developer.android.com/training/articles/perf-jni#native-libraries
2019-12-12 18:38:36 +01:00
Sam Lantinga
e1ba2389e4 Added names for official Microsoft controllers, since they don't have descriptive product names 2019-12-11 19:24:40 -08:00
Sam Lantinga
56c692238c Added custom names for some controllers 2019-12-11 17:47:01 -08:00
Sam Lantinga
becf554a56 Shorten "Performance Designed Products" to "PDP" 2019-12-11 17:46:59 -08:00
Sam Lantinga
b0b7783e08 Added support for the full line of PDP Xbox 360 and Xbox One controllers 2019-12-11 17:46:57 -08:00
Sam Lantinga
3a7b1e1a33 Use the controller product string instead of hard-coding controller names 2019-12-11 17:46:54 -08:00
Sam Lantinga
f7fcedea2c Added support for the Razer Raion Fightpad for PS4 2019-12-10 13:09:52 -08:00
Sam Lantinga
b9bcbcf0fa Add the manufacturer to the joystick name on Mac OS X, for consistency with other drivers 2019-12-10 11:46:22 -08:00
Sam Lantinga
f40a11945f Remove any duplicate manufacturer in the joystick name 2019-12-10 11:30:56 -08:00
Sam Lantinga
7a51772418 Don't include the manufacturer if it's already included in the product string 2019-12-10 10:00:49 -08:00
Sam Lantinga
77784463c1 Fixed the name of the Razer RAION Fightpad 2019-12-10 09:38:10 -08:00
Sam Lantinga
60d180e428 Fixed rumble after Xbox controller initialization
When we initialize the controller it has an internal rumble sequence number, and if our rumble sequence number doesn't match that, rumble won't happen. To fix that we cycle through the range of sequence numbers, and at some point we'll match up with the controller's sequence number and it'll roll forward until it matches our next rumble sequence number.
2019-12-09 16:52:11 -08:00
Sam Lantinga
662e995ae9 The PowerA Mini controller blocks while writing feature reports, so don't try to use the HIDAPI driver for it on Linux 2019-12-09 13:54:05 -08:00
Sam Lantinga
80bc288d57 Added some missing Xbox controller names 2019-12-09 13:54:03 -08:00
Sam Lantinga
91b24c357b Fixed bug 4883 - Add approximation for display DPI on iOS
Aaron Barany

There appears to be no way to directly access the display DPI on iOS, so as an approximation the DPI for the iPhone 1 is used as a base value and is multiplied by the screen's scale. This should at least give a ballpark number for the various screen scales. (based on https://stackoverflow.com/questions/25756087/detecting-iphone-6-6-screen-sizes-in-point-values it appears that both 2x and 3x are used)

I have updated the patch to use a table of current devices and use a computation as a fallback. I have also updated the fallback computation to be more accurate.
2019-12-08 11:36:40 -08:00
Sam Lantinga
9c591a8538 Fixed bug 4890 - Add hint for SDL that the graphics context is externally managed
Aaron Barany

Add SDL_HINT_VIDEO_EXTERNAL_CONTEXT hint to notify SDL that the graphics context is external. This disables the automatic context save/restore behavior on Android and avoids using OpenGL by default when SDL_WINDOW_VUKLAN isn't set.

When the application wishes to manage the OpenGL contexts on Android, this avoids cases where SDL unbinds the context and creates new contexts, which can interfere with the application's operation.

When using Vulkan and Metal renderer implementations, this avoids SDL forcing OpenGL to be enabled on certain platforms. While using the SDL_WINDOW_VULKAN flag can be used to achieve the same thing, it also causes Vulkan to be loaded. If the application uses Vulkan directly, this is not necessary, and fails window creation when using Metal due to Vulkan not being present. (assuming MoltenVK isn't installed)
2019-12-08 11:33:06 -08:00
Sam Lantinga
0bac215ef1 Fixed the Apple TV remote menu button on tvOS 13.2 (thanks Romain Tisserand) 2019-12-06 13:48:13 -08:00
Sam Lantinga
1261b79fa7 Fixed the game controller menu button on tvOS 13.2 (thanks Romain Tisserand) 2019-12-06 13:48:10 -08:00
Ryan C. Gordon
d4ae38e3de cocoa: Patched to compile on older compilers.
--HG--
extra : rebase_source : 5208ac48839c78cc7c88614cf5eceab92a0d79fc
2019-12-05 17:27:06 -05:00
Sam Lantinga
fa5fc94422 Fixed controller mapping issues caused by PS3 gyro jitter 2019-12-05 13:48:08 -08:00
Sam Lantinga
54dbdfc8eb Ignore axis jitter when mapping controllers 2019-12-05 13:18:56 -08:00
Sam Lantinga
e3ef217e93 Get full axis range for PS3 controller triggers on Linux 2019-12-05 13:18:53 -08:00
Ryan C. Gordon
bf9b22caa9 cocoa: SDL_GetDisplayDPI() should account for Retina displays.
Fixes Bugzilla #4856.
2019-12-04 12:20:24 -05:00
Sam Lantinga
eef3b51057 Fixed bug 4882 - Fix build for iOS when disabling OpenGL
Aaron Barany

Since OpenGL is deprecated on iOS, it is advantageous to be able to remove all OpenGL related code when building SDL for iOS. This patch adds the necessary #if checks to compile in this case.
2019-12-03 22:07:58 -08:00
Alex Smith
d3aa0260ee Fix sending SDL_WINDOWEVENT_RESTORED after unminimizing windows on X11
SDL_SendWindowEvent will only send a RESTORED event if the window has
the minimized or maximized flag set. However, for a SHOWN event, it
will clear the minimized flag. Since the SHOWN event was being sent
first for a MapNotify event, the RESTORED event would never be sent.
Swapping the SendWindowEvent calls around fixes this.

https://bugzilla.libsdl.org/show_bug.cgi?id=4821
2019-12-02 15:41:25 +00:00
Cameron Gutman
59728f9802 Use stat() to minimize input device opens when not using udev
Calling open() on input devices can generate device I/O which blocks
the main thread and causes dropped frames. Using stat() we can avoid
opening anything unless /dev/input has changed since we last polled.

We could have used something fancy like inotify, but it didn't seem
worth the added complexity for this uncommon non-udev case.
2019-11-20 20:27:45 -08:00
Sam Lantinga
8fd426855c Fixed bug 4877 - Add support for loading menus from a nib/xib instead of building a hardcoded minimum set
Eric Shepherd

Currently, SDL on Cocoa macOS creates a rudimentary menu bar programmatically if none is already present when the app is registered during setup.

SDL could be much more easily and flexibly used on macOS if upon finding that no menus are currently in place, it first looked for the application's main menu nib or xib file and, if found, loaded that instead of programmatically building the menus.

This would then let developers simply drop in a nib file with a menu bar defined in it and it would be installed and used automatically.

Attached is a patch that does just this. It changes the SDL_cocoaevents.m file to:

* In Cocoa_RegisterApp(), before calling CreateApplicationMenus(), it calls a new function, LoadMainMenuNibIfAvailable(), which attempts to load and install the main menu nib file, using the nib name fetched from the Info.plist file. If that succeeds, LoadMainMenuNibIfAvailable() returns true; otherwise false.
* If LMMNIA() returns false, CreateApplicationMenus() is called to programmatically build the menus as before.
* Otherwise, we're done, and using the menus from the nib/xib file!

I made these changes to support a project I'm working on, and felt they were useful enough to be worth offering them for uplift. They should have zero impact on existing projects' behavior, but make Cocoa SDL development miles easier.
2019-12-03 07:12:55 -08:00
Ryan C. Gordon
152078a690 pulseaudio: don't let FlushCapture get stuck in an infinite loop on shutdown.
Fixes Bugzilla #4645.
2019-12-03 03:53:06 -05:00
Ryan C. Gordon
8a8f825f18 direct3d11: Fixed incorrect texture coordinates (thanks, Martin!).
Fixes Bugzilla #4860.
2019-12-03 03:07:34 -05:00
Gerasim Troeglazov
216706a976 haiku: Disable pointer history
(note from PulkoMandy on Bugzilla #4442 about why this is a desirable patch:
"The event mask: note that the window and GL view run in their own thread
which I don't expect to be too much CPU bound, and will quickly pop these
messages and forward them to the main thread in our SDL code. Therefore the
B_NO_POINTER_HISTORY should be no problem, and is the default on Haiku
anyway (it was not in BeOS, but we changed that and added a
B_FULL_POINTER_HISTORY flag to request the old behavior explicitly). So, this
seems fine.")

Partially fixes Bugzilla #4442.
2019-12-03 02:49:01 -05:00
Ryan C. Gordon
f1d916b454 cmake: ${SDL_CMAKE_DEBUG_POSTFIX} needs to be wrapped in quotes.
Otherwise, if it's an empty string, it causes problems.

Fixes Bugzilla #4117.
2019-12-03 02:42:53 -05:00
Sam Lantinga
a975a672c8 Updated DPAD binding for 8Bitdo Zero controller 2019-11-28 14:23:24 -08:00
Sam Lantinga
a8b35bc28c Fixed trying to use the HIDAPI driver for the original Xbox One S Bluetooth controller 2019-11-28 11:44:17 -08:00
Sam Lantinga
dee346af66 Fixed mapping controllers that have axes that start at -32768 and then snap to 0 at the first input report 2019-11-28 11:44:15 -08:00
Sam Lantinga
668f2bd321 Added support for the 8Bitdo SN30 Pro, wired connection 2019-11-28 10:04:05 -08:00
Sam Lantinga
e28b12ca6a Added the full Xbox One Elite Series 2 controller initialization sequence, to start input reports after switching out of Bluetooth mode. 2019-11-27 18:26:57 -08:00
Sam Lantinga
5d869a7e59 Backed out changeset 6f0ec1079286, which fixed bug 4775
This change broke individual key events, so I'm reverting the change until we can investigate a better fix.
2019-11-27 17:17:03 -08:00
Sam Lantinga
a0a3169d7f Check for duplicates in the supported controller list 2019-11-27 15:27:21 -08:00
Sam Lantinga
03f52303a9 Sorted controller entries by type and VID/PID to more easily find entries in the list 2019-11-27 15:27:19 -08:00
Sam Lantinga
5472c08f0e Fixed detection of the Mad Catz FightPad Pro 2019-11-27 15:27:16 -08:00
Sam Lantinga
78ab9d822d Added support for the Google Stadia Controller 2019-11-27 12:38:53 -08:00
Sam Lantinga
751809cca4 Added support for the Hori Fighting Commander 2019-11-27 12:38:51 -08:00
Sam Lantinga
85e1d73e12 Added support for the PowerA XB1 Fusion Fight Pad 2019-11-27 12:38:48 -08:00
Ozkan Sezer
4205214211 CMakeLists.txt: sync DYLIB_CURRENT_VERSION to Xcode project 2019-11-26 20:41:00 +03:00
Sam Lantinga
3a04fa45ce Added support for a variant of the PowerA FUSION Pro Controller 2019-11-26 08:35:41 -08:00
Sam Lantinga
bc1cfae60e Use the same logic to get the config descriptor in hid_open() as in hid_enumerate() 2019-11-25 16:29:12 -08:00
Sam Lantinga
8c5dc58b2f Added some missing controller names 2019-11-25 15:02:54 -08:00
Sam Lantinga
346666653f Added support for the Hyperkin X91 2019-11-25 15:02:50 -08:00
Sam Lantinga
7eecaefd82 Use SDL_hidapi.c instead of the platform specific hid.c implementations when libusb isn't available 2019-11-25 15:02:48 -08:00
Sam Lantinga
1d549300f2 Backed out change to dynamically load udev - it's already happening in SDL_hidapi.c 2019-11-25 15:02:45 -08:00
Sam Lantinga
6b61f030d5 Moved the SteelSeries controllers into the "known controller" section 2019-11-25 13:27:26 -08:00
Sam Lantinga
a7a866b321 Updated identification for the SteelSeries Stratus Duo 2019-11-25 11:12:09 -08:00
Sam Lantinga
87e9b82737 Linux hidapi code dynamically loads udev 2019-11-23 12:11:20 -08:00
Sam Lantinga
6cb3b5112c Fixed DragonRise Generic USB PCB showing up as a PS3 controller 2019-11-23 12:11:16 -08:00
Sam Lantinga
11431c5c53 Added the Linux hidraw sources when libusb isn't available 2019-11-23 11:35:20 -08:00
Sam Lantinga
2fba75a8fe This packet didn't end up being needed to initialize input for the Xbox One Elite Series 2 controller 2019-11-22 17:46:30 -08:00
Ozkan Sezer
9bb60d130b SDL_gamecontroller.h: remove comma at end of enumerator list 2019-11-23 03:28:02 +03:00
Sam Lantinga
07880dca0e Use SDL_zeroa() appropriately 2019-11-22 16:23:37 -08:00
Sam Lantinga
dd2258c2c3 Fixed build 2019-11-22 14:09:24 -08:00
Sam Lantinga
c9c9eb41b6 Added support for the PDP Versus Fighting Pad 2019-11-22 13:44:40 -08:00
Sam Lantinga
e061577afb Added SDL_GameControllerTypeForIndex() and SDL_GameControllerGetType() to return the type of controller attached. 2019-11-22 13:12:12 -08:00
Sam Lantinga
6d873be06d Added support for the PDP Battlefield One controller 2019-11-21 14:04:48 -08:00
Sam Lantinga
fc6c409633 Fixed the guide button on the NVIDIA Controller v01.04 2019-11-21 13:09:00 -08:00
Sam Lantinga
24fd9254ac Added support for the NVIDIA Controller v01.04 on Linux and Mac OS X 2019-11-21 12:11:47 -08:00
Ozkan Sezer
d7ef3d9d79 fix xcode project file permissions 2019-11-21 23:04:20 +03:00
Sam Lantinga
34608829ba Added support for the NVIDIA Controller v01.04 on Android 2019-11-21 11:52:50 -08:00
Sam Lantinga
e6e255bb87 Added support for the MOGA XP5-A Plus 2019-11-21 10:14:57 -08:00
Sam Lantinga
7ee14a9bc1 Turned on controllermap debug output by default 2019-11-21 10:09:26 -08:00
Ozkan Sezer
5314c4626a ran gendynapi.pl after newly added SDL_string.c functions. 2019-11-21 11:50:50 +03:00
Ozkan Sezer
ef80e4516b updated os/2 config file 2019-11-21 11:33:50 +03:00
Ozkan Sezer
2485c440fb CMakeLists.txt: add several missing function checks for unix case. 2019-11-21 10:33:56 +03:00
Ozkan Sezer
6e3cb7cffa configure: add back mistakenly removed strtok_r check, and regenerate. 2019-11-21 10:02:02 +03:00
Sam Lantinga
7b8e308a67 Improved XInput VID/PID detection and added SDL_wcsstr() and SDL_wcsncmp() 2019-11-20 16:42:50 -08:00
Ozkan Sezer
79725cdb32 added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.) 2019-11-20 20:40:50 +03:00
Sam Lantinga
cc27616f85 Fixed Xbox One Elite Series 2 showing up as 2 devices in Bluetooth mode on Windows 2019-11-20 08:43:24 -08:00
Ozkan Sezer
016dd1f1d1 SDL.c (SDL_ExitProcess): unconstify its param to match its declaration. 2019-11-20 02:47:40 +03:00
Sam Lantinga
5a9fd48247 Added support for the Xbox One Elite Series 2 controller on Mac OSX 2019-11-19 15:15:00 -08:00
Sam Lantinga
66cb584318 Added support for the Xbox One Elite Series 2 controller in wired mode 2019-11-18 15:46:13 -08:00
Sam Lantinga
42c37b06bc Added Linux controller mapping for the Xbox One Elite Series 2 controller in Bluetooth mode 2019-11-18 14:08:05 -08:00
Sam Lantinga
cda9fd15e6 Added names for some missing Xbox controllers 2019-11-18 11:51:39 -08:00
Sam Lantinga
43768687d0 Added identifiers for the Xbox One Elite Series 2 controller 2019-11-18 11:44:51 -08:00
Sam Lantinga
4dd086735a Fixed unused function warning on Android 2019-11-18 10:48:14 -08:00
Sam Lantinga
3a7e57f1da Fixed bug 4814 - Missing scancodes on Linux
Michael Roe

The mappings for keyboard scancodes on Linux do not include keypad left and right parentheses (used on some Microsoft keyboard), keypad plus/minus, LANG1 and LANG2 (used on Korean keyboards), XK86MenuKB, and F20 (remapped to Audio Mic Mute in the usual X11 config).
2019-11-16 22:45:49 -08:00
Sam Lantinga
0b0de4f563 Fixed bug 4819 - Attempting to create an OpenGL ES context with unachievable MSAA parameters under X11 dooms the program
Solra Bizna

I have written a program that, in the event that the user requests more MSAA samples than their hardware supports, attempts to gracefully fall back to the best MSAA available. This code works with my conventional OpenGL renderer, but if I change nothing about the code except to make it request an OpenGL ES profile instead, Xlib kills the program with an error that looks like:

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  4 (X_DestroyWindow)
  Resource id in failed request:  0x5c00008
  Serial number of failed request:  188
  Current serial number in output stream:  193

To trigger the bug, attempt to create a window with the SDL_WINDOW_OPENGL flag, with SDL_GL_CONTEXT_PROFILE_MASK set to SDL_GL_CONTEXT_PROFILE_ES, and with SDL_GL_MULTISAMPLESAMPLES set to any unsupported value. SDL_CreateWindow properly returns NULL, but at this point the program is already doomed. Xlib will shortly terminate the program with an error. Calling SDL_CreateWindow again will immediately trigger this termination.

I have attached a skeletal program that reproduces this bug for me. Replacing SDL_GL_CONTEXT_PROFILE_ES with SDL_GL_CONTEXT_PROFILE_COMPATIBILITY avoids the bug (but, obviously, doesn't create an OpenGL ES context).

As I suspected, the problem was with XDestroyWindow being called twice on the same window. The X11_CreateWindow function in src/video/x11/SDL_x11window.c calls SetupWindowData. If initialization fails after that point, XDestroyWindow gets called on the window by a subsequent call to X11_DestroyWindow. But, later in the same function, iff a GLES context is requested and initializing it fails, X11_XDestroyWindow (which wraps XDestroyWindow) is manually called. Shortly after, the intended call to X11_DestroyWindow occurs, which attempts to destroy the same window again. Boom.

(The above confusing summary involves three separate, similarly-named functions: XDestroyWindow, X11_DestroyWindow, X11_XDestroyWindow)

I have attached a simple patch that removes the redundant X11_XDestroyWindow calls. I've tested that XDestroyWindow still gets called for the windows in question, and that it only gets called once.
2019-11-16 22:35:48 -08:00
Cameron Cawley
b7e16c20c8 atomic: Support compiling on ARMv3 2019-10-11 22:08:53 +01:00
Cameron Cawley
935a136364 Added SDL_PIXELFORMAT_BGR444 2019-11-02 22:58:52 +00:00
Sam Lantinga
d2805d6e55 Don't try to use this driver with the Xbox One S in Bluetooth mode on Linux 2019-11-16 19:58:29 -08:00
Sam Lantinga
a8a6d3497b Added support for the Xbox One S controller in Bluetooth mode on Linux 2019-11-16 19:55:53 -08:00
Sylvain Becker
03ad3136c8 Fix missing prototype warning 2019-11-16 22:59:56 +01:00
Sylvain Becker
02c7e4fd6f Fix crash when detecting SIMD 2019-11-16 22:55:36 +01:00
Sam Lantinga
53768d7d97 Added a utility function to simplify the hint handling logic 2019-11-13 21:53:01 -08:00
Sam Lantinga
c3ed380542 Supported Android and Apple hardware has ARM SIMD capability 2019-11-13 15:46:58 -08:00
Sam Lantinga
3ea1eb5600 SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS defaults to true, to match Steam's default behavior 2019-11-13 14:24:48 -08:00
Anuj Mittal
61f5cf85e1 configure: check for build dir when building version res (fix bug #4858)
Fixes a race where we try to build version res file in build directory
before it has even been created. Prevents errors like:

/bin/bash ../SDL2-2.0.10/build-scripts/updaterev.sh
/bin/bash ../SDL2-2.0.10/build-scripts/mkinstalldirs build
mkdir -p -- build
x86_64-pokysdk-mingw32-windres --include-dir=/home/pokybuild/yocto-worker/meta-mingw/build/build/tmp/work/x86_64-nativesdk-mingw32-pokysdk-mingw32/nativesdk-libsdl2/2.0.10-r0/recipe-sysroot/opt/poky/3.0/sysroots/x86_64-pokysdk-mingw32/usr/include ../SDL2-2.0.10/src/main/windows/version.rc build/version.o
x86_64-pokysdk-mingw32-windres: build/version.o: No such file or directory
Makefile:692: recipe for target 'build/version.o' failed
make: *** [build/version.o] Error 1
make: *** Waiting for unfinished jobs....
touch build/.created
WARNING: exit code 1 from a shell command.

Extension of fix:
https://hg.libsdl.org/SDL/rev/99d8b18acf8a

Signed-off-by: Anuj Mittal <am.devel@gmail.com>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
2019-11-13 10:51:02 +03:00
EXL
8567ce86de haiku: Rename BE_* entities to HAIKU_*
In favor Bugzilla #2349.
Update copyright years to 2019.

Partially fixes Bugzilla #4442.
2019-11-12 17:24:37 -05:00
Peter Kosyh
3af07e9794 haiku: mouse_relative fix
Partially fixes Bugzilla #4442.
2019-11-11 22:23:33 -05:00
Peter Kosyh
6bbeb84a69 haiku: mouse->ShowMouse method added
Partially fixes Bugzilla #4442.
2019-11-11 22:22:40 -05:00
Gerasim Troeglazov
14fb2a9093 haiku: Add support for relative mouse mode.
Partially fixes Bugzilla #4442.
2019-11-11 22:21:17 -05:00
Gerasim Troeglazov
48bde81cb6 haiku: Add simple relative mode for mouse.
Partially fixes Bugzilla #4442.
2019-11-11 22:18:21 -05:00
Adrien Destugues
c2364e8d6a haiku: Fix crash when opening window.
- _num_clips was not set in constructor, so a NULL _clips could be
  mistakenly dereferenced.
- As _clips is accessible outside the class, it is not a good idea to
  free/reallocate it. Try to limit this by reallocating only when it needs to
  grow.

Partially fixes Bugzilla #4442.
2019-11-11 22:14:00 -05:00
Jerome Duval
8380785be9 haiku: use addr_t instead of size_t for OpenGL dynamic loading.
Partially fixes Bugzilla #4442.
2019-11-11 22:04:10 -05:00
Peter Kosyh
a48e635af9 haiku: Invert mouse wheel values to match what SDL expects.
Partially fixes Bugzilla #4442.
2019-11-11 21:59:39 -05:00
EXL
78010bafad haiku: Implement message box for Haiku
Add implementation for functions:

SDL_ShowSimpleMessageBox()
SDL_ShowMessageBox()

Add simple customization support also.
Fix build for x86_gcc2.

Partially fixes Bugzilla #4442.

--HG--
extra : amend_source : 1bada5c1e8f4b81a40bca7158c404b88a97d3dbc
2019-11-11 16:44:40 -05:00
Ozkan Sezer
05e5c6188d ran gendynapi.pl after SDL_HasARMSIMD() addition 2019-11-04 11:15:24 +03:00
Ryan C. Gordon
a5c53f9dc1 Fixed a comment typo (thanks, Dominus!).
https://twitter.com/iniquitatis/status/1190064278365188102
2019-11-01 04:32:44 -04:00
Sylvain Becker
b1eab4839a Android: some readability: redundant casts, deads stores, redundant control flow 2019-10-31 15:53:10 +01:00
Ozkan Sezer
4a96006e0d SDL_qsort.c: sync comments with version 1.15 from mainstream 2019-10-31 17:10:02 +03:00
Sylvain Becker
7a18b5b6ca Wayland: touch events, use of memory after it is freed 2019-10-30 21:12:36 +01:00
Sylvain Becker
51c9915b03 Use correct enum: typo in org_kde_kwin_server_decoration_mode
instead of org_kde_kwin_server_decoration_manager_mode
2019-10-30 17:59:20 +01:00
Sylvain Becker
151fe7f76e Remove redundant 'SDL_GetErrBuf' declaration 2019-10-30 17:35:40 +01:00
Sylvain Becker
5ff9c8ad04 SDL_render_gles2: remove ineffective widening cast
warning: either cast from 'int' to 'size_t' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
2019-10-30 16:45:53 +01:00
Sylvain Becker
fb9b2cb70c revert this const parameter for X11 function 2019-10-30 16:33:32 +01:00
Sylvain Becker
1e2803ce84 Readability: remove redundant cast 2019-10-30 16:20:58 +01:00
Sylvain Becker
d46923790e Fix const warning in RLE getpix functions 2019-10-30 16:17:59 +01:00
Sylvain Becker
8d04ad1f4d SDL_syspower.c: remove redundant expression 2019-10-30 16:12:39 +01:00
Sylvain Becker
61ca65cfae Readability: change some pointer parameter to be pointer to const 2019-10-30 16:06:51 +01:00
Sylvain Becker
4acf3c3cb4 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
Sylvain Becker
b4ca96449f Readability: remove redundant return, continue, enum declaration 2019-10-30 15:36:17 +01:00
Sylvain Becker
2ebaea723d Readability: remove redundant cast to the same type 2019-10-30 15:13:55 +01:00
Sylvain Becker
bab0be855d BlitAuto: remove redundant cast to the same type 2019-10-30 14:37:06 +01:00
Sylvain Becker
b72b3d0d5f Remove nested redundant #ifndef 2019-10-30 14:29:41 +01:00
Sylvain Becker
b503b72f3c SDL_syspower: remove dead store warning
Value stored to 'str' during its initialization is never read
2019-10-30 14:26:18 +01:00
Sylvain Becker
5e348f75e3 Use fill_function for FillRect SIMD/NEON (bug 4365) 2019-10-29 16:13:41 +01:00
Alex Szpakowski
20f38f7052 iOS: remove some unused code, minor code style cleanup. 2019-10-27 11:41:48 -03:00
Alex Szpakowski
9d1f29993c iOS: replace a deprecated function call with a non-deprecated equivalent. 2019-10-27 11:41:11 -03:00
Sylvain Becker
e36f189289 Android: remove warning in blit_features
"integer constant not in range of enumerated type 'enum blit_features'"
2019-10-27 15:22:28 +01:00
Sylvain Becker
9a412bdf64 Android: fix compilation error of SDL_cpuinfo.c on android-r13b (bug 4365) 2019-10-27 14:52:09 +01:00
Ryan C. Gordon
1ed6be9663 x11: check if the X server honored our XMoveWindow() call (thanks, R.E. Rust!).
This can happen if a window is still grabbed when we try to move it, or if
the X11 ecosystem is just in a bad mood, I guess.

This makes sure that SDL will report the correct position for a window;
otherwise, SDL_GetWindowPosition will just report whatever the last
SDL_SetWindowPosition call requested, even if the window didn't actually move.

Fixes Bugzilla #4646.
2019-10-26 23:58:55 -04:00
Alex Szpakowski
97cd01b831 macOS: more robust detection and switching of exclusive-fullscreen display modes (bug #4822). 2019-10-26 15:27:51 -03:00
Alex Szpakowski
1df8b99b3c macOS Fix potential memory leaks in the Metal renderer caught by clang's static analyzer. 2019-10-26 14:39:50 -03:00
Ryan C. Gordon
ea68d4375d d3d11: Don't fail if there's no vertex data to upload (thanks, Martin!).
Fixes Bugzilla #4832.
2019-10-26 12:56:18 -04:00
Ryan C. Gordon
d659e11a27 cpuinfo: Remove incorrect #warning when building for non-ARM architectures. 2019-10-25 00:07:30 -04:00
Ryan C. Gordon
e4bba9687d cmake: added support for enabling the ARM SIMD/NEON code. 2019-10-24 23:17:19 -04:00
Ryan C. Gordon
bafcc3737f configure: Regenerate configure script with the ARM SIMD/NEON changes. 2019-10-24 21:51:55 -04:00
Ryan C. Gordon
91539a1f69 configure: warn about MIT-licensed code if using ARM SIMD/NEON optimizations. 2019-10-24 21:41:03 -04:00
Ben Avison
e11544c11b ARM: NEON assembly optimization for SDL_FillRect
--HG--
extra : histedit_source : 05adff24c257ab385f7d3887c3a7ff9bd7bd86ff
2019-10-24 21:17:52 -04:00
Ben Avison
0b04ebbcf7 ARM: NEON assembly optimization for function BlitARGBto565PixelAlpha
--HG--
extra : histedit_source : 020eebc551604aef16e5a21e92a9b23a969393af
2019-10-24 21:17:38 -04:00
Ben Avison
3f069f458c ARM: NEON assembly optimization for function BlitRGBtoRGBPixelAlpha
--HG--
extra : histedit_source : 0c4202e02cbd677a99c1606ac622ef27e28923c1
2019-10-24 21:17:19 -04:00
Ben Avison
7ddb7981d8 ARM: Create configure option --enable-arm-neon to govern assembly optimizations
--HG--
extra : histedit_source : ae8cebdb416b6b808acab37128921d82105079cc
2019-10-24 21:17:05 -04:00
Ben Avison
ea3d342c44 ARM: SIMD optimization for 4:4:4:4 to 8:8:8:8 normal blits
--HG--
extra : histedit_source : c47e6317d65d0045a8d001fd2d43be99424ff614
2019-10-24 21:15:50 -04:00
Ben Avison
0245b373e7 ARM: assembly optimization for SDL_FillRect
--HG--
extra : histedit_source : a59d74607d4133873e77d6f4b5f046f692d8d488
2019-10-24 21:15:35 -04:00
Ben Avison
38dfe93240 ARM: SIMD assembly optimization for BGR-to-RGB 32bpp normal blits
--HG--
extra : histedit_source : 2030ded3092783d6be7055a136000b3ba5fcfb24
2019-10-24 21:15:21 -04:00
Ben Avison
194b20bc56 SDL_blit: use a named enum for required hardware bits in dispatch tables
--HG--
extra : histedit_source : 21b83b72797307b338b44027826dca63883bac72
2019-10-24 21:15:09 -04:00
Ben Avison
7b74f8dff2 ARM: SIMD assembly optimization for function BlitARGBto565PixelAlpha
--HG--
extra : histedit_source : 5fe9e97bc4fec9a85a801ede31daa2b5b4677a87
2019-10-24 21:13:56 -04:00
Ben Avison
1362ca2643 ARM: SIMD assembly optimization for function BlitRGBtoRGBPixelAlpha
Much of the heavy lifting of this optimization is lifted from the Pixman
project, which is distributed under an MIT-style license. As far as possible,
these elements have been relicensed to the zlib license.

--HG--
extra : histedit_source : c1e93e49cf2981be109d535558693e49452875bc
2019-10-24 21:13:05 -04:00
Ben Avison
fd7508ad61 ARM: Create configure option --enable-arm-simd to govern assembly optimizations
--HG--
extra : histedit_source : 12ab7dd2b55b3aea44b60ad153a73bd41d81f3fb
2019-10-24 21:12:08 -04:00
Alex Szpakowski
789caa7e85 macOS: Expose high dpi-capable display modes on macOS 10.13+.
Fixes an issue in macOS 10.15 where the displayed content would move up after entering, exiting and re-entering exclusive fullscreen when certain display modes were used (bug #4822).
Bug #3949 is also related to this change.
2019-10-24 20:15:54 -03:00
Sylvain Becker
5960887968 Fixed bug 2014 - Hardcoded srcA value in SDL_Blit_auto.c functions 2019-10-24 18:07:30 +02:00
Sylvain Becker
8bd87ca117 Fixed bug 4775 - Japanese on Android, remove inputtype PASSWORD (Thanks Tamo!) 2019-10-23 11:25:16 +02:00
Sylvain Becker
4cd69969d5 Android: remove eglGetProcAdded busted comment (bug #4040) 2019-10-23 11:07:11 +02:00
Sylvain Becker
00bccb9baf Fixed bug 4843 - Passing NULL to memset in SDL_PrivateLoadButtonMapping
(Thanks!)
2019-10-23 09:53:23 +02:00
Sylvain Becker
4f84eb70f2 Fixed bug 4842 - Redundant condition in MS_ADPCM_Decode and IMA_ADPCM_Decode
(Thanks!)
2019-10-23 09:36:41 +02:00
Sylvain Becker
71fd3d0433 Fixed bug 4840 - Read of uninitialized memory in DXGI_LoadDLL (Thanks!) 2019-10-23 09:26:27 +02:00
Sylvain Becker
a5f949624b Fixed bug 4839 - Read of uninitialized memory in Win32_ResizeWindowShape
(Thanks!)
2019-10-23 09:17:53 +02:00
Sylvain Becker
9112e9155b Fixed bug 4841 - Misplaced parenthesis WIN_WindowProc / WM_ACTIVATE / ClipCursor
(Thanks!)
2019-10-23 08:58:52 +02:00
Sylvain Becker
b9bcc1c105 Fixed bug 4838 - Use after free in SDL_JoystickUpdate (Thanks!) 2019-10-23 08:50:57 +02:00
Sylvain Becker
e2b5420f85 Fixed bug 4837 - Use after free in SDL_SensorUpdate (Thanks!) 2019-10-23 08:46:59 +02:00
Sam Lantinga
07141746e7 Fixed accidental whitespace 2019-10-22 15:43:58 -07:00
Sam Lantinga
87cff63608 Added support for the Power A Nintendo Switch Enhanced Wireless Controller 2019-10-22 10:57:07 -07:00
Sam Lantinga
e5f86fa1d6 Reordered Power A Switch controllers so they're grouped together 2019-10-22 10:28:51 -07:00
Sam Lantinga
c64f8c4d86 Added support for the PowerA - Super Mario Controller 2019-10-22 10:27:30 -07:00
Sam Lantinga
be53132dcd Fixed the location of controller_type.h in the Visual Studio project 2019-10-22 10:26:49 -07:00
Sam Lantinga
031a236456 Fixed the location of controller_type.h in the Visual Studio project 2019-10-22 10:25:55 -07:00
Ozkan Sezer
0841f17433 SDL_endian.h: Use endian.h for OpenBSD.
Patch from OpenBSD CVS, authored by Donovan Watteau.
2019-10-21 22:22:28 +03:00
Ozkan Sezer
c4ca9ebdfe Fix typo with __MIPSEB__ preprocessor check (bug #4836.)
Patch from Simon Howard
2019-10-21 10:20:25 +03:00
Ryan C. Gordon
4ead2b39e3 cpuinfo: Use a better default alignment value (thanks, Simon!).
Fixes Bugzilla #4835.
2019-10-20 22:17:59 -04:00
Sam Lantinga
3dc2e8c3e4 Don't try to use the Xbox HID protocol with the NVIDIA Shield controllers 2019-10-19 01:54:02 -07:00
Sylvain Becker
de4af62f3c remove warning prototype SDL_ExitProcess() 2019-10-19 09:23:40 +02:00
Ozkan Sezer
ab6cd0c600 updated includes for _exit() 2019-10-18 23:10:00 +03:00
Sylvain Becker
a149de6a0c Add internal function SDL_EGL_GetVersion() 2019-10-18 21:47:30 +02:00
Sam Lantinga
60332ec10f Fixed whitespace 2019-10-18 08:56:54 -07:00
Sylvain Becker
382e3d8ad2 Fixed bug 4829 - Sensor events incorrectly disabled 2019-10-18 14:23:37 +02:00
Sylvain Becker
8c775d077e Android: enable eglGetProcAddress (bug #4040, bug #4794) 2019-10-18 14:08:07 +02:00
Sylvain Becker
d6be3ee5f7 Add robustness getting the EGL version (see bug #4040) 2019-10-18 13:27:58 +02:00
Ryan C. Gordon
1cb064bf31 egl: adjust how we load symbols in SDL_EGL_GetProcAddress.
Use eglGetProcAddress for everything on EGL >= 1.5. Try SDL_LoadFunction first
for EGL <= 1.4 in case it's a core symbol, and as a fallback if
eglGetProcAddress fails. Finally, for EGL <= 1.4, fallback to
eglGetProcAddress to catch extensions not exported from the shared library.

(Maybe) Fixes Bugzilla #4794.

--HG--
extra : rebase_source : 8288f8901eaf2ddbcd6bfac126ddcc748df1078f
2019-10-18 00:07:32 -04:00
Sam Lantinga
a7975649c6 Added support for the BDA PS4 Fightpad 2019-10-17 18:07:52 -07:00
Sam Lantinga
4a36e96ef3 Build fix for the build fix 2019-10-17 17:51:36 -07:00
Sam Lantinga
2d0a540be2 Better fix for iOS build 2019-10-17 17:51:49 -07:00
Sam Lantinga
fc07d41949 Fixed build on iOS 2019-10-17 17:47:27 -07:00
Sam Lantinga
d6b20b4c53 Removed unused variable 2019-10-17 17:47:11 -07:00
Sam Lantinga
0fdabf6b9c Added the hint SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS to control whether Nintendo Switch controllers use their button labels or button positions for game controller button reporting. 2019-10-17 17:32:47 -07:00
Sam Lantinga
616ae77ef2 Added support for third party Nintendo Switch controllers that don't support the full protocol 2019-10-17 16:59:05 -07:00
Sam Lantinga
1568d44648 Merged latest data from Steam 2019-10-17 16:14:17 -07:00
Alex Szpakowski
0702104c3a metal: Fix compilation when using older Apple SDKs (bug #4828). 2019-10-17 18:48:58 -03:00
Ryan C. Gordon
bc0021f35c emscripten: Patched to compile (thanks, Caleb!).
Fixes Bugzilla #4827.
2019-10-16 13:54:35 -04:00
Sam Lantinga
60137cf696 Fixed bug 4785 - SDL_CreateRGBSurface creates 1-bit surfaces with zero pitch
Sylvain

Seems to be a regression in this commit: https://hg.libsdl.org/SDL/rev/cf166abbde4a
SDL_CalculatePitch() was using format->BytesPerPixel, now it uses SDL_BYTESPERPIXEL().

The underlying issue is that "surface->format->BytesPerPixel" is *not* always the same as SDL_BYTESPERPIXEL(format);
BytesPerPixel defined as format->BytesPerPixel = (bpp + 7) / 8;
vs
#define SDL_BYTESPERPIXEL(format)  ... (format & 0xff)

Because of SDL_pixels.h format definitions, one is giving a BytesPP 1, the other 0.
2019-10-16 08:45:54 -07:00
Ryan C. Gordon
06d5992f30 x11: On macOS, look for X11 install in /opt/X11 instead of /usr/X11R6.
This is where Apple installs XQuartz now (and apparently, the compatibility
symlink at /usr/X11R6 can be missing).

Fixes Bugzilla #4706.

--HG--
extra : histedit_source : 962212cab88ecd1230ec4f491505c88d67085b53
2019-10-15 22:36:08 -04:00
Ryan C. Gordon
7133dfc02d video: Make sure SDL_FillRects()'s fill_function isn't used unitialized. 2019-10-15 14:55:09 -04:00
Ryan C. Gordon
ae447943ff include: Removed a FIXME comment.
Using (1 << 14) instead of 0x4000 might be clearer for the maintainer, but
it makes it harder to look up these flags when debugging an app. The value
has to be written once by one person, the has to be read by tons of people
over and over.
2019-10-15 14:17:32 -04:00
Ryan C. Gordon
5b3ec9f184 video: Removed unused variables. 2019-10-15 14:04:43 -04:00
Ryan C. Gordon
27a9e64d97 video: speed up SDL_FillRect[s] slightly (thanks, Jakub!).
"This patch does the following:

* Instead of SDL_FillRects calling SDL_FillRect in a loop the opposite
happens -- SDL_FillRect (a specific case) calls SDL_FillRects (a general case)
with a count of 1

* The switch/case block is moved out of the loop -- it modifies the color
once and stores the fill routine in a pointer which is then used throughout
the loop"

Fixes Bugzilla #4674.
2019-10-15 14:03:01 -04:00
Ryan C. Gordon
6339b66aab test: Fixed wrong verbose flag check (thanks, watcom.hecht!).
Fixes Bugzilla #4826.
2019-10-15 12:02:19 -04:00
Ryan C. Gordon
dc66966cc6 windows: Remove /ARCH:SSE option from x64 Visual Studio builds.
Fixes Bugzilla #4561.
2019-10-15 09:07:12 -04:00
Ryan C. Gordon
d79a6f9c0a test: Fixed compiler warning on Visual Studio.
--HG--
extra : rebase_source : 909accf2e3015a69e6d5739f5562310202038f47
2019-10-15 08:54:25 -04:00
Cameron Gutman
9462494d8f Reduce delay to 1 ms in SDL_WaitEventTimeout() and SDL_WaitEvent()
The 10 ms delay effectively caps input polling at 100 Hz and rendering
at 100 FPS if applications use these functions in their event loop. The
delay may also lead to dropped frames even at 60 FPS due if they are
unlucky enough to hit the delay and rendering takes longer than 6 ms.
2018-11-03 15:46:42 -07:00
Sam Lantinga
27e3a45771 Backed out changeset a429ccdea379
Better commit incoming!
2019-10-14 22:41:27 -07:00
Ryan C. Gordon
475b1b7bba events: SDL_WaitEvent()'s polling loop now sleeps 1ms instead of 10ms.
Fixes Bugzilla #4356.
2019-10-15 01:13:44 -04:00
Ryan C. Gordon
1c8dffa9b2 cocoa: Implement SDL_WINDOW_ALWAYS_ON_TOP support (thanks, Gabriel!).
Fixes Bugzilla #4809.
2019-10-15 00:59:10 -04:00
Ryan C. Gordon
fc251a1d25 dynapi: Deal with failure cases better, other fixes.
Fixes Bugzilla #4803.

--HG--
extra : rebase_source : e61e03dd4f7a0046baff2d653c4f533ed6766012
2019-10-14 12:41:06 -04:00
Sylvain Becker
e4d2f905eb Fixed race condition when scaling Touch events, and changing the renderer
target.
Always read the output size of the main renderer.
(similar to bug 2107)
2019-10-14 16:40:46 +02:00
Alex Szpakowski
f7e5d151e2 macOS: Fix the initial window background not being black since macOS 10.14.2 or so, when OpenGL is used (bug #4810). Also fixes "CGContext: invalid context 0x0" errors when an OpenGL window is created (bug #4470). 2019-10-14 00:51:53 -03:00
Alex Szpakowski
f55628e7fa macOS: Fix non-highdpi OpenGL contexts not scaling properly in macOS 10.15 (bug 4810 and 4822). 2019-10-13 21:39:20 -03:00
Sylvain Becker
1665430f7c Fixed bug 4825 - SDL Renderer OpenGL: Buffer overflow (SDL_RENDERCMD_DRAW_LINES) 2019-10-13 20:52:52 +02:00
Alex Szpakowski
20c1dd6012 macOS: Fix asserts in SDL_Render's metal scissor code when the window is resized. 2019-10-13 15:18:28 -03:00
Alex Szpakowski
5a1c21a1e9 macOS: Fix a new issue in 10.15 where the window decorations don't always get restored after SDL_SetWindowFullscreen(window, 0). 2019-10-13 12:16:40 -03:00
Sylvain Becker
53385fcc1a Fixed bug 4797 - SDL fails to compile with Mesa Master (thanks Michael Olbrich!)
fix building with Mesa 19.2

With Mesa 19.2 building fails with:

/include/GLES/gl.h:63:25: error: conflicting types for 'GLsizeiptr'

The same type is defined in include/SDL_opengl.h for OpenGL and the two
headers should not be included at the same time.
This was just never noticed because the same header guard '__gl_h_' was
used. This was changed in Mesa. The result is this error.

Fix this the same way GLES2 already handles this: Don't include the GLES
header when the OpenGL header was already included.
(https://hg.libsdl.org/SDL/rev/a60b3c292f0f)
2019-10-12 18:47:56 +02:00
Sylvain Becker
3b9066d478 Remove 'Enum' suffixes (bug 4813) 2019-10-11 06:18:24 +02:00
Sylvain Becker
81a0f46566 Fixed bug 4813 - Give enums their own name
* SDL_PIXELTYPE_
* SDL_BITMAPORDER_
* SDL_PACKEDORDER_
* SDL_ARRAYORDER_
* SDL_PACKEDLAYOUT_
* SDLK_
* SDL_LOG_CATEGORY_
2019-10-10 17:40:00 +02:00
Sylvain Becker
f8e45d4b56 Fixed bug 4820 - SDL assumes RW_SEEK_SET == SEEK_SET 2019-10-10 17:21:46 +02:00
Ryan C. Gordon
00da518a8c linux: If D-Bus isn't available on the system, don't keep trying to load it.
Fixes Bugzilla #4476.
2019-10-09 19:38:16 -04:00
Ryan C. Gordon
484452103f mouse: Save initial position yet even if xrel and yrel are 0.
The X11 target sets mouse->last_x and last_y in EnterNotify and then calls
SDL_SendMouseMotion(), which throws away the new position because it matches
the mouse->last_x and last_y we just set, meaning that if the pointer is
in the window when it created, SDL_GetMouseState() will report a position of
0,0 until a MotionNotify event (the pointer moves) arrives and corrects the
mouse state.

Mostly fixes Bugzilla #1612.
2019-10-09 13:42:13 -04:00
Ryan C. Gordon
4380aea547 dynapi: Make gendynapi.pl work on older Perl releases. 2019-10-05 20:19:10 -04:00
David Ludwig
1758af58f5 WinRT: fix a link-time error when building UWP + x64
--HG--
extra : rebase_source : 76eaabf446b038b79400be8b84b82e9a7ca4a62f
2019-10-02 14:55:02 -04:00
Sam Lantinga
5a993d3789 Removed unused volume check interval 2019-10-01 08:50:04 -07:00
Ozkan Sezer
1bd9e1d4dc endpointvolume.h checks not needed since changeset 13078:ae4f9911321a . 2019-10-01 14:00:02 +03:00
Sylvain Becker
b57ee9bae4 SDL_LockTextureToSurface: robustness of locked region compared to texture size 2019-10-01 09:26:30 +02:00
Ozkan Sezer
7abdb6e754 dynapi: move new SDL_LockTextureToSurface addition to the end of file. 2019-10-01 00:05:50 +03:00
Sylvain Becker
72bbc9de9d Added a helper function SDL_LockTextureToSurface()
Similar to SDL_LockTexture(), except the locked area is exposed as a SDL surface.
2019-09-30 20:58:44 +02:00
Alex Szpakowski
bfc44641e4 macOS: Fix SDL_metal.h not being copied to the framework's Headers folder when SDL.framework is built using Xcode. 2019-09-27 20:15:42 -03:00
Sam Lantinga
c2a5078c5a Fixed rtkit feature guard 2019-09-27 15:21:31 -07:00
Sam Lantinga
063bd947e4 Fix the RealtimeKit dbus include guards
The SDL_USE_LIBDBUS define is set inside SDL_debug.h, therefore the
circular dependency made it impossible for this feature to be enabled.

Instead, guard SDL_dbus.h based on the autoconf variable HAVE_DBUS_DBUS_H

Additionally, fix one of the rtkit comments. CAP_SYS_NICE isn't required
to achieve high priority. But there is some scheduler config that rtkit
needs the app to setup.
2019-09-27 15:21:27 -07:00
Ryan C. Gordon
c5abb67846 stdlib: Patched to compile. 2019-09-26 13:44:49 -04:00
Ryan C. Gordon
0f56490221 stdlib: Try to coerce VS2019 to not replace some loops with memset() calls.
Fixes (?) Bugzilla #4759.
2019-09-26 12:55:05 -04:00
Ryan C. Gordon
3a8e3718b8 audio: Set (something close to) the correct silence value for U16 audio.
Partially fixes Bugzilla #4805.
2019-09-25 15:40:27 -04:00
Ryan C. Gordon
6efb87b5e4 coreaudio: Apple doesn't support U16 data, so convert in that case. 2019-09-25 15:07:07 -04:00
Brandon Schaefer
b40d67ae21 offscreen: Define missing define on a older EGL for an EXT function which it wont have 2019-09-24 17:49:53 -04:00
Brandon Schaefer
86b7a6bd72 offscreen: Avoid using EGLDeviceEXT as it causes issues with older platforms, which is just a void* 2019-09-24 17:27:51 -04:00
Brandon Schaefer
937d0c8ded offscreen: Add new video driver backend Offscreen
The Offscreen video driver is intended to be used for headless rendering
  as well as allows for multiple GPUs to be used for headless rendering

Currently only supports EGL (OpenGL / ES) or Framebuffers
Adds a hint to specifiy which EGL device to use: SDL_HINT_EGL_DEVICE
Adds testoffscreen.c which can be used to test the backend out
Disabled by default for now
2019-09-24 16:36:48 -04:00
David Ludwig
3d7da54392 CMake: tabs to spaces in new parts of README-cmake.md 2019-09-23 18:30:22 -04:00
David Ludwig
ec890882d8 CMake: document iOS/tvOS support in README-cmake.md 2019-09-23 18:27:14 -04:00
David Ludwig
21405ce399 CMake: bug-fix for tvOS support
tvOS Device support wasn't working, at least not with the current-latest tvOS release (13.0), with CMake failing during its configuration stage.
2019-09-23 18:24:03 -04:00
David Ludwig
a2af92e8eb CMake: add version strings to Apple Info.plist files
This fills in the CFBundleVersion and CFBundleShortVersionString fields,
if and when SDL's test-apps are built via CMake.  This is needed to install
the .app bundles on iOS 13+ (using 'xcrun simctl install booted path/to/testsuchandsuch.app')
2019-09-23 17:48:14 -04:00
David Ludwig
248f5137bf CMake: tvOS support/fixes
To use, set the following CMake variables when running CMake's configuration stage:
- CMAKE_SYSTEM_NAME=tvOS
- CMAKE_OSX_SYSROOT=<SDK>  (examples: appletvos, appletvsimulator, appletvos12.4, /full/path/to/AppleTVOS.sdk, etc.)
- CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures> (example: "arm64;x86_64")

--HG--
extra : rebase_source : fdeae761e5df97a2342bfed61dbbfc41170d61d7
2019-08-27 12:30:20 -04:00
David Ludwig
36e1615cf0 CMake: iOS support added
When using a recent version of CMake (3.14+), this should make it possible to:
- build SDL for iOS, both static and dynamic
- build SDL test apps (as iOS .app bundles)
- generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)

To use, set the following CMake variables when running CMake's configuration stage:
- CMAKE_SYSTEM_NAME=iOS
- CMAKE_OSX_SYSROOT=<SDK>  (examples: iphoneos, iphonesimulator, iphoneos12.4, /full/path/to/iPhoneOS.sdk, etc.)
- CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures> (example: "arm64;armv7s")

Examples:
- for Simulator, using the latest, installed SDK:
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64

- for Device, using the latest, installed SDK, 64-bit only
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64

- for Device, using the latest, installed SDK, mixed 32/64 bit
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"

- for Device, using a specific SDK revision (iOS 12.4, in this example):
    cmake path/to/SDL -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64

- for Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
    cmake path/to/SDL -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64

--HG--
extra : rebase_source : 0c6beeec1886332c685dad6c665085ed4e7f2a3e
2019-08-27 11:07:43 -04:00
Jinke Fan
ebcfaef81f Add Hygon Dhyana processor support
Background:
    Chengdu Haiguang IC Design Co., Ltd (Hygon) is a Joint Venture
    between AMD and Haiguang Information Technology Co.,Ltd., aims at
    providing high performance x86 processor for China server market.
    Its first generation processor codename is Dhyana, which
    originates from AMD technology and shares most of the
    architecture with AMD's family 17h, but with different CPU Vendor
    ID("HygonGenuine")/Family series number(Family 18h).

Related Hygon kernel patch can be found on:
http://lkml.kernel.org/r/5ce86123a7b9dad925ac583d88d2f921040e859b.1538583282.git.puwen@hygon.cn

Best regards.
2019-05-15 19:54:36 +08:00
Ozkan Sezer
d6fd87993c SDL_messagebox.h: remove comma at end of enumerator list 2019-09-22 21:41:20 +03:00
Ozkan Sezer
749686ee9d update version number in Makefile.os2 too 2019-09-22 20:47:00 +03:00
Sam Lantinga
455a109d79 Updated SDL development builds to version 2.0.11 2019-09-22 10:37:16 -07:00
Sam Lantinga
ca75c1f7aa The PS4 is ignoring the volume values in the report, so we don't need to fill them in. 2019-09-19 16:50:49 -07:00
Sam Lantinga
7af6f1bab9 Don't have Windows headers define min/max, in case they're defined by application code 2019-09-11 15:08:37 -07:00
Sylvain Becker
a52f365446 Fixed bug 4798 - PNG w/transparency breaks in SDL 2.0.10 but works in SDL 2.0.9 2019-09-10 17:12:34 +02:00
Ozkan Sezer
43d3bedb26 test: replace some exit()s with returns. 2019-09-10 10:03:20 +03:00
Sam Lantinga
530f718027 Fixed compiler warning on Android 2019-09-09 13:50:46 -07:00
Sam Lantinga
77d8ec0dbc SDL_blit_N.c: Correct vec_perm() application on little-endian 64-bit PowerPC
The LE transformation for vec_perm has an implicit assumption that the
permutation is being used to reorder vector elements (in this case 4-byte
integer word elements), not to reorder bytes within those elements.  Although
this is legal behavior, it is not anticipated by the transformation performed
by the compilers.

This causes pygame-1.9.1 test failure on PPC64LE because blitted pixmaps are
corrupted there due to how SDL uses vec_perm().

From RedHat / Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1392465
Original patch was provided by: Menanteau Guy <menantea@linux.vnet.ibm.com>
2019-09-06 08:50:19 -07:00
Conn O'Griofa
0dadd146a6 KMSDRM_GLES_SwapWindow: fix non-vsync case
If KMSDRM_drmModeSetCrtc is called when the swap interval is
set to 0, the driver behaves as though vertical sync is engaged by
limiting framerate to the refresh rate, but performance is much worse
than with vertical sync enabled.

Resolve this issue by ensuring that the Crtc is only set up once,
and KMSDRM_drmModePageFlip is called, albeit without any followup
queueing or waiting for flips.
2019-09-06 08:44:46 -07:00
Sam Lantinga
9f7ed473fc Fixed bug 4789 - Linux accelerometers no longer available as joysticks
Daniel Drake

A long time ago, it was possible to play neverball on Linux using the accelerometer found in HP laptops.

The kernel exposes the accelerometer as a joystick (/dev/input/jsX) as well as an evdev device (/dev/input/eventX). I guess it worked fine when SDL was using the js interface, but then stopped working here: http://hg.libsdl.org/SDL/rev/fdaeea9e7567

Looking at current code which uses udev to discover joysticks, it looks for the udev tag ID_INPUT_JOYSTICK.

However udev's internal input_id logic specifically tags accelerometers as ID_INPUT_ACCELEROMETER and nothing else.

This looks like a good fit for SDL_HINT_ACCELEROMETER_AS_JOYSTICK.
2019-09-06 08:42:54 -07:00
Ozkan Sezer
54cb8a7451 SDL_windowsevents.c: remove isVistaOrNewer (not used since 8254c364ec4a) 2019-09-05 20:47:20 +03:00
Ozkan Sezer
ed7faa076e fix permissions 2019-09-05 13:21:02 +03:00
Sylvain Becker
548a1f9d93 SDL_windowsmessagebox.c: remove unused variable 2019-09-05 10:49:53 +02:00
Sylvain Becker
6f9bfb75f0 SDL_bmp.c: remove unused variable warnings 2019-09-05 10:08:47 +02:00
Sam Lantinga
cc181908f0 x11: add a hint to force the VisualID used when creating a window. 2019-09-04 09:27:58 -07:00
Ryan C. Gordon
cf6b9e8180 stdinc: On macOS and iOS, use memset_pattern4() for SDL_memset4().
Fixes Bugzilla #4724.

--HG--
extra : rebase_source : 09a73f9539ef4b5086c68dcbd42be5944b551fa8
2019-09-04 00:39:47 -04:00
Sam Lantinga
9bfd60fb48 Fixed bug 4536 - Heap-Buffer Overflow in SDL_GetRGB pertaining to SDL_pixels.c
Ozkan Sezer

As for the issue: This bmp reports bpp=0, therefore SDL_CalculatePitch()
returns pitch==0, which is then fed to SDL_malloc() (which is malloc())
and malloc(0) returns _something_ which is not NULL but not someting
that we expect..  Then testsprite.c:LoadSprite() accesses the pixels
as *(Uint8*)pixels which valrind reports as:

==15533== Invalid read of size 1
==15533==    at 0x8048C08: LoadSprite (testsprite.c:45)
==15533==    by 0x80492FC: main (testsprite.c:224)
==15533==  Address 0x449e588 is 0 bytes after a block of size 0 alloc'd
==15533==    at 0x40072B2: malloc (vg_replace_malloc.c:270)
==15533==    by 0x4045719: SDL_CreateRGBSurface (SDL_surface.c:126)
==15533==    by 0x40403C1: SDL_LoadBMP_RW (SDL_bmp.c:237)
==15533==    by 0x8048BB2: LoadSprite (testsprite.c:36)
==15533==    by 0x80492FC: main (testsprite.c:224)

Besides, valrind also reports this:
==15533== Conditional jump or move depends on uninitialised value(s)
==15533==    at 0x40403F3: SDL_LoadBMP_RW (SDL_bmp.c:247)
==15533==    by 0x8048BB2: LoadSprite (testsprite.c:36)
==15533==    by 0x80492FC: main (testsprite.c:224)


Easy/quick solution would be early-rejecting a bmp with 0 bpp from SDL_bmp.c:SDL_LoadBMP_RW()
2019-09-03 11:55:20 -07:00
Ozkan Sezer
09a1cda048 SDL_bmp.c: restore most of the original formatting. 2019-09-02 12:35:00 +03:00
Ryan C. Gordon
25172f6f82 direct3d: Be more aggressive about resetting state when textures go away.
Fixes Bugzilla #4768.
2019-09-02 00:11:58 -04:00
Ryan C. Gordon
94bcd876de d3d11: Fixed VB state, avoiding unnecessary recreation (Thanks, Alex!).
Fixes Bugzilla #4779.
2019-09-01 22:41:44 -04:00
Sylvain Becker
f03b5ef30e LoadBMP: fix some warnings 2019-08-31 22:58:11 +02:00
Sylvain Becker
5982324061 LoadBMP: use code from SDL_image which allows loading compressed BMP files 2019-08-31 22:52:15 +02:00
Sam Lantinga
827c02da57 Allow mouse messages from Wacom pens, e.g. right click pen buttons, etc. 2019-08-30 15:32:15 -07:00
Sam Lantinga
7f1ee3f05e Fixed bug where the Steam overlay would generate an event and stop input processing for the frame. 2019-08-30 08:03:19 -07:00
Ozkan Sezer
4ee2aba0d1 use 'U' suffix on constants instead of (unsigned int) cast. 2019-08-30 11:35:20 +03:00
Sylvain Becker
e7b47e02ba Android: minor warning 2019-08-30 09:00:06 +02:00
Sylvain Becker
017af0ae91 Android: fix corresponding warnings 2019-08-30 08:55:20 +02:00
Sylvain Becker
ed4d83da73 Android: add more warning flags 2019-08-30 08:43:13 +02:00
Sylvain Becker
a8b00e9d91 Fixed bug 3918 - HIDAPI, CMake support for android project 2019-08-27 11:38:43 +02:00
Sam Lantinga
7b13b4a196 Fixed Windows relative mouse coordinates when capturing the mouse over RDP 2019-08-26 17:43:01 -07:00
Alex Szpakowski
9b8c97f15c gl/gles/gles2 render: fix SDL_RenderClear being affected by the clip rect in some situations. 2019-08-26 18:49:04 -03:00
Sam Lantinga
ace57ce610 Fixed bug 4475 - add Gasia Co. Ltd PS(R) Gamepad support
Frank

This gamepad/controller is sold in Germany https://www.amazon.de/gp/product/B01AQTPSA6/ref=ppx_yo_dt_b_asin_title_o03__o00_s00 but isn't supported right now. It identifies as "Gasia Co. Ltd PS(R) Gamepad"
2019-08-26 10:08:25 -07:00
Ozkan Sezer
c4d911d170 RPI_FreeCursor: set global_cursor to NULL to prevent double-free (bug 4769) 2019-08-26 18:41:40 +03:00
Sylvain Becker
0d0b51f2db Fixed bug 1663 - SDL_EventState(SDL_DOLLARGESTURE,SDL_IGNORE) etc. has no effect 2019-08-24 20:40:37 +02:00
Ozkan Sezer
0df1fc13af fix permissions 2019-08-23 03:01:10 +03:00
Sam Lantinga
b9acc8cecd Fixed whitespace 2019-08-22 16:12:16 -07:00
Sam Lantinga
f9c83e5ce5 [SDL][IOS] Audio fix - applies stream to sound data when resampling or reformatting is required. 2019-08-22 16:09:42 -07:00
Sam Lantinga
524454bad0 Prevent the SPEEDLINK COMPETITION PRO joystick from switching into Android controller mode when enumerated over HID on Windows 10. 2019-08-22 15:58:00 -07:00
Alex Szpakowski
504d68fa8f macOS: Use the proper type (NSSize instead of CGSize) for the bounds of metal views. 2019-08-22 19:23:52 -03:00
Sylvain Becker
0fb1a8c50a Fixed bug 4172 - remove logging Gesture error "NumPoints = 0"
- not necessary when app isn't recording gesture.
- happen when gesture path has less than 2 different points
2019-08-22 10:15:33 +02:00
Sylvain Becker
39b5b2d72c Fix audio conversion U16_to_F32_SSE2 (bug 4186) 2019-08-19 21:23:47 +02:00
Sylvain Becker
8749ba20aa Fixed bug 4186 - ARM/NEON audio converters cause strange clicking noises
reverse the order when storing ouput buffer
2019-08-19 20:35:02 +02:00
Sylvain Becker
940eeb03d0 Fixed bug 4186 - ARM/NEON audio converters cause strange clicking noises
reverse the order when storing ouput buffer
2019-08-19 16:57:15 +02:00
Alex Szpakowski
0f14f2a87a metal renderer: optimize SDL_RenderFillRect slightly. 2019-08-18 10:38:32 -03:00
Alex Szpakowski
ccfe75a655 render: fix colors not being set properly after the previous change 2019-08-18 09:35:11 -03:00
Alex Szpakowski
0b01e3cf35 render: avoid a couple redundant memcmp calls in all drawing functions. Improves performance slightly. 2019-08-17 22:26:33 -03:00
Alex Szpakowski
fd9b2e7257 metal renderer: use vertex attributes instead of indexing into a buffer with the vertex id in the shader. Allows for more flexibility with vertex setup in the future.
Also optimize vertex buffer binding slightly.
2019-08-17 16:53:08 -03:00
Alex Szpakowski
bee3a60005 metal renderer: more closely match buffer data alignment requirements from the metal specification. 2019-08-17 01:09:30 -03:00
Alex Szpakowski
e03c7d97d3 render: simplify vertex and uniform data allocation. Improves performance of various SDL_Render functions (bug #4764). 2019-08-17 00:43:44 -03:00
Alex Szpakowski
8a2ccace8a metal renderer: use the device address space instead of the constant address space for colors.
It doesn't negatively impact GPU performance in my tests, and it removes the need for 256 byte memory alignment of color data on macOS.
2019-08-17 00:37:22 -03:00
Alex Szpakowski
9d1d406b74 metal: Update compiled shaders based on compilation script changes 2019-08-16 22:13:30 -03:00
Alex Szpakowski
c4524f16b7 metal: Update shader compilation script with fixes for newer xcode versions and for running on older platforms 2019-08-16 22:11:50 -03:00
Alex Szpakowski
1cac684966 iOS: Fix issues with Split VIew on iPad (bugs #4586, #4705). 2019-08-15 19:38:12 -03:00
Sylvain Becker
7a36cc410d Android: remove tabs/indent 2019-08-15 20:38:25 +02:00
Sylvain Becker
d6637510b2 Android: SDL_image/SDL_mixer/SDL_ttf partially compiling with CMake (bug 3918) 2019-08-13 16:00:08 +02:00
Sam Lantinga
dcf21d5da2 Disable HIDAPI by default, as it breaks on Linux when trying to use libusb with non-root permissions on some distributions 2019-08-12 13:35:36 -07:00
Sylvain Becker
79da113ed7 Fixed bug 3918 - CMake support for android project 2019-08-11 15:23:37 +02:00
Ozkan Sezer
102850e1bd fix permissions 2019-08-08 23:35:02 +03:00
Sam Lantinga
9a01434255 [ SDL ] Fix compile error building for Windows/ARM64 on Visual Studio 2017 Win10 SDK 10.0.18362.0 which requires ar,74intr.h/arm64_neon.h header instead of armintr.h/arm_neon.h for intrinsics.
@saml
2019-08-08 13:26:05 -07:00
Ethan Lee
ebf1ac3122 hidapi: Explicitly include locale.h, for setlocale 2019-08-06 23:08:01 -04:00
Sam Lantinga
5a7015c93c Fixed bug 4747 - [Patch] SDL_ShowMessageBox ignores BUTTON_RETURNKEY_DEFAULT flag
Caleb Cornett

SDL_ShowMessageBox on UIKit doesn't do anything special with buttons that are marked with the flag SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT. According to Apple's documentation on UIAlertController, a button can respond to a return key if it's marked as the preferredAction of the controller. SDL doesn't set a preferredAction currently, so I've attached a patch to fix that.
2019-08-05 23:52:16 -07:00
Sam Lantinga
97b93a86d6 Fixed bug 4354 - CMake builds do not correctly enable IME on Linux
Callum McGing

While the CMake build checks for ibus and does enable the ibus backend with set(HAVE_IBUS_IBUS_H TRUE), this does not define SDL_USE_IME, thus CMake built SDL2 (as in Arch Linux) cannot use IME at all.

The attached patch fixes this behaviour when building against ibus. IME support will still fail when only fcitx is available on the build system.
2019-08-05 23:46:09 -07:00
Sam Lantinga
01075dc1f2 Fixed bug 4689 - SDL fails to detect compositor shutdown on Wayland -- program keeps running
M Stoeckl

To reproduce:

1. Run any SDL-based program with a Wayland compositor, orphaning it so that it doesn't have an immediate parent process. (For example, from a terminal, running `supertux2 & disown`.) The program should use the wayland backend, i.e. by setting environment variable SDL_VIDEODRIVER=wayland.
2. Kill the compositor process.

Results:

- The SDL program will keep running.

Expected results:

- The SDL program should close. (What close should mean here, I'm not sure - is injecting an SDL_Quit the appropriate action when a video driver disconnects?)

Build data:

2019-06-22, hg tip (12901:5cbf6472a916), Linux, can reproduce with sway, weston, and other Wayland oompositors.
2019-08-05 23:38:48 -07:00
Ethan Lee
99abe1244f Port libusb hid.c to SDL, add to MinGW configure 2019-08-04 00:01:38 -04:00
Alex Szpakowski
0ba98cae5f Add public APIs for creating a Metal view attached to an SDL window. Add SDL_metal.h. 2019-08-05 12:35:32 -03:00
Alex Szpakowski
84cb66b8a8 macOS: fix a typo in touch handling code. 2019-08-04 23:30:55 -03:00
Alex Szpakowski
5934a368bb Fix touch-related compile errors on Linux. 2019-08-04 16:56:40 -03:00
Ozkan Sezer
2467ed197c minor warning fixes. 2019-08-04 14:56:02 +03:00
Alex Szpakowski
99c222cc77 Implement touch window IDs on x11/xinput2. 2019-08-04 00:34:23 -03:00
Ozkan Sezer
08a0f96749 fix permissions 2019-08-03 12:50:28 +03:00
Ozkan Sezer
0f3d9a7186 remove test/aclocal.m4 2019-08-03 12:49:50 +03:00
Sam Lantinga
1d2350c07f Fixed building on Mac OS X without libusb 2019-08-02 18:14:31 -07:00
Sam Lantinga
7de41a80e1 Fix nullptr crash on android
nullcheck the device coming back from InputDevice.getDevice(deviceId) in new code added to sdlactivity.onkey.


java.lang.NullPointerException:
  at org.libsdl.app.SDLSurface.onKey (SDLActivity.java:1793)
  at android.view.View.dispatchKeyEvent (View.java:13321)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1912)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1912)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1912)
  at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1912)
  at com.android.internal.policy.DecorView.superDispatchKeyEvent (DecorView.java:685)
  at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent (PhoneWindow.java:1869)
  at android.app.Activity.dispatchKeyEvent (Activity.java:3447)
  at org.libsdl.app.SDLActivity.dispatchKeyEvent (SDLActivity.java:496)

@dang @saml @dave
2019-08-02 17:20:00 -07:00
Sam Lantinga
ac6485552e Fix bug where the wrong button was the default in the old message box because buttons were added backwards, breaking the indexing used by GetButtonIndex.
Add messagebox flags to explicilty request left-to-right button order or right-to-left.  If neither is specified it'll be some platform default.
2019-08-02 17:19:50 -07:00
Sam Lantinga
f146a96b35 Added support for a few controllers on Android 2019-08-02 17:12:49 -07:00
Alex Szpakowski
d34695ffd4 Add a windowID field to SDL_TouchFingerEvent (bug #4331).
This is unimplemented on some platforms and will cause compile errors when building those platform backends for now.
2019-08-01 18:22:12 -03:00
Ozkan Sezer
c8e23236cd configury: allow libusb-less hidapi for macosx. 2019-08-01 17:41:40 +03:00
Ozkan Sezer
9c13eeabbb use WIN_IsWindowsVistaOrGreater() from core/windows for isVistaOrNewer 2019-07-31 23:37:02 +03:00
Ethan Lee
55c49e7d33 hidapi: Add SDL_hidapi.c, allows support for multiple hidapi backends.
This is currently supported on Linux and macOS. iOS and Android are not
supported at all, Windows support could be added with some changes to the libusb
backend. The Visual Studio and Xcode projects do not use this feature.

Based on Valve Software's hid.cpp, written in collaboration with Andrew Eikum.
2019-07-31 12:20:55 -04:00
Sam Lantinga
571fc2a8b1 Make sure HIDAPI is initialized whenever we call HIDAPI_IsDevicePresent() 2019-07-31 10:20:37 -07:00
Andrew Eikum
e0039a7c75 joystick: Ensure HIDAPI is initialized before calling it 2019-07-31 11:14:48 -05:00
Andrew Eikum
5e44950dfe cmake: Fix locating libusb header at configure-time
Removing the CheckUSBHID call is necessary to avoid caching the failed header
check result before we find libusb via pkg-config.
2019-07-31 11:34:00 -05:00
Ozkan Sezer
ac7da51929 minor whitespace tidy-up. 2019-07-31 19:40:50 +03:00
Sam Lantinga
198b2d497f Fixed bug 4692 - Command line parsing
Galadrim

As I have seen, SDL implements its own command line parser for Windows in SDL_windows_main.c. Unfortunately, it doesn't seem to allow command line arguments with trailing backslashes if quoting is required.

Usually, when you write an application that gets command line arguments passed as argc and argv, the parsing is done by parse_cmdline. The Windows API also provides the function CommandLineToArgvW, so an application can parse itself if only the command line string is provided. Both functions behave almost identically according to their documentation. If the argument "\\" (including the quotes) is passed, they both turn it into a single backslash.

The SDL command line parser on the other hand doesn't recognize the second quote character as the closing character in this example and therefore includes it in the parsed argument. The parser does not count the number of backslashes preceding a quote. It always treats a quote as escaped if a backslash is in front of it. Therefore, it should be impossible to quote and escape an argument correctly, if it has a trailing backslash and contains characters that require quoting.

Of course, each application is allowed to implement its own parsing rules, so SDL is free to do so. But the problem I see is that there are arguments, that are impossible to be passed to the parser correctly, as I described above. Is there a reason, why SDL does not simply use CommandLineToArgvW instead of implementing its own parser?

Here are some links that show that correct argument parsing, as it is usually done in Windows, is quite complicated:

https://docs.microsoft.com/en-us/windows/desktop/api/shellapi/nf-shellapi-commandlinetoargvw

http://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/
2019-07-31 09:11:20 -07:00
Ozkan Sezer
32894f4f11 use SDL_zeroa at more places where the argument is an array. 2019-07-31 05:11:40 +03:00
Ozkan Sezer
ab8f831379 Fix bug 4746 - introduce SDL_zeroa macro. 2019-07-31 01:22:02 +03:00
Ozkan Sezer
ac4cb57923 minor build fix. 2019-07-31 01:19:26 +03:00
Ozkan Sezer
82cdc07031 MS_ADPCM_Decode: fix assigning an array to a pointer (lose '&'). 2019-07-31 00:10:00 +03:00
Ozkan Sezer
97014820d1 better readability.. 2019-07-31 00:07:15 +03:00
Ozkan Sezer
61368f443c SDL_iconv_string: add (char*) casts before SDL_malloc() calls. 2019-07-31 00:06:50 +03:00
Ozkan Sezer
0806aa2d53 minor build fixes. 2019-07-31 00:05:28 +03:00
Sam Lantinga
85138c1ec6 Fixed bug 4538 - validate image size when loading BMP files 2019-07-30 11:00:00 -07:00
Andrew Eikum
5542297551 hidapi: Update repository URLs
Upstream hidapi has been re-homed. Update the repo URLs to help guide folks
where to contribute fixes.
2019-07-25 08:05:13 -05:00
Sam Lantinga
f20de21177 Fixed bug 4742 - SDL 2.0.10 DMG has duplicated files (instead of symlinks) 2019-07-30 10:15:49 -07:00
Sam Lantinga
88ea879a38 Fixed bug 4745 - 2.0.10 fails to build against macOS 10.11 SDK
Joshua Root

NSEventSubtypeMouseEvent was added in 10.12, so it needs to be defined on 10.11 as well
2019-07-30 10:04:46 -07:00
Sylvain Becker
2e6310cc74 Fixed bug 4739 - Android: loading native libs, generated by bundletool (Thanks akk0rd87) 2019-07-27 20:21:42 +02:00
Alex Szpakowski
9f568ea83a macOS: fix atomics using deprecated functions instead of compiler intrinsics, when SDL is built with the Xcode project. 2019-07-27 14:08:51 -03:00
Sam Lantinga
b43ec841b4 Don't call hid_enumerate() if the HIDAPI drivers are all disabled 2019-07-25 15:21:44 -07:00
Sam Lantinga
902abb593a Added tag release-2.0.10 for changeset bc90ce38f1e2 2019-07-25 11:04:36 -07:00
892 changed files with 34868 additions and 12269 deletions

View file

@ -4,13 +4,34 @@ autom4te*
config.cache
config.log
config.status
libtool
Makefile
sdl-config
Makefile.rules
sdl2-config
sdl2-config.cmake
sdl2.pc
SDL2.spec
build
gen
Build
# for CMake
CMakeFiles/
CMakeCache.txt
cmake_install.cmake
cmake_uninstall.cmake
SDL2ConfigVersion.cmake
*.a
*.la
*.so
*.so.*
.ninja_*
*.ninja
# for CLion
.idea
cmake-build-*
# for Xcode
*.orig
*.swp
@ -58,7 +79,7 @@ VisualC/visualtest/testsprite2_sample.parameters
# for Android
android-project/local.properties
sdl.pc
test/aclocal.m4
test/autom4te*
test/config.cache
test/config.log
@ -122,10 +143,13 @@ test/testthread
test/testtimer
test/testver
test/testviewport
test/testvulkan
test/testwm2
test/testyuv
test/torturethread
test/*.exe
test/*,e1f
test/*,ff8
test/*.dSYM
buildbot
test/buildbot

View file

@ -34,3 +34,4 @@ e12c387305129c847b3928a123300b113782fe3f release-2.0.4
2088cd828335797d73d151e3288d899f77204862 release-2.0.7
f1084c419f33610cf274e309a8b2798d2ae665c7 release-2.0.8
8feb5da6f2fb75703bde2c06813375af984a57f0 release-2.0.9
bc90ce38f1e27ace54b83bebf987993002504f7f release-2.0.10

6
Android.mk Normal file → Executable file
View file

@ -64,7 +64,11 @@ LOCAL_CFLAGS += \
-Wmissing-variable-declarations \
-Wfloat-conversion \
-Wshorten-64-to-32 \
-Wunreachable-code-return
-Wunreachable-code-return \
-Wshift-sign-overflow \
-Wstrict-prototypes \
-Wkeyword-macro \
# Warnings we haven't fixed (yet)
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare

View file

@ -42,12 +42,12 @@ include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake)
# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
set(SDL_MAJOR_VERSION 2)
set(SDL_MINOR_VERSION 0)
set(SDL_MICRO_VERSION 10)
set(SDL_MICRO_VERSION 12)
set(SDL_INTERFACE_AGE 0)
set(SDL_BINARY_AGE 10)
set(SDL_BINARY_AGE 12)
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
# the following should match the versions in Xcode project file:
set(DYLIB_CURRENT_VERSION 10.0.0)
set(DYLIB_CURRENT_VERSION 12.0.0)
set(DYLIB_COMPATIBILITY_VERSION 1.0.0)
# Set defaults preventing destination file conflicts
@ -118,6 +118,8 @@ elseif(APPLE)
set(DARWIN TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
set(MACOSX TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*")
set(TVOS TRUE)
endif()
# TODO: iOS?
elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*")
@ -127,7 +129,7 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
endif()
# Don't mistake osx for unix
if(UNIX AND NOT APPLE)
if(UNIX AND NOT APPLE AND NOT RISCOS)
set(UNIX_SYS ON)
else()
set(UNIX_SYS OFF)
@ -156,11 +158,10 @@ if(UNIX OR MINGW OR MSYS)
endif()
# The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers,
# so we'll just use libusb when it's available. Except that libusb
# requires root permissions to open devices, so that's not generally
# useful, and we'll disable this by default on Unix. Windows and macOS
# can use it without root access, though, so enable by default there.
if(WINDOWS OR APPLE OR ANDROID)
# so we'll just use libusb when it's available. libusb does not support iOS,
# so we default to yes on iOS.
# TODO: Windows can support libusb, the hid.c file just depends on Unix APIs
if(WINDOWS OR IOS OR TVOS OR ANDROID)
set(HIDAPI_SKIP_LIBUSB TRUE)
else()
set(HIDAPI_SKIP_LIBUSB FALSE)
@ -169,6 +170,14 @@ if (HIDAPI_SKIP_LIBUSB)
set(OPT_DEF_HIDAPI ON)
endif()
# On the other hand, *BSD specifically uses libusb only, so we make a special
# case just for them.
if(FREEBSD OR NETBSD OR OPENBSD OR BSDI)
set(HIDAPI_ONLY_LIBUSB TRUE)
else()
set(HIDAPI_ONLY_LIBUSB FALSE)
endif()
# Compiler info
if(CMAKE_COMPILER_IS_GNUCC)
set(USE_GCC TRUE)
@ -320,6 +329,8 @@ set_option(SSE "Use SSE assembly routines" ${OPT_DEF_ASM})
set_option(SSE2 "Use SSE2 assembly routines" ${OPT_DEF_SSEMATH})
set_option(SSE3 "Use SSE3 assembly routines" ${OPT_DEF_SSEMATH})
set_option(ALTIVEC "Use Altivec assembly routines" ${OPT_DEF_ASM})
set_option(ARMSIMD "use SIMD assembly blitters on ARM" ON)
set_option(ARMNEON "use NEON assembly blitters on ARM" ON)
set_option(DISKAUDIO "Support the disk writer audio driver" ON)
set_option(DUMMYAUDIO "Support the dummy audio driver" ON)
set_option(VIDEO_DIRECTFB "Use DirectFB video driver" OFF)
@ -330,7 +341,7 @@ set_option(VIDEO_OPENGLES "Include OpenGL ES support" ON)
set_option(PTHREADS "Use POSIX threads for multi-threading" ${SDL_PTHREADS_ENABLED_BY_DEFAULT})
dep_option(PTHREADS_SEM "Use pthread semaphores" ON "PTHREADS" OFF)
set_option(SDL_DLOPEN "Use dlopen for shared object loading" ${SDL_DLOPEN_ENABLED_BY_DEFAULT})
set_option(OSS "Support the OSS audio API" ${UNIX_SYS})
dep_option(OSS "Support the OSS audio API" ON "UNIX_SYS OR RISCOS" OFF)
set_option(ALSA "Support the ALSA audio API" ${UNIX_SYS})
dep_option(ALSA_SHARED "Dynamically load ALSA audio support" ON "ALSA" OFF)
set_option(JACK "Support the JACK audio API" ${UNIX_SYS})
@ -366,11 +377,13 @@ set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE})
set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS})
set_option(WASAPI "Use the Windows WASAPI audio driver" ${WINDOWS})
set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS})
set_option(VIDEO_MALI "Use Mali EGL video driver" ${UNIX_SYS})
set_option(RENDER_METAL "Enable the Metal render driver" ${APPLE})
set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS})
dep_option(VIDEO_VULKAN "Enable Vulkan support" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF)
set_option(VIDEO_METAL "Enable Metal support" ${APPLE})
set_option(VIDEO_KMSDRM "Use KMS DRM video driver" ${UNIX_SYS})
dep_option(KMSDRM_SHARED "Dynamically load KMS DRM support" ON "VIDEO_KMSDRM" OFF)
set_option(VIDEO_OFFSCREEN "Use offscreen video driver" OFF)
option_string(BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal or 'OFF'" "OFF")
option_string(FOREGROUNDING_SIGNAL "number to use for magic foregrounding signal or 'OFF'" "OFF")
set_option(HIDAPI "Use HIDAPI for low level joystick drivers" ${OPT_DEF_HIDAPI})
@ -660,6 +673,61 @@ if(ASSEMBLY)
endif()
endif()
endif()
if(ARMSIMD)
set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp")
check_c_source_compiles("
.text
.arch armv6
.object_arch armv4
.arm
.altmacro
#ifndef __ARM_EABI__
#error EABI is required (to be sure that calling conventions are compatible)
#endif
pld [r0]
uqadd8 r0, r0, r0
" ARMSIMD_FOUND)
set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
if(ARMSIMD_FOUND)
set(HAVE_ARMSIMD TRUE)
set(SDL_ARM_SIMD_BLITTERS 1)
file(GLOB ARMSIMD_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S)
set(SOURCE_FILES ${SOURCE_FILES} ${ARMSIMD_SOURCES})
set(WARN_ABOUT_ARM_SIMD_ASM_MIT TRUE)
endif()
endif()
if(ARMNEON)
set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp")
check_c_source_compiles("
.text
.fpu neon
.arch armv7a
.object_arch armv4
.eabi_attribute 10, 0
.arm
.altmacro
#ifndef __ARM_EABI__
#error EABI is required (to be sure that calling conventions are compatible)
#endif
pld [r0]
vmovn.u16 d0, q0
" ARMNEON_FOUND)
set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
if(ARMNEON_FOUND)
set(HAVE_ARMNEON TRUE)
set(SDL_ARM_NEON_BLITTERS 1)
file(GLOB ARMNEON_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S)
set(SOURCE_FILES ${SOURCE_FILES} ${ARMNEON_SOURCES})
set(WARN_ABOUT_ARM_NEON_ASM_MIT TRUE)
endif()
endif()
elseif(MSVC_VERSION GREATER 1500)
# TODO: SDL_cpuinfo.h needs to support the user's configuration wish
# for MSVC - right now it is always activated
@ -692,10 +760,10 @@ if(LIBC)
set(HAVE_SIGNAL_H 1)
foreach(_FN
malloc calloc realloc free qsort abs memset memcpy memmove memcmp
wcslen wcscmp
wcslen wcslcpy wcslcat wcsdup wcsstr wcscmp wcsncmp
strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
_ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp
_stricmp _strnicmp sscanf
_stricmp _strnicmp strtok_s sscanf
acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf
copysign copysignf cos cosf exp expf fabs fabsf floor floorf fmod fmodf
log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
@ -729,10 +797,11 @@ if(LIBC)
foreach(_FN
strtod malloc calloc realloc free getenv setenv putenv unsetenv
qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat
_strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
_strrev _strupr _strlwr strchr strrchr strstr strtok_r itoa _ltoa
_uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull
atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp
vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp
wcscmp wcsdup wcslcat wcslcpy wcslen wcsncmp wcsstr
sscanf vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp
nanosleep sysconf sysctlbyname getauxval poll _Exit
)
string(TOUPPER ${_FN} _UPPER)
@ -744,8 +813,10 @@ if(LIBC)
if(HAVE_LIBM)
set(CMAKE_REQUIRED_LIBRARIES m)
foreach(_FN
atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin
sinf sqrt sqrtf tan tanf acos asin)
atan atan2 atanf atan2f ceil ceilf copysign copysignf cos cosf
exp expf fabs fabsf floor floorf fmod fmodf log logf log10 log10f
pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf acos acosf
asin asinf)
string(TOUPPER ${_FN} _UPPER)
set(_HAVEVAR "HAVE_${_UPPER}")
check_function_exists("${_FN}" ${_HAVEVAR})
@ -842,6 +913,13 @@ if(SDL_VIDEO)
set(HAVE_VIDEO_DUMMY TRUE)
set(HAVE_SDL_VIDEO TRUE)
endif()
if(VIDEO_OFFSCREEN)
set(SDL_VIDEO_DRIVER_OFFSCREEN 1)
file(GLOB VIDEO_OFFSCREEN_SOURCES ${SDL2_SOURCE_DIR}/src/video/offscreen/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_OFFSCREEN_SOURCES})
set(HAVE_VIDEO_OFFSCREEN TRUE)
set(HAVE_SDL_VIDEO TRUE)
endif()
endif()
# Platform-specific options and settings
@ -917,12 +995,18 @@ if(ANDROID)
set(HAVE_SDL_VIDEO TRUE)
# Core stuff
find_library(ANDROID_DL_LIBRARY dl)
# find_library(ANDROID_DL_LIBRARY dl)
# FIXME failing dlopen https://github.com/android-ndk/ndk/issues/929
find_library(ANDROID_DL_LIBRARY NAMES libdl.so dl)
find_library(ANDROID_LOG_LIBRARY log)
find_library(ANDROID_LIBRARY_LIBRARY android)
list(APPEND EXTRA_LIBS ${ANDROID_DL_LIBRARY} ${ANDROID_LOG_LIBRARY} ${ANDROID_LIBRARY_LIBRARY})
add_definitions(-DGL_GLEXT_PROTOTYPES)
if (HAVE_HIDAPI)
list(APPEND EXTRA_LIBS hidapi)
endif()
#enable gles
if(VIDEO_OPENGLES)
set(SDL_VIDEO_OPENGL_EGL 1)
@ -1007,7 +1091,7 @@ elseif(EMSCRIPTEN)
endif()
endif()
elseif(UNIX AND NOT APPLE AND NOT ANDROID)
elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS)
if(SDL_AUDIO)
if(SYSV5 OR SOLARIS OR HPUX)
set(SDL_AUDIO_DRIVER_SUNAUDIO 1)
@ -1047,7 +1131,6 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID)
CheckWayland()
CheckVivante()
CheckKMSDRM()
CheckMali()
endif()
if(UNIX)
@ -1107,6 +1190,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID)
set(HAVE_IBUS_IBUS_H TRUE)
include_directories(${IBUS_INCLUDE_DIRS})
list(APPEND EXTRA_LIBS ${IBUS_LIBRARIES})
add_definitions(-DSDL_USE_IME)
endif()
if(HAVE_LIBUNWIND_H)
# We've already found the header, so REQUIRE the lib to be present
@ -1130,7 +1214,9 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID)
endif()
if(SDL_JOYSTICK)
CheckUSBHID() # seems to be BSD specific - limit the test to BSD only?
if(FREEBSD OR NETBSD OR OPENBSD OR BSDI)
CheckUSBHID()
endif()
CheckHIDAPI()
if(LINUX AND NOT ANDROID)
set(SDL_JOYSTICK_LINUX 1)
@ -1268,10 +1354,9 @@ elseif(WINDOWS)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
endif()
# headers needed elsewhere ...
# headers needed elsewhere
check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
check_include_file(endpointvolume.h HAVE_ENDPOINTVOLUME_H)
if(SDL_AUDIO)
set(SDL_AUDIO_DRIVER_WINMM 1)
@ -1376,6 +1461,7 @@ elseif(WINDOWS)
if(SDL_JOYSTICK)
CheckHIDAPI()
# TODO: Remove this hid.c block when SDL_hidapi.c is supported on Windows!
if(HAVE_HIDAPI)
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/windows/hid.c)
endif()
@ -1432,10 +1518,11 @@ elseif(APPLE)
# !!! FIXME: we need Carbon for some very old API calls in
# !!! FIXME: src/video/cocoa/SDL_cocoakeyboard.c, but we should figure out
# !!! FIXME: how to dump those.
if(NOT IOS)
if(DARWIN OR MACOSX)
set(SDL_FRAMEWORK_COCOA 1)
set(SDL_FRAMEWORK_CARBON 1)
endif()
set(SDL_FRAMEWORK_FOUNDATION 1)
# Requires the darwin file implementation
if(SDL_FILE)
@ -1459,56 +1546,63 @@ elseif(APPLE)
set(HAVE_SDL_AUDIO TRUE)
set(SDL_FRAMEWORK_COREAUDIO 1)
set(SDL_FRAMEWORK_AUDIOTOOLBOX 1)
set(SDL_FRAMEWORK_AVFOUNDATION 1)
endif()
if(SDL_JOYSTICK)
CheckHIDAPI()
if(HAVE_HIDAPI)
if(IOS)
if(IOS OR TVOS)
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/ios/hid.m)
else()
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/mac/hid.c)
set(SDL_FRAMEWORK_COREBLUETOOTH 1)
endif()
endif()
set(SDL_JOYSTICK_IOKIT 1)
if (IOS)
if(IOS OR TVOS)
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c)
set(SDL_JOYSTICK_MFI 1)
if(IOS)
set(SDL_FRAMEWORK_COREMOTION 1)
endif()
set(SDL_FRAMEWORK_GAMECONTROLLER 1)
set(HAVE_SDL_SENSORS 1)
else()
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c)
set(SDL_JOYSTICK_IOKIT 1)
set(SDL_FRAMEWORK_IOKIT 1)
set(SDL_FRAMEWORK_FF 1)
endif()
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
set(HAVE_SDL_JOYSTICK TRUE)
set(SDL_FRAMEWORK_IOKIT 1)
set(SDL_FRAMEWORK_FF 1)
endif()
if(SDL_HAPTIC)
set(SDL_HAPTIC_IOKIT 1)
if (IOS)
if (IOS OR TVOS)
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c)
set(SDL_HAPTIC_DUMMY 1)
else()
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c)
set(SDL_HAPTIC_IOKIT 1)
set(SDL_FRAMEWORK_IOKIT 1)
set(SDL_FRAMEWORK_FF 1)
endif()
set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
set(HAVE_SDL_HAPTIC TRUE)
set(SDL_FRAMEWORK_IOKIT 1)
set(SDL_FRAMEWORK_FF 1)
if(NOT SDL_JOYSTICK)
message(FATAL_ERROR "SDL_HAPTIC requires SDL_JOYSTICK to be enabled")
endif()
endif()
if(SDL_POWER)
set(SDL_POWER_MACOSX 1)
if (IOS)
if (IOS OR TVOS)
file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/uikit/*.m)
set(SDL_POWER_UIKIT 1)
else()
file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/macosx/*.c)
set(SDL_POWER_MACOSX 1)
set(SDL_FRAMEWORK_IOKIT 1)
endif()
set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES})
set(HAVE_SDL_POWER TRUE)
set(SDL_FRAMEWORK_IOKIT 1)
endif()
if(SDL_TIMERS)
@ -1527,6 +1621,89 @@ elseif(APPLE)
set(HAVE_SDL_FILESYSTEM TRUE)
endif()
if(SDL_SENSOR)
if(IOS)
set(SDL_SENSOR_COREMOTION 1)
set(HAVE_SDL_SENSORS TRUE)
file(GLOB SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/coremotion/*.m)
set(SOURCE_FILES ${SOURCE_FILES} ${SENSOR_SOURCES})
endif()
endif()
# iOS hack needed - http://code.google.com/p/ios-cmake/ ?
if(SDL_VIDEO)
if (IOS OR TVOS)
set(SDL_VIDEO_DRIVER_UIKIT 1)
set(SDL_FRAMEWORK_COREGRAPHICS 1)
set(SDL_FRAMEWORK_QUARTZCORE 1)
set(SDL_FRAMEWORK_UIKIT 1)
set(SDL_IPHONE_KEYBOARD 1)
set(SDL_IPHONE_LAUNCHSCREEN 1)
file(GLOB UIKITVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/uikit/*.m)
set(SOURCE_FILES ${SOURCE_FILES} ${UIKITVIDEO_SOURCES})
else()
CheckCOCOA()
if(VIDEO_OPENGL)
set(SDL_VIDEO_OPENGL 1)
set(SDL_VIDEO_OPENGL_CGL 1)
set(SDL_VIDEO_RENDER_OGL 1)
set(HAVE_VIDEO_OPENGL TRUE)
endif()
endif()
if(VIDEO_OPENGLES)
if(IOS OR TVOS)
set(SDL_FRAMEWORK_OPENGLES 1)
set(SDL_VIDEO_OPENGL_ES 1)
set(SDL_VIDEO_RENDER_OGL_ES 1)
else()
set(SDL_VIDEO_OPENGL_EGL 1)
endif()
set(SDL_VIDEO_OPENGL_ES2 1)
set(SDL_VIDEO_RENDER_OGL_ES2 1)
set(HAVE_VIDEO_OPENGLES TRUE)
endif()
if(VIDEO_VULKAN OR VIDEO_METAL OR RENDER_METAL)
set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x objective-c")
check_c_source_compiles("
#include <AvailabilityMacros.h>
#import <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
#if TARGET_OS_SIMULATOR || (!TARGET_CPU_X86_64 && !TARGET_CPU_ARM64)
#error Metal doesn't work on this configuration
#endif
int main()
{
return 0;
}
" HAVE_FRAMEWORK_METAL)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
if(HAVE_FRAMEWORK_METAL)
set(SDL_FRAMEWORK_METAL 1)
set(SDL_FRAMEWORK_QUARTZCORE 1)
else()
set(VIDEO_VULKAN 0)
set(VIDEO_METAL 0)
set(RENDER_METAL 0)
endif()
endif()
if(VIDEO_METAL)
set(SDL_VIDEO_METAL 1)
set(HAVE_VIDEO_METAL TRUE)
endif()
if(RENDER_METAL)
file(GLOB RENDER_METAL_SOURCES ${SDL2_SOURCE_DIR}/src/render/metal/*.m)
set(SOURCE_FILES ${SOURCE_FILES} ${RENDER_METAL_SOURCES})
set(SDL_VIDEO_RENDER_METAL 1)
set(HAVE_RENDER_METAL TRUE)
endif()
endif()
# Actually load the frameworks at the end so we don't duplicate include.
if(SDL_FRAMEWORK_COREVIDEO)
find_library(COREVIDEO CoreVideo)
@ -1556,30 +1733,54 @@ elseif(APPLE)
find_library(AUDIOTOOLBOX AudioToolbox)
list(APPEND EXTRA_LIBS ${AUDIOTOOLBOX})
endif()
# iOS hack needed - http://code.google.com/p/ios-cmake/ ?
if(SDL_VIDEO)
if (IOS)
set(SDL_VIDEO_DRIVER_UIKIT 1)
file(GLOB UIKITVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/uikit/*.m)
set(SOURCE_FILES ${SOURCE_FILES} ${UIKITVIDEO_SOURCES})
if(SDL_FRAMEWORK_AVFOUNDATION)
find_library(AVFOUNDATION AVFoundation)
list(APPEND EXTRA_LIBS ${AVFOUNDATION})
endif()
if(SDL_FRAMEWORK_COREBLUETOOTH)
find_library(COREBLUETOOTH CoreBluetooth)
list(APPEND EXTRA_LIBS ${COREBLUETOOTH})
endif()
if(SDL_FRAMEWORK_COREGRAPHICS)
find_library(COREGRAPHICS CoreGraphics)
list(APPEND EXTRA_LIBS ${COREGRAPHICS})
endif()
if(SDL_FRAMEWORK_COREMOTION)
find_library(COREMOTION CoreMotion)
list(APPEND EXTRA_LIBS ${COREMOTION})
endif()
if(SDL_FRAMEWORK_FOUNDATION)
find_library(FOUNDATION Foundation)
list(APPEND EXTRA_LIBS ${FOUNDATION})
endif()
if(SDL_FRAMEWORK_GAMECONTROLLER)
find_library(GAMECONTROLLER GameController)
list(APPEND EXTRA_LIBS ${GAMECONTROLLER})
endif()
if(SDL_FRAMEWORK_METAL)
if(IOS OR TVOS)
find_library(METAL Metal)
list(APPEND EXTRA_LIBS ${METAL})
else()
CheckCOCOA()
if(VIDEO_OPENGL)
set(SDL_VIDEO_OPENGL 1)
set(SDL_VIDEO_OPENGL_CGL 1)
set(SDL_VIDEO_RENDER_OGL 1)
set(HAVE_VIDEO_OPENGL TRUE)
endif()
if(VIDEO_OPENGLES)
set(SDL_VIDEO_OPENGL_EGL 1)
set(SDL_VIDEO_OPENGL_ES2 1)
set(SDL_VIDEO_RENDER_OGL_ES2 1)
set(HAVE_VIDEO_OPENGLES TRUE)
endif()
list(APPEND EXTRA_LDFLAGS "-Wl,-weak_framework,Metal")
endif()
endif()
if(SDL_FRAMEWORK_OPENGLES)
find_library(OPENGLES OpenGLES)
list(APPEND EXTRA_LIBS ${OPENGLES})
endif()
if(SDL_FRAMEWORK_QUARTZCORE)
if(IOS OR TVOS)
find_library(QUARTZCORE QuartzCore)
list(APPEND EXTRA_LIBS ${QUARTZCORE})
else()
list(APPEND EXTRA_LDFLAGS "-Wl,-weak_framework,QuartzCore")
endif()
endif()
if(SDL_FRAMEWORK_UIKIT)
find_library(UIKIT UIKit)
list(APPEND EXTRA_LIBS ${UIKIT})
endif()
CheckPTHREAD()
@ -1613,6 +1814,24 @@ elseif(HAIKU)
endif()
CheckPTHREAD()
elseif(RISCOS)
if(SDL_TIMERS)
set(SDL_TIMER_UNIX 1)
file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
set(HAVE_SDL_TIMERS TRUE)
if(CLOCK_GETTIME)
set(HAVE_CLOCK_GETTIME 1)
endif()
endif()
CheckPTHREAD()
if(SDL_AUDIO)
CheckOSS()
endif()
endif()
if(VIDEO_VULKAN)
@ -1786,15 +2005,37 @@ if(UNIX)
message(STATUS "")
endif()
if(WARN_ABOUT_ARM_SIMD_ASM_MIT)
message(STATUS "")
message(STATUS "SDL is being built with ARM SIMD optimizations, which")
message(STATUS "uses code licensed under the MIT license. If this is a")
message(STATUS "problem, please disable that code by rerunning CMake with:")
message(STATUS "")
message(STATUS " -DARMSIMD=OFF")
endif()
if(WARN_ABOUT_ARM_NEON_ASM_MIT)
message(STATUS "")
message(STATUS "SDL is being built with ARM NEON optimizations, which")
message(STATUS "uses code licensed under the MIT license. If this is a")
message(STATUS "problem, please disable that code by rerunning CMake with:")
message(STATUS "")
message(STATUS " -DARMNEON=OFF")
endif()
# Ensure that the extra cflags are used at compile time
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
# Always build SDLmain
add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include/SDL2>)
target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
set(_INSTALL_LIBS "SDL2main")
if (NOT ANDROID)
set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
endif()
if (ANDROID AND HAVE_HIDAPI)
set(_INSTALL_LIBS ${_INSTALL_LIBS} "hidapi")
endif()
if(SDL_SHARED)
@ -1822,9 +2063,13 @@ if(SDL_SHARED)
endif()
set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
target_include_directories(SDL2 PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include/SDL2>)
target_include_directories(SDL2 PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
if (NOT ANDROID)
set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
endif()
if(IOS OR TVOS)
set_property(TARGET SDL2 APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")
target_compile_definitions(SDL2 PRIVATE IOS_DYLIB=1)
endif()
endif()
@ -1839,7 +2084,9 @@ if(ANDROID)
set_target_properties(hidapi PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
set_target_properties(hidapi PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB")
endif()
target_link_libraries(hidapi log)
if(HAVE_HIDAPI)
target_link_libraries(hidapi log)
endif()
endif()
if(SDL_STATIC)
@ -1862,9 +2109,12 @@ if(SDL_STATIC)
# libraries - do we need to consider this?
set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS})
target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
target_include_directories(SDL2-static PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include/SDL2>)
target_include_directories(SDL2-static PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
if (NOT ANDROID)
set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
endif()
if(IOS OR TVOS)
set_property(TARGET SDL2-static APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")
endif()
endif()
@ -1887,7 +2137,7 @@ install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets
if (WINDOWS)
set(PKG_PREFIX "cmake")
else ()
set(PKG_PREFIX "lib/cmake/SDL2")
set(PKG_PREFIX "lib${LIB_SUFFIX}/cmake/SDL2")
endif ()
include(CMakePackageConfigHelpers)

View file

@ -1,6 +1,6 @@
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -46,7 +46,7 @@ WAYLAND_SCANNER = @WAYLAND_SCANNER@
INSTALL_SDL2_CONFIG = @INSTALL_SDL2_CONFIG@
SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols
SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac debian docs include Makefile.* sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols
GEN_DIST = SDL2.spec
ifneq ($V,1)
@ -84,6 +84,7 @@ HDRS = \
SDL_log.h \
SDL_main.h \
SDL_messagebox.h \
SDL_metal.h \
SDL_mouse.h \
SDL_mutex.h \
SDL_name.h \
@ -187,6 +188,7 @@ install-data:
ifeq ($(INSTALL_SDL2_CONFIG),TRUE)
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/cmake/SDL2
$(INSTALL) -m 644 sdl2-config.cmake $(DESTDIR)$(libdir)/cmake/SDL2
$(INSTALL) -m 644 sdl2-config-version.cmake $(DESTDIR)$(libdir)/cmake/SDL2
endif
uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data
@ -207,6 +209,7 @@ uninstall-data:
rm -f $(DESTDIR)$(datadir)/aclocal/sdl2.m4
rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl2.pc
rm -f $(DESTDIR)$(libdir)/cmake/SDL2/sdl2-config.cmake
rm -f $(DESTDIR)$(libdir)/cmake/SDL2/sdl2-config-version.cmake
clean:
rm -rf $(objects)

View file

@ -1,8 +1,8 @@
# Open Watcom makefile to build SDL2.dll for OS/2:
# Open Watcom makefile to build SDL2.dll for OS/2
# wmake -f Makefile.os2
LIBNAME = SDL2
VERSION = 2.0.10
VERSION = 2.0.12
DESCRIPTION = Simple DirectMedia Layer 2
LIBHOME = .
@ -33,7 +33,7 @@ MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.
s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c
SRCS = SDL.c SDL_assert.c SDL_error.c SDL_log.c SDL_dataqueue.c SDL_hints.c
SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c
SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c
SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c
SRCS+= SDL_rwops.c SDL_power.c
SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c
@ -89,6 +89,9 @@ SDL_cpuinfo.obj: SDL_cpuinfo.c
SDL_rwops.obj: SDL_rwops.c
wcc386 $(CFLAGS) -wcd=136 -fo=$^@ $<
SDL_wave.obj: SDL_wave.c
wcc386 $(CFLAGS) -wcd=124 -fo=$^@ $<
SDL_blendfillrect.obj: SDL_blendfillrect.c
wcc386 $(CFLAGS) -wcd=200 -fo=$^@ $<

View file

@ -50,6 +50,7 @@ OBJS= src/SDL.o \
src/stdlib/SDL_qsort.o \
src/stdlib/SDL_stdlib.o \
src/stdlib/SDL_string.o \
src/stdlib/SDL_strtokr.o \
src/thread/SDL_thread.o \
src/thread/generic/SDL_systls.o \
src/thread/psp/SDL_syssem.o \
@ -78,7 +79,7 @@ OBJS= src/SDL.o \
src/video/psp/SDL_pspevents.o \
src/video/psp/SDL_pspvideo.o \
src/video/psp/SDL_pspgl.o \
src/video/psp/SDL_pspmouse.o \
src/video/psp/SDL_pspmouse.o
INCDIR = ./include
CFLAGS = -g -O2 -G0 -Wall -D__PSP__ -DHAVE_OPENGL

View file

@ -285,6 +285,7 @@
<ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
<ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
<ClCompile Include="..\..\src\stdlib\SDL_string.c" />
<ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
<ClCompile Include="..\..\src\thread\generic\SDL_syssem.c" />
<ClCompile Include="..\..\src\thread\SDL_thread.c" />
<ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp" />

View file

@ -626,6 +626,9 @@
<ClCompile Include="..\..\src\stdlib\SDL_string.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\stdlib\SDL_strtokr.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\thread\generic\SDL_syssem.c">
<Filter>Source Files</Filter>
</ClCompile>

View file

@ -251,6 +251,7 @@
<ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
<ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
<ClCompile Include="..\..\src\stdlib\SDL_string.c" />
<ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
<ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
<ClCompile Include="..\..\src\thread\SDL_thread.c" />
<ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c" />

View file

@ -593,6 +593,9 @@
<ClCompile Include="..\..\src\stdlib\SDL_string.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\stdlib\SDL_strtokr.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\thread\SDL_thread.c">
<Filter>Source Files</Filter>
</ClCompile>

View file

@ -283,6 +283,7 @@
<ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
<ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
<ClCompile Include="..\..\src\stdlib\SDL_string.c" />
<ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
<ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
<ClCompile Include="..\..\src\thread\SDL_thread.c" />
<ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c" />

View file

@ -611,6 +611,9 @@
<ClCompile Include="..\..\src\stdlib\SDL_string.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\stdlib\SDL_strtokr.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\thread\SDL_thread.c">
<Filter>Source Files</Filter>
</ClCompile>

View file

@ -130,7 +130,6 @@
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<OmitDefaultLibName>true</OmitDefaultLibName>
@ -196,7 +195,6 @@
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<OmitDefaultLibName>true</OmitDefaultLibName>
@ -320,7 +318,7 @@
<ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h" />
<ClInclude Include="..\..\src\haptic\windows\SDL_windowshaptic_c.h" />
<ClInclude Include="..\..\src\haptic\windows\SDL_xinputhaptic_c.h" />
<ClInclude Include="..\..\src\joystick\hidapi\controller_type.h" />
<ClInclude Include="..\..\src\joystick\controller_type.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
@ -421,9 +419,12 @@
<ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c" />
<ClCompile Include="..\..\src\hidapi\windows\hid.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapijoystick.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_gamecube.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps4.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_switch.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360w.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xboxone.c" />
<ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
<ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
@ -486,6 +487,7 @@
<ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
<ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
<ClCompile Include="..\..\src\stdlib\SDL_string.c" />
<ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
<ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
<ClCompile Include="..\..\src\thread\SDL_thread.c" />
<ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c" />

View file

@ -259,7 +259,7 @@
<ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h" />
<ClInclude Include="..\..\src\haptic\windows\SDL_windowshaptic_c.h" />
<ClInclude Include="..\..\src\haptic\windows\SDL_xinputhaptic_c.h" />
<ClInclude Include="..\..\src\joystick\hidapi\controller_type.h" />
<ClInclude Include="..\..\src\joystick\controller_type.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
@ -360,9 +360,12 @@
<ClCompile Include="..\..\src\haptic\windows\SDL_windowshaptic.c" />
<ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c" />
<ClCompile Include="..\..\src\hidapi\windows\hid.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_gamecube.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps4.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_switch.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360w.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xboxone.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapijoystick.c" />
<ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
@ -426,6 +429,7 @@
<ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
<ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
<ClCompile Include="..\..\src\stdlib\SDL_string.c" />
<ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
<ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
<ClCompile Include="..\..\src\thread\SDL_thread.c" />
<ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c" />

View file

@ -108,7 +108,6 @@
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<OmitDefaultLibName>true</OmitDefaultLibName>
@ -143,7 +142,6 @@
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<OmitDefaultLibName>true</OmitDefaultLibName>

View file

@ -108,7 +108,6 @@
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<OmitDefaultLibName>true</OmitDefaultLibName>
@ -143,7 +142,6 @@
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<OmitDefaultLibName>true</OmitDefaultLibName>

View file

@ -1,6 +1,13 @@
This is a list of major changes in SDL's version history.
---------------------------------------------------------------------------
2.0.11/12:
---------------------------------------------------------------------------
General:
* Added SDL_LockTextureToSurface(), similar to SDL_LockTexture() but the locked area is exposed as a SDL surface.
---------------------------------------------------------------------------
2.0.10:
---------------------------------------------------------------------------

68
Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj Normal file → Executable file
View file

@ -355,14 +355,37 @@
56ED04E1118A8EE200A56AA6 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E0118A8EE200A56AA6 /* SDL_power.c */; };
56ED04E3118A8EFD00A56AA6 /* SDL_syspower.m in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */; };
56F9D5601DF73BA400C15B5D /* SDL_dataqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = 566726431DF72CF5001DD3DB /* SDL_dataqueue.c */; };
63CC93C723849391002A5C54 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63CC93C623849391002A5C54 /* SDL_strtokr.c */; };
63CC93C823849391002A5C54 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63CC93C623849391002A5C54 /* SDL_strtokr.c */; };
63CC93C923849391002A5C54 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63CC93C623849391002A5C54 /* SDL_strtokr.c */; };
63CC93CA23849391002A5C54 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63CC93C623849391002A5C54 /* SDL_strtokr.c */; };
93CB792313FC5E5200BD3E05 /* SDL_uikitviewcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CB792213FC5E5200BD3E05 /* SDL_uikitviewcontroller.h */; };
93CB792613FC5F5300BD3E05 /* SDL_uikitviewcontroller.m in Sources */ = {isa = PBXBuildFile; fileRef = 93CB792513FC5F5300BD3E05 /* SDL_uikitviewcontroller.m */; };
A704172E20F7E74800A82227 /* controller_type.h in Headers */ = {isa = PBXBuildFile; fileRef = A704172D20F7E74800A82227 /* controller_type.h */; };
A704172F20F7E76000A82227 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0AD06116647BBB00CE5896 /* SDL_gamecontroller.c */; };
A704173120F7F39900A82227 /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A704173020F7F39400A82227 /* SDL_hidapi_steam.c */; };
A704173220F7F39900A82227 /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A704173020F7F39400A82227 /* SDL_hidapi_steam.c */; };
A75FDAB723E288E400529352 /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A704173020F7F39400A82227 /* SDL_hidapi_steam.c */; };
A75FDAB823E2890000529352 /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A704173020F7F39400A82227 /* SDL_hidapi_steam.c */; };
A75FDBD923EA38AD00529352 /* SDL_hidapi_rumble.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDBD723EA38AD00529352 /* SDL_hidapi_rumble.c */; };
A75FDBDA23EA38AD00529352 /* SDL_hidapi_rumble.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDBD723EA38AD00529352 /* SDL_hidapi_rumble.c */; };
A75FDBDB23EA38AD00529352 /* SDL_hidapi_rumble.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDBD723EA38AD00529352 /* SDL_hidapi_rumble.c */; };
A75FDBDC23EA38AD00529352 /* SDL_hidapi_rumble.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDBD723EA38AD00529352 /* SDL_hidapi_rumble.c */; };
A75FDBDD23EA38AD00529352 /* SDL_hidapi_rumble.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDBD823EA38AD00529352 /* SDL_hidapi_rumble.h */; };
A75FDBDE23EA38AD00529352 /* SDL_hidapi_rumble.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDBD823EA38AD00529352 /* SDL_hidapi_rumble.h */; };
A75FDBDF23EA38AD00529352 /* SDL_hidapi_rumble.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDBD823EA38AD00529352 /* SDL_hidapi_rumble.h */; };
A7C19D29212E552C00DF2152 /* SDL_displayevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C19D27212E552B00DF2152 /* SDL_displayevents_c.h */; };
A7C19D2A212E552C00DF2152 /* SDL_displayevents.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C19D28212E552B00DF2152 /* SDL_displayevents.c */; };
A7C19D2B212E552C00DF2152 /* SDL_displayevents.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C19D28212E552B00DF2152 /* SDL_displayevents.c */; };
A7F629241FE06523002F9CC9 /* SDL_uikitmetalview.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D7516F81EE1C28A00820EEA /* SDL_uikitmetalview.m */; };
A7FF6B6223AC3BC6005876C6 /* SDL_hidapi_gamecube.c in Sources */ = {isa = PBXBuildFile; fileRef = A7FF6B6123AC3BC6005876C6 /* SDL_hidapi_gamecube.c */; };
A7FF6B6323AC3BC6005876C6 /* SDL_hidapi_gamecube.c in Sources */ = {isa = PBXBuildFile; fileRef = A7FF6B6123AC3BC6005876C6 /* SDL_hidapi_gamecube.c */; };
A7FF6B6423AC3BC6005876C6 /* SDL_hidapi_gamecube.c in Sources */ = {isa = PBXBuildFile; fileRef = A7FF6B6123AC3BC6005876C6 /* SDL_hidapi_gamecube.c */; };
A7FF6B6523AC3BC6005876C6 /* SDL_hidapi_gamecube.c in Sources */ = {isa = PBXBuildFile; fileRef = A7FF6B6123AC3BC6005876C6 /* SDL_hidapi_gamecube.c */; };
A7FF6B6723AC3BCD005876C6 /* SDL_hidapi_xbox360w.c in Sources */ = {isa = PBXBuildFile; fileRef = A7FF6B6623AC3BCD005876C6 /* SDL_hidapi_xbox360w.c */; };
A7FF6B6823AC3BCD005876C6 /* SDL_hidapi_xbox360w.c in Sources */ = {isa = PBXBuildFile; fileRef = A7FF6B6623AC3BCD005876C6 /* SDL_hidapi_xbox360w.c */; };
A7FF6B6923AC3BCD005876C6 /* SDL_hidapi_xbox360w.c in Sources */ = {isa = PBXBuildFile; fileRef = A7FF6B6623AC3BCD005876C6 /* SDL_hidapi_xbox360w.c */; };
A7FF6B6A23AC3BCD005876C6 /* SDL_hidapi_xbox360w.c in Sources */ = {isa = PBXBuildFile; fileRef = A7FF6B6623AC3BCD005876C6 /* SDL_hidapi_xbox360w.c */; };
AA0AD06216647BBB00CE5896 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0AD06116647BBB00CE5896 /* SDL_gamecontroller.c */; };
AA0AD06516647BD400CE5896 /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = AA0AD06416647BD400CE5896 /* SDL_gamecontroller.h */; };
AA0F8495178D5F1A00823F9D /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0F8494178D5F1A00823F9D /* SDL_systls.c */; };
@ -717,6 +740,7 @@
F3E3C75B224138AE007D243C /* SDL_uikit_main.c in Sources */ = {isa = PBXBuildFile; fileRef = F3E3C657224069CE007D243C /* SDL_uikit_main.c */; };
FA1DC2721C62BE65008F99A0 /* SDL_uikitclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = FA1DC2701C62BE65008F99A0 /* SDL_uikitclipboard.h */; };
FA1DC2731C62BE65008F99A0 /* SDL_uikitclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = FA1DC2711C62BE65008F99A0 /* SDL_uikitclipboard.m */; };
FA24348D21D4201400B8918A /* SDL_metal.h in Headers */ = {isa = PBXBuildFile; fileRef = FA24348C21D4201400B8918A /* SDL_metal.h */; };
FAB5981D1BB5C31500BE72C5 /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8912E23B8D00BA343D /* SDL_atomic.c */; };
FAB5981E1BB5C31500BE72C5 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8A12E23B8D00BA343D /* SDL_spinlock.c */; };
FAB5981F1BB5C31500BE72C5 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 56EA86F913E9EC2B002E47EB /* SDL_coreaudio.m */; };
@ -962,11 +986,17 @@
56EA86FA13E9EC2B002E47EB /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_coreaudio.h; sourceTree = "<group>"; };
56ED04E0118A8EE200A56AA6 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_power.c; sourceTree = "<group>"; };
56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_syspower.m; sourceTree = "<group>"; };
63CC93C623849391002A5C54 /* SDL_strtokr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_strtokr.c; sourceTree = "<group>"; };
93CB792213FC5E5200BD3E05 /* SDL_uikitviewcontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitviewcontroller.h; sourceTree = "<group>"; };
93CB792513FC5F5300BD3E05 /* SDL_uikitviewcontroller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitviewcontroller.m; sourceTree = "<group>"; };
A704172D20F7E74800A82227 /* controller_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = controller_type.h; sourceTree = "<group>"; };
A704173020F7F39400A82227 /* SDL_hidapi_steam.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_steam.c; sourceTree = "<group>"; };
A75FDBD723EA38AD00529352 /* SDL_hidapi_rumble.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_rumble.c; sourceTree = "<group>"; };
A75FDBD823EA38AD00529352 /* SDL_hidapi_rumble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapi_rumble.h; sourceTree = "<group>"; };
A7C19D27212E552B00DF2152 /* SDL_displayevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_displayevents_c.h; sourceTree = "<group>"; };
A7C19D28212E552B00DF2152 /* SDL_displayevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_displayevents.c; sourceTree = "<group>"; };
A7FF6B6123AC3BC6005876C6 /* SDL_hidapi_gamecube.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_gamecube.c; sourceTree = "<group>"; };
A7FF6B6623AC3BCD005876C6 /* SDL_hidapi_xbox360w.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_xbox360w.c; sourceTree = "<group>"; };
AA0AD06116647BBB00CE5896 /* SDL_gamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_gamecontroller.c; sourceTree = "<group>"; };
AA0AD06416647BD400CE5896 /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontroller.h; sourceTree = "<group>"; };
AA0F8494178D5F1A00823F9D /* SDL_systls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systls.c; sourceTree = "<group>"; };
@ -1064,6 +1094,8 @@
F3E3C75F224138AE007D243C /* libSDLmain.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDLmain.a; sourceTree = BUILT_PRODUCTS_DIR; };
FA1DC2701C62BE65008F99A0 /* SDL_uikitclipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitclipboard.h; sourceTree = "<group>"; };
FA1DC2711C62BE65008F99A0 /* SDL_uikitclipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitclipboard.m; sourceTree = "<group>"; };
FA20874D2307894C0029758C /* SDL_shaders_metal_tvos.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_shaders_metal_tvos.h; sourceTree = "<group>"; };
FA24348C21D4201400B8918A /* SDL_metal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_metal.h; sourceTree = "<group>"; };
FAB598141BB5C1B100BE72C5 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; };
FAD4F7011BA3C4E8008346CE /* SDL_sysjoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysjoystick_c.h; sourceTree = "<group>"; };
FD0BBFEF0E3933DD00D833B1 /* SDL_uikitview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitview.h; sourceTree = "<group>"; };
@ -1405,6 +1437,7 @@
children = (
AADC5A621FDA10C800960936 /* SDL_render_metal.m */,
AADC5A611FDA10C800960936 /* SDL_shaders_metal_ios.h */,
FA20874D2307894C0029758C /* SDL_shaders_metal_tvos.h */,
);
path = metal;
sourceTree = "<group>";
@ -1458,9 +1491,14 @@
F3BDD78A20F51C8D004ECBF3 /* hidapi */ = {
isa = PBXGroup;
children = (
A7FF6B6123AC3BC6005876C6 /* SDL_hidapi_gamecube.c */,
F3BDD78E20F51CB8004ECBF3 /* SDL_hidapi_ps4.c */,
A75FDBD723EA38AD00529352 /* SDL_hidapi_rumble.c */,
A75FDBD823EA38AD00529352 /* SDL_hidapi_rumble.h */,
A704173020F7F39400A82227 /* SDL_hidapi_steam.c */,
F3BDD78C20F51CB8004ECBF3 /* SDL_hidapi_switch.c */,
F3BDD78B20F51CB8004ECBF3 /* SDL_hidapi_xbox360.c */,
A7FF6B6623AC3BCD005876C6 /* SDL_hidapi_xbox360w.c */,
F3BDD78D20F51CB8004ECBF3 /* SDL_hidapi_xboxone.c */,
F3BDD79020F51CB8004ECBF3 /* SDL_hidapijoystick_c.h */,
F3BDD79120F51CB8004ECBF3 /* SDL_hidapijoystick.c */,
@ -1487,6 +1525,7 @@
FD3F4A6F0DEA620800C5B771 /* stdlib */ = {
isa = PBXGroup;
children = (
63CC93C623849391002A5C54 /* SDL_strtokr.c */,
FD3F4A700DEA620800C5B771 /* SDL_getenv.c */,
FD3F4A710DEA620800C5B771 /* SDL_iconv.c */,
FD3F4A720DEA620800C5B771 /* SDL_malloc.c */,
@ -1576,15 +1615,14 @@
children = (
AA7558651595D55500BBD41B /* begin_code.h */,
AA7558661595D55500BBD41B /* close_code.h */,
AA7558971595D55500BBD41B /* SDL.h */,
AA7558671595D55500BBD41B /* SDL_assert.h */,
AA7558681595D55500BBD41B /* SDL_atomic.h */,
AA7558691595D55500BBD41B /* SDL_audio.h */,
AADA5B8E16CCAB7C00107CF7 /* SDL_bits.h */,
AA75586A1595D55500BBD41B /* SDL_blendmode.h */,
AA75586B1595D55500BBD41B /* SDL_clipboard.h */,
AA75586D1595D55500BBD41B /* SDL_config.h */,
AA75586C1595D55500BBD41B /* SDL_config_iphoneos.h */,
AA75586D1595D55500BBD41B /* SDL_config.h */,
AA75586E1595D55500BBD41B /* SDL_copying.h */,
AA75586F1595D55500BBD41B /* SDL_cpuinfo.h */,
AA7558701595D55500BBD41B /* SDL_endian.h */,
@ -1602,6 +1640,7 @@
AA75587B1595D55500BBD41B /* SDL_log.h */,
AA75587C1595D55500BBD41B /* SDL_main.h */,
AA9FF9501637C6E5000DF050 /* SDL_messagebox.h */,
FA24348C21D4201400B8918A /* SDL_metal.h */,
AA75587D1595D55500BBD41B /* SDL_mouse.h */,
AA75587E1595D55500BBD41B /* SDL_mutex.h */,
AA75587F1595D55500BBD41B /* SDL_name.h */,
@ -1630,6 +1669,7 @@
AA7558951595D55500BBD41B /* SDL_version.h */,
AA7558961595D55500BBD41B /* SDL_video.h */,
4D7516FE1EE1C5B400820EEA /* SDL_vulkan.h */,
AA7558971595D55500BBD41B /* SDL.h */,
);
name = "Public Headers";
path = ../../include;
@ -1960,6 +2000,7 @@
52ED1DD5222889500061FCE0 /* SDL_syswm.h in Headers */,
52ED1DD6222889500061FCE0 /* SDL_thread.h in Headers */,
52ED1DD7222889500061FCE0 /* SDL_timer.h in Headers */,
A75FDBDE23EA38AD00529352 /* SDL_hidapi_rumble.h in Headers */,
52ED1DD8222889500061FCE0 /* SDL_touch.h in Headers */,
52ED1DD9222889500061FCE0 /* SDL_types.h in Headers */,
52ED1DDA222889500061FCE0 /* SDL_version.h in Headers */,
@ -2096,6 +2137,7 @@
F3E3C6C32241389A007D243C /* SDL_syswm.h in Headers */,
F3E3C6C42241389A007D243C /* SDL_thread.h in Headers */,
F3E3C6C52241389A007D243C /* SDL_timer.h in Headers */,
A75FDBDF23EA38AD00529352 /* SDL_hidapi_rumble.h in Headers */,
F3E3C6C62241389A007D243C /* SDL_touch.h in Headers */,
F3E3C6C72241389A007D243C /* SDL_types.h in Headers */,
F3E3C6C82241389A007D243C /* SDL_version.h in Headers */,
@ -2183,6 +2225,7 @@
AA75589D1595D55500BBD41B /* SDL_blendmode.h in Headers */,
F30D9C9E212CD0990047DF2E /* SDL_sensor_c.h in Headers */,
AA75589E1595D55500BBD41B /* SDL_clipboard.h in Headers */,
FA24348D21D4201400B8918A /* SDL_metal.h in Headers */,
AA75589F1595D55500BBD41B /* SDL_config_iphoneos.h in Headers */,
AA7558A01595D55500BBD41B /* SDL_config.h in Headers */,
AA7558A11595D55500BBD41B /* SDL_copying.h in Headers */,
@ -2232,6 +2275,7 @@
AA7558C31595D55500BBD41B /* SDL_syswm.h in Headers */,
AA7558C41595D55500BBD41B /* SDL_thread.h in Headers */,
AA7558C51595D55500BBD41B /* SDL_timer.h in Headers */,
A75FDBDD23EA38AD00529352 /* SDL_hidapi_rumble.h in Headers */,
AA7558C61595D55500BBD41B /* SDL_touch.h in Headers */,
AA7558C71595D55500BBD41B /* SDL_types.h in Headers */,
AA7558C81595D55500BBD41B /* SDL_version.h in Headers */,
@ -2483,12 +2527,14 @@
52ED1E07222889500061FCE0 /* SDL_getenv.c in Sources */,
52ED1E08222889500061FCE0 /* SDL_iconv.c in Sources */,
52ED1E09222889500061FCE0 /* SDL_malloc.c in Sources */,
A7FF6B6323AC3BC6005876C6 /* SDL_hidapi_gamecube.c in Sources */,
52ED1E0A222889500061FCE0 /* SDL_hidapi_xbox360.c in Sources */,
52ED1E0B222889500061FCE0 /* SDL_qsort.c in Sources */,
52ED1E0C222889500061FCE0 /* SDL_hidapi_ps4.c in Sources */,
52ED1E0D222889500061FCE0 /* SDL_stdlib.c in Sources */,
52ED1E0E222889500061FCE0 /* SDL_blit.c in Sources */,
52ED1E0F222889500061FCE0 /* SDL_blit_0.c in Sources */,
A75FDAB723E288E400529352 /* SDL_hidapi_steam.c in Sources */,
52ED1E10222889500061FCE0 /* SDL_yuv.c in Sources */,
52ED1E11222889500061FCE0 /* SDL_blit_1.c in Sources */,
52ED1E12222889500061FCE0 /* SDL_dataqueue.c in Sources */,
@ -2504,6 +2550,7 @@
52ED1E1C222889500061FCE0 /* SDL_stretch.c in Sources */,
52ED1E1D222889500061FCE0 /* SDL_egl.c in Sources */,
52ED1E1E222889500061FCE0 /* SDL_surface.c in Sources */,
A75FDBDA23EA38AD00529352 /* SDL_hidapi_rumble.c in Sources */,
52ED1E1F222889500061FCE0 /* SDL_video.c in Sources */,
52ED1E20222889500061FCE0 /* SDL_nullevents.c in Sources */,
52ED1E21222889500061FCE0 /* SDL_nullvideo.c in Sources */,
@ -2547,6 +2594,7 @@
52ED1E47222889500061FCE0 /* SDL_render_gles.c in Sources */,
52ED1E48222889500061FCE0 /* SDL_hints.c in Sources */,
52ED1E49222889500061FCE0 /* SDL_shape.c in Sources */,
A7FF6B6823AC3BCD005876C6 /* SDL_hidapi_xbox360w.c in Sources */,
52ED1E4A222889500061FCE0 /* SDL_render_gles2.c in Sources */,
52ED1E4B222889500061FCE0 /* SDL_dummysensor.c in Sources */,
52ED1E4C222889500061FCE0 /* SDL_shaders_gles2.c in Sources */,
@ -2562,6 +2610,7 @@
52ED1E56222889500061FCE0 /* SDL_gamecontroller.c in Sources */,
52ED1E57222889500061FCE0 /* SDL_systls.c in Sources */,
52ED1E58222889500061FCE0 /* SDL_sysfilesystem.m in Sources */,
63CC93C823849391002A5C54 /* SDL_strtokr.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -2611,12 +2660,14 @@
F3E3C6F52241389A007D243C /* SDL_getenv.c in Sources */,
F3E3C6F62241389A007D243C /* SDL_iconv.c in Sources */,
F3E3C6F72241389A007D243C /* SDL_malloc.c in Sources */,
A7FF6B6523AC3BC6005876C6 /* SDL_hidapi_gamecube.c in Sources */,
F3E3C6F82241389A007D243C /* SDL_hidapi_xbox360.c in Sources */,
F3E3C6F92241389A007D243C /* SDL_qsort.c in Sources */,
F3E3C6FA2241389A007D243C /* SDL_hidapi_ps4.c in Sources */,
F3E3C6FB2241389A007D243C /* SDL_stdlib.c in Sources */,
F3E3C6FC2241389A007D243C /* SDL_blit.c in Sources */,
F3E3C6FD2241389A007D243C /* SDL_blit_0.c in Sources */,
A75FDAB823E2890000529352 /* SDL_hidapi_steam.c in Sources */,
F3E3C6FE2241389A007D243C /* SDL_yuv.c in Sources */,
F3E3C6FF2241389A007D243C /* SDL_blit_1.c in Sources */,
F3E3C7002241389A007D243C /* SDL_dataqueue.c in Sources */,
@ -2632,6 +2683,7 @@
F3E3C70A2241389A007D243C /* SDL_stretch.c in Sources */,
F3E3C70B2241389A007D243C /* SDL_egl.c in Sources */,
F3E3C70C2241389A007D243C /* SDL_surface.c in Sources */,
A75FDBDC23EA38AD00529352 /* SDL_hidapi_rumble.c in Sources */,
F3E3C70D2241389A007D243C /* SDL_video.c in Sources */,
F3E3C70E2241389A007D243C /* SDL_nullevents.c in Sources */,
F3E3C70F2241389A007D243C /* SDL_nullvideo.c in Sources */,
@ -2675,6 +2727,7 @@
F3E3C7362241389A007D243C /* SDL_render_gles.c in Sources */,
F3E3C7372241389A007D243C /* SDL_hints.c in Sources */,
F3E3C7382241389A007D243C /* SDL_shape.c in Sources */,
A7FF6B6A23AC3BCD005876C6 /* SDL_hidapi_xbox360w.c in Sources */,
F3E3C7392241389A007D243C /* SDL_render_gles2.c in Sources */,
F3E3C73A2241389A007D243C /* SDL_dummysensor.c in Sources */,
F3E3C73B2241389A007D243C /* SDL_shaders_gles2.c in Sources */,
@ -2690,6 +2743,7 @@
F3E3C7452241389A007D243C /* SDL_gamecontroller.c in Sources */,
F3E3C7462241389A007D243C /* SDL_systls.c in Sources */,
F3E3C7472241389A007D243C /* SDL_sysfilesystem.m in Sources */,
63CC93CA23849391002A5C54 /* SDL_strtokr.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -2736,6 +2790,7 @@
FAB5984B1BB5C31600BE72C5 /* SDL_sysfilesystem.m in Sources */,
AADC5A5D1FDA104400960936 /* yuv_rgb.c in Sources */,
FAB5984C1BB5C31600BE72C5 /* SDL_syshaptic.c in Sources */,
A75FDBDB23EA38AD00529352 /* SDL_hidapi_rumble.c in Sources */,
AADC5A5F1FDA105600960936 /* SDL_vulkan_utils.c in Sources */,
AADC5A5E1FDA105300960936 /* SDL_yuv.c in Sources */,
FAB5984D1BB5C31600BE72C5 /* SDL_haptic.c in Sources */,
@ -2744,6 +2799,7 @@
FAB598521BB5C31600BE72C5 /* SDL_joystick.c in Sources */,
FAB598551BB5C31600BE72C5 /* SDL_sysloadso.c in Sources */,
AADC5A651FDA10CB00960936 /* SDL_render_metal.m in Sources */,
A7FF6B6923AC3BCD005876C6 /* SDL_hidapi_xbox360w.c in Sources */,
FAB598561BB5C31600BE72C5 /* SDL_sysloadso.c in Sources */,
FAB598571BB5C31600BE72C5 /* SDL_power.c in Sources */,
F30D9CA1212CD0990047DF2E /* SDL_sensor.c in Sources */,
@ -2773,6 +2829,7 @@
FAB598781BB5C31600BE72C5 /* SDL_syscond.c in Sources */,
F3BDD79D20F51CB8004ECBF3 /* SDL_hidapijoystick.c in Sources */,
AADC5A601FDA10A400960936 /* SDL_uikitvulkan.m in Sources */,
A7FF6B6423AC3BC6005876C6 /* SDL_hidapi_gamecube.c in Sources */,
FAB598791BB5C31600BE72C5 /* SDL_sysmutex.c in Sources */,
FAB5987B1BB5C31600BE72C5 /* SDL_syssem.c in Sources */,
FAB5987C1BB5C31600BE72C5 /* SDL_systhread.c in Sources */,
@ -2791,6 +2848,7 @@
FAB598951BB5C31600BE72C5 /* SDL_uikitview.m in Sources */,
FAB598971BB5C31600BE72C5 /* SDL_uikitviewcontroller.m in Sources */,
FAB598991BB5C31600BE72C5 /* SDL_uikitwindow.m in Sources */,
A704173220F7F39900A82227 /* SDL_hidapi_steam.c in Sources */,
FAB5989A1BB5C31600BE72C5 /* SDL_nullevents.c in Sources */,
FAB5989D1BB5C31600BE72C5 /* SDL_nullframebuffer.c in Sources */,
FAB5989E1BB5C31600BE72C5 /* SDL_nullvideo.c in Sources */,
@ -2816,6 +2874,7 @@
FAB598BD1BB5C31600BE72C5 /* SDL_hints.c in Sources */,
FAB598BE1BB5C31600BE72C5 /* SDL_log.c in Sources */,
FAB598BF1BB5C31600BE72C5 /* SDL.c in Sources */,
63CC93C923849391002A5C54 /* SDL_strtokr.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -2857,6 +2916,7 @@
FD3F4A760DEA620800C5B771 /* SDL_getenv.c in Sources */,
FD3F4A770DEA620800C5B771 /* SDL_iconv.c in Sources */,
FD3F4A780DEA620800C5B771 /* SDL_malloc.c in Sources */,
A7FF6B6223AC3BC6005876C6 /* SDL_hidapi_gamecube.c in Sources */,
F3BDD79220F51CB8004ECBF3 /* SDL_hidapi_xbox360.c in Sources */,
FD3F4A790DEA620800C5B771 /* SDL_qsort.c in Sources */,
F3BDD79820F51CB8004ECBF3 /* SDL_hidapi_ps4.c in Sources */,
@ -2868,6 +2928,7 @@
566726451DF72CF5001DD3DB /* SDL_dataqueue.c in Sources */,
FDA684510DF2374E00F98A1A /* SDL_blit_A.c in Sources */,
FDA684520DF2374E00F98A1A /* SDL_blit_auto.c in Sources */,
A704173120F7F39900A82227 /* SDL_hidapi_steam.c in Sources */,
FDA684540DF2374E00F98A1A /* SDL_blit_copy.c in Sources */,
FDA684560DF2374E00F98A1A /* SDL_blit_N.c in Sources */,
FDA684570DF2374E00F98A1A /* SDL_blit_slow.c in Sources */,
@ -2878,6 +2939,7 @@
FDA684640DF2374E00F98A1A /* SDL_stretch.c in Sources */,
AA13B34D1FB8B27800D9FEE6 /* SDL_egl.c in Sources */,
FDA684660DF2374E00F98A1A /* SDL_surface.c in Sources */,
A75FDBD923EA38AD00529352 /* SDL_hidapi_rumble.c in Sources */,
FDA684680DF2374E00F98A1A /* SDL_video.c in Sources */,
FDA685FB0DF244C800F98A1A /* SDL_nullevents.c in Sources */,
FDA685FF0DF244C800F98A1A /* SDL_nullvideo.c in Sources */,
@ -2921,6 +2983,7 @@
0442EC5312FE1C28004C9285 /* SDL_render_gles.c in Sources */,
0442EC5512FE1C3F004C9285 /* SDL_hints.c in Sources */,
AA13B34A1FB8B27800D9FEE6 /* SDL_shape.c in Sources */,
A7FF6B6723AC3BCD005876C6 /* SDL_hidapi_xbox360w.c in Sources */,
0402A85812FE70C600CECEE3 /* SDL_render_gles2.c in Sources */,
F36839CD214790950000F255 /* SDL_dummysensor.c in Sources */,
0402A85912FE70C600CECEE3 /* SDL_shaders_gles2.c in Sources */,
@ -2936,6 +2999,7 @@
AA0AD06216647BBB00CE5896 /* SDL_gamecontroller.c in Sources */,
AA0F8495178D5F1A00823F9D /* SDL_systls.c in Sources */,
56C181E217C44D7A00406AE3 /* SDL_sysfilesystem.m in Sources */,
63CC93C723849391002A5C54 /* SDL_strtokr.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View file

@ -19,10 +19,10 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.0.10</string>
<string>2.0.12</string>
<key>CFBundleSignature</key>
<string>SDLX</string>
<key>CFBundleVersion</key>
<string>2.0.10</string>
<string>2.0.12</string>
</dict>
</plist>

11764
Xcode/SDL/SDL.xcodeproj/project.pbxproj Normal file → Executable file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
</plist>

View file

@ -1,6 +1,6 @@
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -22,6 +22,11 @@ android {
arguments "APP_PLATFORM=android-16"
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
// cmake {
// arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static"
// // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
// abiFilters 'arm64-v8a'
// }
}
}
buildTypes {
@ -38,6 +43,9 @@ android {
ndkBuild {
path 'jni/Android.mk'
}
// cmake {
// path 'jni/CMakeLists.txt'
// }
}
}

View file

@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.6)
project(GAME)
# armeabi-v7a requires cpufeatures library
# include(AndroidNdkModules)
# android_ndk_import_module_cpufeatures()
# SDL sources are in a subfolder named "SDL"
add_subdirectory(SDL)
# Compilation of companion libraries
#add_subdirectory(SDL_image)
#add_subdirectory(SDL_mixer)
#add_subdirectory(SDL_ttf)
# Your game and its CMakeLists.txt are in a subfolder named "src"
add_subdirectory(src)

View file

@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.6)
project(MY_APP)
find_library(SDL2 SDL2)
add_library(main SHARED)
target_sources(main PRIVATE YourSourceHere.c)
target_link_libraries(main SDL2)

View file

@ -17,17 +17,31 @@
android:required="false" />
<!-- Game controller support -->
<uses-feature
android:name="android.hardware.bluetooth"
android:required="false" />
<uses-feature
android:name="android.hardware.gamepad"
android:required="false" />
<uses-feature
android:name="android.hardware.usb.host"
android:required="false" />
<!-- External mouse input events -->
<uses-feature
android:name="android.hardware.type.pc"
android:required="false" />
<!-- Audio recording support -->
<!-- if you want to capture audio, uncomment this. -->
<!-- <uses-feature
android:name="android.hardware.microphone"
android:required="false" /> -->
<!-- Allow writing to external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Allow access to Bluetooth devices -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<!-- Allow access to the vibrator -->
<uses-permission android:name="android.permission.VIBRATE" />

View file

@ -1,5 +1,7 @@
package org.libsdl.app;
import android.hardware.usb.UsbDevice;
interface HIDDevice
{
public int getId();
@ -9,6 +11,7 @@ interface HIDDevice
public int getVersion();
public String getManufacturerName();
public String getProductName();
public UsbDevice getDevice();
public boolean open();
public int sendFeatureReport(byte[] report);
public int sendOutputReport(byte[] report);

View file

@ -9,6 +9,7 @@ import android.bluetooth.BluetoothGattDescriptor;
import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothGattService;
import android.hardware.usb.UsbDevice;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
@ -165,13 +166,13 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
mHandler = new Handler(Looper.getMainLooper());
mGatt = connectGatt();
final HIDDeviceBLESteamController finalThis = this;
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
finalThis.checkConnectionForChromebookIssue();
}
}, CHROMEBOOK_CONNECTION_CHECK_INTERVAL);
// final HIDDeviceBLESteamController finalThis = this;
// mHandler.postDelayed(new Runnable() {
// @Override
// public void run() {
// finalThis.checkConnectionForChromebookIssue();
// }
// }, CHROMEBOOK_CONNECTION_CHECK_INTERVAL);
}
public String getIdentifier() {
@ -469,7 +470,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
// Only register controller with the native side once it has been fully configured
if (!isRegistered()) {
Log.v(TAG, "Registering Steam Controller with ID: " + getId());
mManager.HIDDeviceConnected(getId(), getIdentifier(), getVendorId(), getProductId(), getSerialNumber(), getVersion(), getManufacturerName(), getProductName(), 0);
mManager.HIDDeviceConnected(getId(), getIdentifier(), getVendorId(), getProductId(), getSerialNumber(), getVersion(), getManufacturerName(), getProductName(), 0, 0, 0, 0);
setRegistered();
}
}
@ -563,6 +564,11 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
return "Steam Controller";
}
@Override
public UsbDevice getDevice() {
return null;
}
@Override
public boolean open() {
return true;

View file

@ -19,8 +19,9 @@ import android.hardware.usb.*;
import android.os.Handler;
import android.os.Looper;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
public class HIDDeviceManager {
@ -50,7 +51,6 @@ public class HIDDeviceManager {
private Context mContext;
private HashMap<Integer, HIDDevice> mDevicesById = new HashMap<Integer, HIDDevice>();
private HashMap<UsbDevice, HIDDeviceUSB> mUSBDevices = new HashMap<UsbDevice, HIDDeviceUSB>();
private HashMap<BluetoothDevice, HIDDeviceBLESteamController> mBluetoothDevices = new HashMap<BluetoothDevice, HIDDeviceBLESteamController>();
private int mNextDeviceId = 0;
private SharedPreferences mSharedPreferences = null;
@ -241,31 +241,20 @@ public class HIDDeviceManager {
}
}
private boolean isHIDDeviceUSB(UsbDevice usbDevice) {
for (int interface_number = 0; interface_number < usbDevice.getInterfaceCount(); ++interface_number) {
if (isHIDDeviceInterface(usbDevice, interface_number)) {
return true;
}
}
return false;
}
private boolean isHIDDeviceInterface(UsbDevice usbDevice, int interface_number) {
UsbInterface usbInterface = usbDevice.getInterface(interface_number);
private boolean isHIDDeviceInterface(UsbDevice usbDevice, UsbInterface usbInterface) {
if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_HID) {
return true;
}
if (interface_number == 0) {
if (isXbox360Controller(usbDevice, usbInterface) || isXboxOneController(usbDevice, usbInterface)) {
return true;
}
if (isXbox360Controller(usbDevice, usbInterface) || isXboxOneController(usbDevice, usbInterface)) {
return true;
}
return false;
}
private boolean isXbox360Controller(UsbDevice usbDevice, UsbInterface usbInterface) {
final int XB360_IFACE_SUBCLASS = 93;
final int XB360_IFACE_PROTOCOL = 1; // Wired only
final int XB360_IFACE_PROTOCOL = 1; // Wired
final int XB360W_IFACE_PROTOCOL = 129; // Wireless
final int[] SUPPORTED_VENDORS = {
0x0079, // GPD Win 2
0x044f, // Thrustmaster
@ -275,8 +264,9 @@ public class HIDDeviceManager {
0x06a3, // Saitek
0x0738, // Mad Catz
0x07ff, // Mad Catz
0x0e6f, // Unknown
0x0e6f, // PDP
0x0f0d, // Hori
0x1038, // SteelSeries
0x11c9, // Nacon
0x12ab, // Unknown
0x1430, // RedOctane
@ -291,7 +281,8 @@ public class HIDDeviceManager {
if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC &&
usbInterface.getInterfaceSubclass() == XB360_IFACE_SUBCLASS &&
usbInterface.getInterfaceProtocol() == XB360_IFACE_PROTOCOL) {
(usbInterface.getInterfaceProtocol() == XB360_IFACE_PROTOCOL ||
usbInterface.getInterfaceProtocol() == XB360W_IFACE_PROTOCOL)) {
int vendor_id = usbDevice.getVendorId();
for (int supportedVid : SUPPORTED_VENDORS) {
if (vendor_id == supportedVid) {
@ -308,13 +299,15 @@ public class HIDDeviceManager {
final int[] SUPPORTED_VENDORS = {
0x045e, // Microsoft
0x0738, // Mad Catz
0x0e6f, // Unknown
0x0e6f, // PDP
0x0f0d, // Hori
0x1532, // Razer Wildcat
0x24c6, // PowerA
0x2e24, // Hyperkin
};
if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC &&
if (usbInterface.getId() == 0 &&
usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC &&
usbInterface.getInterfaceSubclass() == XB1_IFACE_SUBCLASS &&
usbInterface.getInterfaceProtocol() == XB1_IFACE_PROTOCOL) {
int vendor_id = usbDevice.getVendorId();
@ -328,45 +321,45 @@ public class HIDDeviceManager {
}
private void handleUsbDeviceAttached(UsbDevice usbDevice) {
if (isHIDDeviceUSB(usbDevice)) {
connectHIDDeviceUSB(usbDevice);
}
connectHIDDeviceUSB(usbDevice);
}
private void handleUsbDeviceDetached(UsbDevice usbDevice) {
HIDDeviceUSB device = mUSBDevices.get(usbDevice);
if (device == null)
return;
int id = device.getId();
mUSBDevices.remove(usbDevice);
mDevicesById.remove(id);
device.shutdown();
HIDDeviceDisconnected(id);
List<Integer> devices = new ArrayList<Integer>();
for (HIDDevice device : mDevicesById.values()) {
if (usbDevice.equals(device.getDevice())) {
devices.add(device.getId());
}
}
for (int id : devices) {
HIDDevice device = mDevicesById.get(id);
mDevicesById.remove(id);
device.shutdown();
HIDDeviceDisconnected(id);
}
}
private void handleUsbDevicePermission(UsbDevice usbDevice, boolean permission_granted) {
HIDDeviceUSB device = mUSBDevices.get(usbDevice);
if (device == null)
return;
boolean opened = false;
if (permission_granted) {
opened = device.open();
for (HIDDevice device : mDevicesById.values()) {
if (usbDevice.equals(device.getDevice())) {
boolean opened = false;
if (permission_granted) {
opened = device.open();
}
HIDDeviceOpenResult(device.getId(), opened);
}
}
HIDDeviceOpenResult(device.getId(), opened);
}
private void connectHIDDeviceUSB(UsbDevice usbDevice) {
synchronized (this) {
for (int interface_number = 0; interface_number < usbDevice.getInterfaceCount(); interface_number++) {
if (isHIDDeviceInterface(usbDevice, interface_number)) {
HIDDeviceUSB device = new HIDDeviceUSB(this, usbDevice, interface_number);
for (int interface_index = 0; interface_index < usbDevice.getInterfaceCount(); interface_index++) {
UsbInterface usbInterface = usbDevice.getInterface(interface_index);
if (isHIDDeviceInterface(usbDevice, usbInterface)) {
HIDDeviceUSB device = new HIDDeviceUSB(this, usbDevice, interface_index);
int id = device.getId();
mUSBDevices.put(usbDevice, device);
mDevicesById.put(id, device);
HIDDeviceConnected(id, device.getIdentifier(), device.getVendorId(), device.getProductId(), device.getSerialNumber(), device.getVersion(), device.getManufacturerName(), device.getProductName(), interface_number);
break;
HIDDeviceConnected(id, device.getIdentifier(), device.getVendorId(), device.getProductId(), device.getSerialNumber(), device.getVersion(), device.getManufacturerName(), device.getProductName(), usbInterface.getId(), usbInterface.getInterfaceClass(), usbInterface.getInterfaceSubclass(), usbInterface.getInterfaceProtocol());
}
}
}
@ -563,33 +556,27 @@ public class HIDDeviceManager {
//////////////////////////////////////////////////////////////////////////////////////////////////////
public boolean openDevice(int deviceID) {
Log.v(TAG, "openDevice deviceID=" + deviceID);
HIDDevice device = getDevice(deviceID);
if (device == null) {
HIDDeviceDisconnected(deviceID);
return false;
}
// Look to see if this is a USB device and we have permission to access it
for (HIDDeviceUSB device : mUSBDevices.values()) {
if (deviceID == device.getId()) {
UsbDevice usbDevice = device.getDevice();
if (!mUsbManager.hasPermission(usbDevice)) {
HIDDeviceOpenPending(deviceID);
try {
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), 0));
} catch (Exception e) {
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
HIDDeviceOpenResult(deviceID, false);
}
return false;
}
break;
UsbDevice usbDevice = device.getDevice();
if (usbDevice != null && !mUsbManager.hasPermission(usbDevice)) {
HIDDeviceOpenPending(deviceID);
try {
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), 0));
} catch (Exception e) {
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
HIDDeviceOpenResult(deviceID, false);
}
return false;
}
try {
Log.v(TAG, "openDevice deviceID=" + deviceID);
HIDDevice device;
device = getDevice(deviceID);
if (device == null) {
HIDDeviceDisconnected(deviceID);
return false;
}
return device.open();
} catch (Exception e) {
Log.e(TAG, "Got exception: " + Log.getStackTraceString(e));
@ -599,7 +586,7 @@ public class HIDDeviceManager {
public int sendOutputReport(int deviceID, byte[] report) {
try {
Log.v(TAG, "sendOutputReport deviceID=" + deviceID + " length=" + report.length);
//Log.v(TAG, "sendOutputReport deviceID=" + deviceID + " length=" + report.length);
HIDDevice device;
device = getDevice(deviceID);
if (device == null) {
@ -616,7 +603,7 @@ public class HIDDeviceManager {
public int sendFeatureReport(int deviceID, byte[] report) {
try {
Log.v(TAG, "sendFeatureReport deviceID=" + deviceID + " length=" + report.length);
//Log.v(TAG, "sendFeatureReport deviceID=" + deviceID + " length=" + report.length);
HIDDevice device;
device = getDevice(deviceID);
if (device == null) {
@ -633,7 +620,7 @@ public class HIDDeviceManager {
public boolean getFeatureReport(int deviceID, byte[] report) {
try {
Log.v(TAG, "getFeatureReport deviceID=" + deviceID);
//Log.v(TAG, "getFeatureReport deviceID=" + deviceID);
HIDDevice device;
device = getDevice(deviceID);
if (device == null) {
@ -672,7 +659,7 @@ public class HIDDeviceManager {
private native void HIDDeviceRegisterCallback();
private native void HIDDeviceReleaseCallback();
native void HIDDeviceConnected(int deviceID, String identifier, int vendorId, int productId, String serial_number, int release_number, String manufacturer_string, String product_string, int interface_number);
native void HIDDeviceConnected(int deviceID, String identifier, int vendorId, int productId, String serial_number, int release_number, String manufacturer_string, String product_string, int interface_number, int interface_class, int interface_subclass, int interface_protocol);
native void HIDDeviceOpenPending(int deviceID);
native void HIDDeviceOpenResult(int deviceID, boolean opened);
native void HIDDeviceDisconnected(int deviceID);

View file

@ -11,6 +11,7 @@ class HIDDeviceUSB implements HIDDevice {
protected HIDDeviceManager mManager;
protected UsbDevice mDevice;
protected int mInterfaceIndex;
protected int mInterface;
protected int mDeviceId;
protected UsbDeviceConnection mConnection;
@ -20,16 +21,17 @@ class HIDDeviceUSB implements HIDDevice {
protected boolean mRunning;
protected boolean mFrozen;
public HIDDeviceUSB(HIDDeviceManager manager, UsbDevice usbDevice, int interface_number) {
public HIDDeviceUSB(HIDDeviceManager manager, UsbDevice usbDevice, int interface_index) {
mManager = manager;
mDevice = usbDevice;
mInterface = interface_number;
mInterfaceIndex = interface_index;
mInterface = mDevice.getInterface(mInterfaceIndex).getId();
mDeviceId = manager.getDeviceIDForIdentifier(getIdentifier());
mRunning = false;
}
public String getIdentifier() {
return String.format("%s/%x/%x", mDevice.getDeviceName(), mDevice.getVendorId(), mDevice.getProductId());
return String.format("%s/%x/%x/%d", mDevice.getDeviceName(), mDevice.getVendorId(), mDevice.getProductId(), mInterfaceIndex);
}
@Override
@ -88,6 +90,7 @@ class HIDDeviceUSB implements HIDDevice {
return result;
}
@Override
public UsbDevice getDevice() {
return mDevice;
}
@ -104,19 +107,15 @@ class HIDDeviceUSB implements HIDDevice {
return false;
}
// Force claim all interfaces
for (int i = 0; i < mDevice.getInterfaceCount(); i++) {
UsbInterface iface = mDevice.getInterface(i);
if (!mConnection.claimInterface(iface, true)) {
Log.w(TAG, "Failed to claim interfaces on USB device " + getDeviceName());
close();
return false;
}
// Force claim our interface
UsbInterface iface = mDevice.getInterface(mInterfaceIndex);
if (!mConnection.claimInterface(iface, true)) {
Log.w(TAG, "Failed to claim interfaces on USB device " + getDeviceName());
close();
return false;
}
// Find the endpoints
UsbInterface iface = mDevice.getInterface(mInterface);
for (int j = 0; j < iface.getEndpointCount(); j++) {
UsbEndpoint endpt = iface.getEndpoint(j);
switch (endpt.getDirection()) {
@ -166,7 +165,7 @@ class HIDDeviceUSB implements HIDDevice {
UsbConstants.USB_TYPE_CLASS | 0x01 /*RECIPIENT_INTERFACE*/ | UsbConstants.USB_DIR_OUT,
0x09/*HID set_report*/,
(3/*HID feature*/ << 8) | report_number,
0,
mInterface,
report, offset, length,
1000/*timeout millis*/);
@ -210,7 +209,7 @@ class HIDDeviceUSB implements HIDDevice {
UsbConstants.USB_TYPE_CLASS | 0x01 /*RECIPIENT_INTERFACE*/ | UsbConstants.USB_DIR_IN,
0x01/*HID get_report*/,
(3/*HID feature*/ << 8) | report_number,
0,
mInterface,
report, offset, length,
1000/*timeout millis*/);
@ -250,10 +249,8 @@ class HIDDeviceUSB implements HIDDevice {
mInputThread = null;
}
if (mConnection != null) {
for (int i = 0; i < mDevice.getInterfaceCount(); i++) {
UsbInterface iface = mDevice.getInterface(i);
mConnection.releaseInterface(iface);
}
UsbInterface iface = mDevice.getInterface(mInterfaceIndex);
mConnection.releaseInterface(iface);
mConnection.close();
mConnection = null;
}

View file

@ -283,10 +283,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
return;
}
if (mHIDDeviceManager != null) {
mHIDDeviceManager.setFrozen(true);
}
SDLActivity.handleNativeState();
}
@ -298,10 +294,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
return;
}
if (mHIDDeviceManager != null) {
mHIDDeviceManager.setFrozen(false);
}
SDLActivity.handleNativeState();
}
@ -310,6 +302,10 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
protected void onPause() {
Log.v(TAG, "onPause()");
super.onPause();
if (mHIDDeviceManager != null) {
mHIDDeviceManager.setFrozen(true);
}
if (!mHasMultiWindow) {
pauseNativeThread();
}
@ -319,6 +315,10 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
protected void onResume() {
Log.v(TAG, "onResume()");
super.onResume();
if (mHIDDeviceManager != null) {
mHIDDeviceManager.setFrozen(false);
}
if (!mHasMultiWindow) {
resumeNativeThread();
}
@ -453,7 +453,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
}
// Default system back button behavior.
super.onBackPressed();
if (!isFinishing()) {
super.onBackPressed();
}
}
// Called by JNI from SDL.
@ -466,7 +468,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
runOnUiThread(new Runnable() {
@Override
public void run() {
SDLActivity.this.superOnBackPressed();
if (!SDLActivity.this.isFinishing()) {
SDLActivity.this.superOnBackPressed();
}
}
});
}
@ -633,6 +637,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0);
mScreenKeyboardShown = false;
mSurface.requestFocus();
}
break;
case COMMAND_SET_KEEP_SCREEN_ON:
@ -724,7 +730,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
}
}
if (bShouldWait) {
if (bShouldWait && (SDLActivity.getContext() != null)) {
// We'll wait for the surfaceChanged() method, which will notify us
// when called. That way, we know our current size is really the
// size we need, instead of grabbing a size that's still got
@ -777,6 +783,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
public static native void nativeSetenv(String name, String value);
public static native void onNativeOrientationChanged(int orientation);
public static native void nativeAddTouch(int touchId, String name);
public static native void nativePermissionResult(int requestCode, boolean result);
/**
* This method is called by SDL using JNI.
@ -811,39 +818,62 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
*/
public void setOrientationBis(int w, int h, boolean resizable, String hint)
{
int orientation = -1;
int orientation_landscape = -1;
int orientation_portrait = -1;
/* If set, hint "explicitly controls which UI orientations are allowed". */
if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
} else if (hint.contains("LandscapeRight")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
} else if (hint.contains("LandscapeLeft")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
} else if (hint.contains("Portrait") && hint.contains("PortraitUpsideDown")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
} else if (hint.contains("Portrait")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
} else if (hint.contains("PortraitUpsideDown")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
}
/* no valid hint */
if (orientation == -1) {
if (hint.contains("Portrait") && hint.contains("PortraitUpsideDown")) {
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
} else if (hint.contains("Portrait")) {
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
} else if (hint.contains("PortraitUpsideDown")) {
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
}
boolean is_landscape_allowed = (orientation_landscape == -1 ? false : true);
boolean is_portrait_allowed = (orientation_portrait == -1 ? false : true);
int req = -1; /* Requested orientation */
/* No valid hint, nothing is explicitly allowed */
if (!is_portrait_allowed && !is_landscape_allowed) {
if (resizable) {
/* no fixed orientation */
/* All orientations are allowed */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
} else {
if (w > h) {
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
/* Fixed window and nothing specified. Get orientation from w/h of created window */
req = (w > h ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
}
} else {
/* At least one orientation is allowed */
if (resizable) {
if (is_portrait_allowed && is_landscape_allowed) {
/* hint allows both landscape and portrait, promote to full sensor */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
} else {
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
/* Use the only one allowed "orientation" */
req = (is_landscape_allowed ? orientation_landscape : orientation_portrait);
}
} else {
/* Fixed window and both orientations are allowed. Choose one. */
if (is_portrait_allowed && is_landscape_allowed) {
req = (w > h ? orientation_landscape : orientation_portrait);
} else {
/* Use the only one allowed "orientation" */
req = (is_landscape_allowed ? orientation_landscape : orientation_portrait);
}
}
}
Log.v("SDL", "setOrientation() orientation=" + orientation + " width=" + w +" height="+ h +" resizable=" + resizable + " hint=" + hint);
if (orientation != -1) {
mSingleton.setRequestedOrientation(orientation);
}
Log.v("SDL", "setOrientation() requestedOrientation=" + req + " width=" + w +" height="+ h +" resizable=" + resizable + " hint=" + hint);
mSingleton.setRequestedOrientation(req);
}
/**
@ -970,6 +1000,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if (Build.MANUFACTURER.equals("Amlogic") && Build.MODEL.equals("X96-W")) {
return true;
}
if (Build.MANUFACTURER.equals("Amlogic") && Build.MODEL.startsWith("TV")) {
return true;
}
return false;
}
@ -994,6 +1027,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
* This method is called by SDL using JNI.
*/
public static boolean isChromebook() {
if (getContext() == null) {
return false;
}
return getContext().getPackageManager().hasSystemFeature("org.chromium.arc.device_management");
}
@ -1565,6 +1601,32 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
}
return true;
}
/**
* This method is called by SDL using JNI.
*/
public static void requestPermission(String permission, int requestCode) {
if (Build.VERSION.SDK_INT < 23) {
nativePermissionResult(requestCode, true);
return;
}
Activity activity = (Activity)getContext();
if (activity.checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
activity.requestPermissions(new String[]{permission}, requestCode);
} else {
nativePermissionResult(requestCode, true);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
nativePermissionResult(requestCode, true);
} else {
nativePermissionResult(requestCode, false);
}
}
}
/**
@ -1590,7 +1652,7 @@ class SDLMain implements Runnable {
Log.v("SDL", "Finished main function");
if (SDLActivity.mSingleton.isFinishing()) {
if (SDLActivity.mSingleton == null || SDLActivity.mSingleton.isFinishing()) {
// Activity is already being destroyed
} else {
// Let's finish the Activity
@ -1825,7 +1887,9 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
if (source == InputDevice.SOURCE_UNKNOWN) {
InputDevice device = InputDevice.getDevice(deviceId);
source = device.getSources();
if (device != null) {
source = device.getSources();
}
}
if ((source & InputDevice.SOURCE_KEYBOARD) != 0) {

View file

@ -39,7 +39,7 @@
#
# Base version of SDL, used for packaging purposes
$SDLVersion = "2.0.10"
$SDLVersion = "2.0.12"
# Gets the .bat file that sets up an MSBuild environment, given one of
# Visual Studio's, "PlatformToolset"s.

View file

@ -738,29 +738,6 @@ macro(CheckVivante)
endif(VIDEO_VIVANTE)
endmacro(CheckVivante)
# Requires:
# - n/a
macro(CheckMali)
if(VIDEO_MALI)
check_c_source_compiles("
#define LINUX
#define EGL_API_FB
#include <EGL/egl.h>
int main(int argc, char** argv) {}" HAVE_VIDEO_MALI_EGL_FB)
if(HAVE_VIDEO_MALI_EGL_FB)
set(HAVE_VIDEO_MALI TRUE)
set(HAVE_SDL_VIDEO TRUE)
file(GLOB MALI_SOURCES ${SDL2_SOURCE_DIR}/src/video/mali-fbdev/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${MALI_SOURCES})
set(SDL_VIDEO_DRIVER_MALI 1)
set(SDL_CFLAGS "${SDL_CFLAGS} -DLINUX -DEGL_API_FB")
list(APPEND EXTRA_LIBS EGL)
endif(HAVE_VIDEO_MALI_EGL_MALI)
endif(VIDEO_MALI)
endmacro(CheckMali)
# Requires:
# - nada
macro(CheckOpenGLX11)
@ -1097,7 +1074,7 @@ macro(CheckHIDAPI)
set(HAVE_HIDAPI FALSE)
pkg_check_modules(LIBUSB libusb)
if (LIBUSB_FOUND)
check_include_file(libusb.h HAVE_LIBUSB_H)
check_include_file(libusb.h HAVE_LIBUSB_H ${LIBUSB_CFLAGS})
if (HAVE_LIBUSB_H)
set(HAVE_HIDAPI TRUE)
endif()
@ -1111,8 +1088,15 @@ macro(CheckHIDAPI)
set(SOURCE_FILES ${SOURCE_FILES} ${HIDAPI_SOURCES})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS} -I${SDL2_SOURCE_DIR}/src/hidapi/hidapi")
if(NOT HIDAPI_SKIP_LIBUSB)
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/libusb/hid.c)
list(APPEND EXTRA_LIBS ${LIBUSB_LIBS})
if(HIDAPI_ONLY_LIBUSB)
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/libusb/hid.c)
list(APPEND EXTRA_LIBS ${LIBUSB_LIBS})
else()
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/SDL_hidapi.c)
# libusb is loaded dynamically, so don't add it to EXTRA_LIBS
FindLibraryAndSONAME("usb-1.0")
set(SDL_LIBUSB_DYNAMIC "\"${USB_LIB_SONAME}\"")
endif()
endif()
endif()
endif()

342
configure vendored
View file

@ -852,6 +852,8 @@ enable_diskaudio
enable_dummyaudio
enable_libsamplerate
enable_libsamplerate_shared
enable_arm_simd
enable_arm_neon
enable_video_wayland
enable_video_wayland_qt_touch
enable_wayland_shared
@ -868,8 +870,8 @@ enable_video_x11_scrnsaver
enable_video_x11_xshape
enable_video_x11_vm
enable_video_vivante
enable_video_mali
enable_video_cocoa
enable_video_metal
enable_render_metal
enable_video_directfb
enable_directfb_shared
@ -1622,6 +1624,8 @@ Optional Features:
[[default=yes]]
--enable-libsamplerate-shared
dynamically load libsamplerate [[default=yes]]
--enable-arm-simd use SIMD assembly blitters on ARM [[default=yes]]
--enable-arm-neon use NEON assembly blitters on ARM [[default=no]]
--enable-video-wayland use Wayland video driver [[default=yes]]
--enable-video-wayland-qt-touch
QtWayland server support for Wayland video driver
@ -1647,8 +1651,8 @@ Optional Features:
enable X11 XShape support [[default=yes]]
--enable-video-x11-vm use X11 VM extension for fullscreen [[default=yes]]
--enable-video-vivante use Vivante EGL video driver [[default=yes]]
--enable-video-mali use Mali EGL video driver [[default=no]]
--enable-video-cocoa use Cocoa video driver [[default=yes]]
--enable-video-metal include Metal support [[default=yes]]
--enable-render-metal enable the Metal render driver [[default=yes]]
--enable-video-directfb use DirectFB video driver [[default=no]]
--enable-directfb-shared
@ -1677,7 +1681,7 @@ Optional Features:
--enable-wasapi use the Windows WASAPI audio driver [[default=yes]]
--enable-sdl-dlopen use dlopen for shared object loading [[default=yes]]
--enable-hidapi use HIDAPI for low level joystick drivers
[[default=maybe]]
[[default=no]]
--enable-clock_gettime use clock_gettime() instead of gettimeofday() on
UNIX [[default=yes]]
--enable-rpath use an rpath when linking SDL [[default=yes]]
@ -2813,9 +2817,9 @@ orig_CFLAGS="$CFLAGS"
#
SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=0
SDL_MICRO_VERSION=10
SDL_MICRO_VERSION=12
SDL_INTERFACE_AGE=0
SDL_BINARY_AGE=10
SDL_BINARY_AGE=12
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
@ -16974,7 +16978,7 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll _Exit
for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat wcsdup wcsstr wcscmp wcsncmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll _Exit
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@ -19358,6 +19362,106 @@ _ACEOF
fi
}
CheckARM()
{
# Check whether --enable-arm-simd was given.
if test "${enable_arm_simd+set}" = set; then :
enableval=$enable_arm_simd; enable_arm_simd=$enableval
else
enable_arm_simd=yes
fi
if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_arm_simd = xyes; then
save_CFLAGS="$CFLAGS"
have_arm_simd=no
CFLAGS="-x assembler-with-cpp $CFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ARM SIMD" >&5
$as_echo_n "checking for ARM SIMD... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
.text
.arch armv6
.object_arch armv4
.arm
.altmacro
#ifndef __ARM_EABI__
#error EABI is required (to be sure that calling conventions are compatible)
#endif
pld [r0]
uqadd8 r0, r0, r0
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
have_arm_simd=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_arm_simd" >&5
$as_echo "$have_arm_simd" >&6; }
CFLAGS="$save_CFLAGS"
if test x$have_arm_simd = xyes; then
$as_echo "#define SDL_ARM_SIMD_BLITTERS 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-simd*.S"
WARN_ABOUT_ARM_SIMD_ASM_MIT="yes"
fi
fi
}
CheckNEON()
{
# Check whether --enable-arm-neon was given.
if test "${enable_arm_neon+set}" = set; then :
enableval=$enable_arm_neon; enable_arm_neon=$enableval
else
enable_arm_neon=no
fi
if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_arm_neon = xyes; then
save_CFLAGS="$CFLAGS"
have_arm_neon=no
CFLAGS="-x assembler-with-cpp $CFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ARM NEON" >&5
$as_echo_n "checking for ARM NEON... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
.text
.fpu neon
.arch armv7a
.object_arch armv4
.eabi_attribute 10, 0
.arm
.altmacro
#ifndef __ARM_EABI__
#error EABI is required (to be sure that calling conventions are compatible)
#endif
pld [r0]
vmovn.u16 d0, q0
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
have_arm_neon=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_arm_neon" >&5
$as_echo "$have_arm_neon" >&6; }
CFLAGS="$save_CFLAGS"
if test x$have_arm_neon = xyes; then
$as_echo "#define SDL_ARM_NEON_BLITTERS 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-neon*.S"
WARN_ABOUT_ARM_NEON_ASM_MIT="yes"
fi
fi
}
CheckVisibilityHidden()
{
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5
@ -19859,7 +19963,7 @@ $as_echo "$have_video_rpi" >&6; }
if test x$have_video_rpi = xyes; then
CFLAGS="$CFLAGS $RPI_CFLAGS"
#SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS"
SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
@ -19886,10 +19990,10 @@ fi
# This isn't necessary for X11, but fixes GLX detection
if test "x$x_includes" = xNONE && \
test "x$x_libraries" = xNONE && \
test -d /usr/X11R6/include && \
test -d /usr/X11R6/lib; then
x_includes="/usr/X11R6/include"
x_libraries="/usr/X11R6/lib"
test -d /opt/X11/include && \
test -d /opt/X11/lib; then
x_includes="/opt/X11/include"
x_libraries="/opt/X11/lib"
fi
;;
esac
@ -20587,15 +20691,16 @@ fi
case "$host" in
*-*-darwin*)
x11_lib='/usr/X11R6/lib/libX11.6.dylib'
x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
xss_lib='/usr/X11R6/lib/libXss.1.dylib'
xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
# Apple now puts this in /opt/X11
x11_lib='/opt/X11/lib/libX11.6.dylib'
x11ext_lib='/opt/X11/lib/libXext.6.dylib'
xcursor_lib='/opt/X11/lib/libXcursor.1.dylib'
xinerama_lib='/opt/X11/lib/libXinerama.1.dylib'
xinput_lib='/opt/X11/lib/libXi.6.dylib'
xrandr_lib='/opt/X11/lib/libXrandr.2.dylib'
xrender_lib='/opt/X11/lib/libXrender.1.dylib'
xss_lib='/opt/X11/lib/libXss.1.dylib'
xvidmode_lib='/opt/X11/lib/libXxf86vm.1.dylib'
;;
*-*-openbsd*)
x11_lib='libX11.so'
@ -21469,56 +21574,6 @@ $as_echo "#define SDL_VIDEO_DRIVER_VIVANTE_VDK 1" >>confdefs.h
fi
}
CheckMaliVideo()
{
# Check whether --enable-video-mali was given.
if test "${enable_video_mali+set}" = set; then :
enableval=$enable_video_mali;
else
enable_video_mali=no
fi
if test x$enable_video = xyes -a x$enable_video_mali = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mali FB API" >&5
$as_echo_n "checking for Mali FB API... " >&6; }
have_mali_egl=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define LINUX
#define EGL_API_FB
#include <EGL/egl.h>
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
have_mali_egl=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_mali_egl" >&5
$as_echo "$have_mali_egl" >&6; }
if test x$have_mali_egl = xyes; then
$as_echo "#define SDL_VIDEO_DRIVER_MALI 1" >>confdefs.h
EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB"
SOURCES="$SOURCES $srcdir/src/video/mali-fbdev/*.c"
SUMMARY_video="${SUMMARY_video} mali"
have_video=yes
fi
fi
}
CheckHaikuVideo()
{
if test x$enable_video = xyes; then
@ -21582,6 +21637,13 @@ $as_echo "#define SDL_VIDEO_DRIVER_COCOA 1" >>confdefs.h
CheckMETAL()
{
# Check whether --enable-video-metal was given.
if test "${enable_video_metal+set}" = set; then :
enableval=$enable_video_metal;
else
enable_video_metal=yes
fi
# Check whether --enable-render-metal was given.
if test "${enable_render_metal+set}" = set; then :
enableval=$enable_render_metal;
@ -21589,7 +21651,7 @@ else
enable_render_metal=yes
fi
if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
if test x$enable_video = xyes -a x$enable_video_metal = xyes; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -x objective-c"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Metal framework" >&5
@ -21626,11 +21688,17 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
$as_echo "$have_metal" >&6; }
if test x$have_metal = xyes; then
$as_echo "#define SDL_VIDEO_METAL 1" >>confdefs.h
if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
$as_echo "#define SDL_VIDEO_RENDER_METAL 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
fi
SUMMARY_video="${SUMMARY_video} metal"
else
enable_video_metal=no
enable_render_metal=no
fi
fi
@ -22768,7 +22836,7 @@ fi
$as_echo "#define SDL_USE_IME 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
fi
}
@ -23660,14 +23728,6 @@ fi
fi
ac_fn_c_check_header_mongrel "$LINENO" "endpointvolume.h" "ac_cv_header_endpointvolume_h" "$ac_includes_default"
if test "x$ac_cv_header_endpointvolume_h" = xyes; then :
$as_echo "#define HAVE_ENDPOINTVOLUME_H 1" >>confdefs.h
fi
# Check whether --enable-wasapi was given.
if test "${enable_wasapi+set}" = set; then :
enableval=$enable_wasapi;
@ -24157,30 +24217,24 @@ CheckHIDAPI()
{
# The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers,
# so we'll just use libusb when it's available.
#
# Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default.
#
# On macOS and Windows, where you don't need libusb or root, we default to yes.
skiplibusb=no
case "$host" in
*-*-cygwin* | *-*-mingw32* | *-*-darwin* )
# libusb does not support iOS
arm*-apple-darwin* | *-ios-* )
skiplibusb=yes
;;
# On the other hand, *BSD specifically uses libusb only
*-*-*bsd* )
onlylibusb=yes
;;
esac
# Check whether --enable-hidapi was given.
if test "${enable_hidapi+set}" = set; then :
enableval=$enable_hidapi;
else
enable_hidapi=maybe
enable_hidapi=no
fi
hidapi_support=no
if test x$enable_hidapi = xmaybe; then
enable_hidapi=$skiplibusb
fi
if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
if test x$skiplibusb = xyes; then
hidapi_support=yes
@ -24265,6 +24319,10 @@ fi
CFLAGS="$save_CFLAGS"
if test x$have_libusb_h = xyes; then
hidapi_support=yes
elif test x$onlylibusb = xyes; then
hidapi_support=no
else
hidapi_support=yes
fi
fi
@ -24274,11 +24332,37 @@ $as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
SOURCES="$SOURCES $srcdir/src/hidapi/SDL_hidapi.c"
if test x$skiplibusb = xno; then
SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
if test x$have_libusb_h = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
if test x$onlylibusb = xyes; then
SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
else
if test x$have_loadso != xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libusb loading" >&5
$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libusb loading" >&2;}
fi
# libusb is loaded dynamically, so don't add it to LDFLAGS
libusb_lib=""
case "$host" in
*-*-darwin* )
libusb_lib="libusb-1.0.0.dylib"
;;
*-*-cygwin* | *-*-mingw32* )
libusb_lib="libusb-1.0.dll"
;;
esac
if test x$libusb_lib = x; then
libusb_lib=`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`
fi
cat >>confdefs.h <<_ACEOF
#define SDL_LIBUSB_DYNAMIC "$libusb_lib"
_ACEOF
fi
fi
fi
@ -24497,6 +24581,8 @@ case "$host" in
CheckDiskAudio
CheckDummyAudio
CheckDLOPEN
CheckARM
CheckNEON
CheckOSS
CheckALSA
CheckPulseAudio
@ -24535,7 +24621,6 @@ case "$host" in
CheckLinuxVersion
CheckRPATH
CheckVivanteVideo
CheckMaliVideo
# Set up files for the audio library
if test x$enable_audio = xyes; then
@ -24785,9 +24870,6 @@ $as_echo "#define SDL_JOYSTICK_WINMM 1" >>confdefs.h
fi
SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
have_joystick=yes
if test x$hidapi_support = xyes; then
SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
fi
fi
if test x$enable_haptic = xyes; then
if test x$have_dinput = xyes -o x$have_xinput = xyes; then
@ -25024,6 +25106,14 @@ $as_echo "#define SDL_JOYSTICK_MFI 1" >>confdefs.h
# have_haptic=yes
# EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
#fi
# Set up files for the sensor library
if test x$enable_sensor = xyes; then
$as_echo "#define SDL_SENSOR_COREMOTION 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/sensor/coremotion/*.m"
have_sensor=yes
fi
# Set up files for the power library
if test x$enable_power = xyes; then
@ -25083,7 +25173,7 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
if test x$enable_video_metal = xyes -o x$enable_video_vulkan = xyes; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal"
fi
;;
@ -25130,9 +25220,6 @@ $as_echo "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
have_joystick=yes
if test x$hidapi_support = xyes; then
SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
fi
fi
# Set up files for the haptic library
if test x$enable_haptic = xyes; then
@ -25180,7 +25267,7 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
if test x$enable_video_metal = xyes -o x$enable_video_vulkan = xyes; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal"
fi
;;
@ -25266,6 +25353,27 @@ $as_echo "#define SDL_FILESYSTEM_EMSCRIPTEN 1" >>confdefs.h
# Set up files for the timer library
if test x$enable_timers = xyes; then
$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
have_timers=yes
fi
;;
*-*-riscos*)
ARCH=riscos
CheckVisibilityHidden
CheckDeclarationAfterStatement
CheckDummyVideo
CheckDiskAudio
CheckDummyAudio
CheckDLOPEN
CheckOSS
CheckPTHREAD
CheckClockGettime
# Set up files for the timer library
if test x$enable_timers = xyes; then
$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
@ -25405,7 +25513,7 @@ VERSION_OBJECTS=`echo $VERSION_SOURCES`
VERSION_DEPENDS=`echo $VERSION_SOURCES`
VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.rc,$(objects)/\1.o,g'`
VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.rc,\\\\
\\$(objects)/\\2.o: \\1/\\2.rc\\\\
\\$(objects)/\\2.o: \\1/\\2.rc \\$(objects)/.created\\\\
\\$(WINDRES) \\$< \\$@,g"`
SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
@ -25519,7 +25627,7 @@ $SDLTEST_DEPENDS
$WAYLAND_PROTOCOLS_DEPENDS
__EOF__
ac_config_files="$ac_config_files Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc"
ac_config_files="$ac_config_files Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake sdl2-config-version.cmake SDL2.spec sdl2.pc"
ac_config_commands="$ac_config_commands sdl2_config"
@ -25569,6 +25677,23 @@ if test x$have_fcitx_frontend_h_hdr = xyes; then
else
SUMMARY="${SUMMARY}Using fcitx : NO\n"
fi
if test x$WARN_ABOUT_ARM_SIMD_ASM_MIT = xyes; then
SUMMARY="${SUMMARY}\nSDL is being built with ARM SIMD optimizations, which\n"
SUMMARY="${SUMMARY}uses code licensed under the MIT license. If this is a\n"
SUMMARY="${SUMMARY}problem, please disable that code by rerunning the\n"
SUMMARY="${SUMMARY}configure script with:\n"
SUMMARY="${SUMMARY}\n --disable-arm-simd\n"
fi
if test x$WARN_ABOUT_ARM_NEON_ASM_MIT = xyes; then
SUMMARY="${SUMMARY}\nSDL is being built with ARM NEON optimizations, which\n"
SUMMARY="${SUMMARY}uses code licensed under the MIT license. If this is a\n"
SUMMARY="${SUMMARY}problem, please disable that code by rerunning the\n"
SUMMARY="${SUMMARY}configure script with:\n"
SUMMARY="${SUMMARY}\n --disable-arm-neon\n"
fi
ac_config_commands="$ac_config_commands summary"
@ -26654,6 +26779,7 @@ do
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:Makefile.in:Makefile.rules" ;;
"sdl2-config") CONFIG_FILES="$CONFIG_FILES sdl2-config" ;;
"sdl2-config.cmake") CONFIG_FILES="$CONFIG_FILES sdl2-config.cmake" ;;
"sdl2-config-version.cmake") CONFIG_FILES="$CONFIG_FILES sdl2-config-version.cmake" ;;
"SDL2.spec") CONFIG_FILES="$CONFIG_FILES SDL2.spec" ;;
"sdl2.pc") CONFIG_FILES="$CONFIG_FILES sdl2.pc" ;;
"sdl2_config") CONFIG_COMMANDS="$CONFIG_COMMANDS sdl2_config" ;;

View file

@ -20,9 +20,9 @@ dnl Set various version strings - taken gratefully from the GTk sources
#
SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=0
SDL_MICRO_VERSION=10
SDL_MICRO_VERSION=12
SDL_INTERFACE_AGE=0
SDL_BINARY_AGE=10
SDL_BINARY_AGE=12
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
AC_SUBST(SDL_MAJOR_VERSION)
@ -335,7 +335,7 @@ if test x$enable_libc = xyes; then
AC_DEFINE(HAVE_MPROTECT, 1, [ ])
]),
)
AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll _Exit)
AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat wcsdup wcsstr wcscmp wcsncmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll _Exit)
AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
@ -1303,6 +1303,82 @@ AS_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate
fi
}
dnl Check for ARM instruction support using gas syntax
CheckARM()
{
AC_ARG_ENABLE(arm-simd,
AC_HELP_STRING([--enable-arm-simd], [use SIMD assembly blitters on ARM [[default=yes]]]),
enable_arm_simd=$enableval, enable_arm_simd=yes)
if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_arm_simd = xyes; then
save_CFLAGS="$CFLAGS"
have_arm_simd=no
CFLAGS="-x assembler-with-cpp $CFLAGS"
AC_MSG_CHECKING(for ARM SIMD)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
.text
.arch armv6
.object_arch armv4
.arm
.altmacro
#ifndef __ARM_EABI__
#error EABI is required (to be sure that calling conventions are compatible)
#endif
pld [r0]
uqadd8 r0, r0, r0
]])], have_arm_simd=yes)
AC_MSG_RESULT($have_arm_simd)
CFLAGS="$save_CFLAGS"
if test x$have_arm_simd = xyes; then
AC_DEFINE(SDL_ARM_SIMD_BLITTERS)
dnl SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-simd*.c"
SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-simd*.S"
WARN_ABOUT_ARM_SIMD_ASM_MIT="yes"
fi
fi
}
dnl Check for ARM NEON instruction support using gas syntax
CheckNEON()
{
AC_ARG_ENABLE(arm-neon,
AC_HELP_STRING([--enable-arm-neon], [use NEON assembly blitters on ARM [[default=no]]]),
enable_arm_neon=$enableval, enable_arm_neon=no)
if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_arm_neon = xyes; then
save_CFLAGS="$CFLAGS"
have_arm_neon=no
CFLAGS="-x assembler-with-cpp $CFLAGS"
AC_MSG_CHECKING(for ARM NEON)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
.text
.fpu neon
.arch armv7a
.object_arch armv4
.eabi_attribute 10, 0
.arm
.altmacro
#ifndef __ARM_EABI__
#error EABI is required (to be sure that calling conventions are compatible)
#endif
pld [r0]
vmovn.u16 d0, q0
]])], have_arm_neon=yes)
AC_MSG_RESULT($have_arm_neon)
CFLAGS="$save_CFLAGS"
if test x$have_arm_neon = xyes; then
AC_DEFINE(SDL_ARM_NEON_BLITTERS)
dnl SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-neon*.c"
SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-neon*.S"
WARN_ABOUT_ARM_NEON_ASM_MIT="yes"
fi
fi
}
dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
CheckVisibilityHidden()
@ -1588,7 +1664,7 @@ AS_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=ye
if test x$have_video_rpi = xyes; then
CFLAGS="$CFLAGS $RPI_CFLAGS"
#SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS"
SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
@ -1610,10 +1686,10 @@ AS_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
# This isn't necessary for X11, but fixes GLX detection
if test "x$x_includes" = xNONE && \
test "x$x_libraries" = xNONE && \
test -d /usr/X11R6/include && \
test -d /usr/X11R6/lib; then
x_includes="/usr/X11R6/include"
x_libraries="/usr/X11R6/lib"
test -d /opt/X11/include && \
test -d /opt/X11/lib; then
x_includes="/opt/X11/include"
x_libraries="/opt/X11/lib"
fi
;;
esac
@ -1626,15 +1702,16 @@ AS_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma
case "$host" in
*-*-darwin*)
x11_lib='/usr/X11R6/lib/libX11.6.dylib'
x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
xss_lib='/usr/X11R6/lib/libXss.1.dylib'
xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
# Apple now puts this in /opt/X11
x11_lib='/opt/X11/lib/libX11.6.dylib'
x11ext_lib='/opt/X11/lib/libXext.6.dylib'
xcursor_lib='/opt/X11/lib/libXcursor.1.dylib'
xinerama_lib='/opt/X11/lib/libXinerama.1.dylib'
xinput_lib='/opt/X11/lib/libXi.6.dylib'
xrandr_lib='/opt/X11/lib/libXrandr.2.dylib'
xrender_lib='/opt/X11/lib/libXrender.1.dylib'
xss_lib='/opt/X11/lib/libXss.1.dylib'
xvidmode_lib='/opt/X11/lib/libXxf86vm.1.dylib'
;;
*-*-openbsd*)
x11_lib='libX11.so'
@ -2006,35 +2083,6 @@ AS_HELP_STRING([--enable-video-vivante], [use Vivante EGL video driver [[default
fi
}
dnl Set up the Mali video driver if enabled
CheckMaliVideo()
{
AC_ARG_ENABLE(video-mali,
AC_HELP_STRING([--enable-video-mali], [use Mali EGL video driver [[default=yes]]]),
, enable_video_mali=yes)
if test x$enable_video = xyes -a x$enable_video_mali = xyes; then
AC_MSG_CHECKING(for Mali FB API)
have_mali_egl=no
AC_TRY_COMPILE([
#define LINUX
#define EGL_API_FB
#include <EGL/egl.h>
],[
],[
have_mali_egl=yes
])
AC_MSG_RESULT($have_mali_egl)
if test x$have_mali_egl = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_MALI, 1, [ ])
EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB"
SOURCES="$SOURCES $srcdir/src/video/mali-fbdev/*.c"
SUMMARY_video="${SUMMARY_video} mali"
have_video=yes
fi
fi
}
dnl Set up the Haiku video driver if enabled
CheckHaikuVideo()
{
@ -2077,10 +2125,13 @@ AS_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]])
CheckMETAL()
{
AC_ARG_ENABLE(video-metal,
AC_HELP_STRING([--enable-video-metal], [include Metal support [[default=yes]]]),
, enable_video_metal=yes)
AC_ARG_ENABLE(render-metal,
AS_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[default=yes]]]),
, enable_render_metal=yes)
if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
if test x$enable_video = xyes -a x$enable_video_metal = xyes; then
save_CFLAGS="$CFLAGS"
dnl Work around that we don't have Objective-C support in autoconf
CFLAGS="$CFLAGS -x objective-c"
@ -2101,10 +2152,14 @@ AS_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[defaul
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($have_metal)
if test x$have_metal = xyes; then
AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ])
SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
AC_DEFINE(SDL_VIDEO_METAL, 1, [ ])
if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ])
SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
fi
SUMMARY_video="${SUMMARY_video} metal"
else
enable_video_metal=no
enable_render_metal=no
fi
fi
@ -2313,7 +2368,7 @@ CheckOpenGLESX11()
if test x$video_opengl_egl = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
fi
if test x$enable_video_opengles1 = xyes; then
AC_MSG_CHECKING(for OpenGL ES v1 headers)
video_opengles_v1=no
@ -2624,7 +2679,7 @@ AS_HELP_STRING([--enable-ime], [enable IME support [[default=yes]]]),
, enable_ime=yes)
if test x$enable_ime = xyes; then
AC_DEFINE(SDL_USE_IME, 1, [ ])
SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
fi
}
@ -3043,8 +3098,6 @@ XINPUT_STATE_EX s1;
AC_DEFINE(HAVE_AUDIOCLIENT_H,1,[])
fi
AC_CHECK_HEADER(endpointvolume.h,AC_DEFINE(HAVE_ENDPOINTVOLUME_H,1,[]))
AC_ARG_ENABLE(wasapi,
AS_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]),
, enable_wasapi=yes)
@ -3096,7 +3149,7 @@ CheckUSBHID()
AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
fi
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $USB_CFLAGS"
@ -3226,26 +3279,20 @@ CheckHIDAPI()
{
# The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers,
# so we'll just use libusb when it's available.
#
# Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default.
#
# On macOS and Windows, where you don't need libusb or root, we default to yes.
skiplibusb=no
case "$host" in
*-*-cygwin* | *-*-mingw32* | *-*-darwin* )
# libusb does not support iOS
arm*-apple-darwin* | *-ios-* )
skiplibusb=yes
;;
# On the other hand, *BSD specifically uses libusb only
*-*-*bsd* )
onlylibusb=yes
;;
esac
AC_ARG_ENABLE(hidapi,
AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=maybe]]]),
, enable_hidapi=maybe)
hidapi_support=no
if test x$enable_hidapi = xmaybe; then
enable_hidapi=$skiplibusb
fi
AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=no]]]),
, enable_hidapi=no)
if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
if test x$skiplibusb = xyes; then
hidapi_support=yes
@ -3257,6 +3304,10 @@ AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[d
CFLAGS="$save_CFLAGS"
if test x$have_libusb_h = xyes; then
hidapi_support=yes
elif test x$onlylibusb = xyes; then
hidapi_support=no
else
hidapi_support=yes
fi
fi
@ -3264,11 +3315,32 @@ AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[d
AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
SOURCES="$SOURCES $srcdir/src/hidapi/SDL_hidapi.c"
if test x$skiplibusb = xno; then
SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
if test x$have_libusb_h = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
if test x$onlylibusb = xyes; then
SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
else
if test x$have_loadso != xyes; then
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libusb loading])
fi
# libusb is loaded dynamically, so don't add it to LDFLAGS
libusb_lib=""
case "$host" in
*-*-darwin* )
libusb_lib="libusb-1.0.0.dylib"
;;
*-*-cygwin* | *-*-mingw32* )
libusb_lib="libusb-1.0.dll"
;;
esac
if test x$libusb_lib = x; then
libusb_lib=[`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
fi
AC_DEFINE_UNQUOTED(SDL_LIBUSB_DYNAMIC, "$libusb_lib", [ ])
fi
fi
fi
@ -3391,6 +3463,8 @@ case "$host" in
CheckDiskAudio
CheckDummyAudio
CheckDLOPEN
CheckARM
CheckNEON
CheckOSS
CheckALSA
CheckPulseAudio
@ -3429,7 +3503,6 @@ case "$host" in
CheckLinuxVersion
CheckRPATH
CheckVivanteVideo
CheckMaliVideo
# Set up files for the audio library
if test x$enable_audio = xyes; then
@ -3629,9 +3702,6 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
fi
SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
have_joystick=yes
if test x$hidapi_support = xyes; then
SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
fi
fi
if test x$enable_haptic = xyes; then
if test x$have_dinput = xyes -o x$have_xinput = xyes; then
@ -3786,6 +3856,12 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
# have_haptic=yes
# EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
#fi
# Set up files for the sensor library
if test x$enable_sensor = xyes; then
AC_DEFINE(SDL_SENSOR_COREMOTION, 1, [ ])
SOURCES="$SOURCES $srcdir/src/sensor/coremotion/*.m"
have_sensor=yes
fi
# Set up files for the power library
if test x$enable_power = xyes; then
AC_DEFINE(SDL_POWER_UIKIT, 1, [ ])
@ -3829,7 +3905,7 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
if test x$enable_video_metal = xyes -o x$enable_video_vulkan = xyes; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal"
fi
;;
@ -3872,9 +3948,6 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
have_joystick=yes
if test x$hidapi_support = xyes; then
SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
fi
fi
# Set up files for the haptic library
if test x$enable_haptic = xyes; then
@ -3914,7 +3987,7 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
if test x$enable_video_metal = xyes -o x$enable_video_vulkan = xyes; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal"
fi
;;
@ -3983,6 +4056,25 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
SOURCES="$SOURCES $srcdir/src/filesystem/emscripten/*.c"
have_filesystem=yes
fi
# Set up files for the timer library
if test x$enable_timers = xyes; then
AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
have_timers=yes
fi
;;
*-*-riscos*)
ARCH=riscos
CheckVisibilityHidden
CheckDeclarationAfterStatement
CheckDummyVideo
CheckDiskAudio
CheckDummyAudio
CheckDLOPEN
CheckOSS
CheckPTHREAD
CheckClockGettime
# Set up files for the timer library
if test x$enable_timers = xyes; then
AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
@ -4101,7 +4193,7 @@ VERSION_OBJECTS=`echo $VERSION_SOURCES`
VERSION_DEPENDS=`echo $VERSION_SOURCES`
VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
\\$(objects)/\\2.o: \\1/\\2.rc\\\\
\\$(objects)/\\2.o: \\1/\\2.rc \\$(objects)/.created\\\\
\\$(WINDRES) \\$< \\$@,g"`
SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
@ -4201,7 +4293,7 @@ $WAYLAND_PROTOCOLS_DEPENDS
__EOF__
AC_CONFIG_FILES([
Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc
Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake sdl2-config-version.cmake SDL2.spec sdl2.pc
])
AC_CONFIG_COMMANDS([sdl2_config],[chmod a+x sdl2-config])
@ -4250,6 +4342,23 @@ if test x$have_fcitx_frontend_h_hdr = xyes; then
else
SUMMARY="${SUMMARY}Using fcitx : NO\n"
fi
if test x$WARN_ABOUT_ARM_SIMD_ASM_MIT = xyes; then
SUMMARY="${SUMMARY}\nSDL is being built with ARM SIMD optimizations, which\n"
SUMMARY="${SUMMARY}uses code licensed under the MIT license. If this is a\n"
SUMMARY="${SUMMARY}problem, please disable that code by rerunning the\n"
SUMMARY="${SUMMARY}configure script with:\n"
SUMMARY="${SUMMARY}\n --disable-arm-simd\n"
fi
if test x$WARN_ABOUT_ARM_NEON_ASM_MIT = xyes; then
SUMMARY="${SUMMARY}\nSDL is being built with ARM NEON optimizations, which\n"
SUMMARY="${SUMMARY}uses code licensed under the MIT license. If this is a\n"
SUMMARY="${SUMMARY}problem, please disable that code by rerunning the\n"
SUMMARY="${SUMMARY}configure script with:\n"
SUMMARY="${SUMMARY}\n --disable-arm-neon\n"
fi
AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"])
AC_OUTPUT

14
debian/changelog vendored
View file

@ -1,8 +1,20 @@
libsdl2 (2.0.12) UNRELEASED; urgency=low
* Updated SDL to version 2.0.12 for development builds
-- Sam Lantinga <slouken@libsdl.org> Sun, 1 Mar 2020 14:57:07 -0800
libsdl2 (2.0.11) UNRELEASED; urgency=low
* Updated SDL to version 2.0.11 for development builds
-- Sam Lantinga <slouken@libsdl.org> Sun, 22 Sep 2019 10:33:03 -0800
libsdl2 (2.0.10) UNRELEASED; urgency=low
* Updated SDL to version 2.0.10
-- Sam Lantinga <slouken@libsdl.org> Mon, 17 Jun 2018 08:48:47 -0800
-- Sam Lantinga <slouken@libsdl.org> Mon, 17 Jun 2019 08:48:47 -0800
libsdl2 (2.0.9) UNRELEASED; urgency=low

17
debian/control vendored
View file

@ -13,6 +13,8 @@ Build-Depends: debhelper (>= 9),
dpkg-dev (>= 1.16.1~),
fcitx-libs-dev [linux-any],
libasound2-dev [linux-any],
libgl1-mesa-dev,
libpulse-dev,
libudev-dev [linux-any],
libdbus-1-dev [linux-any],
libibus-1.0-dev[linux-any],
@ -28,16 +30,16 @@ Build-Depends: debhelper (>= 9),
libxxf86vm-dev
Homepage: http://www.libsdl.org/
Package: libsdl2-2.0-0
Package: libsdl2
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: ${misc:Depends},
${shlibs:Depends},
libudev0 | libudev1 [linux-any],
libudev0 [linux-any],
libdbus-1-3 [linux-any]
Conflicts: libsdl-1.3-0, libsdl2
Replaces: libsdl-1.3-0, libsdl2
Conflicts: libsdl-1.3-0
Replaces: libsdl-1.3-0
Description: Simple DirectMedia Layer
SDL is a library that allows programs portable low level access to
a video framebuffer, audio output, mouse, and keyboard.
@ -49,10 +51,9 @@ Section: libdevel
Architecture: any
Multi-Arch: same
Depends: ${misc:Depends},
libsdl2-2.0-0 (= ${binary:Version}),
libsdl2 (= ${binary:Version}),
libc6-dev,
libgl1-mesa-dev,
libx11-dev
libgl1-mesa-dev
Conflicts: libsdl-1.3-dev
Replaces: libsdl-1.3-dev
Description: Simple DirectMedia Layer development files
@ -67,7 +68,7 @@ Section: debug
Architecture: any
Multi-Arch: same
Depends: ${misc:Depends},
libsdl2-2.0-0 (= ${binary:Version}),
libsdl2 (= ${binary:Version}),
Description: Simple DirectMedia Layer debug files
SDL is a library that allows programs portable low level access to a video
framebuffer, audio output, mouse, and keyboard.

12
debian/copyright vendored
View file

@ -4,7 +4,7 @@ Upstream-Contact: Sam Lantinga <slouken@libsdl.org>
Source: http://www.libsdl.org/
Files: *
Copyright: 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright: 1997-2020 Sam Lantinga <slouken@libsdl.org>
License: zlib/libpng
Files: src/libm/*
@ -12,7 +12,7 @@ Copyright: 1993 by Sun Microsystems, Inc. All rights reserved.
License: SunPro
Files: src/main/windows/SDL_windows_main.c
Copyright: 2019 Sam Lantinga
Copyright: 2020 Sam Lantinga
License: PublicDomain_Sam_Lantinga
Comment: SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98
@ -32,7 +32,7 @@ Copyright: 1995 Erik Corry
License: BrownUn_UnCalifornia_ErikCorry
Files: src/test/SDL_test_md5.c
Copyright: 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright: 1997-2020 Sam Lantinga <slouken@libsdl.org>
1990 RSA Data Security, Inc.
License: zlib/libpng and RSA_Data_Security
@ -46,12 +46,12 @@ Copyright: 1994-2003 The XFree86 Project, Inc.
License: MIT/X11
Files: test/testhaptic.c
Copyright: 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright: 1997-2020 Sam Lantinga <slouken@libsdl.org>
2008 Edgar Simo Serra
License: BSD_3_clause
Files: test/testrumble.c
Copyright: 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright: 1997-2020 Sam Lantinga <slouken@libsdl.org>
2011 Edgar Simo Serra
License: BSD_3_clause
@ -169,7 +169,7 @@ License: BSD_3_clause
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Comment:
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -5,4 +5,5 @@ usr/lib/*/*.la
usr/lib/*/*.so
usr/lib/*/pkgconfig/sdl2.pc
usr/lib/*/cmake/SDL2/sdl2-config.cmake
usr/lib/*/cmake/SDL2/sdl2-config-version.cmake
usr/share/aclocal/sdl2.m4

View file

@ -82,6 +82,23 @@ For more complex projects, follow these instructions:
4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device
If you already have a project that uses CMake, the instructions change somewhat:
1. Do points 1 and 2 from the instruction above.
2. Edit "<project>/app/build.gradle" to comment out or remove sections containing ndk-build
and uncomment the cmake sections. Add arguments to the CMake invocation as needed.
3. Edit "<project>/app/jni/CMakeLists.txt" to include your project (it defaults to
adding the "src" subdirectory). Note that you'll have SDL2, SDL2main and SDL2-static
as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)"
in your CMakeLists.txt file. Also be aware that you should use add_library() instead of
add_executable() for the target containing your "main" function.
If you wish to use Android Studio, you can skip the last step.
4. Run './gradlew installDebug' or './gradlew installRelease' in the project directory. It will build and install your .apk on any
connected Android device
Here's an explanation of the files in the Android project, so you can customize them:
android-project/app
@ -90,10 +107,12 @@ Here's an explanation of the files in the Android project, so you can customize
jni/ - directory holding native code
jni/Application.mk - Application JNI settings, including target platform and STL library
jni/Android.mk - Android makefile that can call recursively the Android.mk files in all subdirectories
jni/CMakeLists.txt - Top-level CMake project that adds SDL as a subproject
jni/SDL/ - (symlink to) directory holding the SDL library files
jni/SDL/Android.mk - Android makefile for creating the SDL shared library
jni/src/ - directory holding your C/C++ source
jni/src/Android.mk - Android makefile that you should customize to include your source code and any library references
jni/src/CMakeLists.txt - CMake file that you may customize to include your source code and any library references
src/main/assets/ - directory holding asset files for your application
src/main/res/ - directory holding resources for your application
src/main/res/mipmap-* - directories holding icons for different phone hardware

View file

@ -15,7 +15,7 @@ platforms:
* Linux
* VS.NET 2010
* MinGW and Msys
* OS X with support for XCode
* macOS, iOS, and tvOS, with support for XCode
================================================================================
@ -30,3 +30,55 @@ Assuming the source for SDL is located at ~/sdl
cmake ../sdl
This will build the static and dynamic versions of SDL in the ~/build directory.
================================================================================
Usage, iOS/tvOS
================================================================================
CMake 3.14+ natively includes support for iOS and tvOS. SDL binaries may be built
using Xcode or Make, possibly among other build-systems.
When using a recent version of CMake (3.14+), it should be possible to:
- build SDL for iOS, both static and dynamic
- build SDL test apps (as iOS/tvOS .app bundles)
- generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)
To use, set the following CMake variables when running CMake's configuration stage:
- `CMAKE_SYSTEM_NAME=<OS>` (either `iOS` or `tvOS`)
- `CMAKE_OSX_SYSROOT=<SDK>` (examples: `iphoneos`, `iphonesimulator`, `iphoneos12.4`, `/full/path/to/iPhoneOS.sdk`,
`appletvos`, `appletvsimulator`, `appletvos12.4`, `/full/path/to/AppleTVOS.sdk`, etc.)
- `CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures>` (example: "arm64;armv7s;x86_64")
### Examples (for iOS/tvOS):
- for iOS-Simulator, using the latest, installed SDK:
`cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
- for iOS-Device, using the latest, installed SDK, 64-bit only
`cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64`
- for iOS-Device, using the latest, installed SDK, mixed 32/64 bit
`cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"`
- for iOS-Device, using a specific SDK revision (iOS 12.4, in this example):
`cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64`
- for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
`cmake ~/sdl -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
- for tvOS-Simulator, using the latest, installed SDK:
`cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
- for tvOS-Device, using the latest, installed SDK:
`cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64`

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -47,6 +47,7 @@
#include "SDL_loadso.h"
#include "SDL_log.h"
#include "SDL_messagebox.h"
#include "SDL_metal.h"
#include "SDL_mutex.h"
#include "SDL_power.h"
#include "SDL_render.h"

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -50,6 +50,9 @@ typedef enum
SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
dstRGB = srcRGB * dstRGB
dstA = dstA */
SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply
dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
dstA = (srcA * dstA) + (dstA * (1-srcA)) */
SDL_BLENDMODE_INVALID = 0x7FFFFFFF
/* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -96,7 +96,10 @@
#cmakedefine HAVE_WCSLEN 1
#cmakedefine HAVE_WCSLCPY 1
#cmakedefine HAVE_WCSLCAT 1
#cmakedefine HAVE_WCSDUP 1
#cmakedefine HAVE_WCSSTR 1
#cmakedefine HAVE_WCSCMP 1
#cmakedefine HAVE_WCSNCMP 1
#cmakedefine HAVE_STRLEN 1
#cmakedefine HAVE_STRLCPY 1
#cmakedefine HAVE_STRLCAT 1
@ -108,6 +111,8 @@
#cmakedefine HAVE_STRCHR 1
#cmakedefine HAVE_STRRCHR 1
#cmakedefine HAVE_STRSTR 1
#cmakedefine HAVE_STRTOK_R 1
#cmakedefine HAVE_STRTOK_S 1
#cmakedefine HAVE_ITOA 1
#cmakedefine HAVE__LTOA 1
#cmakedefine HAVE__UITOA 1
@ -127,6 +132,7 @@
#cmakedefine HAVE_STRCASECMP 1
#cmakedefine HAVE__STRNICMP 1
#cmakedefine HAVE_STRNCASECMP 1
#cmakedefine HAVE_SSCANF 1
#cmakedefine HAVE_VSSCANF 1
#cmakedefine HAVE_VSNPRINTF 1
#cmakedefine HAVE_M_PI 1
@ -211,7 +217,6 @@
#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@
#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@
#cmakedefine HAVE_ENDPOINTVOLUME_H @HAVE_ENDPOINTVOLUME_H@
#cmakedefine HAVE_MMDEVICEAPI_H @HAVE_MMDEVICEAPI_H@
#cmakedefine HAVE_AUDIOCLIENT_H @HAVE_AUDIOCLIENT_H@
@ -294,9 +299,11 @@
#cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@
#cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@
#cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@
#cmakedefine SDL_LIBUSB_DYNAMIC @SDL_LIBUSB_DYNAMIC@
/* Enable various sensor drivers */
#cmakedefine SDL_SENSOR_ANDROID @SDL_SENSOR_ANDROID@
#cmakedefine SDL_SENSOR_COREMOTION @SDL_SENSOR_COREMOTION@
#cmakedefine SDL_SENSOR_DUMMY @SDL_SENSOR_DUMMY@
/* Enable various shared object loading systems */
@ -322,15 +329,16 @@
#cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@
#cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@
#cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@
#cmakedefine SDL_VIDEO_DRIVER_UIKIT @SDL_VIDEO_DRIVER_UIKIT@
#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@
#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@
#cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
#cmakedefine SDL_VIDEO_DRIVER_OFFSCREEN @SDL_VIDEO_DRIVER_OFFSCREEN@
#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@
#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
#cmakedefine SDL_VIDEO_DRIVER_MALI @SDL_VIDEO_DRIVER_MALI@
#cmakedefine SDL_VIDEO_DRIVER_KMSDRM @SDL_VIDEO_DRIVER_KMSDRM@
#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC@
@ -388,11 +396,15 @@
/* Enable Vulkan support */
#cmakedefine SDL_VIDEO_VULKAN @SDL_VIDEO_VULKAN@
/* Enable Metal support */
#cmakedefine SDL_VIDEO_METAL @SDL_VIDEO_METAL@
/* Enable system power support */
#cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@
#cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@
#cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@
#cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@
#cmakedefine SDL_POWER_UIKIT @SDL_POWER_UIKIT@
#cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@
#cmakedefine SDL_POWER_EMSCRIPTEN @SDL_POWER_EMSCRIPTEN@
#cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@
@ -409,11 +421,16 @@
/* Enable assembly routines */
#cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@
#cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@
#cmakedefine SDL_ARM_SIMD_BLITTERS @SDL_ARM_SIMD_BLITTERS@
#cmakedefine SDL_ARM_NEON_BLITTERS @SDL_ARM_NEON_BLITTERS@
/* Enable dynamic libsamplerate support */
#cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@
/* Platform specific definitions */
#cmakedefine SDL_IPHONE_KEYBOARD @SDL_IPHONE_KEYBOARD@
#cmakedefine SDL_IPHONE_LAUNCHSCREEN @SDL_IPHONE_LAUNCHSCREEN@
#if !defined(__WIN32__)
# if !defined(_STDINT_H_) && !defined(_STDINT_H) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H)
typedef unsigned int size_t;

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -33,7 +33,7 @@
/* Make sure that this isn't included by Visual C++ */
#ifdef _MSC_VER
#error You should run hg revert SDL_config.h
#error You should run hg revert SDL_config.h
#endif
/* C language features */
@ -99,7 +99,10 @@
#undef HAVE_WCSLEN
#undef HAVE_WCSLCPY
#undef HAVE_WCSLCAT
#undef HAVE_WCSDUP
#undef HAVE_WCSSTR
#undef HAVE_WCSCMP
#undef HAVE_WCSNCMP
#undef HAVE_STRLEN
#undef HAVE_STRLCPY
#undef HAVE_STRLCAT
@ -111,6 +114,8 @@
#undef HAVE_STRCHR
#undef HAVE_STRRCHR
#undef HAVE_STRSTR
#undef HAVE_STRTOK_R
#undef HAVE_STRTOK_S
#undef HAVE_ITOA
#undef HAVE__LTOA
#undef HAVE__UITOA
@ -192,9 +197,9 @@
#undef HAVE__EXIT
#else
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 1
#endif /* HAVE_LIBC */
#undef HAVE_ALTIVEC_H
@ -210,7 +215,6 @@
#undef HAVE_DSOUND_H
#undef HAVE_DXGI_H
#undef HAVE_XINPUT_H
#undef HAVE_ENDPOINTVOLUME_H
#undef HAVE_MMDEVICEAPI_H
#undef HAVE_AUDIOCLIENT_H
#undef HAVE_XINPUT_GAMEPAD_EX
@ -335,7 +339,6 @@
#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM
#undef SDL_VIDEO_DRIVER_ANDROID
#undef SDL_VIDEO_DRIVER_EMSCRIPTEN
#undef SDL_VIDEO_DRIVER_MALI
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
@ -384,6 +387,9 @@
/* Enable Vulkan support */
#undef SDL_VIDEO_VULKAN
/* Enable Metal support */
#undef SDL_VIDEO_METAL
/* Enable system power support */
#undef SDL_POWER_LINUX
#undef SDL_POWER_WINDOWS
@ -406,6 +412,8 @@
/* Enable assembly routines */
#undef SDL_ASSEMBLY_ROUTINES
#undef SDL_ALTIVEC_BLITTERS
#undef SDL_ARM_SIMD_BLITTERS
#undef SDL_ARM_NEON_BLITTERS
/* Enable ime support */
#undef SDL_USE_IME
@ -413,6 +421,9 @@
/* Enable dynamic udev support */
#undef SDL_UDEV_DYNAMIC
/* Enable dynamic libusb support */
#undef SDL_LIBUSB_DYNAMIC
/* Enable dynamic libsamplerate support */
#undef SDL_LIBSAMPLERATE_DYNAMIC

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -71,6 +71,7 @@
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOK_R 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -71,6 +71,7 @@
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOK_R 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
@ -137,7 +138,7 @@
/* Enable MFi joystick support */
#define SDL_JOYSTICK_MFI 1
/*#define SDL_JOYSTICK_HIDAPI 1*/
#define SDL_JOYSTICK_HIDAPI 1
#ifdef __TVOS__
#define SDL_SENSOR_DUMMY 1
@ -181,6 +182,10 @@
#define SDL_VIDEO_VULKAN 1
#endif
#if SDL_PLATFORM_SUPPORTS_METAL
#define SDL_VIDEO_METAL 1
#endif
/* Enable system power support */
#define SDL_POWER_UIKIT 1

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -74,6 +74,7 @@
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOK_R 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
@ -130,6 +131,8 @@
#define HAVE_SYSCONF 1
#define HAVE_SYSCTLBYNAME 1
#define HAVE_GCC_ATOMICS 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_COREAUDIO 1
#define SDL_AUDIO_DRIVER_DISK 1
@ -157,13 +160,13 @@
#define SDL_VIDEO_DRIVER_COCOA 1
#define SDL_VIDEO_DRIVER_DUMMY 1
#undef SDL_VIDEO_DRIVER_X11
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/opt/X11/lib/libX11.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/opt/X11/lib/libXext.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/opt/X11/lib/libXinerama.1.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/opt/X11/lib/libXi.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/opt/X11/lib/libXrandr.2.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/opt/X11/lib/libXss.1.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/opt/X11/lib/libXxf86vm.1.dylib"
#define SDL_VIDEO_DRIVER_X11_XDBE 1
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
@ -191,9 +194,15 @@
#define SDL_VIDEO_RENDER_OGL_ES2 1
#endif
#ifndef SDL_VIDEO_RENDER_METAL
/* Metal only supported on 64-bit architectures with 10.11+ */
#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
#define SDL_PLATFORM_SUPPORTS_METAL 1
#else
#define SDL_PLATFORM_SUPPORTS_METAL 0
#endif
#ifndef SDL_VIDEO_RENDER_METAL
#if SDL_PLATFORM_SUPPORTS_METAL
#define SDL_VIDEO_RENDER_METAL 1
#else
#define SDL_VIDEO_RENDER_METAL 0
@ -217,13 +226,22 @@
#define SDL_VIDEO_OPENGL_GLX 1
#endif
/* Enable Vulkan support */
/* Metal/Vulkan Portability only supported on 64-bit architectures with 10.11+ */
#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
/* Enable Vulkan and Metal support */
#ifndef SDL_VIDEO_VULKAN
#if SDL_PLATFORM_SUPPORTS_METAL
#define SDL_VIDEO_VULKAN 1
#else
#define SDL_VIDEO_VULKAN 0
#endif
#endif
#ifndef SDL_VIDEO_METAL
#if SDL_PLATFORM_SUPPORTS_METAL
#define SDL_VIDEO_METAL 1
#else
#define SDL_VIDEO_METAL 0
#endif
#endif
/* Enable system power support */
#define SDL_POWER_MACOSX 1

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -110,6 +110,7 @@
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
/* #undef HAVE_STRTOK_R */
#define HAVE_ITOA 1
#define HAVE__LTOA 1
#define HAVE__ULTOA 1
@ -122,12 +123,21 @@
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_WCSLEN 1
#define HAVE_WCSLCPY 1
#define HAVE_WCSLCAT 1
/* #define HAVE_WCSDUP 1 */
/* #define wcsdup _wcsdup */
#define HAVE_WCSSTR 1
#define HAVE_WCSCMP 1
#define HAVE_WCSNCMP 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRICMP 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_SSCANF 1
#define HAVE_SSCANF 1
#define HAVE_VSSCANF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
#define HAVE_SETJMP 1

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -84,7 +84,6 @@ typedef unsigned int uintptr_t;
#define HAVE_XINPUT_H 1
#define HAVE_MMDEVICEAPI_H 1
#define HAVE_AUDIOCLIENT_H 1
#define HAVE_ENDPOINTVOLUME_H 1
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
#ifdef HAVE_LIBC
@ -118,6 +117,10 @@ typedef unsigned int uintptr_t;
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
/* #undef HAVE_STRTOK_R */
#if defined(_MSC_VER)
#define HAVE_STRTOK_S 1
#endif
/* These functions have security warnings, so we won't use them */
/* #undef HAVE__LTOA */
/* #undef HAVE__ULTOA */
@ -139,7 +142,7 @@ typedef unsigned int uintptr_t;
#define HAVE_ATAN2 1
#define HAVE_ATAN2F 1
#define HAVE_CEILF 1
#define HAVE__COPYSIGN 1
#define HAVE__COPYSIGN 1
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_EXP 1
@ -168,7 +171,7 @@ typedef unsigned int uintptr_t;
#define HAVE_STRTOLL 1
#define HAVE_VSSCANF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_SCALBNF 1
#endif
/* This function is available with at least the VC++ 2008 C runtime library */
#if _MSC_VER >= 1400

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -100,7 +100,6 @@ typedef unsigned int uintptr_t;
#define HAVE_MMDEVICEAPI_H 1
#define HAVE_AUDIOCLIENT_H 1
#define HAVE_ENDPOINTVOLUME_H 1
#define HAVE_LIBC 1
#define STDC_HEADERS 1
@ -131,6 +130,7 @@ typedef unsigned int uintptr_t;
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOK_S 1
//#define HAVE_ITOA 1 // TODO, WinRT: consider using _itoa_s instead
//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead
//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -67,6 +67,7 @@
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOK_R 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -73,8 +73,8 @@
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
# endif
# if defined (_M_ARM64)
# include <armintr.h>
# include <arm_neon.h>
# include <arm64intr.h>
# include <arm64_neon.h>
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
# endif
# endif
@ -186,6 +186,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
/**
* This function returns true if the CPU has ARM SIMD (ARMv6) features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void);
/**
* This function returns true if the CPU has NEON (ARM SIMD) features.
*/

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -390,6 +390,9 @@ typedef enum {
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#ifndef NOMINMAX /* don't define min() and max(). */
#define NOMINMAX
#endif
#include <windows.h>
#if __WINRT__

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -42,10 +42,13 @@
#ifdef __linux__
#include <endian.h>
#define SDL_BYTEORDER __BYTE_ORDER
#else /* __linux__ */
#elif defined(__OpenBSD__)
#include <endian.h>
#define SDL_BYTEORDER BYTE_ORDER
#else
#if defined(__hppa__) || \
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MISPEB__)) || \
(defined(__MIPS__) && defined(__MIPSEB__)) || \
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
defined(__sparc__)
#define SDL_BYTEORDER SDL_BIG_ENDIAN

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -442,6 +442,7 @@ typedef struct SDL_TouchFingerEvent
float dx; /**< Normalized in the range -1...1 */
float dy; /**< Normalized in the range -1...1 */
float pressure; /**< Normalized in the range 0...1 */
Uint32 windowID; /**< The window underneath the finger, if any */
} SDL_TouchFingerEvent;
@ -558,7 +559,7 @@ typedef union SDL_Event
{
Uint32 type; /**< Event type, shared with all events */
SDL_CommonEvent common; /**< Common event data */
SDL_DisplayEvent display; /**< Window event data */
SDL_DisplayEvent display; /**< Display event data */
SDL_WindowEvent window; /**< Window event data */
SDL_KeyboardEvent key; /**< Keyboard event data */
SDL_TextEditingEvent edit; /**< Text editing event data */

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -57,6 +57,15 @@ extern "C" {
struct _SDL_GameController;
typedef struct _SDL_GameController SDL_GameController;
typedef enum
{
SDL_CONTROLLER_TYPE_UNKNOWN = 0,
SDL_CONTROLLER_TYPE_XBOX360,
SDL_CONTROLLER_TYPE_XBOXONE,
SDL_CONTROLLER_TYPE_PS3,
SDL_CONTROLLER_TYPE_PS4,
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO
} SDL_GameControllerType;
typedef enum
{
@ -175,6 +184,12 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
*/
extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
/**
* Get the type of a game controller.
* This can be called before any controllers are opened.
*/
extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index);
/**
* Get the mapping of a game controller.
* This can be called before any controllers are opened.
@ -199,11 +214,21 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_
*/
extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid);
/**
* Return the SDL_GameController associated with a player index.
*/
extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(int player_index);
/**
* Return the name for this currently opened controller
*/
extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
/**
* Return the type of this currently opened controller
*/
extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller);
/**
* Get the player index of an opened game controller, or -1 if it's not available
*
@ -211,6 +236,11 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *g
*/
extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller);
/**
* Set the player index of an opened game controller
*/
extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index);
/**
* Get the USB vendor ID of an opened controller, if available.
* If the vendor ID isn't available this function returns 0.

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -164,6 +164,21 @@ extern "C" {
*/
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER"
/**
* \brief A variable controlling whether the graphics context is externally managed.
*
* This variable can be set to the following values:
* "0" - SDL will manage graphics contexts that are attached to windows.
* "1" - Disable graphics context management on windows.
*
* By default SDL will manage OpenGL contexts in certain situations. For example, on Android the
* context will be automatically saved and restored when pausing the application. Additionally, some
* platforms will assume usage of OpenGL if Vulkan isn't used. Setting this to "1" will prevent this
* behavior, which is desireable when the application manages the graphics context, such as
* an externally managed OpenGL context or attaching a Vulkan surface to the window.
*/
#define SDL_HINT_VIDEO_EXTERNAL_CONTEXT "SDL_VIDEO_EXTERNAL_CONTEXT"
/**
* \brief A variable controlling whether the X11 VidMode extension should be used.
*
@ -197,6 +212,12 @@ extern "C" {
*/
#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
/**
* \brief A variable forcing the visual ID chosen for new X11 windows
*
*/
#define SDL_HINT_VIDEO_X11_WINDOW_VISUALID "SDL_VIDEO_X11_WINDOW_VISUALID"
/**
* \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported.
*
@ -223,6 +244,17 @@ extern "C" {
*/
#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
/**
* \brief A variable controlling whether X11 should use GLX or EGL by default
*
* This variable can be set to the following values:
* "0" - Use GLX
* "1" - Use EGL
*
* By default SDL will use GLX when both are present.
*/
#define SDL_HINT_VIDEO_X11_FORCE_EGL "SDL_VIDEO_X11_FORCE_EGL"
/**
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
*
@ -482,6 +514,29 @@ extern "C" {
*/
#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
/**
* \brief If set, game controller face buttons report their values according to their labels instead of their positional layout.
*
* For example, on Nintendo Switch controllers, normally you'd get:
*
* (Y)
* (X) (B)
* (A)
*
* but if this hint is set, you'll get:
*
* (X)
* (Y) (A)
* (B)
*
* The variable can be set to the following values:
* "0" - Report the face buttons by position, as though they were on an Xbox controller.
* "1" - Report the face buttons by label instead of position
*
* The default value is "1". This hint may be set at any time.
*/
#define SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS "SDL_GAMECONTROLLER_USE_BUTTON_LABELS"
/**
* \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
*
@ -565,6 +620,17 @@ extern "C" {
*/
#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX"
/**
* \brief A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used.
*
* This variable can be set to the following values:
* "0" - HIDAPI driver is not used
* "1" - HIDAPI driver is used
*
* The default is the value of SDL_HINT_JOYSTICK_HIDAPI
*/
#define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE "SDL_JOYSTICK_HIDAPI_GAMECUBE"
/**
* \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs
*
@ -922,33 +988,6 @@ extern "C" {
*/
#define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS"
/**
* \brief Tell dispmanx to stretch the SDL window to fill the display.
*
* This hint only applies to the rpi video driver.
*
* The variable can be set to the following values:
* "0" - Window resolution is desktop resolution.
* This is the behaviour of SDL <= 2.0.4. (default)
* "1" - Requested video resolution will be scaled to desktop resolution.
* Aspect ratio of requested video resolution will be respected.
* "2" - Requested video resolution will be scaled to desktop resolution.
* "3" - Requested video resolution will be scaled to desktop resolution.
* Aspect ratio of requested video resolution will be respected.
* If possible output resolution will be integral multiple of video
* resolution.
*/
#define SDL_HINT_VIDEO_RPI_SCALE_MODE "SDL_VIDEO_RPI_SCALE_MODE"
/**
* \brief Tell dispmanx to set a specific aspect ratio.
*
* This hint only applies to the rpi video driver.
*
* Must be set together with SDL_HINT_VIDEO_RPI_SCALE_MODE=1.
*/
#define SDL_HINT_VIDEO_RPI_RATIO "SDL_VIDEO_RPI_RATIO"
/**
* \brief Tell SDL not to generate window-close events for Alt+F4 on Windows.
*
@ -1201,6 +1240,20 @@ extern "C" {
*/
#define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK"
/*
* \brief Override for SDL_GetDisplayUsableBounds()
*
* If set, this hint will override the expected results for
* SDL_GetDisplayUsableBounds() for display index 0. Generally you don't want
* to do this, but this allows an embedded system to request that some of the
* screen be reserved for other uses when paired with a well-behaved
* application.
*
* The contents of this hint must be 4 comma-separated integers, the first
* is the bounds x, then y, width and height, in that order.
*/
#define SDL_HINT_DISPLAY_USABLE_BOUNDS "SDL_DISPLAY_USABLE_BOUNDS"
/**
* \brief An enumeration of hint priorities
*/

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -192,7 +192,12 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
/**
* Return the SDL_Joystick associated with an instance id.
*/
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid);
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID instance_id);
/**
* Return the SDL_Joystick associated with a player index.
*/
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_index);
/**
* Return the name for this currently opened joystick.
@ -207,6 +212,11 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
*/
extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick);
/**
* Set the player index of an opened joystick
*/
extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick * joystick, int player_index);
/**
* Return the GUID for this opened joystick
*/

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -47,7 +47,7 @@ typedef Sint32 SDL_Keycode;
#define SDLK_SCANCODE_MASK (1<<30)
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
enum
typedef enum
{
SDLK_UNKNOWN = 0,
@ -317,7 +317,7 @@ enum
SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
};
} SDL_KeyCode;
/**
* \brief Enumeration of valid key mods (possibly OR'd together).

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -61,7 +61,7 @@ extern "C" {
* at the VERBOSE level and all other categories are enabled at the
* CRITICAL level.
*/
enum
typedef enum
{
SDL_LOG_CATEGORY_APPLICATION,
SDL_LOG_CATEGORY_ERROR,
@ -94,7 +94,7 @@ enum
};
*/
SDL_LOG_CATEGORY_CUSTOM
};
} SDL_LogCategory;
/**
* \brief The predefined log priorities

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -36,9 +36,11 @@ extern "C" {
*/
typedef enum
{
SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */
SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
SDL_MESSAGEBOX_INFORMATION = 0x00000040, /**< informational dialog */
SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080, /**< buttons placed left to right */
SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100 /**< buttons placed right to left */
} SDL_MessageBoxFlags;
/**

91
include/SDL_metal.h Normal file
View file

@ -0,0 +1,91 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_metal.h
*
* Header file for functions to creating Metal layers and views on SDL windows.
*/
#ifndef SDL_metal_h_
#define SDL_metal_h_
#include "SDL_video.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
*
* \note This can be cast directly to an NSView or UIView.
*/
typedef void *SDL_MetalView;
/**
* \name Metal support functions
*/
/* @{ */
/**
* \brief Create a CAMetalLayer-backed NSView/UIView and attach it to the
* specified window.
*
* On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on its
* own. It is up to user code to do that.
*
* The returned handle can be casted directly to a NSView or UIView, and the
* CAMetalLayer can be accessed from the view's 'layer' property.
*
* \code
* SDL_MetalView metalview = SDL_Metal_CreateView(window);
* UIView *uiview = (__bridge UIView *)metalview;
* CAMetalLayer *metallayer = (CAMetalLayer *)uiview.layer;
* // [...]
* SDL_Metal_DestroyView(metalview);
* \endcode
*
* \sa SDL_Metal_DestroyView
*/
extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window);
/**
* \brief Destroy an existing SDL_MetalView object.
*
* This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was
* called after SDL_CreateWindow.
*
* \sa SDL_Metal_CreateView
*/
extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view);
/* @} *//* Metal support functions */
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_metal_h_ */

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -40,6 +40,9 @@ extern "C" {
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#ifndef NOMINMAX /* don't define min() and max(). */
#define NOMINMAX
#endif
#include <windows.h>
#endif

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -48,7 +48,7 @@ extern "C" {
/* @} */
/** Pixel type. */
enum
typedef enum
{
SDL_PIXELTYPE_UNKNOWN,
SDL_PIXELTYPE_INDEX1,
@ -62,18 +62,18 @@ enum
SDL_PIXELTYPE_ARRAYU32,
SDL_PIXELTYPE_ARRAYF16,
SDL_PIXELTYPE_ARRAYF32
};
} SDL_PixelType;
/** Bitmap pixel order, high bit -> low bit. */
enum
typedef enum
{
SDL_BITMAPORDER_NONE,
SDL_BITMAPORDER_4321,
SDL_BITMAPORDER_1234
};
} SDL_BitmapOrder;
/** Packed component order, high bit -> low bit. */
enum
typedef enum
{
SDL_PACKEDORDER_NONE,
SDL_PACKEDORDER_XRGB,
@ -84,12 +84,12 @@ enum
SDL_PACKEDORDER_BGRX,
SDL_PACKEDORDER_ABGR,
SDL_PACKEDORDER_BGRA
};
} SDL_PackedOrder;
/** Array component order, low byte -> high byte. */
/* !!! FIXME: in 2.1, make these not overlap differently with
!!! FIXME: SDL_PACKEDORDER_*, so we can simplify SDL_ISPIXELFORMAT_ALPHA */
enum
typedef enum
{
SDL_ARRAYORDER_NONE,
SDL_ARRAYORDER_RGB,
@ -98,10 +98,10 @@ enum
SDL_ARRAYORDER_BGR,
SDL_ARRAYORDER_BGRA,
SDL_ARRAYORDER_ABGR
};
} SDL_ArrayOrder;
/** Packed component layout. */
enum
typedef enum
{
SDL_PACKEDLAYOUT_NONE,
SDL_PACKEDLAYOUT_332,
@ -112,7 +112,7 @@ enum
SDL_PACKEDLAYOUT_8888,
SDL_PACKEDLAYOUT_2101010,
SDL_PACKEDLAYOUT_1010102
};
} SDL_PackedLayout;
#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
@ -191,6 +191,9 @@ typedef enum
SDL_PIXELFORMAT_RGB444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
SDL_PACKEDLAYOUT_4444, 12, 2),
SDL_PIXELFORMAT_BGR444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
SDL_PACKEDLAYOUT_4444, 12, 2),
SDL_PIXELFORMAT_RGB555 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
SDL_PACKEDLAYOUT_1555, 15, 2),

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -85,6 +85,16 @@ typedef struct SDL_RendererInfo
int max_texture_height; /**< The maximum texture height */
} SDL_RendererInfo;
/**
* \brief The scaling mode for a texture.
*/
typedef enum
{
SDL_ScaleModeNearest, /**< nearest pixel sampling */
SDL_ScaleModeLinear, /**< linear filtering */
SDL_ScaleModeBest /**< anisotropic filtering */
} SDL_ScaleMode;
/**
* \brief The access pattern allowed for a texture.
*/
@ -366,6 +376,35 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
SDL_BlendMode *blendMode);
/**
* \brief Set the scale mode used for texture scale operations.
*
* \param texture The texture to update.
* \param scaleMode ::SDL_ScaleMode to use for texture scaling.
*
* \return 0 on success, or -1 if the texture is not valid.
*
* \note If the scale mode is not supported, the closest supported mode is
* chosen.
*
* \sa SDL_GetTextureScaleMode()
*/
extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
SDL_ScaleMode scaleMode);
/**
* \brief Get the scale mode used for texture scale operations.
*
* \param texture The texture to query.
* \param scaleMode A pointer filled in with the current scale mode.
*
* \return 0 on success, or -1 if the texture is not valid.
*
* \sa SDL_SetTextureScaleMode()
*/
extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
SDL_ScaleMode *scaleMode);
/**
* \brief Update the given texture rectangle with new pixel data.
*
@ -430,10 +469,31 @@ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
const SDL_Rect * rect,
void **pixels, int *pitch);
/**
* \brief Lock a portion of the texture for write-only pixel access.
* Expose it as a SDL surface.
*
* \param texture The texture to lock for access, which was created with
* ::SDL_TEXTUREACCESS_STREAMING.
* \param rect A pointer to the rectangle to lock for access. If the rect
* is NULL, the entire texture will be locked.
* \param surface This is filled in with a SDL surface representing the locked area
* Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture.
*
* \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
*
* \sa SDL_UnlockTexture()
*/
extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
const SDL_Rect *rect,
SDL_Surface **surface);
/**
* \brief Unlock a texture, uploading the changes to video memory, if needed.
* If SDL_LockTextureToSurface() was called for locking, the SDL surface is freed.
*
* \sa SDL_LockTexture()
* \sa SDL_LockTextureToSurface()
*/
extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

Some files were not shown because too many files have changed in this diff Show more