Commit Graph

9246 Commits

Author SHA1 Message Date
Sam Lantinga
d77ab77a7a Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga
c5f76b4772 Convert some files back into DOS line endings after updating copyright 2017-01-01 18:32:57 -08:00
Sam Lantinga
d03df789f4 We don't currently support blitting to < 8 bpp surfaces, return an error instead of corrupting memory in that case. 2016-12-31 18:11:19 -08:00
Sam Lantinga
012e17b879 Fixed bug 3535 - Misplaced comment #if/#endif closure comment
Coriiander

This notice is about a misplaced comment.

Often times when we use an #if #endif sequence, the #endif is followed by a comment to indicate what #if statement it belonged to. The SDL_xaudio2.c file contains a misplaced comment, as follows (I stripped the other comments):

#ifdef __GNUC__
#  define SDL_XAUDIO2_HAS_SDK 1
#elif defined(__WINRT__)
#  define SDL_XAUDIO2_HAS_SDK
#include "SDL_xaudio2.h"
#else
#if 0
#include <dxsdkver.h>
#if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284))
#  pragma message("Your DirectX SDK is too old. Disabling XAudio2 support.")
#else
#  define SDL_XAUDIO2_HAS_SDK 1
#endif
#endif
#endif /* 0 */



That final /* 0 */ should be moved one line up. Like this (I tabbed it out for you to make it more clear):
2016-12-31 16:21:55 -08:00
Sam Lantinga
4b6138f947 Fixed bug 3531 - internal SDL_vsnprintf implementation access memory outside given buffer ranges
Tristan

The internal SDL_vsnprintf implementation accesses memory outside buffer. The bug existed also inside the format (%) processing, which was fixed with Bug 3441.

But there is still an invalid access, if we do not have any format inside the source string and the destination string is shorter than the format string. You can use any string for this test, as long it is longer than the buffer.

Example:

va_list argList;
char buffer[4];
SDL_vsnprintf(buffer, sizeof(buffer), "Testing", argList);

The bug is located on the 'else' branch of the format char test:

while (*fmt) {
  if (*fmt == '%') {
    ...
  } else {
    if (left > 1) {
      *text = *fmt;
      --left;
    }
    ++fmt;
    ++text;
  }
}
if (left > 0) {
  *text = '\0';
}

As you can see that text is always incremented, even when left is already one. When then on the last lines, *text is assigned the NULL char, the pointer is located outside bounds.
2016-12-31 16:14:51 -08:00
Sam Lantinga
90b6b805fd Fixed bug 3541 - DisplayIndex out of bounds in SDL_SetWindowPosition
Intellectual Kitty

In SDL_video.c, on line #1756, in SDL_SetWindowPosition (from today's distribution, 12-31-2016, https://hg.libsdl.org/SDL/shortlog/fe1e3dfa67ef):

        if (displayIndex > _this->num_displays) {

should be:

        if (displayIndex >= _this->num_displays) {
2016-12-31 10:30:07 -08:00
Philipp Wiesemann
0cc40f2af6 Fixed warning and missing animation delay in testoverlay2 program. 2016-12-30 19:57:50 +01:00
Philipp Wiesemann
eb909cf972 Fixed compiling of testgamecontroller program with C++. 2016-12-28 20:11:29 +01:00
Philipp Wiesemann
3d06b2ce33 Fixed warning about unused variable in controllermap program. 2016-12-28 20:11:12 +01:00
Philipp Wiesemann
ca476cf958 Fixed crash if allocating memory for game controller failed. 2016-12-28 20:10:48 +01:00
Sam Lantinga
2f75c15ee0 Added documentation for the game controller axis values 2016-12-27 09:59:36 -08:00
Sam Lantinga
e1d3e01601 Make sure we go all the way back (within the XBox controller dead zone) to prevent accidentally binding axes inverted 2016-12-27 09:51:58 -08:00
Sam Lantinga
abbbf7e924 Fixed comment style 2016-12-27 02:04:38 -08:00
Sam Lantinga
bdd7e6b176 Split controller axes into positive and negative sides so each can be bound independently.
Using this a D-Pad can be mapped to a thumbstick and vice versa.
Also added support for inverted axes, improving trigger binding support
2016-12-27 01:39:07 -08:00
Ryan C. Gordon
6514102d26 x11: Don't loop forever if the X server refuses a pointer grab. 2016-12-26 23:02:14 -05:00
Ryan C. Gordon
3c3f3dc3bd Don't use pushd/popd in autogen.sh; Ubuntu's /bin/sh doesn't support it. 2016-12-26 22:58:58 -05:00
Sam Lantinga
7f0b81eebd Fixed bug 3517 - Compiler warnings with gcc -Wstrict-prototypes
felix

Compiling even a simple SDL2 'hello world' program with gcc -Wstrict-prototypes (GCC 6.2.1) results in warnings like:

/usr/include/SDL2/SDL_gamecontroller.h:143:1: attention : function declaration isn't a prototype [-Wstrict-prototypes]
 extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings();
 ^~~~~~

It seems there is a missing 'void' between the parentheses.
2016-12-26 02:12:21 -08:00
Sam Lantinga
a838f265ba Fixed bug 3516 - fix build on illumos
Sylvain

trivial patch to fix the build on illumos

 -Werror=declaration-after-statement

https://gist.github.com/wiedi/15b71456667f7aa2a7f8815663723bb3
2016-12-26 01:56:52 -08:00
Alex Szpakowski
e2c3169a11 Mac: back out commit e5b39f4935c8. It causes significant overhead on many GPUs. 2016-12-23 22:49:37 -04:00
Alex Szpakowski
52728f28b8 Mac: Fix over-saturated colors on P3 displays (e.g. the 2016 MBPs). 2016-12-23 22:08:18 -04:00
Philipp Wiesemann
2e0077f026 Windows: Fixed compile error. 2016-12-23 20:36:24 +01:00
Philipp Wiesemann
ded7e84edd Corrected header file guard comments. 2016-12-23 20:36:12 +01:00
Sam Lantinga
a252b4d73d Removed debug print statements 2016-12-23 02:23:44 -08:00
Sam Lantinga
46dd5015df Fixed compile errors on various platforms 2016-12-22 18:43:00 -07:00
Sam Lantinga
d016c5e57c Fixed issue where the throttle and other axes on racing wheels don't start at zero and show up as immediate input when the wheel is turned for the first time. Wait until they are actually moved before generating input from them. 2016-12-22 17:33:45 -08:00
Sam Lantinga
d4bf5754f1 Fixed bus error when converting 16-bit to float for non-integral-multiple sample rates 2016-12-19 11:15:53 -08:00
Ryan C. Gordon
b9d8e7cdfd audio: fixed one more incorrectly-hardcoded value in the resamplers. 2016-12-18 20:17:33 -05:00
Alex Szpakowski
7ad6cbc42a tvOS: Expose remote swipe gestures as arrow key presses (thanks oviano!) 2016-12-18 13:05:14 -04:00
Alex Szpakowski
2bfa2037ca iOS bug #3377: work around bugs in some third party iOS libraries (e.g. Google admob) where they assume the optional UIApplicationDelegate ‘window’ property always exists and will crash if it doesn’t. 2016-12-18 12:28:28 -04:00
Ryan C. Gordon
4405458835 audio: fixed arbitrary upsampling (thanks, Sylvain!).
This was a leftover of simplifying the resamplers down from autogenerated
code; I forgot to make something that the generator hardcoded into something
variable.

Fixes Bugzilla #3507.
2016-12-17 16:15:24 -05:00
Philipp Wiesemann
af39fc10d3 Fixed hotplug with more than one device in testjoystick program. 2016-12-16 22:58:32 +01:00
Philipp Wiesemann
7d96beee5e Fixed warning about unused variable in controllermap program. 2016-12-16 22:58:16 +01:00
Sam Lantinga
103da69c77 Fixed handling joysticks that send multiple events for a single control, e.g. both a button and axis event for a trigger.
Tested with the 8Bitdo NES30 Pro on Linux
2016-12-15 14:27:22 -08:00
Sam Lantinga
bfb613a4f0 Fixed crash if there are multiple joysticks closed during the joystick update loop 2016-12-14 06:25:09 -08:00
Ryan C. Gordon
331848b488 windows: add whitespace to fix macro preprocessing issue (thanks, Sven!).
Apparently without a space here, "fastbuild -cache" breaks.
2016-12-13 00:22:42 -05:00
Sam Lantinga
5d0f852a47 Fixed updated return value for SDL_GL_SwapWindow()
Ozkan Sezer

http://hg.libsdl.org/SDL/rev/00fe449fbefe seems to have
forgotten removing the return from SDL_dynapi_procs.h, and this patch
does that. Without it, MSVC warns:
c:\sdl2\src\dynapi\SDL_dynapi_procs.h(598) : warning C4098:
'SDL_GL_SwapWindow_DEFAULT' : 'void' function returning a value
c:\sdl2\src\dynapi\SDL_dynapi_procs.h(598) : warning C4098:
'SDL_GL_SwapWindow' : 'void' function returning a value
2016-12-12 09:19:48 -08:00
Sam Lantinga
42b51c05e9 Fixed edid parsing code for older gcc compilers
Ozkan Sezer

This adds the name 'ad' to two unnamed unions in edid.h
and adjusts edid-parse.c for it.  Nameless unions are not supported in
ancient gcc, which I happened to use on one of my ancient setups.
2016-12-12 09:18:42 -08:00
Sam Lantinga
23ab0d83a2 Fixed ABI, don't change the return type of SDL_GL_SwapWindow() 2016-12-11 12:01:44 -08:00
Sam Lantinga
bfe435201d Fixed creating a renderer on the dummy driver on Mac OS X 2016-12-11 12:01:01 -08:00
Sam Lantinga
9bf991ada9 Fixed crash when creating a dummy window on Mac OS X 2016-12-11 11:45:33 -08:00
David Ludwig
e48feb4c62 WinRT: build fixes
These fixes are lumped into two categories:

1. add new file, SDL_dataqueue.c, to UWP/WinRT build-inputs (via MSVC project
   files)

2. implement a temporary, hack-fix for a build error in SDL_xinputjoystick.c.
   Win32's Raw Input APIs are, unfortunately, not available for use in UWP/WinRT
   APIs.  There does appear to be a replacement API, available in the
   Windows.Devices.HumanInterfaceDevice namespace.

   This fix should be sufficient to get SDL compiling again, without affecting
   Win32 builds, however using the UWP/WinRT API (in UWP/WinRT builds) would
   almost certainly be better (for UWP/WinRT builds).

   TODO: research Windows.Devices.HumanInterfaceDevice, and use that if and as
   appropriate.
2016-12-10 15:23:17 -05:00
Sam Lantinga
52391e28f8 PP_OK isn't available in the NaCl build environment on buildbot. It's defined as 0 2016-12-09 05:19:31 -08:00
Sam Lantinga
04c2e22b30 Fixed a bunch of SwapWindow calls that needed their return value updated 2016-12-09 05:12:27 -08:00
Sam Lantinga
85aea51fe1 Fixed X11 OpenGL ES build 2016-12-09 05:04:18 -08:00
Sam Lantinga
0f202d18b3 Fixed build for EGL platforms 2016-12-09 05:00:35 -08:00
Sam Lantinga
a55ef0239f Added support for the XiaoMi Game Controller 2016-12-09 04:57:54 -08:00
Sam Lantinga
800baf2915 Only print out the controller mappings if we're not going to test a controller 2016-12-09 04:17:10 -08:00
Sam Lantinga
b505909719 Fixed bug 3513 - SDL_GL_SwapWindow does not return error status
Return an error code from SDL_GL_SwapWindow(), like the other SDL APIs.
2016-12-09 01:47:43 -08:00
Sam Lantinga
a2c540e172 Fixed bug 3512 - Memory leak of SDL_Joystick axes_zero array
Benjamin Harris

Found with valgrind and confirmed in the 2.0.5 source code.
One-line fix in SDL_JoystickClose?
2016-12-09 01:29:52 -08:00
Sam Lantinga
4292a15aca Protect the game controller API the same way the joystick API is protected from multi-threaded access 2016-12-08 10:13:45 -08:00