diff options
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | src/libjvm-unity.c | 21 |
2 files changed, 24 insertions, 2 deletions
@@ -54,10 +54,11 @@ jvm.a: wrapper.a src/jvm/jvm.c runtime/libjvm-java.so: private CPPFLAGS += -D_GNU_SOURCE runtime/libjvm-java.so: verbose src/libjvm-java.c runtime/libjvm-android.so: verbose src/libjvm-android.c -java: runtime/libjvm-java.so runtime/libjvm-android.so +runtime/libjvm-unity.so: verbose src/libjvm-unity.c +java: runtime/libjvm-java.so runtime/libjvm-android.so runtime/libjvm-unity.so app: private LDLIBS += -ldl -Wl,-rpath,runtime runtime/libdl.so runtime/libpthread.so -app: private LDLIBS += runtime/libjvm-java.so runtime/libjvm-android.so +app: private LDLIBS += runtime/libjvm-java.so runtime/libjvm-android.so runtime/libjvm-unity.so app: wrapper.a src/app.c native jvm.a java install-bin: $(bins) diff --git a/src/libjvm-unity.c b/src/libjvm-unity.c new file mode 100644 index 0000000..cfed49f --- /dev/null +++ b/src/libjvm-unity.c @@ -0,0 +1,21 @@ +#include <stddef.h> +#include <assert.h> +#include "jvm/jni.h" + +jmethodID +com_unity3d_player_ReflectionHelper_getMethodID(JNIEnv *env, jobject object, jvalue *values) +{ + assert(env && object); + const char *utf1 = (*env)->GetStringUTFChars(env, values[1].l, NULL); + const char *utf2 = (*env)->GetStringUTFChars(env, values[2].l, NULL); + return (*env)->GetMethodID(env, values[0].l, utf1, utf2); +} + +jfieldID +com_unity3d_player_ReflectionHelper_getFieldID(JNIEnv *env, jobject object, jvalue *values) +{ + assert(env && object); + const char *utf1 = (*env)->GetStringUTFChars(env, values[1].l, NULL); + const char *utf2 = (*env)->GetStringUTFChars(env, values[2].l, NULL); + return (*env)->GetFieldID(env, values[0].l, utf1, utf2); +} |