All options are now applied without restarting
Instances manager: cleanup, now explicitly state the error message Moved init_loadCustomEnv() back to JavaLauncher.m
This commit is contained in:
1 parent
85bc35f679
commit
7337d90eee
4 files changed
+68
-108
No files matched your search
@@ -46,6 +46,43 @@ NSString *renderer_pre;
|
||||
NSString *allocmem_pre;
|
||||
NSString *multidir_pre;
|
||||
|
||||
void init_loadCustomEnv() {
|
||||
/* Define default env */
|
||||
|
||||
// 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)
|
||||
setenv("JAVA_AWT_PATH", [NSString stringWithFormat:@"%s/Frameworks/libawt.dylib", getenv("BUNDLE_PATH")].UTF8String, 1);
|
||||
|
||||
// Disable overloaded functions hack for Minecraft 1.17+
|
||||
setenv("LIBGL_NOINTOVLHACK", "1", 1);
|
||||
|
||||
// Override OpenGL version to 4.1 for Zink
|
||||
setenv("MESA_GL_VERSION_OVERRIDE", "4.1", 1);
|
||||
|
||||
/* Load custom env */
|
||||
FILE *envFile = fopen([NSString stringWithFormat:@"%s/custom_env.txt", getenv("POJAV_HOME")].UTF8String, "r");
|
||||
|
||||
regLog("[Pre-init] Reading custom environment variables (custom_env.txt), opened=%d\n", envFile != NULL);
|
||||
|
||||
if (envFile) {
|
||||
char *line = NULL;
|
||||
size_t len = 0;
|
||||
ssize_t read;
|
||||
while ((read = getline(&line, &len, envFile)) != -1) {
|
||||
if (line[0] == '#' || line[0] == '\n') continue;
|
||||
if (line[read-1] == '\n') {
|
||||
line[read-1] = '\0';
|
||||
}
|
||||
if (strchr(line, '=') != NULL) {
|
||||
regLog("[Pre-init] Added custom env: %s", line);
|
||||
setenv(strtok(line, "="), strtok(NULL, "="), 1);
|
||||
} else {
|
||||
regLog("[Pre-init] Warning: skipped empty value custom env: %s", line);
|
||||
}
|
||||
}
|
||||
fclose(envFile);
|
||||
}
|
||||
}
|
||||
|
||||
void init_loadCustomJvmFlags() {
|
||||
NSString *jvmargs = getPreference(@"java_args");
|
||||
BOOL isFirstArg = YES;
|
||||
@@ -94,6 +131,8 @@ NSString* environmentFailsafes(int minVersion) {
|
||||
int launchJVM(NSString *username, NSString *selectedVersion, int width, int height, int minVersion) {
|
||||
sprintf((char*) java_libs_path, "%s/libs", getenv("BUNDLE_PATH"));
|
||||
|
||||
init_loadCustomEnv();
|
||||
|
||||
regLog("[JavaLauncher] Beginning JVM launch\n");
|
||||
|
||||
NSString *javaHome_pre = getPreference(@"java_home");
|
||||
|
||||
Reference in new issue
Block a user