Commit Graph

3839 Commits

Author SHA1 Message Date
David Ludwig
6bf31495f9 WinRT: merged with latest, official, SDL 2.x sources 2013-04-21 12:38:44 -04:00
David Ludwig
95a3bba282 future-proofing for Microsoft's C++/CX extensions, whereby "generic" is a reserved keyword 2013-04-20 23:05:08 -04:00
Jørgen P. Tjernø
84b7ed93dc Fix overflow in recent gamecontroller trigger change. 2013-04-19 16:02:16 -07:00
Jørgen P. Tjernø
2a4188c11f Make gamecontroller triggers have values in 0 - 32767.
This changes the old behavior of having values in the -32768 - 32767
range, like regular joystick axis. Now "button as axis" triggers (like
on Logitech controllers) and regular axis triggers (like on Xbox
controllers) have the same resting value, 0.
2013-04-19 10:51:21 -07:00
Ryan C. Gordon
8cc072db1b Fixed using the event queue lock before the mutex was created.
This has the benefit of ending the otherwise-bogus complaints that
 SDL_GetError() reports "Passed a NULL mutex" if you call it instead of
 checking if SDL_CreateWindow() actually succeeded.  :)
2013-04-19 11:58:38 -04:00
David Ludwig
48c5ee264e WinRT: made SDL's inner WinRT CoreWindow be accessible to non-C++/CX code, in theory 2013-04-16 23:40:03 -04:00
Ryan C. Gordon
295c17e99b Don't use glDisable(GL_TEXTURE_2D) in GLES2 renderer.
Fixes Bugzilla #1799.
2013-04-17 11:45:50 -04:00
Andreas Schiffler
4e8c854aab Fix bug 1789: SDL_IntersectRect intersection with empty rect does not set result to empty; add test coverage to Rect suite 2013-04-17 08:09:11 -07:00
Andreas Schiffler
fc589bd617 Fix bug 1764: incorrect variable assignment in RenderDrawLinesWithRects 2013-04-17 07:35:30 -07:00
Sam Lantinga
ab2a7e61cf Fixed bug 1805 - Memory Leak issue in src/video/x11/edid-parse.c file
Nitz

In Function,

MonitorInfo *
decode_edid (const uchar *edid)

In this function "info" is going out of scope and leaks the storage it points to, if the first if condition get true:
if (!decode_header (edid))
        return NULL;

So while returning from this if statement there should be free for "info" pointer.
2013-04-17 01:38:59 -07:00
Sam Lantinga
6b599f9c89 Fixed bug 1804 - Memory leak issue in src/video/x11/SDL_x11mouse.c
Nitz

In SDL_x11mouse.c file there is function named
static Cursor
X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y)
{
  // Some code

  data_bits = SDL_calloc(1, surface->h * width_bytes);
  mask_bits = SDL_calloc(1, surface->h * width_bytes);
  if (!data_bits || !mask_bits) {
     SDL_OutOfMemory();
     return None;
  }

 // Some code

}

Here is the problem in if statement,
suppose if !data_bits is false and !mask_bits is true then,
data_bits will go out of scope and leaks the memory it points to.

Solution is that data_bits and mask_bits should be checked separately, not by using OR operator.
2013-04-17 01:35:10 -07:00
Sam Lantinga
4f8c0f33f9 Fixed bug 1802 - NULL pointer dereference in SDL_AllocRW() if out of memory.
Philipp Wiesemann

There is a NULL pointer dereference in SDL_AllocRW() if the system is out of memory. The "type" field is always written. This may be fixed with an early return.

Or an else{} or not writing the field and using slower SDL_calloc().

This fault was recently introduced (http://hg.libsdl.org/SDL/rev/681820ca0e78).
2013-04-17 01:32:06 -07:00
Sam Lantinga
ec2f595166 BMP files don't contain alpha information in the palette, the fourth element is reserved and must be zero. 2013-04-16 09:33:33 -07:00
David Ludwig
f9531484c0 WinRT: hack-fixed C++/CX compile errors regarding the 'generic' field in SDL_Event, which conflicts with a C++/CX keyword 2013-04-14 11:45:01 -04:00
David Ludwig
49820874a9 WinRT: merged with latest, official, SDL 2.x sources (at rev. bea100d73d13) 2013-04-14 11:42:55 -04:00
David Ludwig
a46b1c6663 WinRT: added render-to-texture support for D3D 11.1, via SDL_SetRenderTarget 2013-04-13 23:03:46 -04:00
Jørgen P. Tjernø
8405633512 Numlock & pause fix from Alfred.
Fix numlock and pause keys not being pressable on win32, they both report under
the same scancode, so use the VK to tell them apart
2013-04-10 14:11:26 -07:00
David Ludwig
922323a1cd WinRT: added texture channel color-modulation support for D3D 11.1 2013-04-07 22:35:58 -04:00
Ryan C. Gordon
1a2d04cab5 Fixed another infinite recursion accident in stdlib. 2013-04-05 16:34:59 -04:00
Jørgen P. Tjernø
7f8886048e Add 3 Logitech gamecontroller mappings for Mac OS X. 2013-04-03 16:48:20 -07:00
Ryan C. Gordon
5b551af664 Compiler warning fixes for Windows message box code. 2013-04-03 11:48:03 -04:00
Ryan C. Gordon
d24b0148d6 Fixed compiler warnings. "leftFingerDown" doesn't need to be an SDL_FingerID. 2013-04-03 11:34:21 -04:00
Ryan C. Gordon
ccf4a46f60 Fixed infinite recursion (thanks, Rainer!). 2013-04-03 10:36:15 -04:00
Jørgen P. Tjernø
9e99462c06 Add new controller mappings for Windows. 2013-04-02 18:09:30 -07:00
Andreas Schiffler
8de86784a7 Add input validation and null checking to SDL_Get/SetWindowData [reported by Joseph T.] 2013-04-02 08:38:52 -07:00
Sam Lantinga
e52fbd7243 Fixed bug 1780 - SDL_RWFromFile() sets an error on Android although a valid SDL_RWops pointer is returned.
Philipp Wiesemann

SDL_RWFromFile() sets an error to be queried with SDL_GetError() on Android although a valid SDL_RWops pointer is returned.

This happens if the fallback implemented in SDL_android.cpp is used to load compressed assets (see README.android in section "Loading assets") and results in a message like "java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed". I think this is confusing and not needed because the loading works as expected.

I attached a patch which changes SDL_android.cpp to not set an error if compressed assets are loaded. In this case also no Exception is queried and no additional string are created.
2013-04-02 07:57:37 -07:00
Sam Lantinga
01b8e5cc93 Fixed bug 1781 - SDL sets an error for the initial touch on Android.
Philipp Wiesemann

SDL sets an error to be queried with SDL_GetError() for the initial touch on Android.

Android_OnTouch() in SDL_androidtouch.c uses SDL_GetTouch() to check if a touch device was already added. SDL_GetTouch() sets the error "Unknown touch device" for an out of range access because touch devices are added after initial touch. I think this error is confusing because it always happens by design.

I attached a patch which removes the call to SDL_GetTouch() and only uses SDL_AddTouch() which does the check (if already added) again and does not set an error (if not added yet).
2013-04-02 07:51:23 -07:00
David Ludwig
50a881d724 WinRT: removed a bit of unused code from the D3D 11.1 renderer 2013-04-02 00:21:01 -04:00
David Ludwig
0c6e5ad1a9 WinRT: added rotation support to SDL_RenderCopyEx via D3D 11.1 2013-04-02 00:09:49 -04:00
David Ludwig
c2e89ec462 WinRT: implemented SDL_RenderCopyEx, w/ SDL_RendererFlip support, in D3D 11.1 2013-04-01 22:33:37 -04:00
David Ludwig
3ca7578363 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1 2013-04-01 21:34:47 -04:00
David Ludwig
44e81071eb WinRT: made WinRT path retrieval be available in both UCS-2 and UTF-8 flavors 2013-04-01 21:33:06 -04:00
Gabriel Jacobo
72c6e6bf7f Backed out changeset: a500a9dbfb41 2013-04-01 13:21:23 -03:00
Gabriel Jacobo
4741e6bc5b Backed out changeset: a713101e1d25 2013-04-01 13:21:08 -03:00
Gabriel Jacobo
b19f55242a Backed out changeset: 9cef1005df5f 2013-04-01 13:20:22 -03:00
Ryan C. Gordon
d619a9a9ee Changed audio subsystem's OpenDevice interface to return -1 on error.
This lets us 'return SDL_SetError("whatever");' on one line.

 Fixes Bugzilla #1778.
2013-03-31 13:05:40 -04:00
Ryan C. Gordon
16cdc59bab Make SDL_SetError and friends unconditionally return -1.
This lets us change things like this...

    if (Failed) {
        SDL_SetError("We failed");
        return -1;
    }

...into this...

    if (Failed) {
        return SDL_SetError("We failed");
    }


 Fixes Bugzilla #1778.
2013-03-31 12:48:50 -04:00
David Ludwig
2a3066f606 WinRT: removed code that unnecessarily set a blank D3D 11.1 texture's contents 2013-03-31 11:44:50 -04:00
David Ludwig
b80d430b5c WinRT: added SDL_LockTexture and SDL_UnlockTexture support to the D3D 11.1 renderer 2013-03-31 11:16:31 -04:00
Ryan C. Gordon
879c663159 Haiku no longer #defines __BEOS__, so check for it too (thanks, Axel!).
Fixes Bugzilla #1773.
2013-03-29 21:25:02 -04:00
Sam Lantinga
af4d292e15 Fixed compiler error with Cygwin 2013-03-26 05:09:09 -07:00
Sam Lantinga
1297d17733 Fixed compiler warning with Cygwin 2013-03-26 05:08:57 -07:00
Sam Lantinga
dbb5bc19c3 SDL message box improvements from Dan Thompson 2013-03-26 04:57:29 -07:00
Sam Lantinga
5ffbff4132 Added support for the GameStop Gamepad 2013-03-25 12:04:16 -07:00
Sam Lantinga
77bba91132 Added GUIDs for Bluetooth devices, using the same algorithm as the Linux code.
Reformatted the code so it was easier to step through using gdb.
2013-03-25 11:38:30 -07:00
David Ludwig
f6c8097c65 WinRT: added point drawing support to the Direct3D 11.1 rendering backend 2013-03-24 21:57:40 -04:00
David Ludwig
2fef732bf6 WinRT: added line drawing support to the Direct3D 11.1 rendering backend 2013-03-24 21:19:26 -04:00
Sam Lantinga
0feed45f5c Make sure we bump the palette version when we modify it. 2013-03-24 10:37:16 -07:00
Sam Lantinga
4d92e1780f We're using the alpha component of the palette entries, let's name it appropriately. 2013-03-24 09:56:45 -07:00
Sam Lantinga
74fa44299d The palette unused value is treated as alpha and updated when setting the colorkey.
This fixes issues loading palettized images that have a colorkey with the same RGB values as another entry in the palette (e.g. bug 1746)
2013-03-24 09:51:01 -07:00