summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/app.c b/src/app.c
index 481d5d0..9b7fd14 100644
--- a/src/app.c
+++ b/src/app.c
@@ -4,6 +4,7 @@
#include <dlfcn.h>
#include <err.h>
#include <assert.h>
+#include <linux/limits.h>
#include "linker/dlfcn.h"
#include "jvm/jvm.h"
@@ -20,9 +21,9 @@ main(int argc, const char *argv[])
{
// FIXME: when bionic linker is rewritten it will just use system search path
- char path[4096];
- snprintf(path, sizeof(path), "%s", argv[1]);
- dl_parse_library_path(dirname(path), ";");
+ char abs[PATH_MAX];
+ realpath(argv[1], abs);
+ dl_parse_library_path(dirname(abs), ";");
}
{
@@ -36,28 +37,35 @@ main(int argc, const char *argv[])
jvm_init(&jvm);
const jobject context = jvm.native.AllocObject(&jvm.env, jvm.native.FindClass(&jvm.env, "android/content/Context"));
- void* (*JNI_OnLoad)(void*, void*) = bionic_dlsym(handle, "JNI_OnLoad");
+ jint (*JNI_OnLoad)(void*, void*) = bionic_dlsym(handle, "JNI_OnLoad");
assert(JNI_OnLoad);
JNI_OnLoad(&jvm.vm, NULL);
static const char *unity_player_class = "com/unity3d/player/UnityPlayer";
- void (*native_init)(JNIEnv*, jobject, jobject) = jvm_get_native_method(&jvm, unity_player_class, "initJni");
+ void (*native_init_jni)(JNIEnv*, jobject, jobject) = jvm_get_native_method(&jvm, unity_player_class, "initJni");
+ void (*native_done)(JNIEnv*, jobject) = jvm_get_native_method(&jvm, unity_player_class, "nativeDone");
void (*native_file)(JNIEnv*, jobject, jstring) = jvm_get_native_method(&jvm, unity_player_class, "nativeFile");
jboolean (*native_pause)(JNIEnv*, jobject) = jvm_get_native_method(&jvm, unity_player_class, "nativePause");
- void (*native_done)(JNIEnv*, jobject) = jvm_get_native_method(&jvm, unity_player_class, "nativeDone");
- void (*native_recreate_gfx_state)(JNIEnv*, jobject, jobject) = jvm_get_native_method(&jvm, unity_player_class, "nativeRecreateGfxState");
- void (*native_resume)(JNIEnv*, jobject) = jvm_get_native_method(&jvm, unity_player_class, "nativeResume");
+ void (*native_recreate_gfx_state)(JNIEnv*, jobject, jint, jobject) = jvm_get_native_method(&jvm, unity_player_class, "nativeRecreateGfxState");
jboolean (*native_render)(JNIEnv*, jobject) = jvm_get_native_method(&jvm, unity_player_class, "nativeRender");
+ void (*native_resume)(JNIEnv*, jobject) = jvm_get_native_method(&jvm, unity_player_class, "nativeResume");
void (*native_focus_changed)(JNIEnv*, jobject, jboolean) = jvm_get_native_method(&jvm, unity_player_class, "nativeFocusChanged");
void (*native_set_input_string)(JNIEnv*, jobject, jstring) = jvm_get_native_method(&jvm, unity_player_class, "nativeSetInputString");
void (*native_soft_input_closed)(JNIEnv*, jobject) = jvm_get_native_method(&jvm, unity_player_class, "nativeSoftInputClosed");
- void (*native_soft_input_canceled)(JNIEnv*, jobject, jboolean) = jvm_get_native_method(&jvm, unity_player_class, "nativeSoftInputCanceled");
- native_init(&jvm.env, context, context);
+ void (*native_set_input_canceled)(JNIEnv*, jobject, jboolean) = jvm_get_native_method(&jvm, unity_player_class, "nativeSetInputCanceled");
+ void (*native_init_www)(JNIEnv*, jobject, jobject) = jvm_get_native_method(&jvm, unity_player_class, "nativeInitWWW");
+ void (*native_init_web_request)(JNIEnv*, jobject, jobject) = jvm_get_native_method(&jvm, unity_player_class, "nativeInitWebRequest");
+ native_init_jni(&jvm.env, context, context);
native_file(&jvm.env, context, android_content_Context_getPackageCodePath(&jvm.env, context, 0));
- native_done(&jvm.env, context);
- native_recreate_gfx_state(&jvm.env, context, context);
- native_render(&jvm.env, (jobject)1);
+ native_init_www(&jvm.env, context, jvm.native.FindClass(&jvm.env, "com/unity3d/player/WWW"));
+ native_init_web_request(&jvm.env, context, jvm.native.FindClass(&jvm.env, "com/unity3d/player/UnityWebRequest"));
+ native_recreate_gfx_state(&jvm.env, context, 0, context);
+ native_file(&jvm.env, context, jvm.env->NewStringUTF(&jvm.env, "/mnt/media/dev/android2gnulinux/file.apk"));
+ native_file(&jvm.env, context, jvm.env->NewStringUTF(&jvm.env, "/mnt/media/dev/android2gnulinux/local/obb/com.miHoYo.bh3oversea/main.81.com.miHoYo.bh3oversea.obb"));
+ native_focus_changed(&jvm.env, context, true);
+ // native_done(&jvm.env, context);
+ native_render(&jvm.env, context);
printf("unloading module: %s\n", argv[1]);
bionic_dlclose(handle);