Commit Graph

9156 Commits

Author SHA1 Message Date
Sam Lantinga
14e3231663 We are comparing 16-bit values 2016-11-24 11:53:23 -08:00
Ryan C. Gordon
ca453bb681 Pacify some GCC strict-aliasing compiler warnings. 2016-11-23 21:52:48 -05:00
Sam Lantinga
261e994ebe Fixed XBox One S controller mapping for firmware revision 3.1.1221.0, including back and guide buttons 2016-11-23 06:54:19 -08:00
Ryan C. Gordon
67072748a7 Still more compiler warning fixes for various platforms. 2016-11-23 17:20:28 -05:00
Ryan C. Gordon
4cdffc800c Fixed more compiler warnings. 2016-11-23 11:49:26 -05:00
Ryan C. Gordon
45c72a176b directsound: fixed compiler warnings. 2016-11-23 10:51:44 -05:00
Sam Lantinga
1bd16ec940 The XBox One S controller sends keys outside the standard joystick button range 2016-11-22 22:14:28 -08:00
Sam Lantinga
4a94f04278 Added mapping for XBox One S controller firmware version 3.1.1221.0 2016-11-22 04:42:07 -08:00
Ryan C. Gordon
484ed1dc30 cpuinfo: fix SDL_HasNEON() on older iOS devices, fixed C++ comment. 2016-11-21 20:35:59 -05:00
Sam Lantinga
9cc7ce9008 Renaming of guard header names to quiet -Wreserved-id-macro
Patch contributed by Sylvain
2016-11-20 21:34:54 -08:00
Sam Lantinga
a097bc3ca3 Fixed warning building under mingw, patch contributed by Sylvain 2016-11-20 21:29:27 -08:00
Sam Lantinga
d20b74a060 Fixed a few warnings that show up with -Wdocumentation and -Wdocumentation-unknown-command, patch contributed by Sylvain 2016-11-20 21:26:56 -08:00
Sam Lantinga
840200630a Fixed bug 3494 - SDL_test_fuzzer.c fails compile since r10604
Ozkan Sezer

As of hg rev. 10604 (http://hg.libsdl.org/SDL/rev/27d0fb08d755),
SDL_test_fuzzer.c fails to build again
2016-11-20 21:24:09 -08:00
Sam Lantinga
c6e13cd484 Fixed bug 3486 - Can't get HINSTANCE of my window
realitix

SDL2 allows to create widow and to get information through SDL_SysWMinfo.
But it misses something, with Vulkan, you need the HWND and HINSTANCE of the window for Win32 system.
Sadly, SDL2 provides only HWND but not HINSTANCE.

In some context, it can be difficult to get the HINSTANCE, indeed, I'm using pySDL2 (Python) and I can only access properties that SDL2 gives me.
I have to use a dirty trick like that to get the HINSTANCE:  (https://raw.githubusercontent.com/bglgwyng/pyVulkan/master/examples/win32misc.py)
2016-11-20 21:18:55 -08:00
Philipp Wiesemann
caf7fabdac Updated configure script. 2016-11-19 23:27:51 +01:00
Philipp Wiesemann
df55bace19 Fixed two memory leaks if added game controller mapping has lower priority.
Found by buildbot.
2016-11-19 23:27:37 +01:00
Philipp Wiesemann
3f55f0f3cb Windows: Fixed crash if using current SDL_GetWindowWMInfo() from older programs. 2016-11-18 00:06:09 +01:00
Philipp Wiesemann
2035106f7a Wayland: Fixed file descriptor leaks if device was not initialized. 2016-11-18 00:05:54 +01:00
Philipp Wiesemann
70f3f843fd Emscripten: Fixed handling of deactivated mouse events.
SDL_GetEventState() was called with a button state instead of an event type.
2016-11-18 00:05:28 +01:00
Ryan C. Gordon
9c4bef3bd7 cpuinfo: patched to compile for getauxval() path. 2016-11-17 17:03:43 -05:00
Ryan C. Gordon
7854221f46 cpuinfo: more patching for Android. Legacy platform targets are a pain. 2016-11-17 16:10:32 -05:00
Ryan C. Gordon
f2eb8732e4 cpuinfo: Patched to compile on Android, Linux. 2016-11-17 16:04:00 -05:00
Ryan C. Gordon
6774892f96 cpuinfo: patched to compile.
Nothing quite like experimentation via Buildbot!  :/
2016-11-17 16:01:59 -05:00
Ryan C. Gordon
e387dd428b cpuinfo: more work on SDL_HasNEON(). 2016-11-17 15:57:58 -05:00
Ryan C. Gordon
3e7fc78c4c cpuinfo: silence compiler warnings on non-Intel CPU architectures. 2016-11-17 01:41:56 -05:00
Ryan C. Gordon
c9a3d7c87b cpuinfo: disable NEON detection on Android for now.
Will fix this properly soon.
2016-11-17 01:34:18 -05:00
Ryan C. Gordon
bb52f8ccb0 cpuinfo: more robust ARM preprocessor checks. 2016-11-17 01:26:56 -05:00
Ryan C. Gordon
162885911a cpuinfo: first attempt at SDL_HasNEON() implementation. 2016-11-17 01:15:16 -05:00
Ryan C. Gordon
54d66342e6 cpuinfo: Removed code duplication, cached CPUID details. 2016-11-16 22:49:04 -05:00
Philipp Wiesemann
e81616f396 Wayland: Fixed memory leak if output retrieval failed.
Found by Cppcheck.
2016-11-16 22:09:40 +01:00
Philipp Wiesemann
a85facd73d Fixed empty parameter list in signatures of internal functions. 2016-11-16 22:08:51 +01:00
Sam Lantinga
7c78a4b28d Fixed bug 1646 - Warnings from clang with -Weverything 2016-11-15 01:30:08 -08:00
Sam Lantinga
2ae04deb92 Removed unused constants
Except for SDL_bmp.c where they are historically interesting and I've left them in.
2016-11-15 01:24:58 -08:00
Thomas Perl
9d54f837f3 [qtwayland] Set orientation and window flags via SDL hints 2016-11-13 10:39:04 +01:00
Sam Lantinga
faf9e4817c Fixed bug 3490 - Build failure with --enable-video-directfb
felix

Building SDL 2.0.5, or even the Mercurial snapshot (r10608) with GCC 6.2.1 and --enable-video-directfb generates a number of compiler diagnostics and fails.
2016-11-15 01:14:30 -08:00
Sam Lantinga
6fb5c98236 Fixed bug 3359 - Software renderer does incorrect blending with SDL_RenderCopyEx
Simon Hug

The software renderer produces incorrect results when blending textures at an angle with certain blend modes. It seems that there were some edge cases that weren't considered when the SW_RenderCopyEx function was last changed. Or another bug possibly covered up the problem. (More on that in another bug report.)

Most of the issues come from the fact that the rotating function sets a black colorkey. This is problematic because black is most likely appearing in the surface and the final blit will ignore these pixels. Unless a colorkey is already set (the software renderer currently never sets one), it's very hard to find a free color. Of course it could scan over the whole image until one is found, but that seems inefficient.

The following blend modes have issues when drawn at an angle.

NONE: The black pixels get ignored, making them essentially transparent. This breaks the 'dstRGBA = srcRGBA' definition of the NONE blend mode.

MOD: Again, the black pixels get ignored. This also breaks the 'dstRGB = dstRGB * srcRGB' definition of the MOD blend mode, where black pixels would make the destination black as well. A white colorkey will work though, with some preparations.

BLEND: There are some issues when blending a texture with a translucent RGBA target texture. I - uh - forgot what the problem here exactly is.

This patch fixes the issues mentioned above. It mainly changes the code so it tries to do things without the colorkey and removes the automatic format conversion part from the SDLgfx_rotateSurface function. Getting the format right is something the caller has to do now and the required code has been added to the SW_RenderCopyEx function.

There's a small change to the SW_CreateTexture function. RLE encoding a surface with an alpha mask can be a lossy process. Depending on how the user uses the RGBA channels, this may be undesired. The change that surfaces with an alpha mask don't get encoded makes the software renderer consistent with the other renderers.

The SW_RenderCopyEx function now does these steps: Lock the source surface if necessary. Create a clone of the source by using the pixel buffer directly. Check the format and set a flag if a conversion is necessary. Check if scaling or cropping is necessary and set the flag for that as well. Check if color and alpha modulation has to be done before the rotate. Check if the source is an opaque surface. If not, it creates a mask surface that is necessary for the NONE blend mode. If any of the flags were set, a new surface is created and the source will be converted, scaled, cropped, and modulated. The rest of the function stays somewhat the same. The mask also needs to be rotated of course and then there is the NONE blend mode...

It's surprisingly hard to get the pixel from a rotated surface to the destination buffer without affecting the pixel outside the rotated area. I found a way to do this with three blits which is pretty hard on the performance. Perhaps someone has an idea how to do this faster?

As mentioned above, the SDLgfx_rotateSurface now only takes 8-bit paletted or 32-bit with alpha mask surfaces. It additionally sets the new surfaces up for the MOD blend mode.

I shortly tested the 8-bit path of SDLgfx_rotateSurface and it seemed to work so far. This path is not used by the software renderer anyway.
2016-11-15 01:12:27 -08:00
Sam Lantinga
663f5c8763 Fixed build error with missing function prototype in the SDL_test_harness.h header 2016-11-13 23:09:42 -08:00
Sam Lantinga
18e0ea1988 Fixed unresolved symbol on Visual Studio 2016-11-13 23:04:47 -08:00
Sam Lantinga
5e1151257d Patch from Sylvain to fix clang warnings 2016-11-13 22:57:41 -08:00
Sam Lantinga
34578b09f4 Fixed bug 3488 - Random crashes (because Memory overlap in audio converters detected by Valgrind)
Vitaly Novichkov

Okay, when I researched code and algorithm, I tried to replace condition "while(dst >= target)" with "while(dst > target)" and crashes are gone.
Seems on some moments it tries to write into the place before memory block begin, therefore phantom crashes appearing after some moments.
2016-11-13 00:09:02 -08:00
Sam Lantinga
f3329c65cd Fixed build on various platforms 2016-11-11 13:47:40 -08:00
Sam Lantinga
b7e4112c21 Fixed bug 1822 - Inconsistent renderer behaviour on rotation
Sylvain 2016-11-07 08:49:34 UTC

when rotated +90 or -90, some transparent lines appears, though there is no Alpha or ColorKey.

if you set a dummy colorkey, it will remove the line ...
if you set a some alpha mod, the +90/-90 get transparent but not the 0/180  ...
2016-11-11 13:38:39 -08:00
Sam Lantinga
ccff0f0bba Fixed bug 3079 - Allow non destructive SDL_GameControllerAddMappingsFromFile
x414e54

It is a bit of a pain to update the library or rely on whatever version the user has on their computer for default mappings.

So providing an easily updatable text file via SDL_GameControllerAddMappingsFromFile is still currently the most viable way. However using this replaces all mappings provided by the SDL_HINT_GAMECONTROLLERCONFIG environment variable which may have come from the user's custom Steam mapping.

There should be an easy way for games to supply extra game controller mappings to fill in the differences between SDL versions without it clobbering the SDL_HINT_GAMECONTROLLERCONFIG environment variable.

Internally the mappings could use a priority system and if the priority is lower then it will not overwrite the mappings.

For now it just assumes SDL_HINT_GAMECONTROLLERCONFIG is the highest priority, the default hardcoded are the lowest and anything set via the API is medium.
2016-11-11 13:29:23 -08:00
Sam Lantinga
8a080aef5c Define _GNU_SOURCE when building SDL 2016-11-11 13:14:00 -08:00
Sam Lantinga
7360e7876d Fixed bug 3484 - DSP driver does not detect /dev/dsp0
Tobias Kortkamp

using SDL 2.0.5 (and a repository checkout) on FreeBSD 11.0 I get this output
from testaudioinfo with SDL_AUDIODRIVER=dsp:

INFO: Found 8 output devices:
INFO:   0: /dev/dsp
INFO:   1: /dev/dsp1
INFO:   2: /dev/dsp2
INFO:   3: /dev/dsp3
INFO:   4: /dev/dsp4
INFO:   5: /dev/dsp5
INFO:   6: /dev/dsp6
INFO:   7: /dev/dsp7
INFO:
INFO: Found 3 capture devices:
INFO:   0: /dev/dsp
INFO:   1: /dev/dsp4
INFO:   2: /dev/dsp5
INFO:

This is /dev/sndstat:

Installed devices:
pcm0: <NVIDIA (0x0040) (HDMI/DP 8ch)> (play)
pcm1: <NVIDIA (0x0040) (HDMI/DP 8ch)> (play)
pcm2: <NVIDIA (0x0040) (HDMI/DP 8ch)> (play)
pcm3: <NVIDIA (0x0040) (HDMI/DP 8ch)> (play)
pcm4: <Realtek ALC887 (Rear Analog 7.1/2.0)> (play/rec)
pcm5: <Realtek ALC887 (Front Analog)> (play/rec) default
pcm6: <Realtek ALC887 (Rear Digital)> (play)
pcm7: <Realtek ALC887 (Onboard Digital)> (play)
No devices installed from userspace.

I'd expect to find /dev/dsp0 in the output device list.  It's not detected
because of a a small logic error in SDL_audiodev.c (see attached patch).

With the patch applied I get this which is what I'd expect:

INFO: Found 9 output devices:
INFO:   0: /dev/dsp
INFO:   1: /dev/dsp0
INFO:   2: /dev/dsp1
INFO:   3: /dev/dsp2
INFO:   4: /dev/dsp3
INFO:   5: /dev/dsp4
INFO:   6: /dev/dsp5
INFO:   7: /dev/dsp6
INFO:   8: /dev/dsp7
2016-11-11 12:41:06 -08:00
Sam Lantinga
27e5a516d1 Fixed whitespace and added code to support older game controller GUIDs 2016-11-11 04:35:06 -08:00
Sam Lantinga
f2d2e2bb11 Fixed whitespace 2016-11-11 04:30:09 -08:00
Sam Lantinga
6da99d61ef Updated Windows game controller support 2016-11-11 03:35:37 -08:00
Sam Lantinga
d7b1c59814 Fixed signed/unsigned comparison warnings in Visual Studio 2016-11-11 03:18:16 -08:00
Sam Lantinga
1fe7158463 Updated Mac OS X game controller support 2016-11-11 04:06:00 -07:00