src/core/android/SDL_android.c
changeset 8900 537445b25e4e
parent 8776 29aac8b813d9
parent 8897 fff9c0b9f1fb
child 8961 7dbbee37826b
     1.1 --- a/src/core/android/SDL_android.c	Sat Jun 21 17:31:36 2014 -0700
     1.2 +++ b/src/core/android/SDL_android.c	Sat Jun 21 20:35:36 2014 -0700
     1.3 @@ -385,7 +385,15 @@
     1.4      (*env)->ReleaseStringUTFChars(env, text, utftext);
     1.5  }
     1.6  
     1.7 +jstring Java_org_libsdl_app_SDLActivity_nativeGetHint(JNIEnv* env, jclass cls, jstring name) {
     1.8 +    const char *utfname = (*env)->GetStringUTFChars(env, name, NULL);
     1.9 +    const char *hint = SDL_GetHint(utfname);
    1.10  
    1.11 +    jstring result = (*env)->NewStringUTF(env, hint);
    1.12 +    (*env)->ReleaseStringUTFChars(env, name, utfname);
    1.13 +
    1.14 +    return result;
    1.15 +}
    1.16  
    1.17  /*******************************************************************************
    1.18               Functions called by SDL into Java
    1.19 @@ -758,7 +766,14 @@
    1.20                  "open", "(Ljava/lang/String;I)Ljava/io/InputStream;");
    1.21          inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */);
    1.22          if (Android_JNI_ExceptionOccurred(false)) {
    1.23 -            goto failure;
    1.24 +            // Try fallback to APK Extension files
    1.25 +            mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context),
    1.26 +                "openAPKExtensionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;");
    1.27 +            inputStream = (*mEnv)->CallObjectMethod(mEnv, context, mid, fileNameJString);
    1.28 +
    1.29 +            if (Android_JNI_ExceptionOccurred(false)) {
    1.30 +                goto failure;
    1.31 +            }
    1.32          }
    1.33  
    1.34          ctx->hidden.androidio.inputStreamRef = (*mEnv)->NewGlobalRef(mEnv, inputStream);