export_plugin.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  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. bool is_on = get_project_setting(p_preset, "application/boot_splash/fullsize");
  86. // If custom logo is not specified, Godot does not scale default one, so we should do the same.
  87. value = (is_on && logo_path.length() > 0) ? "scaleAspectFit" : "center";
  88. } break;
  89. default: {
  90. value = storyboard_image_scale_mode[image_scale_mode - 1];
  91. }
  92. }
  93. settings["ios/launch_screen_image_mode"] = value;
  94. return settings;
  95. }
  96. Error EditorExportPlatformIOS::_export_loading_screen_file(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir) {
  97. const String custom_launch_image_2x = p_preset->get("storyboard/custom_image@2x");
  98. const String custom_launch_image_3x = p_preset->get("storyboard/custom_image@3x");
  99. if (custom_launch_image_2x.length() > 0 && custom_launch_image_3x.length() > 0) {
  100. String image_path = p_dest_dir.path_join("[email protected]");
  101. Error err = OK;
  102. Ref<Image> image = _load_icon_or_splash_image(custom_launch_image_2x, &err);
  103. if (err != OK || image.is_null() || image->is_empty()) {
  104. return err;
  105. }
  106. if (image->save_png(image_path) != OK) {
  107. return ERR_FILE_CANT_WRITE;
  108. }
  109. image_path = p_dest_dir.path_join("[email protected]");
  110. image = _load_icon_or_splash_image(custom_launch_image_3x, &err);
  111. if (err != OK || image.is_null() || image->is_empty()) {
  112. return err;
  113. }
  114. if (image->save_png(image_path) != OK) {
  115. return ERR_FILE_CANT_WRITE;
  116. }
  117. } else {
  118. Error err = OK;
  119. Ref<Image> splash;
  120. const String splash_path = get_project_setting(p_preset, "application/boot_splash/image");
  121. if (!splash_path.is_empty()) {
  122. splash = _load_icon_or_splash_image(splash_path, &err);
  123. }
  124. if (err != OK || splash.is_null() || splash->is_empty()) {
  125. splash.instantiate(boot_splash_png);
  126. }
  127. // Using same image for both @2x and @3x
  128. // because Godot's own boot logo uses single image for all resolutions.
  129. // Also not using @1x image, because devices using this image variant
  130. // are not supported by iOS 9, which is minimal target.
  131. const String splash_png_path_2x = p_dest_dir.path_join("[email protected]");
  132. const String splash_png_path_3x = p_dest_dir.path_join("[email protected]");
  133. if (splash->save_png(splash_png_path_2x) != OK) {
  134. return ERR_FILE_CANT_WRITE;
  135. }
  136. if (splash->save_png(splash_png_path_3x) != OK) {
  137. return ERR_FILE_CANT_WRITE;
  138. }
  139. }
  140. return OK;
  141. }
  142. Vector<EditorExportPlatformAppleEmbedded::IconInfo> EditorExportPlatformIOS::get_icon_infos() const {
  143. Vector<EditorExportPlatformAppleEmbedded::IconInfo> icon_infos;
  144. return {
  145. // Settings on iPhone, iPad Pro, iPad, iPad mini
  146. { PNAME("icons/settings_58x58"), "universal", "Icon-58", "58", "2x", "29x29", false },
  147. { PNAME("icons/settings_87x87"), "universal", "Icon-87", "87", "3x", "29x29", false },
  148. // Notifications on iPhone, iPad Pro, iPad, iPad mini
  149. { PNAME("icons/notification_40x40"), "universal", "Icon-40", "40", "2x", "20x20", false },
  150. { PNAME("icons/notification_60x60"), "universal", "Icon-60", "60", "3x", "20x20", false },
  151. { PNAME("icons/notification_76x76"), "universal", "Icon-76", "76", "2x", "38x38", false },
  152. { PNAME("icons/notification_114x114"), "universal", "Icon-114", "114", "3x", "38x38", false },
  153. // Spotlight on iPhone, iPad Pro, iPad, iPad mini
  154. { PNAME("icons/spotlight_80x80"), "universal", "Icon-80", "80", "2x", "40x40", false },
  155. { PNAME("icons/spotlight_120x120"), "universal", "Icon-120", "120", "3x", "40x40", false },
  156. // Home Screen on iPhone
  157. { PNAME("icons/iphone_120x120"), "universal", "Icon-120-1", "120", "2x", "60x60", false },
  158. { PNAME("icons/iphone_180x180"), "universal", "Icon-180", "180", "3x", "60x60", false },
  159. // Home Screen on iPad Pro
  160. { PNAME("icons/ipad_167x167"), "universal", "Icon-167", "167", "2x", "83.5x83.5", false },
  161. // Home Screen on iPad, iPad mini
  162. { PNAME("icons/ipad_152x152"), "universal", "Icon-152", "152", "2x", "76x76", false },
  163. { PNAME("icons/ios_128x128"), "universal", "Icon-128", "128", "2x", "64x64", false },
  164. { PNAME("icons/ios_192x192"), "universal", "Icon-192", "192", "3x", "64x64", false },
  165. { PNAME("icons/ios_136x136"), "universal", "Icon-136", "136", "2x", "68x68", false },
  166. // App Store
  167. { PNAME("icons/app_store_1024x1024"), "universal", "Icon-1024", "1024", "1x", "1024x1024", true },
  168. };
  169. }
  170. Error EditorExportPlatformIOS::_export_icons(const Ref<EditorExportPreset> &p_preset, const String &p_iconset_dir) {
  171. String json_description = "{\"images\":[";
  172. String sizes;
  173. Ref<DirAccess> da = DirAccess::open(p_iconset_dir);
  174. if (da.is_null()) {
  175. add_message(EXPORT_MESSAGE_ERROR, TTR("Export Icons"), vformat(TTR("Could not open a directory at path \"%s\"."), p_iconset_dir));
  176. return ERR_CANT_OPEN;
  177. }
  178. Color boot_bg_color = get_project_setting(p_preset, "application/boot_splash/bg_color");
  179. enum IconColorMode {
  180. ICON_NORMAL,
  181. ICON_DARK,
  182. ICON_TINTED,
  183. ICON_MAX,
  184. };
  185. Vector<IconInfo> icon_infos = get_icon_infos();
  186. bool first_icon = true;
  187. for (int i = 0; i < icon_infos.size(); ++i) {
  188. for (int color_mode = ICON_NORMAL; color_mode < ICON_MAX; color_mode++) {
  189. IconInfo info = icon_infos[i];
  190. int side_size = String(info.actual_size_side).to_int();
  191. String key = info.preset_key;
  192. String exp_name = info.export_name;
  193. if (color_mode == ICON_DARK) {
  194. key += "_dark";
  195. exp_name += "_dark";
  196. } else if (color_mode == ICON_TINTED) {
  197. key += "_tinted";
  198. exp_name += "_tinted";
  199. }
  200. exp_name += ".png";
  201. String icon_path = p_preset->get(key);
  202. bool resize_waning = true;
  203. if (icon_path.is_empty()) {
  204. // Load and resize base icon.
  205. key = "icons/icon_1024x1024";
  206. if (color_mode == ICON_DARK) {
  207. key += "_dark";
  208. } else if (color_mode == ICON_TINTED) {
  209. key += "_tinted";
  210. }
  211. icon_path = p_preset->get(key);
  212. resize_waning = false;
  213. }
  214. if (icon_path.is_empty()) {
  215. if (color_mode != ICON_NORMAL) {
  216. continue;
  217. }
  218. // Resize main app icon.
  219. icon_path = get_project_setting(p_preset, "application/config/icon");
  220. Error err = OK;
  221. Ref<Image> img = _load_icon_or_splash_image(icon_path, &err);
  222. if (err != OK || img.is_null() || img->is_empty()) {
  223. add_message(EXPORT_MESSAGE_ERROR, TTR("Export Icons"), vformat("Invalid icon (%s): '%s'.", info.preset_key, icon_path));
  224. return ERR_UNCONFIGURED;
  225. } else if (info.force_opaque && img->detect_alpha() != Image::ALPHA_NONE) {
  226. img->resize(side_size, side_size, (Image::Interpolation)(p_preset->get("application/icon_interpolation").operator int()));
  227. Ref<Image> new_img = Image::create_empty(side_size, side_size, false, Image::FORMAT_RGBA8);
  228. new_img->fill(boot_bg_color);
  229. _blend_and_rotate(new_img, img, false);
  230. err = new_img->save_png(p_iconset_dir + exp_name);
  231. } else {
  232. img->resize(side_size, side_size, (Image::Interpolation)(p_preset->get("application/icon_interpolation").operator int()));
  233. err = img->save_png(p_iconset_dir + exp_name);
  234. }
  235. if (err) {
  236. add_message(EXPORT_MESSAGE_ERROR, TTR("Export Icons"), vformat("Failed to export icon (%s): '%s'.", info.preset_key, icon_path));
  237. return err;
  238. }
  239. } else {
  240. // Load custom icon and resize if required.
  241. Error err = OK;
  242. Ref<Image> img = _load_icon_or_splash_image(icon_path, &err);
  243. if (err != OK || img.is_null() || img->is_empty()) {
  244. add_message(EXPORT_MESSAGE_ERROR, TTR("Export Icons"), vformat("Invalid icon (%s): '%s'.", info.preset_key, icon_path));
  245. return ERR_UNCONFIGURED;
  246. } else if (info.force_opaque && img->detect_alpha() != Image::ALPHA_NONE) {
  247. if (resize_waning) {
  248. add_message(EXPORT_MESSAGE_WARNING, TTR("Export Icons"), vformat("Icon (%s) must be opaque.", info.preset_key));
  249. }
  250. img->resize(side_size, side_size, (Image::Interpolation)(p_preset->get("application/icon_interpolation").operator int()));
  251. Ref<Image> new_img = Image::create_empty(side_size, side_size, false, Image::FORMAT_RGBA8);
  252. new_img->fill(boot_bg_color);
  253. _blend_and_rotate(new_img, img, false);
  254. err = new_img->save_png(p_iconset_dir + exp_name);
  255. } else if (img->get_width() != side_size || img->get_height() != side_size) {
  256. if (resize_waning) {
  257. 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)));
  258. }
  259. img->resize(side_size, side_size, (Image::Interpolation)(p_preset->get("application/icon_interpolation").operator int()));
  260. err = img->save_png(p_iconset_dir + exp_name);
  261. } else if (!icon_path.ends_with(".png")) {
  262. err = img->save_png(p_iconset_dir + exp_name);
  263. } else {
  264. err = da->copy(icon_path, p_iconset_dir + exp_name);
  265. }
  266. if (err) {
  267. add_message(EXPORT_MESSAGE_ERROR, TTR("Export Icons"), vformat("Failed to export icon (%s): '%s'.", info.preset_key, icon_path));
  268. return err;
  269. }
  270. }
  271. sizes += String(info.actual_size_side) + "\n";
  272. if (first_icon) {
  273. first_icon = false;
  274. } else {
  275. json_description += ",";
  276. }
  277. json_description += String("{");
  278. if (color_mode != ICON_NORMAL) {
  279. json_description += String("\"appearances\":[{");
  280. json_description += String("\"appearance\":\"luminosity\",");
  281. if (color_mode == ICON_DARK) {
  282. json_description += String("\"value\":\"dark\"");
  283. } else if (color_mode == ICON_TINTED) {
  284. json_description += String("\"value\":\"tinted\"");
  285. }
  286. json_description += String("}],");
  287. }
  288. json_description += String("\"idiom\":") + "\"" + info.idiom + "\",";
  289. json_description += String("\"platform\":\"" + get_platform_name() + "\",");
  290. json_description += String("\"size\":") + "\"" + info.unscaled_size + "\",";
  291. if (String(info.scale) != "1x") {
  292. json_description += String("\"scale\":") + "\"" + info.scale + "\",";
  293. }
  294. json_description += String("\"filename\":") + "\"" + exp_name + "\"";
  295. json_description += String("}");
  296. }
  297. }
  298. json_description += "],\"info\":{\"author\":\"xcode\",\"version\":1}}";
  299. Ref<FileAccess> json_file = FileAccess::open(p_iconset_dir + "Contents.json", FileAccess::WRITE);
  300. if (json_file.is_null()) {
  301. add_message(EXPORT_MESSAGE_ERROR, TTR("Export Icons"), vformat(TTR("Could not write to a file at path \"%s\"."), p_iconset_dir + "Contents.json"));
  302. return ERR_CANT_CREATE;
  303. }
  304. CharString json_utf8 = json_description.utf8();
  305. json_file->store_buffer((const uint8_t *)json_utf8.get_data(), json_utf8.length());
  306. Ref<FileAccess> sizes_file = FileAccess::open(p_iconset_dir + "sizes", FileAccess::WRITE);
  307. if (sizes_file.is_null()) {
  308. add_message(EXPORT_MESSAGE_ERROR, TTR("Export Icons"), vformat(TTR("Could not write to a file at path \"%s\"."), p_iconset_dir + "sizes"));
  309. return ERR_CANT_CREATE;
  310. }
  311. CharString sizes_utf8 = sizes.utf8();
  312. sizes_file->store_buffer((const uint8_t *)sizes_utf8.get_data(), sizes_utf8.length());
  313. return OK;
  314. }
  315. 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) {
  316. // Do iOS specific processing first, and call super implementation if there are no matches
  317. String strnew;
  318. // Supported Destinations
  319. if (p_line.contains("$targeted_device_family")) {
  320. String xcode_value;
  321. switch ((int)p_preset->get("application/targeted_device_family")) {
  322. case 0: // iPhone
  323. xcode_value = "1";
  324. break;
  325. case 1: // iPad
  326. xcode_value = "2";
  327. break;
  328. case 2: // iPhone & iPad
  329. xcode_value = "1,2";
  330. break;
  331. }
  332. strnew += p_line.replace("$targeted_device_family", xcode_value) + "\n";
  333. // MoltenVK Framework
  334. } else if (p_line.contains("$moltenvk_buildfile")) {
  335. String value = "9039D3BE24C093AC0020482C /* MoltenVK.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9039D3BD24C093AC0020482C /* MoltenVK.xcframework */; };";
  336. strnew += p_line.replace("$moltenvk_buildfile", value) + "\n";
  337. } else if (p_line.contains("$moltenvk_fileref")) {
  338. String value = "9039D3BD24C093AC0020482C /* MoltenVK.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MoltenVK; path = MoltenVK.xcframework; sourceTree = \"<group>\"; };";
  339. strnew += p_line.replace("$moltenvk_fileref", value) + "\n";
  340. } else if (p_line.contains("$moltenvk_buildphase")) {
  341. String value = "9039D3BE24C093AC0020482C /* MoltenVK.xcframework in Frameworks */,";
  342. strnew += p_line.replace("$moltenvk_buildphase", value) + "\n";
  343. } else if (p_line.contains("$moltenvk_buildgrp")) {
  344. String value = "9039D3BD24C093AC0020482C /* MoltenVK.xcframework */,";
  345. strnew += p_line.replace("$moltenvk_buildgrp", value) + "\n";
  346. // Launch Storyboard
  347. } else if (p_line.contains("$plist_launch_screen_name")) {
  348. String value = "<key>UILaunchStoryboardName</key>\n<string>Launch Screen</string>";
  349. strnew += p_line.replace("$plist_launch_screen_name", value) + "\n";
  350. } else if (p_line.contains("$pbx_launch_screen_file_reference")) {
  351. String value = "90DD2D9D24B36E8000717FE1 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = \"Launch Screen.storyboard\"; sourceTree = \"<group>\"; };";
  352. strnew += p_line.replace("$pbx_launch_screen_file_reference", value) + "\n";
  353. } else if (p_line.contains("$pbx_launch_screen_copy_files")) {
  354. String value = "90DD2D9D24B36E8000717FE1 /* Launch Screen.storyboard */,";
  355. strnew += p_line.replace("$pbx_launch_screen_copy_files", value) + "\n";
  356. } else if (p_line.contains("$pbx_launch_screen_build_phase")) {
  357. String value = "90DD2D9E24B36E8000717FE1 /* Launch Screen.storyboard in Resources */,";
  358. strnew += p_line.replace("$pbx_launch_screen_build_phase", value) + "\n";
  359. } else if (p_line.contains("$pbx_launch_screen_build_reference")) {
  360. String value = "90DD2D9E24B36E8000717FE1 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 90DD2D9D24B36E8000717FE1 /* Launch Screen.storyboard */; };";
  361. strnew += p_line.replace("$pbx_launch_screen_build_reference", value) + "\n";
  362. // Launch Storyboard customization
  363. } else if (p_line.contains("$launch_screen_image_mode")) {
  364. int image_scale_mode = p_preset->get("storyboard/image_scale_mode");
  365. String value;
  366. switch (image_scale_mode) {
  367. case 0: {
  368. String logo_path = get_project_setting(p_preset, "application/boot_splash/image");
  369. bool is_on = get_project_setting(p_preset, "application/boot_splash/fullsize");
  370. // If custom logo is not specified, Godot does not scale default one, so we should do the same.
  371. value = (is_on && logo_path.length() > 0) ? "scaleAspectFit" : "center";
  372. } break;
  373. default: {
  374. value = storyboard_image_scale_mode[image_scale_mode - 1];
  375. }
  376. }
  377. strnew += p_line.replace("$launch_screen_image_mode", value) + "\n";
  378. } else if (p_line.contains("$launch_screen_background_color")) {
  379. bool use_custom = p_preset->get("storyboard/use_custom_bg_color");
  380. Color color = use_custom ? p_preset->get("storyboard/custom_bg_color") : get_project_setting(p_preset, "application/boot_splash/bg_color");
  381. const String value_format = "red=\"$red\" green=\"$green\" blue=\"$blue\" alpha=\"$alpha\"";
  382. Dictionary value_dictionary;
  383. value_dictionary["red"] = color.r;
  384. value_dictionary["green"] = color.g;
  385. value_dictionary["blue"] = color.b;
  386. value_dictionary["alpha"] = color.a;
  387. String value = value_format.format(value_dictionary, "$_");
  388. strnew += p_line.replace("$launch_screen_background_color", value) + "\n";
  389. // OS Deployment Target
  390. } else if (p_line.contains("$os_deployment_target")) {
  391. String min_version = p_preset->get("application/min_" + get_platform_name() + "_version");
  392. String value = "IPHONEOS_DEPLOYMENT_TARGET = " + min_version + ";";
  393. strnew += p_line.replace("$os_deployment_target", value) + "\n";
  394. // Valid Archs
  395. } else if (p_line.contains("$valid_archs")) {
  396. strnew += p_line.replace("$valid_archs", "arm64 x86_64") + "\n";
  397. // Apple Embedded common
  398. } else {
  399. strnew += EditorExportPlatformAppleEmbedded::_process_config_file_line(p_preset, p_line, p_config, p_debug, p_code_signing);
  400. }
  401. return strnew;
  402. }