Skip to content
This repository has been archived by the owner. It is now read-only.
Browse files

Fixes bug 1696, thanks Paul Geerts!

Also adds a bit of information about asset loading on Android.
  • Loading branch information
gabomdq committed Jan 14, 2013
1 parent 4a4503c commit 61aee025d73514ed0c523719a58dc164c9130237
Showing with 15 additions and 0 deletions.
  1. +12 −0
  2. +3 −0 src/core/android/SDL_android.cpp
@@ -138,6 +138,18 @@ SDL_AndroidGetExternalStoragePath()

See SDL_system.h for more details on these functions.

The asset packaging system will, by default, compress certain file extensions.
SDL includes two asset file access mechanisms, the preferred one is the so
called "File Descriptor" method, which is faster and doesn't involve the Dalvik
GC, but given this method does not work on compressed assets, there is also the
"Input Stream" method, which is automatically used as a fall back by SDL. You
may want to keep this fact in mind when building your APK, specially when large
files are involved.
For more information on which extensions get compressed by default and how to
disable this behaviour, see for example:

Pause / Resume behaviour
@@ -613,6 +613,9 @@ static int Android_JNI_FileOpen(SDL_RWops* ctx)
descriptor = mEnv->GetFieldID(fdCls, "descriptor", "I");
ctx->hidden.androidio.fd = mEnv->GetIntField(fd, descriptor);

// Seek to the correct offset in the file.
lseek(ctx->hidden.androidio.fd, (off_t)ctx->hidden.androidio.offset, SEEK_SET);

if (false) {
__android_log_print(ANDROID_LOG_DEBUG, "SDL", "Falling back to legacy InputStream method for opening file");

0 comments on commit 61aee02

Please sign in to comment.