Skip to content

Commit 4462970

Browse files
committed
Add Android file support back
1 parent 56f32e6 commit 4462970

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

project/src/backend/sdl3/SDLSystem.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,25 @@ namespace lime {
632632
#ifndef HX_WINDOWS
633633

634634
SDL_PropertiesID properties = SDL_GetIOProperties((SDL_IOStream*)handle);
635-
return (FILE*)SDL_GetPointerProperty(properties, SDL_PROP_IOSTREAM_STDIO_FILE_POINTER, NULL);
635+
636+
FILE* filePointer = (FILE*)SDL_GetPointerProperty(properties, SDL_PROP_IOSTREAM_STDIO_FILE_POINTER, NULL);
637+
638+
if(filePointer != NULL)
639+
return filePointer
640+
641+
#ifdef ANDROID
642+
System::GCEnterBlocking ();
643+
int fd;
644+
off_t outStart;
645+
off_t outLength;
646+
fd = AAsset_openFileDescriptor ((AAsset*)SDL_GetPointerProperty(properties, SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER, NULL), &outStart, &outLength);
647+
FILE* file = ::fdopen (fd, "rb");
648+
::fseek (file, outStart, 0);
649+
System::GCExitBlocking ();
650+
return file;
651+
#endif
652+
653+
return NULL;
636654

637655
#else
638656

0 commit comments

Comments
 (0)