diff --git a/Makefile b/Makefile index ed0ff2e8..c52b34a3 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,14 @@ DETECT := $(shell clang -v 2>&1 | grep Target | cut -b 9-60) # version 1.3 on iPhone9,1 running 14.6 VERSION := $(shell cat DEBIAN/control | grep Version | cut -b 9-60) COMMIT := $(shell git log --oneline | sed '2,10000000d' | cut -b 1-7) +ifndef RELEASE +RELEASE := 0 +endif +ifeq ($(filter 1,$(RELEASE)),) +CMAKE_BUILD_TYPE := RelWithDebInfo +else +CMAKE_BUILD_TYPE := Debug +endif # Distinguish iOS from macOS ifneq ($(filter arm64-apple-ios%,$(DETECT)),) @@ -97,7 +105,7 @@ native: @echo 'Starting build task - native application' @mkdir -p Natives/build @cd Natives/build && cmake . \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \ -DCMAKE_CROSSCOMPILING=true \ -DCMAKE_SYSTEM_NAME=Darwin \ -DCMAKE_SYSTEM_PROCESSOR=aarch64 \ @@ -105,8 +113,9 @@ native: -DCMAKE_OSX_ARCHITECTURES=arm64 \ -DCMAKE_C_FLAGS="-arch arm64 -miphoneos-version-min=12.0" \ -DCONFIG_COMMIT="$(COMMIT)" \ + -DCONFIG_RELEASE=$(RELEASE) \ .. - @cd Natives/build && cmake --build . --config Release --target awt_headless awt_xawt pojavexec PojavLauncher + @cd Natives/build && cmake --build . --config $(CMAKE_BUILD_TYPE) --target awt_headless awt_xawt pojavexec PojavLauncher @rm Natives/build/libawt_headless.dylib @echo 'Finished build task - native application' @@ -124,7 +133,6 @@ extras: @if [ '$(IOS)' = '0' ]; then \ mkdir -p Natives/build/PojavLauncher.app/Base.lproj; \ xcrun actool Natives/Assets.xcassets --compile Natives/resources --platform iphoneos --minimum-deployment-target 12.0 --app-icon AppIcon --output-partial-info-plist /dev/null || exit 1; \ - ibtool --compile Natives/build/PojavLauncher.app/Base.lproj/MinecraftSurface.storyboardc Natives/en.lproj/MinecraftSurface.storyboard || exit 1; \ ibtool --compile Natives/build/PojavLauncher.app/Base.lproj/LaunchScreen.storyboardc Natives/en.lproj/LaunchScreen.storyboard || exit 1; \ elif [ '$(IOS)' = '1' ]; then \ echo 'Due to the required tools not being available, you cannot compile the extras for PojavLauncher with an iOS device.'; \ diff --git a/Natives/AboutLauncherViewController.m b/Natives/AboutLauncherViewController.m index a897a810..80b28b20 100644 --- a/Natives/AboutLauncherViewController.m +++ b/Natives/AboutLauncherViewController.m @@ -5,7 +5,7 @@ #import -#ifdef NDEBUG +#if CONFIG_RELEASE == 1 # define CONFIG_TYPE "release" #else # define CONFIG_TYPE "debug" diff --git a/Natives/CMakeLists.txt b/Natives/CMakeLists.txt index 97addf93..c47c793f 100644 --- a/Natives/CMakeLists.txt +++ b/Natives/CMakeLists.txt @@ -12,6 +12,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rpath @executable_path/Fr set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rpath /usr/lib/jvm/java-8-openjdk/lib") add_definitions(-DCONFIG_COMMIT="${CONFIG_COMMIT}") +add_definitions(-DCONFIG_RELEASE=${CONFIG_RELEASE}) # EXT: stub library, delete after compile awt_xawt add_library(awt_headless SHARED diff --git a/Natives/SurfaceViewController.m b/Natives/SurfaceViewController.m index 0aa9d91b..d974bfd1 100644 --- a/Natives/SurfaceViewController.m +++ b/Natives/SurfaceViewController.m @@ -77,6 +77,9 @@ int notchOffset; savedWidth = roundf(width * screenScale); savedHeight = roundf(height * screenScale); + MGLKView *surfaceView = [[MGLKView alloc] initWithFrame:self.view.frame]; + self.view = surfaceView; + touchView = [[UIView alloc] initWithFrame:self.view.frame]; notchOffset = insets.left; @@ -191,9 +194,8 @@ int notchOffset; viewController = self; - MGLKView *view = glView = (MGLKView *) self.view; - view.drawableDepthFormat = MGLDrawableDepthFormat24; - view.enableSetNeedsDisplay = YES; + surfaceView.drawableDepthFormat = MGLDrawableDepthFormat24; + surfaceView.enableSetNeedsDisplay = YES; // [self setPreferredFramesPerSecond:1000]; // Init GLES @@ -207,7 +209,7 @@ int notchOffset; NSLog(@"Failed to create ES context"); } - view.context = self.context; + surfaceView.context = self.context; #ifndef USE_EGL glContext = self.context; #endif diff --git a/Natives/en.lproj/MinecraftSurface.storyboard b/Natives/en.lproj/MinecraftSurface.storyboard deleted file mode 100644 index 0a3373b9..00000000 --- a/Natives/en.lproj/MinecraftSurface.storyboard +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Natives/en.lproj/MinecraftSurface.storyboardc/2-view-3.nib b/Natives/en.lproj/MinecraftSurface.storyboardc/2-view-3.nib deleted file mode 100644 index 6fc6983c..00000000 Binary files a/Natives/en.lproj/MinecraftSurface.storyboardc/2-view-3.nib and /dev/null differ diff --git a/Natives/en.lproj/MinecraftSurface.storyboardc/Info.plist b/Natives/en.lproj/MinecraftSurface.storyboardc/Info.plist deleted file mode 100644 index 3c05c62b..00000000 Binary files a/Natives/en.lproj/MinecraftSurface.storyboardc/Info.plist and /dev/null differ diff --git a/Natives/en.lproj/MinecraftSurface.storyboardc/MinecraftSurfaceVC.nib b/Natives/en.lproj/MinecraftSurface.storyboardc/MinecraftSurfaceVC.nib deleted file mode 100644 index f7f0f265..00000000 Binary files a/Natives/en.lproj/MinecraftSurface.storyboardc/MinecraftSurfaceVC.nib and /dev/null differ diff --git a/Natives/ios_uikit_bridge.m b/Natives/ios_uikit_bridge.m index f2bdf7ea..83c1f63d 100644 --- a/Natives/ios_uikit_bridge.m +++ b/Natives/ios_uikit_bridge.m @@ -149,8 +149,7 @@ void UIKit_launchJarFile(const char* filepath) { void UIKit_launchMinecraftSurfaceVC() { dispatch_async(dispatch_get_main_queue(), ^{ UIViewController *rootController = UIApplication.sharedApplication.windows.lastObject.rootViewController; - UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MinecraftSurface" bundle:nil]; - SurfaceViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"MinecraftSurfaceVC"]; + SurfaceViewController *vc = [[SurfaceViewController alloc] init]; vc.modalPresentationStyle = UIModalPresentationFullScreen; [rootController presentViewController:vc animated:YES completion:nil]; // rootController.childForScreenEdgesDeferringSystemGestures = vc;