Skip to content
Permalink
Browse files

inital apk extension support

  • Loading branch information
stopiccot committed Apr 7, 2014
1 parent d5c109b commit 612f4a69dbf0cc5ecb4bc45d74033fac4d11f3c8

File 3 of 3 in 612f4a6

@@ -385,7 +385,15 @@ void Java_org_libsdl_app_SDLInputConnection_nativeSetComposingText(
(*env)->ReleaseStringUTFChars(env, text, utftext);
}

jstring Java_org_libsdl_app_SDLActivity_getHint(JNIEnv* env, jclass cls, jstring name) {
const char *utfname = (*env)->GetStringUTFChars(env, name, NULL);
const char *hint = SDL_GetHint(utfname);

jstring result = (*env)->NewStringUTF(env, hint);
(*env)->ReleaseStringUTFChars(env, name, utfname);

return result;
}

/*******************************************************************************
Functions called by SDL into Java
@@ -758,7 +766,14 @@ static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx)
"open", "(Ljava/lang/String;I)Ljava/io/InputStream;");
inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */);
if (Android_JNI_ExceptionOccurred(false)) {
goto failure;
// Try fallback to APK Extension files
mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context),
"openAPKExtensionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;");
inputStream = (*mEnv)->CallObjectMethod(mEnv, context, mid, fileNameJString);

if (Android_JNI_ExceptionOccurred(false)) {
goto failure;
}
}

ctx->hidden.androidio.inputStreamRef = (*mEnv)->NewGlobalRef(mEnv, inputStream);

0 comments on commit 612f4a6

Please sign in to comment.