Skip to content

Commit

Permalink
Fix: always bypass validation to load external dylib
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhduytran0 committed Jul 13, 2024
1 parent 2ad1ed3 commit 563f25c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Natives/JavaLauncher.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ void init_loadCustomJvmFlags(int* argc, const char** argv) {
int launchJVM(NSString *username, id launchTarget, int width, int height, int minVersion) {
NSLog(@"[JavaLauncher] Beginning JVM launch");

if (NSBundle.mainBundle.infoDictionary[@"LCDataUUID"]) {
NSDebugLog(@"[JavaLauncher] Running in LiveContainer, skipping dyld patch");
} else {
// Activate Library Validation bypass for external runtime and dylibs (JNA, etc)
init_bypassDyldLibValidation();
}


init_loadDefaultEnv();
init_loadCustomEnv();

Expand Down Expand Up @@ -138,13 +146,6 @@ int launchJVM(NSString *username, id launchTarget, int width, int height, int mi
isExecuteJar ? [launchTarget lastPathComponent] : PLProfiles.current.selectedProfile[@"lastVersionId"], minVersion]);
return 1;
} else if ([javaHome hasPrefix:@(getenv("POJAV_HOME"))]) {
if (NSBundle.mainBundle.infoDictionary[@"LCDataUUID"]) {
NSDebugLog(@"[JavaLauncher] Running in LiveContainer, skipping dyld patch");
} else {
// Activate Library Validation bypass for external runtime
init_bypassDyldLibValidation();
}

// Symlink libawt_xawt.dylib
NSString *dest = [NSString stringWithFormat:@"%@/lib/libawt_xawt.dylib", javaHome];
NSString *source = [NSString stringWithFormat:@"%@/Frameworks/libawt_xawt.dylib", NSBundle.mainBundle.bundlePath];
Expand Down

0 comments on commit 563f25c

Please sign in to comment.