Commit graph

11215 commits

Author SHA1 Message Date
Sam Lantinga
6631266fa4 Fixed bug 4268 - Android_JNI_OpenAudioDevice function has error
alittle

where iscapture == 1

1.param set error

(*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureOpen, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames)

param:audioBuffer16Bit need change to captureBuffer16Bit

2.logic error

if (is16Bit) {
        // ALITTLE Modify the source code
        if (iscapture) {
            audioBufferFrames = (*env)->GetArrayLength(env, (jshortArray)captureBuffer);
        } else {
            audioBufferPinned = (*env)->GetShortArrayElements(env, (jshortArray)audioBuffer, &isCopy);
            audioBufferFrames = (*env)->GetArrayLength(env, (jshortArray)audioBuffer);
        }
        // if (!iscapture) {
        //     audioBufferPinned = (*env)->GetShortArrayElements(env, (jshortArray)audioBuffer, &isCopy);
        // }
        // audioBufferFrames = (*env)->GetArrayLength(env, (jshortArray)audioBuffer);
    } else {
        // ALITTLE Modify the source code
        if (iscapture) {
            audioBufferFrames = (*env)->GetArrayLength(env, (jbyteArray)captureBuffer);
        } else {
            audioBufferPinned = (*env)->GetByteArrayElements(env, (jbyteArray)audioBuffer, &isCopy);
            audioBufferFrames = (*env)->GetArrayLength(env, (jbyteArray)audioBuffer);
        }
        // if (!iscapture) {
        //     audioBufferPinned = (*env)->GetByteArrayElements(env, (jbyteArray)audioBuffer, &isCopy);
        // }
        // audioBufferFrames = (*env)->GetArrayLength(env, (jbyteArray)audioBuffer);
    }
2018-09-25 20:08:51 -07:00
Sam Lantinga
9742633210 Removed redundant SDL_GetColorKey() call. (thanks Sylvain!) 2018-09-25 19:53:16 -07:00
Ethan Lee
f17afdc446 WinRT: Wait until audio device activation is complete and PrepDevice during OpenAudio 2018-09-25 01:45:12 -04:00
Sam Lantinga
ed5685aa59 Added 8bitdo SF 30 PRO controller support for Linux / DInput mode (thanks Frank Hartung) 2018-09-25 19:41:33 -07:00
Sam Lantinga
d4661b8795 Fixed building with newer Android NDK 2018-09-25 08:23:57 -07:00
Ozkan Sezer
acf03aea49 safer this way, just in case.. 2018-09-25 09:20:56 +03:00
Sam Lantinga
2e6df0aaba Fixed rare null pointer dereference 2018-09-24 20:31:24 -07:00
Sam Lantinga
3845ca6792 Fixed bug 4264 - SDL_CreateTextureFromSurface generates error message but returns ok
Anthony @ POW Games

SDL_CreateTextureFromSurface makes an internal call to SDL_GetColorKey which can return an error and spams the error log with "Surface doesn't have a colorkey" even though the original function didn't return an error.
2018-09-24 16:41:55 -07:00
Sam Lantinga
e5786b21c3 Fixed bug 4267 - linkage failure with --enable-hidapi because of missing libudev symbols
Ozkan Sezer

hidapi dynamic udev initial patch
2018-09-24 16:33:14 -07:00
Sam Lantinga
7aff227a2d Support relative mouse for Samsung DeX on Samsung Experience 9.5 or later (Android 8.1 or later) 2018-09-24 11:53:04 -07:00
Sam Lantinga
f65bdeb358 Fixed whitespace 2018-09-24 11:49:25 -07:00
Drew Pirrone-Brusse
bb213856aa Correct the name of the SDL shared library in CMake for Mac OS 2018-08-18 17:23:40 -04:00
Sam Lantinga
c4b6199246 Fixed bug 3166 - It would be nice, if SDL would support including SDL project as a subdirectory into another CMake project
Wayde Reitsma

After attempting to use SDL2 in the way described in this bug, I found the main issue was the includes not being added to the compiler command.

I found the issue was that the target_include_directories commands for the SDL2, SDL2-static and SDL2main targets only sets the public includes for installations using the INSTALL_INTERFACE generator expression.

I have written a patch to CMakeLists.txt that fixes this issue by adding another item to the target_include_directories commands, utilizing the BUILD_INTERFACE generator expression to correctly add the include directory during builds.
2018-09-24 08:41:59 -07:00
Sam Lantinga
a5c7d967d7 Removed button logging message 2018-09-21 09:41:21 -07:00
Sam Lantinga
5191684830 Added missing call to WindowsDeleteString() 2018-09-20 15:55:52 -07:00
Sam Lantinga
e11cbcfbe2 Added experimental support for Windows.Gaming.Input 2018-09-19 10:03:40 -07:00
Ryan C. Gordon
a2a70b23b1 cmake: correctly report Vulkan support at configure time (thanks, Tiago!).
Fixes Bugzilla #4262.

--HG--
extra : amend_source : 7b1ebe533fe01925ace83d32db188c2f002fc9b1
2018-09-18 11:49:42 -04:00
Sam Lantinga
dc60849e53 Fixed NullPointerException if there's no singleton 2018-09-17 12:08:05 -07:00
Sam Lantinga
105bf84a49 Store the API device refcount on the device itself, so if the device is disconnected and we have multiple application references to it, we only free it once. 2018-09-17 11:35:24 -07:00
Sam Lantinga
46e033920e Fixed creating an Android game controller mapping for HIDAPI devices on initialization 2018-09-17 11:35:22 -07:00
Ozkan Sezer
7c42592b86 do not export hidapi symbols from SDL dlls (bug #4259). 2018-09-15 14:28:10 +03:00
Ozkan Sezer
9c16559c88 acinclude: rename ax_gcc_x86_cpuid.m4.htm to ax_gcc_x86_cpuid.m4
--HG--
rename : acinclude/ax_gcc_x86_cpuid.m4.htm => acinclude/ax_gcc_x86_cpuid.m4
2018-09-15 09:24:04 +03:00
Ozkan Sezer
0a9f975af7 fix permissions 2018-09-15 08:11:50 +03:00
Sam Lantinga
6fd2001c4b Added hints SDL_HINT_MOUSE_DOUBLE_CLICK_TIME and SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS to allow tuning double-click sensitivity.
Also increased the default double-click radius to 32 pixels to be more forgiving for touch interfaces
2018-09-14 19:26:26 -07:00
Sam Lantinga
534639b3f0 Guard against Steam Controller input when we're shutting down. 2018-09-14 18:31:03 -07:00
Sam Lantinga
9f17ce1ed2 Use atomic reference counting for the HID device object 2018-09-14 18:31:01 -07:00
Sam Lantinga
81d9677756 Fixed crash launching under Steam on Mac OS X 2018-09-14 12:41:29 -07:00
Sam Lantinga
1e2bdbb7fe Fixed Chinese IME support (thanks 树子。!) 2018-09-10 23:01:33 -07:00
Sam Lantinga
0074b218ae Fixed building on tvOS 2018-09-10 23:00:09 -07:00
Sam Lantinga
a316223159 Fixed building on tvOS without any sensor support 2018-09-10 22:59:49 -07:00
Ozkan Sezer
efaed040cb hidapi/SDL_hidapijoystick.c: fix build in C90 mode:
src/joystick/hidapi/SDL_hidapijoystick.c: In function 'HIDAPI_InitializeDiscovery':
src/joystick/hidapi/SDL_hidapijoystick.c:281: error: 'true' undeclared (first use in this function)
src/joystick/hidapi/SDL_hidapijoystick.c:281: error: (Each undeclared identifier is reported only once
src/joystick/hidapi/SDL_hidapijoystick.c:281: error: for each function it appears in.)
src/joystick/hidapi/SDL_hidapijoystick.c: In function 'HIDAPI_UpdateDiscovery':
src/joystick/hidapi/SDL_hidapijoystick.c:339: error: 'true' undeclared (first use in this function)
src/joystick/hidapi/SDL_hidapijoystick.c:341: error: ISO C90 forbids mixed declarations and code
2018-09-07 11:03:24 +03:00
Ozkan Sezer
38f56226f1 SDL_sensor.h, SDL_video.h: remove comma at end of enumerator lists.
Avoids gcc -pedantic warnings, closes bug #4253.
2018-09-07 10:47:50 +03:00
Anthony Pesch
cfcef86f4d alsa: avoid hardware parameters with an excessive number of periods.
The previous code attempted to use set_buffer_size / set_period_size
discretely, favoring the parameters which generated a buffer size that was
exactly 2x the requested buffer size. This solution ultimately prioritizes
only the buffer size, which comes at a large performance cost on some machines
where this results in an excessive number of periods. In my case, for a 4096
sample buffer, this configured the device to use 37 periods with a period size
of 221 samples and a buffer size of 8192 samples. With 37 periods, the SDL
Audio thread was consuming 25% of the CPU.

This code has been refactored to use set_period_size and set_buffer_size
together. set_period_size is called first to attempt to set the period to
exactly match the requested buffer size, and set_buffer_size is called second
to further refine the parameters to attempt to use only 2 periods. The
fundamental change here is that the period size / count won't go to extreme
values if the buffer size can't be exactly matched, the buffer size should
instead just increase to the next closest multiple of the target period size
that is supported. After changing this, for a 4096 sample buffer, the device
is configured to use 3 periods with a period size of 4096 samples and a buffer
size of 12288 samples. With only 3 periods, the SDL Audio thread doesn't even
show up when profiling.

Fixes Bugzilla #4156.
2018-05-04 21:21:32 -04:00
Ryan C. Gordon
353e706a9e cmake: Look in popular places for X11 headers, export this info properly.
Fixes CMake not being able to find X11 on FreeBSD (which generally has the
headers in /usr/local/include/X11).

List of other popular places borrowed from CMake's FindX11 module.

This worked on the configure script because of magic in the AC_PATH_X macro.

Fixes Bugzilla #4815.
2018-06-24 15:12:18 -04:00
Ryan C. Gordon
a1083ef2b0 x11: Normalize x11xinput2 touch x to be 1.0 at width (thanks, Zach!).
"Applications (such as SDL's testgesture) do "event.tfinger.x * window_width"
to find window coord. Currently the X11 XInput2 backend expects application
to do "event.tfinger.x * (window_width-1)" instead.

X11 XInput2 touch events are normalized so x is 1.0 at "width - 1" but other
SDL backends appear to have x be 1.0 at "width". Same issue for touch event
y with regards to height."

Fixes Bugzilla #4183.
2018-06-24 13:57:22 -04:00
Tomeu Vizoso
3c03c0beeb egl: Don't change context when deleting current.
If we change the current context behind the app's back, those tracking
the current context to minimize context changes are going to get
confused.

This brings the EGL backend in line with the GLX one.

Fixes Bugzilla #4199.
2018-06-14 06:12:12 +00:00
Ryan C. Gordon
94500043c1 Fixed some possible malloc(0) calls reported by static analysis.
--HG--
extra : rebase_source : 8c2181ff55533bc83aab66ac7d7d1bad87cd0e6f
2018-06-24 12:16:58 -04:00
Sam Lantinga
dd4649c8fb Use a blank cursor instead of PointerIcon.TYPE_NULL since that shows the default cursor on Samsung DeX 2018-06-18 13:14:04 -07:00
Sam Lantinga
7d843b752b Added support for external mouse in Samsung DeX mode
relative mode doesn't work, but absolute coordinates are functional
2018-06-18 13:14:02 -07:00
Sam Lantinga
d8cdfc2a4b Make certain we only hide system UI when we're fullscreen for real. (thanks Rachel!) 2018-06-18 13:14:00 -07:00
Sam Lantinga
90fc4490bc Deal with situations where the system UI is shown when the keyboard pops up (thanks Rachel!) 2018-06-18 13:13:58 -07:00
Sam Lantinga
a2da3d641d Fixed race condition where Android touch events could get scaled by a render target's viewport 2018-06-18 13:13:56 -07:00
Sam Lantinga
c995f49d76 Fixed bug 4094 - No SDL_TEXTEDITING after pressing Alt key on Raspberry Pi Linux
This was reproducible by running an SDL app on the console from an ssh login. In this case the terminal wasn't owned by the user running the app, so we were using the default keymap, which didn't have state transitions defined for ctrl and alt, so once we entered that state keypresses would no longer transition out of that state, nor would they generate text.

As a workaround, we'll just reset to the default shift state if that happens, which means we'll get text for keys pressed while ctrl is held down, but I don't think that's a big problem.

Note that in this case we also can't mute the keyboard, so the keypresses go to the console, which probably isn't what you want...
2018-06-14 00:51:45 -07:00
Sam Lantinga
fd0a45865f SDL Android fullscreen code extensively tested on Steam Link with no issues reported 2018-06-13 14:24:30 -07:00
Ozkan Sezer
5b1c603dbc use the 'aborts' pragma of Watcom for SDL_NORETURN functions
SDL_ExitProcess(), SDL_AbortAssertion() and SDLTest_BailOut().

(Commit c8b4a5166613 for bug #4100 removed SDL_NORETURN from
SDL_ExitProcess() and SDL_AbortAssertion() in order to avoid
warnings from windows builds, but that's temporary I guess..)
2018-06-13 14:45:02 +03:00
Sam Lantinga
dc4b4cc9df Deal with fullscreen limitations under windowed Android environments (Chromebook, DeX, etc.) (Thanks Rachel!) 2018-06-12 13:22:58 -07:00
Ozkan Sezer
53e38a8dfc ran 'chmod -x' on many files 2018-06-12 14:00:15 +03:00
Sam Lantinga
8496fbe117 Merged in community contributed controller mappings from https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt 2018-06-12 01:04:26 -07:00
Sam Lantinga
1208c5aa55 Added common controllers used with Steam Big Picture
These are entirely untested
Several USB ids refer to multiple packaged products. In those cases I tried to use the most common name, or a general name (e.g. PS3 Controller), or a completely generic name (e.g. USB gamepad) if it wasn't clear what type of controller it was.
Patches welcome!
2018-06-12 00:18:10 -07:00
Sam Lantinga
e11ad4a284 Don't crash on exit from SDLActivity if we don't have a singleton for some reason. (Thanks Rachel!) 2018-06-07 17:07:05 -07:00