diff --git a/Makefile b/Makefile index cb1eb7a7..6b54f23f 100644 --- a/Makefile +++ b/Makefile @@ -228,6 +228,7 @@ package: native java jre assets @cp -R $(SOURCEDIR)/Natives/*.lproj $(WORKINGDIR)/PojavLauncher.app/ || exit 1 $(call DIRCHECK,$(OUTPUTDIR)) @cp -R $(WORKINGDIR)/PojavLauncher.app $(OUTPUTDIR) + ldid -S $(OUTPUTDIR)/PojavLauncher.app; \ ldid -S$(SOURCEDIR)/entitlements.xml $(OUTPUTDIR)/PojavLauncher.app/PojavLauncher; \ rm -f $(OUTPUTDIR)/*.ipa; \ cd $(OUTPUTDIR); \ @@ -260,6 +261,7 @@ dsym: package deploy: @echo '[PojavLauncher v$(VERSION)] deploy - start' + @ldid -S $(WORKINGDIR)/PojavLauncher.app; \ @ldid -S$(SOURCEDIR)/entitlements.xml $(WORKINGDIR)/PojavLauncher.app/PojavLauncher; \ if [ '$(NOSTDIN)' = '1' ]; then \ echo '$(SUDOPASS)' | sudo -S mv $(WORKINGDIR)/*.dylib /Applications/PojavLauncher.app/Frameworks/; \ diff --git a/Natives/JavaLauncher.m b/Natives/JavaLauncher.m index 10250694..59e8b68e 100644 --- a/Natives/JavaLauncher.m +++ b/Natives/JavaLauncher.m @@ -257,7 +257,8 @@ int launchJVM(NSString *username, id launchTarget, int width, int height, int mi } margv[++margc] = cacio_classpath.UTF8String; - if (!getEntitlementValue(@"com.apple.developer.kernel.extended-virtual-addressing")) { + if (UIDevice.currentDevice.systemVersion.floatValue < 14 || + !getEntitlementValue(@"com.apple.developer.kernel.extended-virtual-addressing")) { // In jailed environment, where extended virtual addressing entitlement isn't // present (for free dev account), allocating compressed space fails. // FIXME: does extended VA allow allocating compressed class space? diff --git a/Natives/main_hook.m b/Natives/main_hook.m index 74f66663..669b17c2 100644 --- a/Natives/main_hook.m +++ b/Natives/main_hook.m @@ -2,6 +2,7 @@ #import "SurfaceViewController.h" #import "utils.h" +#include #include "external/fishhook/fishhook.h" void (*orig_abort)(); @@ -32,7 +33,14 @@ void hooked_abort() { } void* hooked_dlopen(const char* path, int mode) { - if (path && [@(path) hasSuffix:@"/libawt_xawt.dylib"]) { + // iOS 12 refuses to dlopen executables, so here we put a workaround + if (path == NULL || [@(path) hasSuffix:@"/PojavLauncher"]) { + return orig_dlopen(NULL, mode); + } + + if (getenv("POJAV_PREFER_EXTERNAL_JRE") && [@(path) hasSuffix:@"/libawt_xawt.dylib"]) { + // In this environment, libawt_xawt is not available/X11 only. + // hook dlopen to use our libawt_xawt return orig_dlopen([NSString stringWithFormat:@"%s/Frameworks/libawt_xawt.dylib", getenv("BUNDLE_PATH")].UTF8String, mode); } @@ -67,14 +75,10 @@ int hooked_open(const char *path, int oflag, ...) { } void init_hookFunctions() { - if (getenv("POJAV_PREFER_EXTERNAL_JRE")) { - // In this environment, libawt_xawt is not available/X11 only. - // hook dlopen to use our libawt_xawt - rebind_symbols((struct rebinding[1]){{"dlopen", hooked_dlopen, (void *)&orig_dlopen}}, 1); - } - rebind_symbols((struct rebinding[3]){ + rebind_symbols((struct rebinding[4]){ {"abort", hooked_abort, (void *)&orig_abort}, + {"dlopen", hooked_dlopen, (void *)&orig_dlopen}, {"exit", hooked_exit, (void *)&orig_exit}, {"open", hooked_open, (void *)&orig_open} - }, 3); + }, 4); } diff --git a/README.md b/README.md index e5681dc4..1c3ca172 100644 --- a/README.md +++ b/README.md @@ -73,9 +73,9 @@ PojavLauncher is amazing, and surprisingly stable, and it wouldn't be this way w - [LWJGLX](https://github.com/PojavLauncherTeam/lwjglx) (LWJGL2 API compatibility layer for LWJGL3): unknown license. - [Alderis](https://github.com/hbang/Alderis) (color picker for iOS < 14): [Apache 2.0 License](https://github.com/hbang/Alderis/blob/master/LICENSE.md). - [DBNumberedSlider](https://github.com/khanhduytran0/DBNumberedSlider): [Apache 2.0 License](https://github.com/immago/DBNumberedSlider/blob/master/LICENSE) -- [fishhook](https://github.com/khanhduytran0/fishhook) (jailed environment usage only): [BSD-3 License](https://github.com/facebook/fishhook/blob/main/LICENSE). +- [fishhook](https://github.com/khanhduytran0/fishhook): [BSD-3 License](https://github.com/facebook/fishhook/blob/main/LICENSE). - [Java Native Access](https://github.com/java-native-access/jna): [Apache 2.0 License](https://github.com/java-native-access/jna/blob/master/LICENSE). -- [shaderc](https://github.com/khanhduytran0/shaderc) (used by mods that uses Vulkan for rendering): [Apache 2.0 License](https://github.com/google/shaderc/blob/main/LICENSE). +- [shaderc](https://github.com/khanhduytran0/shaderc) (used by Vulkan rendering mods): [Apache 2.0 License](https://github.com/google/shaderc/blob/main/LICENSE). - [TOInsetGroupedTableView](https://github.com/TimOliver/TOInsetGroupedTableView): [MIT License](https://github.com/TimOliver/TOInsetGroupedTableView/blob/master/LICENSE). - [AltKit](https://github.com/rileytestut/AltKit) - Thanks to [MCHeads](https://mc-heads.net) for providing Minecraft avatars.