From 7d8f09c6d40c3c7a369761b89bbfffcc9a12e3bf Mon Sep 17 00:00:00 2001 From: Andrey Filipenkov Date: Sun, 7 Aug 2022 09:48:10 +0300 Subject: [PATCH] add overriding launch type via environment variable VCMI_LAUNCH_TYPE --- client/ios/main.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/client/ios/main.m b/client/ios/main.m index 018725e3d..dbba2cef3 100644 --- a/client/ios/main.m +++ b/client/ios/main.m @@ -13,6 +13,8 @@ #import +#include + static void startSDLManually(int argc, char * argv[]) { id appDelegate; @@ -33,8 +35,13 @@ int qt_main_wrapper(int argc, char * argv[]); int client_main(int argc, char * argv[]) { NSInteger launchType; - @autoreleasepool { - launchType = [NSUserDefaults.standardUserDefaults integerForKey:@"LaunchType"]; + __auto_type envVar = getenv("VCMI_LAUNCH_TYPE"); + if (envVar) + launchType = envVar[0] == '0' ? 0 : 1; + else { + @autoreleasepool { + launchType = [NSUserDefaults.standardUserDefaults integerForKey:@"LaunchType"]; + } } if (launchType == 1) return startSDL(argc, argv, NO);