Update SDL to 2.0.22.

On Android, `SDL_RWops` no longer stores a plain file descriptor,
so the `AAsset` API must be used instead:
https://developer.android.com/ndk/reference/group/asset

`HAVE_INOTIFY` is required on Linux at the moment, but the bug will be
fixed in the next SDL release.
This commit is contained in:
Joseph Cloutier
2022-05-19 17:34:20 -04:00
parent 3b4ad78b6a
commit d21847e65c
11 changed files with 658 additions and 505 deletions

View File

@@ -31,6 +31,10 @@
#endif
#endif
#ifdef ANDROID
#include <android/asset_manager_jni.h>
#endif
#include <SDL.h>
#include <string>
@@ -580,8 +584,12 @@ namespace lime {
{
#ifdef ANDROID
System::GCEnterBlocking ();
FILE* file = ::fdopen (((SDL_RWops*)handle)->hidden.androidio.fd, "rb");
::fseek (file, ((SDL_RWops*)handle)->hidden.androidio.offset, 0);
int fd;
off_t outStart;
off_t outLength;
fd = AAsset_openFileDescriptor ((AAsset*)(((SDL_RWops*)handle)->hidden.androidio.asset), &outStart, &outLength);
FILE* file = ::fdopen (fd, "rb");
::fseek (file, outStart, 0);
System::GCExitBlocking ();
return file;
#endif