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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user