Commit Graph

68 Commits

Author SHA1 Message Date
Anonymous Maarten
1a68d846de Create a functional CMake project using androidbuild.sh 2024-06-18 00:11:44 +02:00
Anthony
e9982bf1b5
Filter Android drivers according to SDL_***_DISABLED macros to help reduce APK size (#9986) 2024-06-08 08:55:15 -07:00
Sam Lantinga
27728db41d Sort joystick drivers in Android.mk 2024-06-05 12:08:29 -07:00
Sam Lantinga
69bfa5c951 Build the dummy joystick driver on Android
Fixes https://github.com/libsdl-org/SDL/issues/9978
2024-06-05 12:07:31 -07:00
Miku AuahDark
86fada6faa Android: Implement open and save file dialog. 2024-05-06 09:33:48 -07:00
Frank Praznik
a6fbf0488c Add time and realtime clock functions
Adds functions to query the system's realtime clock, convert time intervals to/from a calendar date and time in either UTC or the local time, and perform time related calculations.

An SDL_Time type (a time interval represented in nanoseconds), and SDL_DateTime struct (broken down calendar date and time) were added to facilitate this functionality.

Querying the system time results in a value expressed in nanoseconds since the Unix epoch (Jan 1, 1970) in UTC +0000. Conversions to and from the various platform epochs and units are performed when required.

Any direct handling of timezones and DST were intentionally avoided. The offset from UTC is provided when converting from UTC to a local time by calculating the difference between the original UTC and the resulting local time, but no other timezone or DST information is used.

The preferred date formatting and 12/24 hour time for the system locale can be retrieved via global preferences.

Helper functions for obtaining the day of week or day or year for calendar date, and getting the number of days in a month in a given year are provided for convenience. These are simple, but useful for performing various time related calculations.

An automated test for time conversion is included, as is a simple standalone test to display the current system date and time onscreen along with a calendar, the rendering of which demonstrates the use of the utility functions (press up/down to increment or decrement the current month, and keys 1-5 to change the date and time formats).
2024-03-19 10:57:36 -07:00
Sam Lantinga
db0c1d7aeb Added portable file and directory operations (thanks @icculus!) 2024-03-17 08:39:43 -07:00
Ryan C. Gordon
2613e3da24 camera: Rewrote Android support.
This does something a little weird, in that it doesn't care what
`__ANDROID_API__` is set to, but will attempt to dlopen the system
libraries, like we do for many other platform-specific pieces of SDL.

This allows us to a) not bump the minimum required Android version, which is
extremely ancient but otherwise still working, doing the right thing on old
and new hardware in the field, and b) not require the app to link against
more libraries than it previously did before the feature was available.

The downside is that it's a little messy, but it's okay for now, I think.
2024-02-20 15:56:26 -05:00
Ryan C. Gordon
f3485a47b3 android: Add src/main/ files to Android.mk 2024-02-20 15:56:26 -05:00
Anonymous Maarten
25ce87979d Always provide an implementation for all SDL3 symbols 2023-10-12 14:00:47 +02:00
Sam Lantinga
5a62a4596e Fixed building with the 16.1.4479499 Android toolchain
(cherry picked from commit b9d1c483b90e2a1c23053692e06d15f9dbd5fe99)
2023-06-13 07:50:00 -07:00
Sam Lantinga
6dc135413a Create a static SDL_test library on Android 2023-01-25 13:06:42 -08:00
Sam Lantinga
39852241ef Added -Wdocumentation to CMake clang build 2023-01-03 15:58:48 -08:00
Daniel Gibson
c3bf253b09 Remove SDL3_main from build systems, remove most of src/main/*
XCode is still missing, and src/main/winrt/SDL3-WinRTResource*
still need to find a new home
2022-12-15 08:01:01 -08:00
Jan Engelhardt
1878674477 build: add symbol versioning for SDL
If a program built against one version of SDL is run in an
environment where there is an earlier version of the SDL .so library
installed, the result varies depending on platform configuration; in
the best case, it won't start at all, at worst it aborts in the
middle of the user doing "something important" (systems implementing
lazy symbol resolution). verdefs on the other hand are always checked
on startup.

The dependency information present in programs and shared libraries
is not only of value to the dynamic linker, but also to a
distribution's package management. If the dynamic linker is able to
tell that a program is not runnable per the above, a package manager
is able to come to the same conclusion — and block the installation
of a nonfunctional program+library ensemble.

Because there are a lot more symbols than there are libraries (I am
going to throw in "10^4 to 1 or worse"), package managers generally
do not evaluate symbols, but only e.g. the SONAME, NEEDED and VERNEED
fields/blocks. Because the SONAME is the same between two SDL
versions like 2.0.24, and 2.0.26, everything rests on having verdefs.

This patch proposes the addition of verdefs.
2022-12-02 13:05:37 -08:00
Sam Lantinga
c5790359fd
Added precompiled header support for Visual Studio and Xcode (#6710)
Fixes https://github.com/libsdl-org/SDL/issues/6704
2022-11-29 18:34:15 -08:00
Sam Lantinga
c2432f8d0d Rename SDLmain to SDL_main and SDLtest to SDL_test for consistency with other SDL libraries 2022-11-28 10:57:59 -08:00
Anonymous Maarten
47c37a8e9d android.mk: LOCAL_EXPORT_C_INCLUDES does not need to add include subfolder 2022-11-22 18:35:49 +01:00
Sam Lantinga
2c4159b99a First pass at changing SDL 2.0 to SDL 3.0 2022-11-21 20:28:58 -08:00
Sam Lantinga
8ae46a49ea Save the version in VERSION.txt instead of VERSION
Fixes https://github.com/libsdl-org/SDL/issues/6558
2022-11-21 06:57:02 -08:00
Ozkan Sezer
c29629a5ef fix permissions of Android.mk 2022-10-01 04:25:40 +03:00
Sam Lantinga
28572702bf Properly backspace over text that was entered when autocorrect updates text with the iPhone on-screen keyboard 2022-09-30 17:25:57 -07:00
Ozkan Sezer
7567c4cb00 revert executable permissions from Android.mk 2022-09-30 21:51:11 +03:00
Sam Lantinga
82e341bc9e Android: use real editable text and mimic the edit operations to generate key events
This fixes issues where the IME and the output would get out of sync
2022-09-30 11:40:29 -07:00
Anonymous Maarten
d76f0cc753 Android.mk: Build android SDL2.so with -Wl,--no-undefined 2022-09-27 13:13:52 -07:00
Ozkan Sezer
c3a4a6a033 mark Android.mk as non-executable 2021-11-12 12:55:28 +03:00
Sam Lantinga
97c71371f2 If Android version >= API 31 PendingIntent.FLAG_MUTABLE
"If your app targets Android 12, you must specify the mutability of each PendingIntent object that your app creates. This additional requirement improves your app's security."

Thanks @FormularSumo and @cgutman
2021-11-12 01:21:29 -08:00
Ozkan Sezer
33735d5997 mark Android.mk as non-executable 2021-11-12 07:40:00 +03:00
Sam Lantinga
ed05a0e9e7 Fixed exception trying to get USB permission
You can't set the intent to be immutable, otherwise the USB system can't set the device and permission in the response. This works fine on Android 12 without an immutable intent.
2021-11-11 20:33:02 -08:00
Sam Lantinga
5b646cd19e Build hidapi code into SDL as a new public API
This prevents conflicts with hidapi linked with applications, as well as allowing applications to make use of HIDAPI on Android and other platforms that might not normally have an implementation available.
2021-11-07 23:00:59 -08:00
Ozkan Sezer
646ddfb782 minor watcom build fixes. 2021-05-15 00:22:50 +03:00
Sam Lantinga
9231f1f1cf Added support for the PS5 controller on iOS and tvOS 2021-05-07 12:29:03 -07:00
Sylvain
146656cfe6
AAudio: add compilation to Android.mk, but not activated in SDL_config_android.h 2021-04-15 21:03:10 +02:00
Ozkan Sezer
e58cc5fa0e minor whitespace fix 2020-10-09 03:28:30 +03:00
Sam Lantinga
79e625f017 Fixed trying to build OSX SDL_OpenURL on iOS and tvOS 2020-10-08 17:01:28 -07:00
Ryan C. Gordon
77c9d73b63 Removed SDL_AndroidOpenURL, added SDL_OpenURL.
Still needs to be wired into Xcode and Visual Studio projects.
2020-10-05 11:30:33 -04:00
Ozkan Sezer
9db16a6557 fix permissions of some project files 2020-06-14 12:21:02 +03:00
Ryan C. Gordon
fa23e3d00b locale: Implemented SDL_GetPreferredLocales().
This was something I proposed a long time ago, Sylvain Becker did
additional work on it, then back to me.

Fixes Bugzilla #2131.
2020-05-04 02:27:29 -04:00
Sam Lantinga
9e3b259dec Added virtual joystick sources to the Android build 2020-04-13 19:17:28 -07:00
Sam Lantinga
c7a62b410b There are lots of unused macros in the Steam controller code 2020-01-29 20:09:12 -08:00
Ozkan Sezer
51df932efb fix permissions 2019-09-05 13:21:02 +03:00
Sam Lantinga
e5580e18ba x11: add a hint to force the VisualID used when creating a window. 2019-09-04 09:27:58 -07:00
Sylvain Becker
6794ec6670 Android: add more warning flags 2019-08-30 08:43:13 +02:00
Ozkan Sezer
09142eb715 fix permissions 2019-06-12 13:56:20 +03:00
Sam Lantinga
7dc92a7669 Initial Android OpenSL ES implementation, contributed by ANTA 2019-01-12 12:18:44 -08:00
Sam Lantinga
db320e460a Fixed the PS4 motion controls showing up as a separate game controller on Linux 2018-12-04 14:21:29 -08:00
Ryan C. Gordon
3323b355c9 android: use cpufeatures to support SDL_HasNEON() (thanks, Sylvain!).
Fixes Bugzilla #4406.
2018-12-01 12:19:11 -05:00
Ozkan Sezer
14e389eadc minor update to Makefile.os2, added a test/Makefile.os2. 2018-11-20 10:55:00 +03:00
Sam Lantinga
2e348c1f59 Fixed bug 3193 - Dualshock 3's motion sensors overwrite analog stick
maxxus

The Dualshock 3's motion sensors don't seem to be reported by the call to EVIOCGBIT but they still send EV_ABS events.  Because they're not reported by EVIOCGBIT they're not assigned a proper axis ids and the default of 0 is used, which is the valid id for the left analog sticks left/right axis.
2018-11-14 13:37:22 -08:00
Sam Lantinga
47fb450beb Fixed bug 4315 - little Warning in Android_JNI_CaptureAudioBuffer
Sylvain

SDL_android.c
src/core/android/SDL_android.c:1302:5: warning: variable 'br' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
    default:
    ^~~~~~~
src/core/android/SDL_android.c:1306:12: note: uninitialized use occurs here
    return br;
           ^~
src/core/android/SDL_android.c:1270:12: note: initialize the variable 'br' to silence this warning
    jint br;
           ^


Maybe we could add some basics warning flags, not to see all warnings, but so that new warnings are caught sooner.

I would go for -Wall -Wextra, and some -Wno-warning for the allowed warnings.
2018-11-02 17:18:03 -07:00