Commit graph

9461 commits

Author SHA1 Message Date
Sam Lantinga
86f6ab1b62 We only need the first few keymaps corresponding to the following constants:
K_NORMTAB, K_SHIFTTAB, K_ALTTAB, K_ALTSHIFTTAB

In the normal case we'll load all the keymaps from the kernel, but this reduces the size of the SDL library for the fallback case when we can't get to the tty.
2017-01-09 11:58:01 -08:00
Sam Lantinga
435a9e75c7 Fixed spacing 2017-01-09 11:30:29 -08:00
Sam Lantinga
b59bd003d7 Fixed bug 3100 - SetSwapInterval should now be enabled for ANGLE/EGL
Mark Logan 2015-08-24 15:57:50 UTC
In SDL_windowsopengles.c, WIN_GLES_SetSwapInterval is as follows:

WIN_GLES_SetSwapInterval(_THIS, int interval)
{
    /* FIXME: This should call SDL_EGL_SetSwapInterval, but ANGLE has a bug that prevents this
     * from working if we do (the window contents freeze and don't swap properly). So, we ignore
     * the request for now.
     */
    SDL_Log("WARNING: Ignoring SDL_GL_SetSwapInterval call due to ANGLE bug");
    return 0;
}

With a recent version of ANGLE (early July) calling SDL_EGL_SetSwapInterval with a D3D11 backend appears to work just fine. I am working on testing this with D3D9.

--

Alex Szpakowski

I found the bug, it was fixed in 2013. https://bugs.chromium.org/p/angleproject/issues/detail?id=481

In my opinion it should be safe to unconditionally use SetSwapInterval now. Anyone who encounters the bug should update their ANGLE to a version less than 3 years old, especially since they'd be using a SDL version that's 3+ years newer than their ANGLE version.
2017-01-09 10:10:33 -08:00
Ryan C. Gordon
2f283c2beb audio: Replaced older resamplers in SDL_AudioCVT with the new ones.
--HG--
extra : rebase_source : a4df0c56d61d9927e97bbd738c12a3043f44742e
2017-01-09 06:00:58 -05:00
Ryan C. Gordon
575a388ff4 audio: Patched to compile if linking directly to libsamplerate.
--HG--
extra : rebase_source : 32676dd43d1d33c1985c4dc6cef969ddbc082935
2017-01-09 05:59:30 -05:00
Sam Lantinga
9558d55a84 Implemented full evdev keyboard text support
This is based on the Linux kernel driver, and has fallback mapping tables in case we aren't connected to a virtual terminal.
2017-01-09 02:54:42 -08:00
Sam Lantinga
def09bbf54 Fixed bug 3545 - SDL_EVDEV_do_text_input() may be too eager to find error cases
Rob

I've ran into an issue where I successfully receive SDL_KEY[UP,DOWN] events but not SDL_TEXTINPUT or SDL_TEXTEDITING.  In my case the code in SDL_EVDEV_do_text_input() is returning early (on error) prior to calling SDL_SendKeyboardText().  I'm running on the RaspberryPi 3, without X11.

In SDL_EVDEV_do_text_input() there is a condition to check keysyms with a type value below 0xf0, then subtract 0xf0 from type.  Without understanding the purpose of this code, I disabled it, recompiled, and I'm getting correct SDL_TEXTINPUT events.  I'm going to guess that my hack/fix is going to be problematic in some other environment, but after some initial testing it looks like everything is running fine in my setup.
2017-01-08 20:03:18 -08:00
Sam Lantinga
5913d167bd Removed console check, let the kernel decide whether muting is appropriate on this terminal.
We don't fail the init if we can't mute the terminal (we might be running from ssh, or on a system without virtual terminals, etc.)
2017-01-08 19:04:38 -08:00
Sam Lantinga
be34ee410d Check the return value of SDL_EVDEV_Init() 2017-01-08 18:32:20 -08:00
Ryan C. Gordon
9268415b53 audio: Improvements in channel conversion code.
--HG--
extra : amend_source : 521d4d1f25bba02be473faa4d573928ea9007452
2017-01-08 16:18:49 -05:00
Ryan C. Gordon
ba27cf3fc1 audio: Patched to compile with libsamplerate support (again). 2017-01-08 14:28:44 -05:00
Ryan C. Gordon
d8f718f75d audio: Patched to compile with libsamplerate support. 2017-01-08 14:23:15 -05:00
Ryan C. Gordon
f904fecce3 audio: libsamplerate loading now happens once at init time.
--HG--
extra : rebase_source : b88014744534e382d6b6ea004554ffcebe5caffe
2017-01-08 14:18:03 -05:00
Ryan C. Gordon
d81fb0038f Fixed coding style on a function signature.
--HG--
extra : rebase_source : ccbcdf0c433bac0ad213f4a377674363b1fab87e
2017-01-08 14:17:09 -05:00
Ryan C. Gordon
c5c2526b7a README-linux: added notes about libsamplerate.
--HG--
extra : rebase_source : a865ab45d6fbb2fe94bb130f3e16de26907cfe14
2017-01-08 14:16:19 -05:00
Sam Lantinga
5f89fe73fa Fixed attempting to dynamically load libsamplerate when shared object loading is disabled.
Thanks to Ozkan Sezer for pointing this out
2017-01-08 10:52:02 -08:00
Sam Lantinga
d01010338e Fixed bug 3304 - Android black screen on resume
Richard Russell

Resuming from a suspended state results in a black screen.  This only happens when using GLES 1.1 (GLES 2 resumes correctly) and when the render target has been changed using SDL_SetRenderTarget.  This problem is new in 2.0.4.

The attached test case demonstrates the issue.

Sylvain Becker has apparently found a fix as follows:

"In the opengles leaf function (in 'src/render/opengles/SDL_render_gles.c'), it appears there is a call to 'GLES_ActivateRenderer' in 'GLES_SetRenderTarget', which is not present in opengles2. When commenting out this 'GLES_ActivateRenderer', it seems to resume fine".

This appears to fix the testcase perfectly, but I don't know whether it could have any undesirable side-effects.
2017-01-08 10:41:22 -08:00
Sam Lantinga
4f3c7c976f SDL_evdev.c: fix building against old kernel headers (K_OFF may not be defined.) 2017-01-08 10:15:22 -08:00
Sam Lantinga
9414004279 Don't fail if we can't open the tty, this can be a legitimate use case. 2017-01-07 16:49:23 -08:00
Sam Lantinga
472b34a08c Added mappings for the 8Bitdo NES30 Pro and iBuffalo SNES Controller
Also swapped the Wii U Pro controller button mappings to position instead of label, as emulators expect from XBox controllers.
2017-01-07 13:47:34 -08:00
Ryan C. Gordon
1720fdee1d Fixed a bunch of compiler warnings in the test code. 2017-01-07 22:24:45 -05:00
Ryan C. Gordon
021504c71a x11: make the X11 target work on macOS with Xquartz.
--HG--
extra : rebase_source : c39bb96dea5512d268ffbf1903dae9283b9b6b63
2017-01-07 19:55:29 -05:00
Ryan C. Gordon
7b6965f75b Replaced a few single-line "//" comments.
--HG--
extra : rebase_source : a1bd030f02288429951a77df9555944cf2657f90
2017-01-07 17:09:14 -05:00
Sam Lantinga
58f6b7d511 Really fixed blit issue for capehill 2017-01-07 16:51:48 -08:00
Sam Lantinga
294906558e Fixed bug 3469 - Keypresses leak to the console with 2.0.5
tvc

I believe this patch should fix it, instead of looping through all the tty's and seemingly selecting the wrong one and corrupting the console I've just made SDL open /dev/tty which is the console attached to the current process anyway.
2017-01-07 10:13:04 -08:00
Sam Lantinga
5a0aef995a Added configure and cmake support for libsamplerate 2017-01-06 20:43:53 -08:00
Ryan C. Gordon
8ab0ba202d audio: Don't call a NULL function pointer when clearing audio streams.
(Partially?) fixes Bugzilla #3547.
2017-01-06 21:23:51 -05:00
Ryan C. Gordon
cbb4c1dc3b Better fix for static analysis issue in SDL_DestroyRenderer().
Follow up fix for Bugzilla #3544.
2017-01-06 21:17:33 -05:00
Ryan C. Gordon
29c6f748df emscripten-buildbot.sh: let user override default SDKDIR. 2017-01-06 20:00:17 -05:00
Sam Lantinga
376e6fa6f2 Added support for using libsamplerate to do audio resampling 2017-01-06 02:16:26 -08:00
Sam Lantinga
b2161da809 Fixed confusion between Ryan's new audio stream and the audio buffer we were calling stream in the callback 2017-01-06 00:47:42 -08:00
Sam Lantinga
3cbab22892 Just roll back the entire portion of the commit from b6ec7005ca15 which caused bug 3544 until we figure out what the right static analysis fix is. 2017-01-06 00:40:22 -08:00
Ryan C. Gordon
70c33e0441 audio: Add an assert to make sure non-streaming audio uses good buffer sizes.
--HG--
extra : rebase_source : 80db5ce8cde0774915b7bc68542e1a58a49d6f18
2017-01-06 03:38:14 -05:00
Sam Lantinga
17e16c2e64 Fixed bug 3544 - Memory freeing bug in SDL_DestroyRenderer/SDL_DestroyTexture
felix

Here's a snippet of SDL_DestroyRenderer from hg revision 10746:95c57a177719:

    SDL_Texture *texture = NULL;
    SDL_Texture *nexttexture = NULL;
    /* ... */
    for (texture = renderer->textures; texture; texture = nexttexture) {
        nexttexture = texture->next;
        SDL_DestroyTexture(texture);
    }

SDL_DestroyTexture removes the texture from the linked list pointed to by the renderer and ends up calling SDL_DestroyTextureInternal, which contains this:

    if (texture->native) {
        SDL_DestroyTexture(texture->native);
    }

If it happens that texture->native is an alias of nexttexture two stack frames up, SDL_DestroyRenderer will end up trying to destroy an already freed texture. I've had this very situation happen in dosemu2.

Bug introduced in revision 10650:b6ec7005ca15, which has a somewhat ironic description of "Fixed all known static analysis bugs"...
2017-01-06 00:32:06 -08:00
Ryan C. Gordon
82b913d92c haiku: Patched to compile.
--HG--
extra : rebase_source : 358fa3054f6c237605fd57c64adf42dd0beeabdd
2017-01-06 03:15:27 -05:00
Sam Lantinga
2373e22054 Don't do any audio conversion if none is necessary 2017-01-05 23:53:46 -08:00
Sam Lantinga
a215c06f22 Fixed bug 3546 - SDL_EVDEV_is_console() uses type of wrong size when calling ioctl
Rob

When calling ioctl(fd, KDGKBTYPE, &type) in SDL_EVDEV_is_console(), we declare type as an 'int'.  This should be a 'char'.  The subsequent syscall, and kernel code, only writes the lower byte of the word.

See: http://lxr.free-electrons.com/source/drivers/tty/vt/vt_ioctl.c?v=4.4#L399

ucval = KB_101;
ret = put_user(ucval, (char __user *)arg);

I've observed intermittent behavior related to this, and I can force an error condition by using an int initialized to 0xFFFFFFFF.  The resulting ioctl will set type to 0XFFFFFF02, and the conditional return in SDL_EVDEV_is_console() will fail.

Recommend changing to char, or masking off unused bits.
2017-01-05 23:26:13 -08:00
Ryan C. Gordon
d8788062d4 audio: rename fake_stream to work_buffer.
It's more than an alternative for when the OS can't provide a DMA buffer, now.
2017-01-06 01:07:34 -05:00
Ryan C. Gordon
29fb138f51 audio: Fixed SDL_AudioStreamGet() function parameters.
There was a draft of this where it did audio conversion into the final buffer,
if there was enough room available past what you asked for, but that interface
got removed, so the parameters didn't make sense (and we were using the
wrong one in any case, too!).
2017-01-06 01:02:58 -05:00
Ryan C. Gordon
e93c4d4639 naclaudio: Untested attempt to migrate to SDL_AudioStream. 2017-01-06 00:56:29 -05:00
Ryan C. Gordon
f6a4c94ecc haikuaudio: Untested attempt to get this working with SDL_AudioStream. 2017-01-06 00:50:01 -05:00
Ryan C. Gordon
b2691868b7 emscriptenaudio: don't get stuck in infinite loop if SDL_AudioStreamPut fails. 2017-01-06 00:49:35 -05:00
Ryan C. Gordon
bd307581b6 emscriptenaudio: Reworked to use SDL_AudioStream.
--HG--
extra : amend_source : ef370fe4cb3d7446d1af21a0d452bd4393909e7a
2017-01-05 21:31:02 -05:00
Ryan C. Gordon
591dff71c2 Fixed a few compiler warnings. 2017-01-05 20:11:19 -05:00
Ryan C. Gordon
d629ac2d67 Patched to compile on some compilers.
--HG--
extra : histedit_source : 7b348321ae168305eceacdf3a966c0f0c7f24514
2017-01-05 19:45:57 -05:00
Ryan C. Gordon
70608017eb audio: Added SDL_AudioStream. Non-power-of-two resampling now works!
--HG--
extra : rebase_source : f6b2eb0c8a4d8869879112d60abe32962839fe7a
2017-01-05 19:29:38 -05:00
Ryan C. Gordon
02fd7b4a1e audio: More effort to improve and simplify audio resamplers.
--HG--
extra : rebase_source : a46522900178929c58d4e5442f710eb1ae31e91e
2017-01-05 19:12:20 -05:00
Ryan C. Gordon
884507a69e diskaudio: Use SDL_Log, not fprintf.
--HG--
extra : rebase_source : 66ffa127677e612d7cec47003cec9eb1c6486df3
2017-01-05 19:30:45 -05:00
Sam Lantinga
4aefa49d72 Fixed signedness issue when blitting on a big endian platform, as reported by capehill
For example, if sR is 0 and dR is 255, we will get -255*sA casted to an unsigned value. Basically results are quite large numbers instead of the expected 0-255 range.
2017-01-05 08:16:39 -08:00
Sam Lantinga
25b315f121 Fixed build warning on Haiku 2017-01-05 02:53:29 -08:00