lbry-android/p4a/pythonforandroid/recipes/sdl2/add_nativeSetEnv.patch

23 lines
910 B
Diff
Raw Normal View History

2017-08-13 03:24:00 +02:00
--- orig/src/core/android/SDL_android.c 2016-01-02 20:56:31.000000000 +0100
+++ patch/src/core/android/SDL_android.c 2016-04-15 22:21:13.985708267 +0200
@@ -188,6 +188,19 @@
Android_OnHat(device_id, hat_id, x, y);
}
+/* Patched in env var setter for python-for-android */
+JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeSetEnv(
+ JNIEnv* env, jclass jcls,
+ jstring j_name, jstring j_value)
+{
+ jboolean iscopy;
+ const char *name = (*env)->GetStringUTFChars(env, j_name, &iscopy);
+ const char *value = (*env)->GetStringUTFChars(env, j_value, &iscopy);
+ setenv(name, value, 1);
+ (*env)->ReleaseStringUTFChars(env, j_name, name);
+ (*env)->ReleaseStringUTFChars(env, j_value, value);
+}
+
JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick(
JNIEnv* env, jclass jcls,