diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index cdf39fcb..f15ce00a 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -63,7 +63,7 @@ jobs: - name: Build the Debian package run: gmake -j$(sysctl -n hw.ncpu) package - - name: Generate dSYM for libpojavexec + - name: Generate dSYM for PojavCore run: dsymutil --arch arm64 Natives/build/PojavCore.framework/PojavCore - name: Upload build artifact diff --git a/.gitignore b/.gitignore index 48c9bc8b..d947fa5d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ /JavaApp/.gradle /JavaApp/build /JavaApp/local_out -/Natives/libpojavexec.dylib /Natives/PojavLauncher /Natives/build /Natives/resources/*.png diff --git a/Makefile b/Makefile index 0b0bf712..d276ccda 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,7 @@ native: -DCONFIG_COMMIT="$(COMMIT)" \ -DCONFIG_RELEASE=$(RELEASE) \ .. - @cd Natives/build && cmake --build . --config $(CMAKE_BUILD_TYPE) --target awt_headless awt_xawt PojavCore PojavLauncher + @cd Natives/build && cmake --build . --config $(CMAKE_BUILD_TYPE) --target awt_headless awt_xawt libOSMesaOverride.dylib PojavCore PojavLauncher @rm Natives/build/libawt_headless.dylib @echo 'Finished build task - native application' @@ -136,6 +136,7 @@ package: native java extras cp -R Natives/resources/* Natives/build/PojavLauncher.app/ || exit 1; \ cp Natives/build/libawt_xawt.dylib Natives/build/PojavLauncher.app/Frameworks/ || exit 1; \ ( cd Natives/build/PojavLauncher.app/Frameworks; ln -sf libawt_xawt.dylib libawt_headless.dylib ) || exit 1; \ + cp -R Natives/build/libOSMesaOverride.dylib.framework Natives/build/PojavLauncher.app/Frameworks/ || exit 1; \ cp -R Natives/build/PojavCore.framework Natives/build/PojavLauncher.app/Frameworks/ || exit 1; \ mkdir Natives/build/PojavLauncher.app/{libs,libs_caciocavallo}; \ cp JavaApp/local_out/launcher.jar Natives/build/PojavLauncher.app/libs/launcher.jar || exit 1; \ @@ -159,6 +160,7 @@ package: native java extras cp -R Natives/PkgInfo Natives/build/PojavLauncher.app/PkgInfo || exit 1; \ cp Natives/build/libawt_xawt.dylib Natives/build/PojavLauncher.app/Frameworks/ || exit 1; \ ( cd Natives/build/PojavLauncher.app/Frameworks; ln -sf libawt_xawt.dylib libawt_headless.dylib ) || exit 1; \ + cp -R Natives/build/libOSMesaOverride.dylib.framework Natives/build/PojavLauncher.app/Frameworks/ || exit 1; \ cp -R Natives/build/PojavCore.framework Natives/build/PojavLauncher.app/Frameworks/ || exit 1; \ cp -R Natives/resources/* Natives/build/PojavLauncher.app/ || exit 1; \ cp -R JavaApp/libs Natives/build/PojavLauncher.app/libs || exit 1; \ @@ -185,10 +187,17 @@ install: native java if [ '$(DEVICE_IP)' != '' ]; then \ if [ '$(DEVICE_PORT)' != '' ]; then \ scp -P $(DEVICE_PORT) packages/pojavlauncher_iphoneos-arm.deb root@$(DEVICE_IP):/var/tmp/pojavlauncher_iphoneos-arm.deb; \ - ssh root@$(DEVICE_IP) -p $(DEVICE_PORT) -t "apt remove pojavlauncher; apt remove pojavlauncher-dev; dpkg -i /var/tmp/pojavlauncher_iphoneos-arm.deb; uicache -p /Applications/PojavLauncher.app"; \ + ssh root@$(DEVICE_IP) -p $(DEVICE_PORT) -t " + apt remove pojavlauncher; \ + apt remove pojavlauncher-dev; \ + dpkg -i /var/tmp/pojavlauncher_iphoneos-arm.deb; \ + uicache -p /Applications/PojavLauncher.app"; \ else \ scp packages/pojavlauncher_iphoneos-arm.deb root@$(DEVICE_IP):/var/tmp/pojavlauncher_iphoneos-arm.deb; \ - ssh root@$(DEVICE_IP) -t "apt remove pojavlauncher; apt remove pojavlauncher-dev; dpkg -i /var/tmp/pojavlauncher_iphoneos-arm.deb; uicache -p /Applications/PojavLauncher.app"; \ + ssh root@$(DEVICE_IP) -t " + apt remove pojavlauncher; apt remove pojavlauncher-dev; \ + dpkg -i /var/tmp/pojavlauncher_iphoneos-arm.deb; \ + uicache -p /Applications/PojavLauncher.app"; \ fi; \ else \ echo 'You need to run '\''export DEVICE_IP='\'' to use make install.'; \ @@ -208,19 +217,42 @@ deploy: native java if [ '$(DEVICE_IP)' != '' ]; then \ ldid -Sentitlements.xml Natives/build/PojavLauncher.app/PojavLauncher; \ if [ '$(DEVICE_PORT)' != '' ]; then \ - scp -r -P $(DEVICE_PORT) -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null" Natives/build/PojavCore.framework \ + scp -r -P $(DEVICE_PORT) -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null" \ + Natives/build/libOSMesaOverride.dylib.framework \ + Natives/build/PojavCore.framework \ Natives/build/libawt_xawt.dylib \ Natives/build/PojavLauncher.app/PojavLauncher \ JavaApp/local_out/launcher.jar \ root@$(DEVICE_IP):/var/tmp/; \ - ssh root@$(DEVICE_IP) -p $(DEVICE_PORT) -t "mv /var/tmp/libawt_xawt.dylib /Applications/PojavLauncher.app/Frameworks/libawt_xawt.dylib && rm -rf /Applications/PojavLauncher.app/Frameworks/PojavCore.framework && mv /var/tmp/PojavCore.framework /Applications/PojavLauncher.app/Frameworks/PojavCore.framework && mv /var/tmp/PojavLauncher /Applications/PojavLauncher.app/PojavLauncher && mv /var/tmp/launcher.jar /Applications/PojavLauncher.app/libs/launcher.jar && cd /Applications/PojavLauncher.app/Frameworks && ln -sf libawt_xawt.dylib libawt_headless.dylib && killall PojavLauncher && chown -R 501:501 /Applications/PojavLauncher.app/*"; \ + ssh root@$(DEVICE_IP) -p $(DEVICE_PORT) -t " \ + mv /var/tmp/libawt_xawt.dylib /Applications/PojavLauncher.app/Frameworks/libawt_xawt.dylib && \ + rm -rf /Applications/PojavLauncher.app/Frameworks/libOSMesaOverride.dylib.framework && \ + mv /var/tmp/libOSMesaOverride.dylib.framework /Applications/PojavLauncher.app/Frameworks/libOSMesaOverride.dylib.framework && \ + rm -rf /Applications/PojavLauncher.app/Frameworks/PojavCore.framework && \ + mv /var/tmp/PojavCore.framework /Applications/PojavLauncher.app/Frameworks/PojavCore.framework && \ + mv /var/tmp/PojavLauncher /Applications/PojavLauncher.app/PojavLauncher && \ + mv /var/tmp/launcher.jar /Applications/PojavLauncher.app/libs/launcher.jar && \ + cd /Applications/PojavLauncher.app/Frameworks && \ + ln -sf libawt_xawt.dylib libawt_headless.dylib && killall PojavLauncher && \ + chown -R 501:501 /Applications/PojavLauncher.app/*"; \ else \ - scp -r -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null" Natives/build/PojavCore.framework \ + scp -r -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null" \ + Natives/build/libOSMesaOverride.dylib.framework \ + Natives/build/PojavCore.framework \ Natives/build/libawt_xawt.dylib \ Natives/build/PojavLauncher.app/PojavLauncher \ JavaApp/local_out/launcher.jar \ root@$(DEVICE_IP):/var/tmp/; \ - ssh root@$(DEVICE_IP) -t "mv /var/tmp/libawt_xawt.dylib /Applications/PojavLauncher.app/Frameworks/libawt_xawt.dylib && rm -rf /Applications/PojavLauncher.app/Frameworks/PojavCore.framework && mv /var/tmp/PojavCore.framework /Applications/PojavLauncher.app/Frameworks/PojavCore.framework && mv /var/tmp/PojavLauncher /Applications/PojavLauncher.app/PojavLauncher && mv /var/tmp/launcher.jar /Applications/PojavLauncher.app/libs/launcher.jar && cd /Applications/PojavLauncher.app/Frameworks && ln -sf libawt_xawt.dylib libawt_headless.dylib && killall PojavLauncher && chown -R 501:501 /Applications/PojavLauncher.app/*"; \ + ssh root@$(DEVICE_IP) -t " \ + mv /var/tmp/libawt_xawt.dylib /Applications/PojavLauncher.app/Frameworks/libawt_xawt.dylib && \ + rm -rf /Applications/PojavLauncher.app/Frameworks/libOSMesaOverride.dylib.framework && \ + mv /var/tmp/libOSMesaOverride.dylib.framework /Applications/PojavLauncher.app/Frameworks/libOSMesaOverride.dylib.framework && \ + rm -rf /Applications/PojavLauncher.app/Frameworks/PojavCore.framework && \ + mv /var/tmp/PojavCore.framework /Applications/PojavLauncher.app/Frameworks/PojavCore.framework && \ + mv /var/tmp/PojavLauncher /Applications/PojavLauncher.app/PojavLauncher && \ + mv /var/tmp/launcher.jar /Applications/PojavLauncher.app/libs/launcher.jar && \ + cd /Applications/PojavLauncher.app/Frameworks && ln -sf libawt_xawt.dylib libawt_headless.dylib && killall PojavLauncher && \ + chown -R 501:501 /Applications/PojavLauncher.app/*"; \ fi; \ else \ echo 'You need to run '\''export DEVICE_IP='\'' to use make deploy.'; \ @@ -231,6 +263,7 @@ deploy: native java sudo cp JavaApp/local_out/launcher.jar /Applications/PojavLauncher.app/libs/launcher.jar; \ sudo cp Natives/build/PojavLauncher.app/PojavLauncher /Applications/PojavLauncher.app/PojavLauncher; \ sudo cp Natives/build/libawt_xawt.dylib /Applications/PojavLauncher.app/Frameworks/; \ + sudo cp -R Natives/build/libOSMesaOverride.dylib.framework /Applications/PojavLauncher.app/Frameworks/; \ sudo cp -R Natives/build/PojavCore.framework /Applications/PojavLauncher.app/Frameworks/; \ cd /Applications/PojavLauncher.app/Frameworks; \ sudo ln -sf libawt_xawt.dylib libawt_headless.dylib; \ diff --git a/Natives/CMakeLists.txt b/Natives/CMakeLists.txt index 8f183f97..c7ab379d 100644 --- a/Natives/CMakeLists.txt +++ b/Natives/CMakeLists.txt @@ -26,9 +26,18 @@ target_link_libraries(awt_xawt "-lawt_headless" ) -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rpath @executable_path/Frameworks -rpath @loader_path/Frameworks") +set(CMAKE_FRAMEWORK_PATH "${CMAKE_CURRENT_LIST_DIR}/resources/Frameworks") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rpath @executable_path/Frameworks -rpath @loader_path/Frameworks") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rpath @executable_path/Frameworks -rpath @loader_path/Frameworks") + +find_library(OSMESA_LIB libOSMesa.8.dylib) + +add_library(libOSMesaOverride.dylib SHARED gl_mesa3d_patch.m) +set_target_properties(libOSMesaOverride.dylib PROPERTIES + FRAMEWORK TRUE +) +target_link_libraries(libOSMesaOverride.dylib ${OSMESA_LIB}) add_library(PojavCore SHARED AboutLauncherViewController.m @@ -54,10 +63,8 @@ add_library(PojavCore SHARED ) set_target_properties(PojavCore PROPERTIES FRAMEWORK TRUE - FRAMEWORK_VERSION CXX ) target_link_libraries(PojavCore - "-F'${CMAKE_CURRENT_LIST_DIR}/resources/Frameworks'" "-framework AuthenticationServices" "-framework CoreGraphics" "-framework QuartzCore" diff --git a/Natives/JavaLauncher.m b/Natives/JavaLauncher.m index f2ef759a..030abcd6 100644 --- a/Natives/JavaLauncher.m +++ b/Natives/JavaLauncher.m @@ -550,7 +550,7 @@ int launchJVM(int argc, char *argv[]) { char *userHome = calloc(1, 2048); char *memMin = calloc(1, 2048); char *memMax = calloc(1, 2048); - snprintf(frameworkPath, 2048, "-Djava.library.path=%s/Frameworks:%s/Frameworks/libOSMesa.8.dylib.framework", getenv("BUNDLE_PATH"), getenv("BUNDLE_PATH")); + snprintf(frameworkPath, 2048, "-Djava.library.path=%s/Frameworks:%s/Frameworks/libOSMesaOverride.dylib.framework", getenv("BUNDLE_PATH"), getenv("BUNDLE_PATH")); snprintf(javaPath, 2048, "%s/bin/java", javaHome); snprintf(userDir, 2048, "-Duser.dir=%s", getenv("POJAV_GAME_DIR")); snprintf(userHome, 2048, "-Duser.home=%s", getenv("POJAV_HOME")); diff --git a/Natives/LauncherPreferencesViewController.m b/Natives/LauncherPreferencesViewController.m index 831a22e1..38928291 100644 --- a/Natives/LauncherPreferencesViewController.m +++ b/Natives/LauncherPreferencesViewController.m @@ -58,7 +58,7 @@ NSString *libsjava8; NSString *lib_gl4es114 = @"libgl4es_114.dylib"; NSString *lib_gl4es115 = @"libgl4es_115.dylib"; NSString *lib_tinygl4angle = @"libtinygl4angle.dylib"; -NSString *lib_zink = @"libOSMesa.8.dylib"; +NSString *lib_zink = @"libOSMesaOverride.dylib"; - (void)viewDidLoad { @@ -206,7 +206,7 @@ NSString *lib_zink = @"libOSMesa.8.dylib"; [rendererList addObject:gl4es114]; [rendererList addObject:gl4es115]; [rendererList addObject:tinygl4angle]; - //[rendererList addObject:zink]; //TODO + [rendererList addObject:zink]; [self instanceDirCont]; diff --git a/Natives/SurfaceViewController.m b/Natives/SurfaceViewController.m index 3de5b9a1..8a462e85 100644 --- a/Natives/SurfaceViewController.m +++ b/Natives/SurfaceViewController.m @@ -53,7 +53,7 @@ const void * _CGDataProviderGetBytePointerCallbackOSMESA(void *info) { - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; - if ([@(getenv("RENDERER")) hasPrefix:@"libOSMesa"]) { + if ([@(getenv("RENDERER")) hasPrefix:@"libOSMesaOverride"]) { self.layer.opaque = YES; colorSpace = CGColorSpaceCreateDeviceRGB(); diff --git a/Natives/egl_bridge.m b/Natives/egl_bridge.m index b70e5ff7..1254b1ab 100644 --- a/Natives/egl_bridge.m +++ b/Natives/egl_bridge.m @@ -139,7 +139,7 @@ void loadSymbols() { char fileName[2048]; switch (config_renderer) { case RENDERER_VK_ZINK: - sprintf((char *)fileName, "%s/Frameworks/libOSMesa.8.dylib.framework/libOSMesa.8.dylib", getenv("BUNDLE_PATH")); + sprintf((char *)fileName, "%s/Frameworks/libOSMesaOverride.dylib.framework/libOSMesaOverride.dylib", getenv("BUNDLE_PATH")); break; case RENDERER_MTL_ANGLE: sprintf((char *)fileName, "%s/Frameworks/MetalANGLE.framework/MetalANGLE", getenv("BUNDLE_PATH")); diff --git a/Natives/gl_mesa3d_patch.c b/Natives/gl_mesa3d_patch.m similarity index 86% rename from Natives/gl_mesa3d_patch.c rename to Natives/gl_mesa3d_patch.m index 23af71b6..dbd3b900 100644 --- a/Natives/gl_mesa3d_patch.c +++ b/Natives/gl_mesa3d_patch.m @@ -18,8 +18,8 @@ GLAPI void GLAPIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) { // this is wrong but idk how to deal with it yet... // minecraft stills works with this for unknown reason - glDrawArrays_real(GL_TRIANGLE_STRIP, first, count); + glDrawArrays_p(GL_TRIANGLE_STRIP, first, count); } else { - glDrawArrays_real(mode, first, count); + glDrawArrays_p(mode, first, count); } } diff --git a/Natives/resources/Frameworks/libOSMesa.8.dylib.framework/libOSMesa.8.dylib b/Natives/resources/Frameworks/libOSMesa.8.dylib.framework/libOSMesa.8.dylib index 61fc3e4d..8c7a816c 100755 Binary files a/Natives/resources/Frameworks/libOSMesa.8.dylib.framework/libOSMesa.8.dylib and b/Natives/resources/Frameworks/libOSMesa.8.dylib.framework/libOSMesa.8.dylib differ