summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-02-19 02:31:22 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2018-02-19 02:31:22 +0200
commit12d58ade2732e7ce0a644371ca10a1dd234c5bc1 (patch)
treebc0a613b31957b4f57c3a3f552703a548323b1ab /src/app.c
parentc87c1650885ed8d156b343d02fcd0efa8e3f2170 (diff)
app: some temporary code
I'm testing this thing with certain unity thing. Eventually the Java side reimplementations of apps will be moved to support modules.
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/app.c b/src/app.c
index 5d23a3d..78bb689 100644
--- a/src/app.c
+++ b/src/app.c
@@ -28,13 +28,13 @@ main(int argc, const char *argv[])
apkenv_parse_library_path(dirname(path), ";");
}
- void *handle;
- if (!(handle = apkenv_android_dlopen(argv[1], RTLD_NOW | RTLD_LOCAL)))
- errx(EXIT_FAILURE, "dlopen failed: %s", dlerror());
+ {
+ void *handle;
+ if (!(handle = apkenv_android_dlopen(argv[1], RTLD_NOW | RTLD_LOCAL)))
+ errx(EXIT_FAILURE, "dlopen failed: %s", dlerror());
- printf("trying JNI_OnLoad from: %s\n", argv[1]);
+ printf("trying JNI_OnLoad from: %s\n", argv[1]);
- {
struct jvm jvm;
jvm_init(&jvm);
@@ -42,8 +42,16 @@ main(int argc, const char *argv[])
assert(JNI_OnLoad);
JNI_OnLoad(&jvm.vm, NULL);
+
+ static const char *unity_player_class = "com/unity3d/player/UnityPlayer";
+ void (*native_init)(void*, void*, int, int) = jvm_get_native_method(&jvm, unity_player_class, "initJni");
+ native_init(&jvm.env, (jclass)1, 1024, 768);
+
+ printf("unloading module: %s\n", argv[1]);
+ apkenv_android_dlclose(handle);
+ jvm_release(&jvm);
}
- // apkenv_android_dlclose(handle);
+ printf("exiting\n");
return EXIT_SUCCESS;
}