Make the debug logging switch actually do something
Pretty much disables everything except for [Pre-Init] and [Init], as well as Renderer Init Success. Toggle debug logging off to see. regLog(message) -> logs all the time debugLog(message) -> logs only when debug logging is enabled
This commit is contained in:
1 parent
c343b80bd8
commit
70c150af38
7 files changed
+82
-78
No files matched your search
@@ -51,7 +51,7 @@ public final class Tools
|
||||
|
||||
public static final Gson GLOBAL_GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
||||
public static final String URL_HOME = "https://pojavlauncherteam.github.io/PojavLauncher";
|
||||
public static final String URL_HOME = "https://pojav.ml";
|
||||
public static String DIR_BUNDLE = System.getenv("BUNDLE_PATH"); // path to "PojavLauncher.app"
|
||||
public static String CURRENT_ARCHITECTURE;
|
||||
|
||||
@@ -96,7 +96,7 @@ public final class Tools
|
||||
|
||||
String[] launchArgs = getMinecraftArgs(profile, versionInfo);
|
||||
|
||||
System.out.println("Minecraft Args: " + Arrays.toString(launchArgs));
|
||||
// System.out.println("Minecraft Args: " + Arrays.toString(launchArgs));
|
||||
|
||||
final String launchClassPath = generateLaunchClassPath(profile.selectedVersion);
|
||||
|
||||
|
||||
+33
-33
@@ -209,7 +209,7 @@ void init_hookFunctions() {
|
||||
void init_loadCustomEnv() {
|
||||
FILE *envFile = fopen(env_path, "r");
|
||||
|
||||
debug("[Pre-init] Reading custom environment variables (custom_env.txt), opened=%d\n", envFile != NULL);
|
||||
regLog("[Pre-init] Reading custom environment variables (custom_env.txt), opened=%d\n", envFile != NULL);
|
||||
|
||||
if (envFile) {
|
||||
char *line = NULL;
|
||||
@@ -221,10 +221,10 @@ void init_loadCustomEnv() {
|
||||
line[read-1] = '\0';
|
||||
}
|
||||
if (strchr(line, '=') != NULL) {
|
||||
debug("[Pre-init] Added custom env: %s", line);
|
||||
regLog("[Pre-init] Added custom env: %s", line);
|
||||
setenv(strtok(line, "="), strtok(NULL, "="), 1);
|
||||
} else {
|
||||
debug("[Pre-init] Warning: skipped empty value custom env: %s", line);
|
||||
regLog("[Pre-init] Warning: skipped empty value custom env: %s", line);
|
||||
}
|
||||
}
|
||||
fclose(envFile);
|
||||
@@ -279,13 +279,13 @@ void init_logDeviceAndVer (char *argument) {
|
||||
} else {
|
||||
jbStrap = "Other";
|
||||
}
|
||||
debug("[Pre-Init] %s with iOS %s (%s)", deviceHardware, deviceSoftware, jbStrap);
|
||||
regLog("[Pre-Init] %s with iOS %s (%s)", deviceHardware, deviceSoftware, jbStrap);
|
||||
} else {
|
||||
debug("[Pre-Init] %s with iOS %s", deviceHardware, deviceSoftware);
|
||||
regLog("[Pre-Init] %s with iOS %s", deviceHardware, deviceSoftware);
|
||||
}
|
||||
|
||||
// PojavLauncher version
|
||||
debug("[Pre-Init] PojavLauncher version: %s - %s", CONFIG_TYPE, CONFIG_COMMIT);
|
||||
regLog("[Pre-Init] PojavLauncher version: %s - %s", CONFIG_TYPE, CONFIG_COMMIT);
|
||||
|
||||
setenv("POJAV_DETECTEDHW", deviceHardware, 1);
|
||||
setenv("POJAV_DETECTEDSW", deviceSoftware, 1);
|
||||
@@ -295,14 +295,14 @@ void init_logDeviceAndVer (char *argument) {
|
||||
}
|
||||
|
||||
void init_redirectStdio(char* homeDir) {
|
||||
debug("[Pre-init] Staring logging STDIO as jrelog:V\n");
|
||||
regLog("[Pre-init] Staring logging STDIO as jrelog:V\n");
|
||||
// Redirect stdio to latestlog.txt
|
||||
char newname[2048];
|
||||
sprintf(newname, "%s/latestlog.old.txt", homeDir);
|
||||
rename(log_path, newname);
|
||||
FILE* logFile = fopen(log_path, "w");
|
||||
if (!logFile) {
|
||||
debug("[Pre-init] Error: failed to open %s: %s", log_path, strerror(errno));
|
||||
regLog("[Pre-init] Error: failed to open %s: %s", log_path, strerror(errno));
|
||||
assert(0 && "Failed to open latestlog.txt. Check oslog for more details.");
|
||||
}
|
||||
log_fd = fileno(logFile);
|
||||
@@ -328,13 +328,13 @@ void environmentFailsafes(char *argv[]) {
|
||||
if (0 == access("/usr/lib/jvm/java-8-openjdk/", F_OK)) {
|
||||
javaHome_pre = @"/usr/lib/jvm/java-8-openjdk";
|
||||
} else if (0 == access("/usr/lib/jvm/java-16-openjdk/", F_OK)) {
|
||||
debug("[Pre-init] Java 8 wasn't found on your device. Install Java 8 for more compatibility and the mod installer.");
|
||||
regLog("[Pre-init] Java 8 wasn't found on your device. Install Java 8 for more compatibility and the mod installer.");
|
||||
javaHome_pre = @"/usr/lib/jvm/java-16-openjdk";
|
||||
} else if (0 == access("/usr/lib/jvm/java-17-openjdk/", F_OK)) {
|
||||
debug("[Pre-init] Java 8 wasn't found on your device. Install Java 8 for more compatibility and the mod installer.");
|
||||
regLog("[Pre-init] Java 8 wasn't found on your device. Install Java 8 for more compatibility and the mod installer.");
|
||||
javaHome_pre = @"/usr/lib/jvm/java-17-openjdk";
|
||||
} else {
|
||||
debug("[Pre-init] FATAL ERROR: Java wasn't found on your device, PojavLauncher cannot continue, aborting.");
|
||||
regLog("[Pre-init] FATAL ERROR: Java wasn't found on your device, PojavLauncher cannot continue, aborting.");
|
||||
abort();
|
||||
}
|
||||
javaHome = [javaHome_pre cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
@@ -402,7 +402,7 @@ int launchJVM(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
init_logDeviceAndVer(argv[0]);
|
||||
debug("[Pre-init] Beginning JVM launch\n");
|
||||
regLog("[Pre-init] Beginning JVM launch\n");
|
||||
|
||||
char javaAwtPath[4096];
|
||||
// I accidentally patched a bit wrong, the value should be a path containing libawt_xawt.dylib, but here is libawt.dylib path (no need to exist)
|
||||
@@ -425,13 +425,13 @@ int launchJVM(int argc, char *argv[]) {
|
||||
javaHome = [javaHome_pre cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
if ([javaHome_pre length] == 0) {
|
||||
environmentFailsafes(argv);
|
||||
debug("[Pre-init] JAVA_HOME environment variable was not set. Defaulting to %s for future use.\n", javaHome);
|
||||
regLog("[Pre-init] JAVA_HOME environment variable was not set. Defaulting to %s for future use.\n", javaHome);
|
||||
} else {
|
||||
if (0 == [[NSFileManager defaultManager] fileExistsAtPath:javaHome_pre]) {
|
||||
debug("[Pre-Init] Failed to locate %s. Restoring default value for JAVA_HOME.", javaHome);
|
||||
regLog("[Pre-Init] Failed to locate %s. Restoring default value for JAVA_HOME.", javaHome);
|
||||
environmentFailsafes(argv);
|
||||
} else {
|
||||
debug("[Pre-Init] Restored preference: JAVA_HOME is set to %s\n", javaHome);
|
||||
regLog("[Pre-Init] Restored preference: JAVA_HOME is set to %s\n", javaHome);
|
||||
}
|
||||
}
|
||||
setenv("JAVA_HOME", javaHome, 1);
|
||||
@@ -529,9 +529,9 @@ int launchJVM(int argc, char *argv[]) {
|
||||
setPreference(@"renderer", renderer_pre);
|
||||
renderer = [renderer_pre cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
setenv("POJAV_RENDERER", renderer, 1);
|
||||
debug("[Pre-init] RENDERER environment variable was not set. Defaulting to %s for future use.\n", renderer);
|
||||
regLog("[Pre-init] RENDERER environment variable was not set. Defaulting to %s for future use.\n", renderer);
|
||||
} else {
|
||||
debug("[Pre-Init] Restored preference: RENDERER is set to %s\n", renderer);
|
||||
regLog("[Pre-Init] Restored preference: RENDERER is set to %s\n", renderer);
|
||||
}
|
||||
|
||||
allocmem_pre = [getPreference(@"allocated_memory") stringValue];
|
||||
@@ -565,7 +565,7 @@ int launchJVM(int argc, char *argv[]) {
|
||||
classpath[cplen-1] = '\0';
|
||||
closedir(d);
|
||||
}
|
||||
debug("[Pre-init] Classpath generated: %s", classpath);
|
||||
debugLog("[Pre-init] Classpath generated: %s", classpath);
|
||||
|
||||
multidir_pre = getPreference(@"game_directory");
|
||||
multidir = [multidir_pre cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
@@ -573,10 +573,10 @@ int launchJVM(int argc, char *argv[]) {
|
||||
multidir_pre = @"default";
|
||||
multidir = [multidir_pre cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
setPreference(@"game_directory", multidir_pre);
|
||||
debug("[Pre-init] MULTI_DIR environment variable was not set. Defaulting to %s for future use.\n", multidir);
|
||||
regLog("[Pre-init] MULTI_DIR environment variable was not set. Defaulting to %s for future use.\n", multidir);
|
||||
} else {
|
||||
multidir = [multidir_pre cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
debug("[Pre-init] Restored preference: MULTI_DIR is set to %s\n", multidir);
|
||||
regLog("[Pre-init] Restored preference: MULTI_DIR is set to %s\n", multidir);
|
||||
}
|
||||
char *multidir_char, *librarySym;
|
||||
asprintf(&multidir_char, "%s/instances/%s", getenv("POJAV_HOME"), multidir);
|
||||
@@ -590,7 +590,7 @@ int launchJVM(int argc, char *argv[]) {
|
||||
|
||||
if (0 == access("/var/mobile/Documents/minecraft", F_OK)) {
|
||||
rename("/var/mobile/Documents/minecraft", multidir_char);
|
||||
debug("[Pre-Init] Migrated old minecraft folder to new location.");
|
||||
regLog("[Pre-Init] Migrated old minecraft folder to new location.");
|
||||
}
|
||||
|
||||
if (0 == access("/var/mobile/Documents/Library", F_OK)) {
|
||||
@@ -632,7 +632,7 @@ int launchJVM(int argc, char *argv[]) {
|
||||
}
|
||||
} else {
|
||||
setenv("POJAV_RENDERER", renderer, 1);
|
||||
debug("[Pre-init] RENDERER has been set to %s", getenv("POJAV_RENDERER"));
|
||||
regLog("[Pre-init] RENDERER has been set to %s", getenv("POJAV_RENDERER"));
|
||||
}
|
||||
|
||||
// Load java
|
||||
@@ -643,11 +643,11 @@ int launchJVM(int argc, char *argv[]) {
|
||||
setenv("INTERNAL_JLI_PATH", libjlipath16, 1);
|
||||
void* libjli = dlopen(libjlipath16, RTLD_LAZY | RTLD_GLOBAL);
|
||||
if (!libjli) {
|
||||
debug("[Init] Can't load %s, trying %s", libjlipath16, libjlipath8);
|
||||
debugLog("[Init] Can't load %s, trying %s", libjlipath16, libjlipath8);
|
||||
setenv("INTERNAL_JLI_PATH", libjlipath8, 1);
|
||||
libjli = dlopen(libjlipath8, RTLD_LAZY | RTLD_GLOBAL);
|
||||
if (!libjli) {
|
||||
debug("[Init] JLI lib = NULL: %s", dlerror());
|
||||
debugLog("[Init] JLI lib = NULL: %s", dlerror());
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -687,7 +687,7 @@ int launchJVM(int argc, char *argv[]) {
|
||||
if (!started) {
|
||||
init_loadCustomJvmFlags();
|
||||
}
|
||||
debug("[Init] Found JLI lib");
|
||||
regLog("[Init] Found JLI lib");
|
||||
|
||||
if (!started) {
|
||||
margv[margc++] = "-cp";
|
||||
@@ -699,7 +699,7 @@ int launchJVM(int argc, char *argv[]) {
|
||||
(JLI_Launch_func *)dlsym(libjli, "JLI_Launch");
|
||||
|
||||
if (NULL == pJLI_Launch) {
|
||||
debug("[Init] JLI_Launch = NULL");
|
||||
regLog("[Init] JLI_Launch = NULL");
|
||||
return -2;
|
||||
}
|
||||
|
||||
@@ -707,10 +707,10 @@ int launchJVM(int argc, char *argv[]) {
|
||||
free(librarySym);
|
||||
free(multidir_char);
|
||||
|
||||
debug("[Init] Calling JLI_Launch");
|
||||
regLog("[Init] Calling JLI_Launch");
|
||||
/*
|
||||
for (int i = 0; i < margc; i++) {
|
||||
debug("arg[%d] = %s", i, margv[i]);
|
||||
regLog("arg[%d] = %s", i, margv[i]);
|
||||
}
|
||||
*/
|
||||
int targc = started ? argc : margc;
|
||||
@@ -719,11 +719,11 @@ int launchJVM(int argc, char *argv[]) {
|
||||
if (!started) {
|
||||
started = YES;
|
||||
}
|
||||
/* debug:
|
||||
for (int i = 0; i < targc; i++) {
|
||||
debug("Arg=%s", targv[i]);
|
||||
}
|
||||
*/
|
||||
|
||||
for (int i = 0; i < targc; i++) {
|
||||
debugLog("Arg=%s", targv[i]);
|
||||
}
|
||||
|
||||
return pJLI_Launch(targc, targv,
|
||||
0, NULL, // sizeof(const_jargs) / sizeof(char *), const_jargs,
|
||||
0, NULL, // sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,
|
||||
|
||||
+29
-29
@@ -104,7 +104,7 @@ JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_utils_JREUtils_setenv(JNIEnv *en
|
||||
}
|
||||
|
||||
void pojavTerminate() {
|
||||
debug("EGLBridge: Terminating");
|
||||
debugLog("EGLBridge: Terminating");
|
||||
|
||||
switch (config_renderer) {
|
||||
case RENDERER_MTL_ANGLE: {
|
||||
@@ -240,16 +240,16 @@ int pojavInit() {
|
||||
if (potatoBridge.eglDisplay == EGL_NO_DISPLAY) {
|
||||
potatoBridge.eglDisplay = eglGetPlatformDisplay_p(EGL_PLATFORM_ANGLE_ANGLE, (void *)EGL_DEFAULT_DISPLAY, NULL);
|
||||
if (potatoBridge.eglDisplay == EGL_NO_DISPLAY) {
|
||||
NSLog(@"EGLBridge: Error eglGetDefaultDisplay() failed: 0x%x", eglGetError_p());
|
||||
debugLog("EGLBridge: Error eglGetDefaultDisplay() failed: 0x%x", eglGetError_p());
|
||||
return JNI_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
NSLog(@"EGLBridge: Initializing");
|
||||
debugLog("EGLBridge: Initializing");
|
||||
// printf("EGLBridge: ANativeWindow pointer = %p\n", potatoBridge.androidWindow);
|
||||
//(*env)->ThrowNew(env,(*env)->FindClass(env,"java/lang/Exception"),"Trace exception");
|
||||
if (!eglInitialize_p(potatoBridge.eglDisplay, NULL, NULL)) {
|
||||
NSLog(@"EGLBridge: Error eglInitialize() failed: 0x%x", eglGetError_p());
|
||||
debugLog("EGLBridge: Error eglInitialize() failed: 0x%x", eglGetError_p());
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ int pojavInit() {
|
||||
EGLint vid;
|
||||
|
||||
if (!eglChooseConfig_p(potatoBridge.eglDisplay, attribs, &config, 1, &num_configs)) {
|
||||
NSLog(@"EGLBridge: Error couldn't get an EGL visual config: 0x%x", eglGetError_p());
|
||||
debugLog("EGLBridge: Error couldn't get an EGL visual config: 0x%x", eglGetError_p());
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ int pojavInit() {
|
||||
//ANativeWindow_setBuffersGeometry(potatoBridge.androidWindow, 0, 0, vid);
|
||||
|
||||
if (/*!isVGPU &&*/ !eglBindAPI_p(EGL_OPENGL_API)) {
|
||||
NSLog(@"EGLBridge: Failed to bind EGL_OPENGL_API, falling back to EGL_OPENGL_ES_API, error=0x%x", eglGetError_p());
|
||||
debugLog("EGLBridge: Failed to bind EGL_OPENGL_API, falling back to EGL_OPENGL_ES_API, error=0x%x", eglGetError_p());
|
||||
eglBindAPI_p(EGL_OPENGL_ES_API);
|
||||
} else if (isVGPU) {
|
||||
eglBindAPI_p(EGL_OPENGL_ES_API);
|
||||
@@ -293,14 +293,14 @@ int pojavInit() {
|
||||
//NSLog(@"Layer %@", ((SurfaceViewController *)viewController).surfaceView.layer);
|
||||
|
||||
if (!potatoBridge.eglSurface) {
|
||||
NSLog(@"EGLBridge: Error eglCreateWindowSurface failed: 0x%x", eglGetError_p());
|
||||
debugLog("EGLBridge: Error eglCreateWindowSurface failed: 0x%x", eglGetError_p());
|
||||
//(*env)->ThrowNew(env,(*env)->FindClass(env,"java/lang/Exception"),"Trace exception");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
NSLog(@"EGLBridge: Initialized!");
|
||||
NSLog(@"EGLBridge: ThreadID=%d", gettid());
|
||||
NSLog(@"EGLBridge: EGLDisplay=%p, EGLSurface=%p",
|
||||
debugLog("EGLBridge: Initialized!");
|
||||
debugLog("EGLBridge: ThreadID=%d", gettid());
|
||||
debugLog("EGLBridge: EGLDisplay=%p, EGLSurface=%p",
|
||||
/* window==0 ? EGL_NO_CONTEXT : */
|
||||
potatoBridge.eglDisplay,
|
||||
potatoBridge.eglSurface
|
||||
@@ -385,14 +385,14 @@ void* egl_make_current(void* window) {
|
||||
);
|
||||
|
||||
if (success == EGL_FALSE) {
|
||||
NSLog(@"EGLBridge: Error: eglMakeCurrent() failed: 0x%x", eglGetError_p());
|
||||
debugLog("EGLBridge: Error: eglMakeCurrent() failed: 0x%x", eglGetError_p());
|
||||
} else {
|
||||
NSLog(@"EGLBridge: eglMakeCurrent() succeed!");
|
||||
debugLog("EGLBridge: eglMakeCurrent() succeed!");
|
||||
}
|
||||
|
||||
if (config_renderer == RENDERER_VIRGL) {
|
||||
NSLog(@"VirGL: vtest_main = %p", vtest_main_p);
|
||||
NSLog(@"VirGL: Calling VTest server's main function");
|
||||
debugLog("VirGL: vtest_main = %p", vtest_main_p);
|
||||
debugLog("VirGL: Calling VTest server's main function");
|
||||
vtest_main_p(3, (const char*[]){"vtest", "--no-loop-or-fork", "--use-gles", NULL, NULL});
|
||||
}
|
||||
|
||||
@@ -407,9 +407,9 @@ void pojavMakeCurrent(void* window) {
|
||||
|
||||
if (config_renderer == RENDERER_MTL_ANGLE) {
|
||||
EGLContext *currCtx = eglGetCurrentContext_p();
|
||||
NSLog(@"EGLBridge: Comparing: thr=%d, this=%p, curr=%p", gettid(), window, currCtx);
|
||||
debugLog("EGLBridge: Comparing: thr=%d, this=%p, curr=%p", gettid(), window, currCtx);
|
||||
if (currCtx == NULL || window == 0) {
|
||||
NSLog(@"EGLBridge: Making current on window %p on thread %d", window, gettid());
|
||||
debugLog("EGLBridge: Making current on window %p on thread %d", window, gettid());
|
||||
egl_make_current((void *)window);
|
||||
|
||||
// Test
|
||||
@@ -417,21 +417,21 @@ void pojavMakeCurrent(void* window) {
|
||||
glClearColor(0.4f, 0.4f, 0.4f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
eglSwapBuffers(potatoBridge.eglDisplay, potatoBridge.eglSurface);
|
||||
NSLog(@"First frame error: 0x%x", eglGetError());
|
||||
debugLog("First frame error: 0x%x", eglGetError());
|
||||
#endif
|
||||
|
||||
// ADDITIONAL STEP ON IOS: Initialize gl4es
|
||||
void *gl4es_handle = dlopen(getenv("POJAV_RENDERER"), RTLD_GLOBAL);
|
||||
debug("%s=%p, error=%s", getenv("POJAV_RENDERER"), gl4es_handle, dlerror());
|
||||
debugLog("%s=%p, error=%s", getenv("POJAV_RENDERER"), gl4es_handle, dlerror());
|
||||
|
||||
gl4esInitialize_func *gl4esInitialize = (gl4esInitialize_func*) dlsym(gl4es_handle, "initialize_gl4es");
|
||||
// debug("initialize_gl4es = %p", gl4esInitialize);
|
||||
// debugLog("initialize_gl4es = %p", gl4esInitialize);
|
||||
if (gl4esInitialize) {
|
||||
gl4esInitialize();
|
||||
} else {
|
||||
debug("%s", dlerror());
|
||||
debugLog("%s", dlerror());
|
||||
}
|
||||
NSLog(@"Renderer init success");
|
||||
regLog("Renderer init success");
|
||||
|
||||
return;
|
||||
} else {
|
||||
@@ -448,9 +448,9 @@ void pojavMakeCurrent(void* window) {
|
||||
OSMesaPixelStore_p(OSMESA_Y_UP,0);
|
||||
}
|
||||
|
||||
NSLog(@"OSMDroid: vendor: %s",glGetString_p(GL_VENDOR));
|
||||
NSLog(@"OSMDroid: renderer: %s",glGetString_p(GL_RENDERER));
|
||||
NSLog(@"OSMDroid: extensions: %s",glGetString_p(GL_EXTENSIONS));
|
||||
debugLog("OSMDroid: vendor: %s",glGetString_p(GL_VENDOR));
|
||||
debugLog("OSMDroid: renderer: %s",glGetString_p(GL_RENDERER));
|
||||
debugLog("OSMDroid: extensions: %s",glGetString_p(GL_EXTENSIONS));
|
||||
glClear_p(GL_COLOR_BUFFER_BIT);
|
||||
glClearColor_p(0.4f, 0.4f, 0.4f, 1.0f);
|
||||
pojavSwapBuffers();
|
||||
@@ -470,15 +470,15 @@ void* pojavCreateContext(void* contextSrc) {
|
||||
};
|
||||
EGLContext* ctx = eglCreateContext_p(potatoBridge.eglDisplay, config, (void*)contextSrc, ctx_attribs);
|
||||
potatoBridge.eglContext = ctx;
|
||||
NSLog(@"EGLBridge: Created CTX pointer = %p",ctx);
|
||||
debugLog("EGLBridge: Created CTX pointer = %p",ctx);
|
||||
//(*env)->ThrowNew(env,(*env)->FindClass(env,"java/lang/Exception"),"Trace exception");
|
||||
return (void *)ctx;
|
||||
}
|
||||
|
||||
if (config_renderer == RENDERER_VK_ZINK || config_renderer == RENDERER_VIRGL) {
|
||||
NSLog(@"OSMDroid: generating context");
|
||||
debugLog("OSMDroid: generating context");
|
||||
void* ctx = OSMesaCreateContext_p(OSMESA_RGBA,contextSrc);
|
||||
NSLog(@"OSMDroid: context=%p",ctx);
|
||||
debugLog("OSMDroid: context=%p",ctx);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
@@ -492,7 +492,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nativeRegalMakeCurrent(JNIEnv *e
|
||||
//assert(RegalMakeCurrent);
|
||||
//RegalMakeCurrent(potatoBridge.eglContext);
|
||||
|
||||
NSLog(@"Regal removed");
|
||||
regLog("Regal removed");
|
||||
abort();
|
||||
}
|
||||
|
||||
@@ -516,7 +516,7 @@ void pojavSwapInterval(int interval) {
|
||||
} break;
|
||||
|
||||
case RENDERER_VK_ZINK: {
|
||||
NSLog(@"eglSwapInterval: NOT IMPLEMENTED YET!");
|
||||
debugLog("eglSwapInterval: NOT IMPLEMENTED YET!");
|
||||
// Nothing to do here
|
||||
} break;
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@ GLAPI void GLAPIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) {
|
||||
glDrawArrays_p = dlsym(RTLD_NEXT, "glDrawArrays");
|
||||
}
|
||||
|
||||
// debug("func=%p, next=%p", glDrawArrays, glDrawArrays_real);
|
||||
// debug("glDrawArrays mode=%p", mode);
|
||||
// debugLog("func=%p, next=%p", glDrawArrays, glDrawArrays_real);
|
||||
// debugLog("glDrawArrays mode=%p", mode);
|
||||
if (mode == GL_TRIANGLE_FAN) {
|
||||
// debug("ERROR: GL_TRIANGLE_FAN unsupported!");
|
||||
// debugLog("ERROR: GL_TRIANGLE_FAN unsupported!");
|
||||
|
||||
// this is wrong but idk how to deal with it yet...
|
||||
// minecraft stills works with this for unknown reason
|
||||
|
||||
@@ -81,9 +81,7 @@ ADD_CALLBACK_WWIN(WindowPos);
|
||||
#undef ADD_CALLBACK_WWIN
|
||||
|
||||
void getJavaInputBridge(jclass* clazz, jmethodID* method) {
|
||||
#ifdef DEBUG
|
||||
debug("Debug: Initializing input bridge, method.isNull=%d, jnienv.isNull=%d\n", *method == NULL, runtimeJNIEnvPtr_ANDROID == NULL);
|
||||
#endif
|
||||
debugLog("Debug: Initializing input bridge, method.isNull=%d, jnienv.isNull=%d\n", *method == NULL, runtimeJNIEnvPtr_ANDROID == NULL);
|
||||
if (*method == NULL && runtimeJNIEnvPtr_ANDROID != NULL) {
|
||||
*clazz = (*runtimeJNIEnvPtr_ANDROID)->FindClass(runtimeJNIEnvPtr_ANDROID, "org/lwjgl/glfw/CallbackBridge");
|
||||
assert(*clazz != NULL);
|
||||
@@ -98,11 +96,9 @@ void sendData(int type, CGFloat i1, CGFloat i2, int i3, int i4) {
|
||||
getJavaInputBridge(&inputBridgeClass_ANDROID, &inputBridgeMethod_ANDROID);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
debug("Debug: Send data, jnienv.isNull=%d\n", runtimeJNIEnvPtr_ANDROID == NULL);
|
||||
#endif
|
||||
debugLog("Debug: Send data, jnienv.isNull=%d\n", runtimeJNIEnvPtr_ANDROID == NULL);
|
||||
if (runtimeJNIEnvPtr_ANDROID == NULL) {
|
||||
debug("BUG: Input is ready but thread is not attached yet.");
|
||||
debugLog("BUG: Input is ready but thread is not attached yet.");
|
||||
return;
|
||||
}
|
||||
// FIXME: should we send double instead of float?
|
||||
@@ -154,7 +150,7 @@ void callback_LauncherViewController_installMinecraft(char* versionPath) {
|
||||
}
|
||||
|
||||
void callback_SurfaceViewController_launchMinecraft(int width, int height) {
|
||||
debug("Received SurfaceViewController callback, width=%d, height=%d\n", width, height);
|
||||
debugLog("Received SurfaceViewController callback, width=%d, height=%d\n", width, height);
|
||||
|
||||
// Because UI init after JVM init, this should not be null
|
||||
assert(runtimeJNIEnvPtr_JRE != NULL);
|
||||
|
||||
+2
-1
@@ -21,7 +21,8 @@ extern "C" {
|
||||
# define DEBUG_LOGD(...)
|
||||
#endif
|
||||
|
||||
void debug(const char *message, ...) __attribute__((format(printf, 1, 2)));
|
||||
void regLog(const char *message, ...) __attribute__((format(printf, 1, 2)));
|
||||
void debugLog(const char *message, ...) __attribute__((format(printf, 1, 2)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+9
-2
@@ -1,10 +1,17 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "log.h"
|
||||
#import "LauncherPreferences.h"
|
||||
|
||||
void debug(const char *message,...)
|
||||
{
|
||||
void regLog(const char *message,...) {
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
NSLog(@"%@",[[NSString alloc] initWithFormat:[NSString stringWithUTF8String:message] arguments:args]);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void debugLog(const char *message,...)
|
||||
{
|
||||
if([getPreference(@"debug_logging") boolValue] == true) {
|
||||
regLog("%s", message);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user