Revert workaround + vtest is now a single lib

This commit is contained in:
khanhduytran0 2021-11-23 05:33:53 +07:00
parent 511ef3833c
commit 2ec6c4d18c
6 changed files with 8 additions and 13 deletions

View File

@ -772,10 +772,10 @@ bool loadSymbolsVirGL() {
loadSymbols();
config_renderer = RENDERER_VIRGL;
// hack: set LD_LIBRARY_PATH back to workaround a dlopen bug(?) in Android 7.0
setLdLibraryPath(getenv("POJAV_NATIVEDIR"));
char* fileName = calloc(1, 1024);
void *handle = dlopen("libvirgl_test_server.so", RTLD_LAZY);
sprintf(fileName, "%s/libvirgl_test_server.so", getenv("POJAV_NATIVEDIR"));
void *handle = dlopen(fileName, RTLD_LAZY);
printf("VirGL: libvirgl_test_server = %p\n", handle);
if (!handle) {
printf("VirGL: %s\n", dlerror());
@ -783,7 +783,7 @@ bool loadSymbolsVirGL() {
vtest_main_p = dlsym(handle, "vtest_main");
vtest_swap_buffers_p = dlsym(handle, "vtest_swap_buffers");
setLdLibraryPath(getenv("LD_LIBRARY_PATH"));
free(fileName);
}
int pojavInit() {

View File

@ -82,7 +82,9 @@ JNIEXPORT jint JNICALL Java_android_os_OpenJDKNativeRegister_nativeRegisterNativ
return (jint) result;
}
void setLdLibraryPath(const char* ldLibPathUtf) {
JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_utils_JREUtils_setLdLibraryPath(JNIEnv *env, jclass clazz, jstring ldLibraryPath) {
// jclass exception_cls = (*env)->FindClass(env, "java/lang/UnsatisfiedLinkError");
android_update_LD_LIBRARY_PATH_t android_update_LD_LIBRARY_PATH;
void *libdl_handle = dlopen("libdl.so", RTLD_LAZY);
@ -97,14 +99,8 @@ void setLdLibraryPath(const char* ldLibPathUtf) {
}
android_update_LD_LIBRARY_PATH = (android_update_LD_LIBRARY_PATH_t) updateLdLibPath;
android_update_LD_LIBRARY_PATH(ldLibPathUtf);
}
JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_utils_JREUtils_setLdLibraryPath(JNIEnv *env, jclass clazz, jstring ldLibraryPath) {
// jclass exception_cls = (*env)->FindClass(env, "java/lang/UnsatisfiedLinkError");
const char* ldLibPathUtf = (*env)->GetStringUTFChars(env, ldLibraryPath, 0);
setLdLibraryPath(ldLibPathUtf);
android_update_LD_LIBRARY_PATH(ldLibPathUtf);
(*env)->ReleaseStringUTFChars(env, ldLibraryPath, ldLibPathUtf);
}

View File

@ -21,7 +21,6 @@ char** convert_to_char_array(JNIEnv *env, jobjectArray jstringArray);
jobjectArray convert_from_char_array(JNIEnv *env, char **charArray, int num_rows);
void free_char_array(JNIEnv *env, jobjectArray jstringArray, const char **charArray);
jstring convertStringJVM(JNIEnv* srcEnv, JNIEnv* dstEnv, jstring srcStr);
void setLdLibraryPath(const char* ldLibPathUtf);
void closeGLFWWindow();