summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-05-29 03:58:10 +0300
committerJari Vetoniemi <mailroxas@gmail.com>2018-05-29 03:58:10 +0300
commitab8e7d1f19932fdb9b14461f6eb2521421f8f4ce (patch)
treed578680ba406264aefe847cd4ad7be6532b8d391 /src
parent836ec0a47f3b852e9a95f3792fb3f72ea3c875c3 (diff)
app: Unity related hacks
Mostly the -DWOLF define to switch between apks more easily
Diffstat (limited to 'src')
-rw-r--r--src/app.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/app.c b/src/app.c
index c0cf543..5258101 100644
--- a/src/app.c
+++ b/src/app.c
@@ -56,21 +56,25 @@ main(int argc, const char *argv[])
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");
+ void (*native_add_vsync_time)(JNIEnv*, jobject, jlong) = jvm_get_native_method(&jvm, unity_player_class, "nativeAddVSyncTime");
+ void (*native_forward_events_to_dalvik)(JNIEnv*, jobject, jboolean) = jvm_get_native_method(&jvm, unity_player_class, "nativeForwardEventsToDalvik");
native_init_jni(&jvm.env, context, context);
- native_file(&jvm.env, context, android_content_Context_getPackageCodePath(&jvm.env, context, 0));
+#if WOLF
+ native_file(&jvm.env, context, jvm.env->NewStringUTF(&jvm.env, "/mnt/media/dev/android2gnulinux/apks/wolf.apk"));
+#else
+ native_file(&jvm.env, context, jvm.env->NewStringUTF(&jvm.env, "/mnt/media/dev/android2gnulinux/apks/honkai.apk"));
+ native_file(&jvm.env, context, jvm.env->NewStringUTF(&jvm.env, "/mnt/media/dev/android2gnulinux/local/obb/com.miHoYo.bh3oversea/main.100.com.miHoYo.bh3oversea.obb"));
+#endif
+ // native_forward_events_to_dalvik(&jvm.env, context, true);
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_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_recreate_gfx_state(&jvm.env, context, 0, context);
native_focus_changed(&jvm.env, context, true);
- // native_done(&jvm.env, context);
-
- while (1) {
- bool ret = native_render(&jvm.env, context);
- fprintf(stderr, "%d\n", ret);
- }
+ native_resume(&jvm.env, context);
+ native_done(&jvm.env, context);
+ // native_add_vsync_time(&jvm.env, context, 0);
+ while (native_render(&jvm.env, context));
printf("unloading module: %s\n", argv[1]);
bionic_dlclose(handle);
jvm_release(&jvm);