export_plugin.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. /**************************************************************************/
  2. /* export_plugin.cpp */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #include "export_plugin.h"
  31. #include "logo_svg.gen.h"
  32. #include "run_icon_svg.gen.h"
  33. #include "editor/editor_node.h"
  34. Vector<String> EditorExportPlatformIOS::device_types({ "iPhone", "iPad" });
  35. void EditorExportPlatformIOS::initialize() {
  36. if (EditorNode::get_singleton()) {
  37. EditorExportPlatformAppleEmbedded::_initialize(_ios_logo_svg, _ios_run_icon_svg);
  38. #ifdef MACOS_ENABLED
  39. _start_remote_device_poller_thread();
  40. #endif
  41. }
  42. }
  43. EditorExportPlatformIOS::~EditorExportPlatformIOS() {
  44. #ifdef MACOS_ENABLED
  45. _stop_remote_device_poller_thread();
  46. #endif
  47. }
  48. void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options) const {
  49. EditorExportPlatformAppleEmbedded::get_export_options(r_options);
  50. r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/targeted_device_family", PROPERTY_HINT_ENUM, "iPhone,iPad,iPhone & iPad"), 2));
  51. r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/min_ios_version"), get_minimum_deployment_target()));
  52. r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "storyboard/image_scale_mode", PROPERTY_HINT_ENUM, "Same as Logo,Center,Scale to Fit,Scale to Fill,Scale"), 0));
  53. r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "storyboard/custom_image@2x", PROPERTY_HINT_FILE_PATH, "*.png,*.jpg,*.jpeg"), ""));
  54. r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "storyboard/custom_image@3x", PROPERTY_HINT_FILE_PATH, "*.png,*.jpg,*.jpeg"), ""));
  55. r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "storyboard/use_custom_bg_color"), false));
  56. r_options->push_back(ExportOption(PropertyInfo(Variant::COLOR, "storyboard/custom_bg_color"), Color()));
  57. }
  58. bool EditorExportPlatformIOS::has_valid_export_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates, bool p_debug) const {
  59. bool valid = EditorExportPlatformAppleEmbedded::has_valid_export_configuration(p_preset, r_error, r_missing_templates, p_debug);
  60. String err;
  61. String rendering_method = get_project_setting(p_preset, "rendering/renderer/rendering_method.mobile");
  62. String rendering_driver = get_project_setting(p_preset, "rendering/rendering_device/driver." + get_platform_name());
  63. if ((rendering_method == "forward_plus" || rendering_method == "mobile") && rendering_driver == "metal") {
  64. float version = p_preset->get("application/min_ios_version").operator String().to_float();
  65. if (version < 14.0) {
  66. err += TTR("Metal renderer require iOS 14+.") + "\n";
  67. }
  68. }
  69. if (!err.is_empty()) {
  70. if (!r_error.is_empty()) {
  71. r_error += err;
  72. } else {
  73. r_error = err;
  74. }
  75. }
  76. return valid;
  77. }
  78. HashMap<String, Variant> EditorExportPlatformIOS::get_custom_project_settings(const Ref<EditorExportPreset> &p_preset) const {
  79. HashMap<String, Variant> settings;
  80. int image_scale_mode = p_preset->get("storyboard/image_scale_mode");
  81. String value;
  82. switch (image_scale_mode) {
  83. case 0: {
  84. String logo_path = get_project_setting(p_preset, "application/boot_splash/image");
  85. RenderingServer::SplashStretchMode stretch_mode = get_project_setting(p_preset, "application/boot_splash/stretch_mode");
  86. // If custom logo is not specified, Godot does not scale default one, so we should do the same.
  87. if (logo_path.is_empty()) {
  88. value = "center";
  89. } else {
  90. switch (stretch_mode) {
  91. case RenderingServer::SplashStretchMode::SPLASH_STRETCH_MODE_DISABLED: {
  92. value = "center";
  93. } break;
  94. case RenderingServer::SplashStretchMode::SPLASH_STRETCH_MODE_KEEP: {
  95. value = "scaleAspectFit";
  96. } break;
  97. case RenderingServer::SplashStretchMode::SPLASH_STRETCH_MODE_KEEP_WIDTH: {
  98. value = "scaleAspectFit";
  99. } break;
  100. case RenderingServer::SplashStretchMode::SPLASH_STRETCH_MODE_KEEP_HEIGHT: {
  101. value = "scaleAspectFit";
  102. } break;
  103. case RenderingServer::SplashStretchMode::SPLASH_STRETCH_MODE_COVER: {
  104. value = "scaleAspectFill";
  105. } break;
  106. case RenderingServer::SplashStretchMode::SPLASH_STRETCH_MODE_IGNORE: {
  107. value = "scaleToFill";
  108. } break;
  109. }
  110. }
  111. } break;
  112. default: {
  113. value = storyboard_image_scale_mode[image_scale_mode - 1];
  114. }
  115. }
  116. settings["ios/launch_screen_image_mode"] = value;
  117. return settings;
  118. }
  119. Error EditorExportPlatformIOS::_export_loading_screen_file(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir) {
  120. const String custom_launch_image_2x = p_preset->get("storyboard/custom_image@2x");
  121. const String custom_launch_image_3x = p_preset->get("storyboard/custom_image@3x");
  122. if (custom_launch_image_2x.length() > 0 && custom_launch_image_3x.length() > 0) {
  123. String image_path = p_dest_dir.path_join("[email protected]");
  124. Error err = OK;
  125. Ref<Image> image = _load_icon_or_splash_image(custom_launch_image_2x, &err);
  126. if (err != OK || image.is_null() || image->is_empty()) {
  127. return err;
  128. }
  129. if (image->save_png(image_path) != OK) {
  130. return ERR_FILE_CANT_WRITE;
  131. }
  132. image_path = p_dest_dir.path_join("[email protected]");
  133. image = _load_icon_or_splash_image(custom_launch_image_3x, &err);
  134. if (err != OK || image.is_null() || image->is_empty()) {
  135. return err;
  136. }
  137. if (image->save_png(image_path) != OK) {
  138. return ERR_FILE_CANT_WRITE;
  139. }
  140. } else {
  141. Error err = OK;
  142. Ref<Image> splash;
  143. const String splash_path = get_project_setting(p_preset, "application/boot_splash/image");
  144. if (!splash_path.is_empty()) {
  145. splash = _load_icon_or_splash_image(splash_path, &err);
  146. }
  147. if (err != OK || splash.is_null() || splash->is_empty()) {
  148. splash.instantiate(boot_splash_png);
  149. }
  150. // Using same image for both @2x and @3x
  151. // because Godot's own boot logo uses single image for all resolutions.
  152. // Also not using @1x image, because devices using this image variant
  153. // are not supported by iOS 9, which is minimal target.
  154. const String splash_png_path_2x = p_dest_dir.path_join("[email protected]");
  155. const String splash_png_path_3x = p_dest_dir.path_join("[email protected]");
  156. if (splash->save_png(splash_png_path_2x) != OK) {
  157. return ERR_FILE_CANT_WRITE;
  158. }
  159. if (splash->save_png(splash_png_path_3x) != OK) {
  160. return ERR_FILE_CANT_WRITE;
  161. }
  162. }
  163. return OK;
  164. }
  165. Vector<EditorExportPlatformAppleEmbedded::IconInfo> EditorExportPlatformIOS::get_icon_infos() const {
  166. Vector<EditorExportPlatformAppleEmbedded::IconInfo> icon_infos;
  167. return {
  168. // Settings on iPhone, iPad Pro, iPad, iPad mini
  169. { PNAME("icons/settings_58x58"), "universal", "Icon-58", "58", "2x", "29x29", false },
  170. { PNAME("icons/settings_87x87"), "universal", "Icon-87", "87", "3x", "29x29", false },
  171. // Notifications on iPhone, iPad Pro, iPad, iPad mini
  172. { PNAME("icons/notification_40x40"), "universal", "Icon-40", "40", "2x", "20x20", false },
  173. { PNAME("icons/notification_60x60"), "universal", "Icon-60", "60", "3x", "20x20", false },
  174. { PNAME("icons/notification_76x76"), "universal", "Icon-76", "76", "2x", "38x38", false },
  175. { PNAME("icons/notification_114x114"), "universal", "Icon-114", "114", "3x", "38x38", false },
  176. // Spotlight on iPhone, iPad Pro, iPad, iPad mini
  177. { PNAME("icons/spotlight_80x80"), "universal", "Icon-80", "80", "2x", "40x40", false },
  178. { PNAME("icons/spotlight_120x120"), "universal", "Icon-120", "120", "3x", "40x40", false },
  179. // Home Screen on iPhone
  180. { PNAME("icons/iphone_120x120"), "universal", "Icon-120-1", "120", "2x", "60x60", false },
  181. { PNAME("icons/iphone_180x180"), "universal", "Icon-180", "180", "3x", "60x60", false },
  182. // Home Screen on iPad Pro
  183. { PNAME("icons/ipad_167x167"), "universal", "Icon-167", "167", "2x", "83.5x83.5", false },
  184. // Home Screen on iPad, iPad mini
  185. { PNAME("icons/ipad_152x152"), "universal", "Icon-152", "152", "2x", "76x76", false },
  186. { PNAME("icons/ios_128x128"), "universal", "Icon-128", "128", "2x", "64x64", false },
  187. { PNAME("icons/ios_192x192"), "universal", "Icon-192", "192", "3x", "64x64", false },
  188. { PNAME("icons/ios_136x136"), "universal", "Icon-136", "136", "2x", "68x68", false },
  189. // App Store
  190. { PNAME("icons/app_store_1024x1024"), "universal", "Icon-1024", "1024", "1x", "1024x1024", true },
  191. };
  192. }
  193. Error EditorExportPlatformIOS::_export_icons(const Ref<EditorExportPreset> &p_preset, const String &p_iconset_dir) {
  194. String json_description = "{\"images\":[";
  195. String sizes;
  196. Ref<DirAccess> da = DirAccess::open(p_iconset_dir);
  197. if (da.is_null()) {
  198. add_message(EXPORT_MESSAGE_ERROR, TTR("Export Icons"), vformat(TTR("Could not open a directory at path \"%s\"."), p_iconset_dir));
  199. return ERR_CANT_OPEN;
  200. }
  201. Color boot_bg_color = get_project_setting(p_preset, "application/boot_splash/bg_color");
  202. enum IconColorMode {
  203. ICON_NORMAL,
  204. ICON_DARK,
  205. ICON_TINTED,
  206. ICON_MAX,
  207. };
  208. Vector<IconInfo> icon_infos = get_icon_infos();
  209. bool first_icon = true;
  210. for (int i = 0; i < icon_infos.size(); ++i) {
  211. for (int color_mode = ICON_NORMAL; color_mode < ICON_MAX; color_mode++) {
  212. IconInfo info = icon_infos[i];
  213. int side_size = String(info.actual_size_side).to_int();
  214. String key = info.preset_key;
  215. String exp_name = info.export_name;
  216. if (color_mode == ICON_DARK) {
  217. key += "_dark";
  218. exp_name += "_dark";
  219. } else if (color_mode == ICON_TINTED) {
  220. key += "_tinted";
  221. exp_name += "_tinted";
  222. }
  223. exp_name += ".png";
  224. String icon_path = p_preset->get(key);
  225. bool resize_waning = true;
  226. if (icon_path.is_empty()) {
  227. // Load and resize base icon.
  228. key = "icons/icon_1024x1024";
  229. if (color_mode == ICON_DARK) {
  230. key += "_dark";
  231. } else if (color_mode == ICON_TINTED) {
  232. key += "_tinted";
  233. }
  234. icon_path = p_preset->get(key);
  235. resize_waning = false;
  236. }
  237. if (icon_path.is_empty()) {
  238. if (color_mode != ICON_NORMAL) {
  239. continue;
  240. }
  241. // Resize main app icon.
  242. icon_path = get_project_setting(p_preset, "application/config/icon");
  243. Error err = OK;
  244. Ref<Image> img = _load_icon_or_splash_image(icon_path, &err);
  245. if (err != OK || img.is_null() || img->is_empty()) {
  246. add_message(EXPORT_MESSAGE_ERROR, TTR("Export Icons"), vformat("Invalid icon (%s): '%s'.", info.preset_key, icon_path));
  247. return ERR_UNCONFIGURED;
  248. } else if (info.force_opaque && img->detect_alpha() != Image::ALPHA_NONE) {
  249. img->resize(side_size, side_size, (Image::Interpolation)(p_preset->get("application/icon_interpolation").operator int()));
  250. Ref<Image> new_img = Image::create_empty(side_size, side_size, false, Image::FORMAT_RGBA8);
  251. new_img->fill(boot_bg_color);
  252. _blend_and_rotate(new_img, img, false);
  253. err = new_img->save_png(p_iconset_dir + exp_name);
  254. } else {
  255. img->resize(side_size, side_size, (Image::Interpolation)(p_preset->get("application/icon_interpolation").operator int()));
  256. err = img->save_png(p_iconset_dir + exp_name);
  257. }
  258. if (err) {
  259. add_message(EXPORT_MESSAGE_ERROR, TTR("Export Icons"), vformat("Failed to export icon (%s): '%s'.", info.preset_key, icon_path));
  260. return err;
  261. }
  262. } else {
  263. // Load custom icon and resize if required.
  264. Error err = OK;
  265. Ref<Image> img = _load_icon_or_splash_image(icon_path, &err);
  266. if (err != OK || img.is_null() || img->is_empty()) {
  267. add_message(EXPORT_MESSAGE_ERROR, TTR("Export Icons"), vformat("Invalid icon (%s): '%s'.", info.preset_key, icon_path));
  268. return ERR_UNCONFIGURED;
  269. } else if (info.force_opaque && img->detect_alpha() != Image::ALPHA_NONE) {
  270. if (resize_waning) {
  271. add_message(EXPORT_MESSAGE_WARNING, TTR("Export Icons"), vformat("Icon (%s) must be opaque.", info.preset_key));
  272. }
  273. img->resize(side_size, side_size, (Image::Interpolation)(p_preset->get("application/icon_interpolation").operator int()));
  274. Ref<Image> new_img = Image::create_empty(side_size, side_size, false, Image::FORMAT_RGBA8);
  275. new_img->fill(boot_bg_color);
  276. _blend_and_rotate(new_img, img, false);
  277. err = new_img->save_png(p_iconset_dir + exp_name);
  278. } else if (img->get_width() != side_size || img->get_height() != side_size) {
  279. if (resize_waning) {
  280. add_message(EXPORT_MESSAGE_WARNING, TTR("Export Icons"), vformat("Icon (%s): '%s' has incorrect size %s and was automatically resized to %s.", info.preset_key, icon_path, img->get_size(), Vector2i(side_size, side_size)));
  281. }
  282. img->resize(side_size, side_size, (Image::Interpolation)(p_preset->get("application/icon_interpolation").operator int()));
  283. err = img->save_png(p_iconset_dir + exp_name);
  284. } else if (!icon_path.ends_with(".png")) {
  285. err = img->save_png(p_iconset_dir + exp_name);
  286. } else {
  287. err = da->copy(icon_path, p_iconset_dir + exp_name);
  288. }
  289. if (err) {
  290. add_message(EXPORT_MESSAGE_ERROR, TTR("Export Icons"), vformat("Failed to export icon (%s): '%s'.", info.preset_key, icon_path));
  291. return err;
  292. }
  293. }
  294. sizes += String(info.actual_size_side) + "\n";
  295. if (first_icon) {
  296. first_icon = false;
  297. } else {
  298. json_description += ",";
  299. }
  300. json_description += String("{");
  301. if (color_mode != ICON_NORMAL) {
  302. json_description += String("\"appearances\":[{");
  303. json_description += String("\"appearance\":\"luminosity\",");
  304. if (color_mode == ICON_DARK) {
  305. json_description += String("\"value\":\"dark\"");
  306. } else if (color_mode == ICON_TINTED) {
  307. json_description += String("\"value\":\"tinted\"");
  308. }
  309. json_description += String("}],");
  310. }
  311. json_description += String("\"idiom\":") + "\"" + info.idiom + "\",";
  312. json_description += String("\"platform\":\"" + get_platform_name() + "\",");
  313. json_description += String("\"size\":") + "\"" + info.unscaled_size + "\",";
  314. if (String(info.scale) != "1x") {
  315. json_description += String("\"scale\":") + "\"" + info.scale + "\",";
  316. }
  317. json_description += String("\"filename\":") + "\"" + exp_name + "\"";
  318. json_description += String("}");
  319. }
  320. }
  321. json_description += "],\"info\":{\"author\":\"xcode\",\"version\":1}}";
  322. Ref<FileAccess> json_file = FileAccess::open(p_iconset_dir + "Contents.json", FileAccess::WRITE);
  323. if (json_file.is_null()) {
  324. add_message(EXPORT_MESSAGE_ERROR, TTR("Export Icons"), vformat(TTR("Could not write to a file at path \"%s\"."), p_iconset_dir + "Contents.json"));
  325. return ERR_CANT_CREATE;
  326. }
  327. CharString json_utf8 = json_description.utf8();
  328. json_file->store_buffer((const uint8_t *)json_utf8.get_data(), json_utf8.length());
  329. Ref<FileAccess> sizes_file = FileAccess::open(p_iconset_dir + "sizes", FileAccess::WRITE);
  330. if (sizes_file.is_null()) {
  331. add_message(EXPORT_MESSAGE_ERROR, TTR("Export Icons"), vformat(TTR("Could not write to a file at path \"%s\"."), p_iconset_dir + "sizes"));
  332. return ERR_CANT_CREATE;
  333. }
  334. CharString sizes_utf8 = sizes.utf8();
  335. sizes_file->store_buffer((const uint8_t *)sizes_utf8.get_data(), sizes_utf8.length());
  336. return OK;
  337. }
  338. String EditorExportPlatformIOS::_process_config_file_line(const Ref<EditorExportPreset> &p_preset, const String &p_line, const AppleEmbeddedConfigData &p_config, bool p_debug, const CodeSigningDetails &p_code_signing) {
  339. // Do iOS specific processing first, and call super implementation if there are no matches
  340. String strnew;
  341. // Supported Destinations
  342. if (p_line.contains("$targeted_device_family")) {
  343. String xcode_value;
  344. switch ((int)p_preset->get("application/targeted_device_family")) {
  345. case 0: // iPhone
  346. xcode_value = "1";
  347. break;
  348. case 1: // iPad
  349. xcode_value = "2";
  350. break;
  351. case 2: // iPhone & iPad
  352. xcode_value = "1,2";
  353. break;
  354. }
  355. strnew += p_line.replace("$targeted_device_family", xcode_value) + "\n";
  356. // MoltenVK Framework
  357. } else if (p_line.contains("$moltenvk_buildfile")) {
  358. String value = "9039D3BE24C093AC0020482C /* MoltenVK.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9039D3BD24C093AC0020482C /* MoltenVK.xcframework */; };";
  359. strnew += p_line.replace("$moltenvk_buildfile", value) + "\n";
  360. } else if (p_line.contains("$moltenvk_fileref")) {
  361. String value = "9039D3BD24C093AC0020482C /* MoltenVK.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MoltenVK; path = MoltenVK.xcframework; sourceTree = \"<group>\"; };";
  362. strnew += p_line.replace("$moltenvk_fileref", value) + "\n";
  363. } else if (p_line.contains("$moltenvk_buildphase")) {
  364. String value = "9039D3BE24C093AC0020482C /* MoltenVK.xcframework in Frameworks */,";
  365. strnew += p_line.replace("$moltenvk_buildphase", value) + "\n";
  366. } else if (p_line.contains("$moltenvk_buildgrp")) {
  367. String value = "9039D3BD24C093AC0020482C /* MoltenVK.xcframework */,";
  368. strnew += p_line.replace("$moltenvk_buildgrp", value) + "\n";
  369. // Launch Storyboard
  370. } else if (p_line.contains("$plist_launch_screen_name")) {
  371. String value = "<key>UILaunchStoryboardName</key>\n<string>Launch Screen</string>";
  372. strnew += p_line.replace("$plist_launch_screen_name", value) + "\n";
  373. } else if (p_line.contains("$pbx_launch_screen_file_reference")) {
  374. String value = "90DD2D9D24B36E8000717FE1 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = \"Launch Screen.storyboard\"; sourceTree = \"<group>\"; };";
  375. strnew += p_line.replace("$pbx_launch_screen_file_reference", value) + "\n";
  376. } else if (p_line.contains("$pbx_launch_screen_copy_files")) {
  377. String value = "90DD2D9D24B36E8000717FE1 /* Launch Screen.storyboard */,";
  378. strnew += p_line.replace("$pbx_launch_screen_copy_files", value) + "\n";
  379. } else if (p_line.contains("$pbx_launch_screen_build_phase")) {
  380. String value = "90DD2D9E24B36E8000717FE1 /* Launch Screen.storyboard in Resources */,";
  381. strnew += p_line.replace("$pbx_launch_screen_build_phase", value) + "\n";
  382. } else if (p_line.contains("$pbx_launch_screen_build_reference")) {
  383. String value = "90DD2D9E24B36E8000717FE1 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 90DD2D9D24B36E8000717FE1 /* Launch Screen.storyboard */; };";
  384. strnew += p_line.replace("$pbx_launch_screen_build_reference", value) + "\n";
  385. // Launch Storyboard customization
  386. } else if (p_line.contains("$launch_screen_image_mode")) {
  387. int image_scale_mode = p_preset->get("storyboard/image_scale_mode");
  388. String value;
  389. switch (image_scale_mode) {
  390. case 0: {
  391. String logo_path = get_project_setting(p_preset, "application/boot_splash/image");
  392. bool is_on = get_project_setting(p_preset, "application/boot_splash/fullsize");
  393. // If custom logo is not specified, Godot does not scale default one, so we should do the same.
  394. value = (is_on && logo_path.length() > 0) ? "scaleAspectFit" : "center";
  395. } break;
  396. default: {
  397. value = storyboard_image_scale_mode[image_scale_mode - 1];
  398. }
  399. }
  400. strnew += p_line.replace("$launch_screen_image_mode", value) + "\n";
  401. } else if (p_line.contains("$launch_screen_background_color")) {
  402. bool use_custom = p_preset->get("storyboard/use_custom_bg_color");
  403. Color color = use_custom ? p_preset->get("storyboard/custom_bg_color") : get_project_setting(p_preset, "application/boot_splash/bg_color");
  404. const String value_format = "red=\"$red\" green=\"$green\" blue=\"$blue\" alpha=\"$alpha\"";
  405. Dictionary value_dictionary;
  406. value_dictionary["red"] = color.r;
  407. value_dictionary["green"] = color.g;
  408. value_dictionary["blue"] = color.b;
  409. value_dictionary["alpha"] = color.a;
  410. String value = value_format.format(value_dictionary, "$_");
  411. strnew += p_line.replace("$launch_screen_background_color", value) + "\n";
  412. // OS Deployment Target
  413. } else if (p_line.contains("$os_deployment_target")) {
  414. String min_version = p_preset->get("application/min_" + get_platform_name() + "_version");
  415. String value = "IPHONEOS_DEPLOYMENT_TARGET = " + min_version + ";";
  416. strnew += p_line.replace("$os_deployment_target", value) + "\n";
  417. // Valid Archs
  418. } else if (p_line.contains("$valid_archs")) {
  419. strnew += p_line.replace("$valid_archs", "arm64 x86_64") + "\n";
  420. // Apple Embedded common
  421. } else {
  422. strnew += EditorExportPlatformAppleEmbedded::_process_config_file_line(p_preset, p_line, p_config, p_debug, p_code_signing);
  423. }
  424. return strnew;
  425. }