attempt fix blank + updated x64 libs

This commit is contained in:
khanhduytran0 2021-11-09 18:57:03 +07:00
parent 04cc1f4646
commit 0967dae16c
3 changed files with 11 additions and 30 deletions

View File

@ -36,8 +36,6 @@ LOCAL_SRC_FILES := \
input_bridge_v3.c \
jre_launcher.c \
utils.c
LOCAL_SHARED_LIBRARIES := xhook
LOCAL_C_INCLUDES := $(LOCAL_PATH)/xhook
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)

View File

@ -664,6 +664,9 @@ void pojavTerminate() {
JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_utils_JREUtils_setupBridgeWindow(JNIEnv* env, jclass clazz, jobject surface) {
potatoBridge.androidWindow = ANativeWindow_fromSurface(env, surface);
char *ptrStr = malloc(sizeof(long));
sprintf(ptrStr, "%ld", (long) potatoBridge.androidWindow);
setenv("POJAV_WINDOW_PTR", ptrStr, 1);
}
void* pojavGetCurrentContext() {
@ -762,6 +765,7 @@ bool loadSymbolsVirGL() {
}
int pojavInit() {
potatoBridge.androidWindow = (void *)atol(getenv("POJAV_WINDOW_PTR"));
ANativeWindow_acquire(potatoBridge.androidWindow);
savedWidth = ANativeWindow_getWidth(potatoBridge.androidWindow);
savedHeight = ANativeWindow_getHeight(potatoBridge.androidWindow);
@ -1032,17 +1036,14 @@ Java_org_lwjgl_glfw_GLFW_nativeEglDetachOnCurrentThread(JNIEnv *env, jclass claz
}
*/
JNIEXPORT jlong JNICALL
Java_org_lwjgl_glfw_GLFW_nativeEglCreateContext(JNIEnv *env, jclass clazz, jlong contextSrc) {
void* pojavCreateContext(void* contextSrc) {
if (config_renderer == RENDERER_GL4ES) {
const EGLint ctx_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, atoi(getenv("LIBGL_ES")),
EGL_NONE
};
EGLContext* ctx = eglCreateContext_p(potatoBridge.eglDisplay, config, (void*)contextSrc, ctx_attribs);
potatoBridge.eglContext = ctx;
printf("EGLBridge: Created CTX pointer = %p\n",ctx);
//(*env)->ThrowNew(env,(*env)->FindClass(env,"java/lang/Exception"),"Trace exception");
return (long)ctx;

View File

@ -33,8 +33,6 @@
// Boardwalk: missing include
#include <string.h>
#include <xhook.h>
#include "log.h"
#include "utils.h"
@ -85,15 +83,6 @@ typedef jint JLI_Launch_func(int argc, char ** argv, /* main argc, argc */
jint ergo /* ergonomics class policy */
);
void* (*old_dlopen)(const char *filename, int flags);
void* custom_dlopen(const char *filename, int flags) {
if (flags == (RTLD_LAZY | RTLD_LOCAL)) {
return old_dlopen(filename, RTLD_LAZY | RTLD_GLOBAL);
} else {
return old_dlopen(filename, flags);
}
}
static jint launchJVM(int margc, char** margv) {
void* libjli = dlopen("libjli.so", RTLD_LAZY | RTLD_GLOBAL);
@ -170,13 +159,6 @@ JNIEXPORT jint JNICALL Java_com_oracle_dalvik_VMLauncher_launchJVM(JNIEnv *env,
CATCHSIG(SIGXFSZ);
//Signal trapper ready
// Since we have moved from JNI call to LWJGL call for fixing GL context
// set incorrectly, we're facing another problem: fields in the previously
// loaded pojavexec aren't shared to LWJGL loaded one, is it because
// of RTLD_LOCAL? hook moment.
xhook_register(".*/liblwjgl.so$","dlopen",custom_dlopen,&old_dlopen);
xhook_refresh(1);
// Save dalvik JNIEnv pointer for JVM launch thread
dalvikJNIEnvPtr_ANDROID = env;