Commit Graph

11404 Commits

Author SHA1 Message Date
Sylvain Becker
5610d67656 Fix audio conversion U16_to_F32_SSE2 (bug 4186) 2019-08-19 21:23:47 +02:00
Sylvain Becker
7db238231d 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
5507e8c0d3 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
225bac198c metal renderer: optimize SDL_RenderFillRect slightly. 2019-08-18 10:38:32 -03:00
Alex Szpakowski
ffd955faf1 render: fix colors not being set properly after the previous change 2019-08-18 09:35:11 -03:00
Alex Szpakowski
fcbcdb56fc render: avoid a couple redundant memcmp calls in all drawing functions. Improves performance slightly. 2019-08-17 22:26:33 -03:00
Alex Szpakowski
a7fc7f2f01 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
4806fd2326 metal renderer: more closely match buffer data alignment requirements from the metal specification. 2019-08-17 01:09:30 -03:00
Alex Szpakowski
58f5d312f3 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
5e0bbbca54 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
c7bb69b363 metal: Update compiled shaders based on compilation script changes 2019-08-16 22:13:30 -03:00
Alex Szpakowski
b99bcb45b5 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
a88c8e5e3d iOS: Fix issues with Split VIew on iPad (bugs #4586, #4705). 2019-08-15 19:38:12 -03:00
Sylvain Becker
09fc115c5a Android: remove tabs/indent 2019-08-15 20:38:25 +02:00
Sylvain Becker
e8c4c75188 Android: SDL_image/SDL_mixer/SDL_ttf partially compiling with CMake (bug 3918) 2019-08-13 16:00:08 +02:00
Sam Lantinga
a800c90014 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
8713ac0e33 Fixed bug 3918 - CMake support for android project 2019-08-11 15:23:37 +02:00
Ozkan Sezer
97773ac8f8 fix permissions 2019-08-08 23:35:02 +03:00
Sam Lantinga
7405009192 [ 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
057397ee6b hidapi: Explicitly include locale.h, for setlocale 2019-08-06 23:08:01 -04:00
Sam Lantinga
01b5799b4b 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
1d3440189d 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
64e87c75de 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
1036552fce Port libusb hid.c to SDL, add to MinGW configure 2019-08-04 00:01:38 -04:00
Alex Szpakowski
74249a6d05 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
15b648952f macOS: fix a typo in touch handling code. 2019-08-04 23:30:55 -03:00
Alex Szpakowski
d8e1144031 Fix touch-related compile errors on Linux. 2019-08-04 16:56:40 -03:00
Ozkan Sezer
c2cca5d636 minor warning fixes. 2019-08-04 14:56:02 +03:00
Alex Szpakowski
9488323b39 Implement touch window IDs on x11/xinput2. 2019-08-04 00:34:23 -03:00
Ozkan Sezer
b7fc7d807c fix permissions 2019-08-03 12:50:28 +03:00
Ozkan Sezer
fb740bd37c remove test/aclocal.m4 2019-08-03 12:49:50 +03:00
Sam Lantinga
5a23e7f36f Fixed building on Mac OS X without libusb 2019-08-02 18:14:31 -07:00
Sam Lantinga
cd87d3e6d8 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
7fddc8fc4f 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
98be461de0 Added support for a few controllers on Android 2019-08-02 17:12:49 -07:00
Alex Szpakowski
cb6b489e36 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
1e9e2d7ba1 configury: allow libusb-less hidapi for macosx. 2019-08-01 17:41:40 +03:00
Ozkan Sezer
6a87ae38ef use WIN_IsWindowsVistaOrGreater() from core/windows for isVistaOrNewer 2019-07-31 23:37:02 +03:00
Ethan Lee
62b2efc9f2 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
733cf789ce Make sure HIDAPI is initialized whenever we call HIDAPI_IsDevicePresent() 2019-07-31 10:20:37 -07:00
Andrew Eikum
d5162f20e7 joystick: Ensure HIDAPI is initialized before calling it 2019-07-31 11:14:48 -05:00
Andrew Eikum
f9bfaca8ac 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
622a7d1e61 minor whitespace tidy-up. 2019-07-31 19:40:50 +03:00
Sam Lantinga
f113f21e5f 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
5410f2c5dc use SDL_zeroa at more places where the argument is an array. 2019-07-31 05:11:40 +03:00
Ozkan Sezer
f5282c7c66 Fix bug 4746 - introduce SDL_zeroa macro. 2019-07-31 01:22:02 +03:00
Ozkan Sezer
20db4a86ec minor build fix. 2019-07-31 01:19:26 +03:00
Ozkan Sezer
ab84d20480 MS_ADPCM_Decode: fix assigning an array to a pointer (lose '&'). 2019-07-31 00:10:00 +03:00
Ozkan Sezer
18f946e1ce better readability.. 2019-07-31 00:07:15 +03:00
Ozkan Sezer
311b444829 SDL_iconv_string: add (char*) casts before SDL_malloc() calls. 2019-07-31 00:06:50 +03:00