export_plugin.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. /*************************************************************************/
  2. /* export_plugin.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
  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 "core/config/project_settings.h"
  32. #include "editor/editor_node.h"
  33. #include "editor/editor_paths.h"
  34. #include "editor/editor_scale.h"
  35. #include "platform/linuxbsd/logo_svg.gen.h"
  36. #include "platform/linuxbsd/run_icon_svg.gen.h"
  37. #include "modules/modules_enabled.gen.h" // For svg.
  38. #ifdef MODULE_SVG_ENABLED
  39. #include "modules/svg/image_loader_svg.h"
  40. #endif
  41. Error EditorExportPlatformLinuxBSD::_export_debug_script(const Ref<EditorExportPreset> &p_preset, const String &p_app_name, const String &p_pkg_name, const String &p_path) {
  42. Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::WRITE);
  43. if (f.is_null()) {
  44. add_message(EXPORT_MESSAGE_ERROR, TTR("Debug Script Export"), vformat(TTR("Could not open file \"%s\"."), p_path));
  45. return ERR_CANT_CREATE;
  46. }
  47. f->store_line("#!/bin/sh");
  48. f->store_line("echo -ne '\\033c\\033]0;" + p_app_name + "\\a'");
  49. f->store_line("base_path=\"$(dirname \"$(realpath \"$0\")\")\"");
  50. f->store_line("\"$base_path/" + p_pkg_name + "\" \"$@\"");
  51. return OK;
  52. }
  53. Error EditorExportPlatformLinuxBSD::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
  54. bool export_as_zip = p_path.ends_with("zip");
  55. String pkg_name;
  56. if (String(GLOBAL_GET("application/config/name")) != "") {
  57. pkg_name = String(GLOBAL_GET("application/config/name"));
  58. } else {
  59. pkg_name = "Unnamed";
  60. }
  61. pkg_name = OS::get_singleton()->get_safe_dir_name(pkg_name);
  62. // Setup temp folder.
  63. String path = p_path;
  64. String tmp_dir_path = EditorPaths::get_singleton()->get_cache_dir().path_join(pkg_name);
  65. Ref<DirAccess> tmp_app_dir = DirAccess::create_for_path(tmp_dir_path);
  66. if (export_as_zip) {
  67. if (tmp_app_dir.is_null()) {
  68. return ERR_CANT_CREATE;
  69. }
  70. if (DirAccess::exists(tmp_dir_path)) {
  71. if (tmp_app_dir->change_dir(tmp_dir_path) == OK) {
  72. tmp_app_dir->erase_contents_recursive();
  73. }
  74. }
  75. tmp_app_dir->make_dir_recursive(tmp_dir_path);
  76. path = tmp_dir_path.path_join(p_path.get_file().get_basename());
  77. }
  78. // Export project.
  79. Error err = EditorExportPlatformPC::export_project(p_preset, p_debug, path, p_flags);
  80. if (err != OK) {
  81. return err;
  82. }
  83. // Save console script.
  84. if (err == OK) {
  85. int con_scr = p_preset->get("debug/export_console_script");
  86. if ((con_scr == 1 && p_debug) || (con_scr == 2)) {
  87. String scr_path = path.get_basename() + ".sh";
  88. err = _export_debug_script(p_preset, pkg_name, path.get_file(), scr_path);
  89. FileAccess::set_unix_permissions(scr_path, 0755);
  90. if (err != OK) {
  91. add_message(EXPORT_MESSAGE_ERROR, TTR("Debug Script Export"), TTR("Could not create console script."));
  92. }
  93. }
  94. }
  95. // ZIP project.
  96. if (export_as_zip) {
  97. if (FileAccess::exists(p_path)) {
  98. OS::get_singleton()->move_to_trash(p_path);
  99. }
  100. Ref<FileAccess> io_fa_dst;
  101. zlib_filefunc_def io_dst = zipio_create_io(&io_fa_dst);
  102. zipFile zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, nullptr, &io_dst);
  103. zip_folder_recursive(zip, tmp_dir_path, "", pkg_name);
  104. zipClose(zip, nullptr);
  105. if (tmp_app_dir->change_dir(tmp_dir_path) == OK) {
  106. tmp_app_dir->erase_contents_recursive();
  107. tmp_app_dir->change_dir("..");
  108. tmp_app_dir->remove(pkg_name);
  109. }
  110. }
  111. return err;
  112. }
  113. String EditorExportPlatformLinuxBSD::get_template_file_name(const String &p_target, const String &p_arch) const {
  114. return "linux_" + p_target + "." + p_arch;
  115. }
  116. List<String> EditorExportPlatformLinuxBSD::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const {
  117. List<String> list;
  118. list.push_back(p_preset->get("binary_format/architecture"));
  119. list.push_back("zip");
  120. return list;
  121. }
  122. void EditorExportPlatformLinuxBSD::get_export_options(List<ExportOption> *r_options) {
  123. EditorExportPlatformPC::get_export_options(r_options);
  124. r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "x86_64,x86_32,arm64,arm32,rv64,ppc64,ppc32"), "x86_64"));
  125. String run_script = "#!/usr/bin/env bash\n"
  126. "export DISPLAY=:0\n"
  127. "unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"\n"
  128. "\"{temp_dir}/{exe_name}\" {cmd_args}";
  129. String cleanup_script = "#!/usr/bin/env bash\n"
  130. "kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")\n"
  131. "rm -rf \"{temp_dir}\"";
  132. r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "ssh_remote_deploy/enabled"), false));
  133. r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/host"), "user@host_ip"));
  134. r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/port"), "22"));
  135. r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/extra_args_ssh", PROPERTY_HINT_MULTILINE_TEXT), ""));
  136. r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/extra_args_scp", PROPERTY_HINT_MULTILINE_TEXT), ""));
  137. r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/run_script", PROPERTY_HINT_MULTILINE_TEXT), run_script));
  138. r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "ssh_remote_deploy/cleanup_script", PROPERTY_HINT_MULTILINE_TEXT), cleanup_script));
  139. }
  140. bool EditorExportPlatformLinuxBSD::is_elf(const String &p_path) const {
  141. Ref<FileAccess> fb = FileAccess::open(p_path, FileAccess::READ);
  142. ERR_FAIL_COND_V_MSG(fb.is_null(), false, vformat("Can't open file: \"%s\".", p_path));
  143. uint32_t magic = fb->get_32();
  144. return (magic == 0x464c457f);
  145. }
  146. bool EditorExportPlatformLinuxBSD::is_shebang(const String &p_path) const {
  147. Ref<FileAccess> fb = FileAccess::open(p_path, FileAccess::READ);
  148. ERR_FAIL_COND_V_MSG(fb.is_null(), false, vformat("Can't open file: \"%s\".", p_path));
  149. uint16_t magic = fb->get_16();
  150. return (magic == 0x2123);
  151. }
  152. bool EditorExportPlatformLinuxBSD::is_executable(const String &p_path) const {
  153. return is_elf(p_path) || is_shebang(p_path);
  154. }
  155. Error EditorExportPlatformLinuxBSD::fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) {
  156. // Patch the header of the "pck" section in the ELF file so that it corresponds to the embedded data
  157. Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ_WRITE);
  158. if (f.is_null()) {
  159. add_message(EXPORT_MESSAGE_ERROR, TTR("PCK Embedding"), vformat(TTR("Failed to open executable file \"%s\"."), p_path));
  160. return ERR_CANT_OPEN;
  161. }
  162. // Read and check ELF magic number
  163. {
  164. uint32_t magic = f->get_32();
  165. if (magic != 0x464c457f) { // 0x7F + "ELF"
  166. add_message(EXPORT_MESSAGE_ERROR, TTR("PCK Embedding"), TTR("Executable file header corrupted."));
  167. return ERR_FILE_CORRUPT;
  168. }
  169. }
  170. // Read program architecture bits from class field
  171. int bits = f->get_8() * 32;
  172. if (bits == 32 && p_embedded_size >= 0x100000000) {
  173. add_message(EXPORT_MESSAGE_ERROR, TTR("PCK Embedding"), TTR("32-bit executables cannot have embedded data >= 4 GiB."));
  174. }
  175. // Get info about the section header table
  176. int64_t section_table_pos;
  177. int64_t section_header_size;
  178. if (bits == 32) {
  179. section_header_size = 40;
  180. f->seek(0x20);
  181. section_table_pos = f->get_32();
  182. f->seek(0x30);
  183. } else { // 64
  184. section_header_size = 64;
  185. f->seek(0x28);
  186. section_table_pos = f->get_64();
  187. f->seek(0x3c);
  188. }
  189. int num_sections = f->get_16();
  190. int string_section_idx = f->get_16();
  191. // Load the strings table
  192. uint8_t *strings;
  193. {
  194. // Jump to the strings section header
  195. f->seek(section_table_pos + string_section_idx * section_header_size);
  196. // Read strings data size and offset
  197. int64_t string_data_pos;
  198. int64_t string_data_size;
  199. if (bits == 32) {
  200. f->seek(f->get_position() + 0x10);
  201. string_data_pos = f->get_32();
  202. string_data_size = f->get_32();
  203. } else { // 64
  204. f->seek(f->get_position() + 0x18);
  205. string_data_pos = f->get_64();
  206. string_data_size = f->get_64();
  207. }
  208. // Read strings data
  209. f->seek(string_data_pos);
  210. strings = (uint8_t *)memalloc(string_data_size);
  211. if (!strings) {
  212. return ERR_OUT_OF_MEMORY;
  213. }
  214. f->get_buffer(strings, string_data_size);
  215. }
  216. // Search for the "pck" section
  217. bool found = false;
  218. for (int i = 0; i < num_sections; ++i) {
  219. int64_t section_header_pos = section_table_pos + i * section_header_size;
  220. f->seek(section_header_pos);
  221. uint32_t name_offset = f->get_32();
  222. if (strcmp((char *)strings + name_offset, "pck") == 0) {
  223. // "pck" section found, let's patch!
  224. if (bits == 32) {
  225. f->seek(section_header_pos + 0x10);
  226. f->store_32(p_embedded_start);
  227. f->store_32(p_embedded_size);
  228. } else { // 64
  229. f->seek(section_header_pos + 0x18);
  230. f->store_64(p_embedded_start);
  231. f->store_64(p_embedded_size);
  232. }
  233. found = true;
  234. break;
  235. }
  236. }
  237. memfree(strings);
  238. if (!found) {
  239. add_message(EXPORT_MESSAGE_ERROR, TTR("PCK Embedding"), TTR("Executable \"pck\" section not found."));
  240. return ERR_FILE_CORRUPT;
  241. }
  242. return OK;
  243. }
  244. Ref<Texture2D> EditorExportPlatformLinuxBSD::get_run_icon() const {
  245. return run_icon;
  246. }
  247. bool EditorExportPlatformLinuxBSD::poll_export() {
  248. Ref<EditorExportPreset> preset;
  249. for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
  250. Ref<EditorExportPreset> ep = EditorExport::get_singleton()->get_export_preset(i);
  251. if (ep->is_runnable() && ep->get_platform() == this) {
  252. preset = ep;
  253. break;
  254. }
  255. }
  256. int prev = menu_options;
  257. menu_options = (preset.is_valid() && preset->get("ssh_remote_deploy/enabled").operator bool());
  258. if (ssh_pid != 0 || !cleanup_commands.is_empty()) {
  259. if (menu_options == 0) {
  260. cleanup();
  261. } else {
  262. menu_options += 1;
  263. }
  264. }
  265. return menu_options != prev;
  266. }
  267. Ref<ImageTexture> EditorExportPlatformLinuxBSD::get_option_icon(int p_index) const {
  268. return p_index == 1 ? stop_icon : EditorExportPlatform::get_option_icon(p_index);
  269. }
  270. int EditorExportPlatformLinuxBSD::get_options_count() const {
  271. return menu_options;
  272. }
  273. String EditorExportPlatformLinuxBSD::get_option_label(int p_index) const {
  274. return (p_index) ? TTR("Stop and uninstall") : TTR("Run on remote Linux/BSD system");
  275. }
  276. String EditorExportPlatformLinuxBSD::get_option_tooltip(int p_index) const {
  277. return (p_index) ? TTR("Stop and uninstall running project from the remote system") : TTR("Run exported project on remote Linux/BSD system");
  278. }
  279. void EditorExportPlatformLinuxBSD::cleanup() {
  280. if (ssh_pid != 0 && OS::get_singleton()->is_process_running(ssh_pid)) {
  281. print_line("Terminating connection...");
  282. OS::get_singleton()->kill(ssh_pid);
  283. OS::get_singleton()->delay_usec(1000);
  284. }
  285. if (!cleanup_commands.is_empty()) {
  286. print_line("Stopping and deleting previous version...");
  287. for (const SSHCleanupCommand &cmd : cleanup_commands) {
  288. if (cmd.wait) {
  289. ssh_run_on_remote(cmd.host, cmd.port, cmd.ssh_args, cmd.cmd_args);
  290. } else {
  291. ssh_run_on_remote_no_wait(cmd.host, cmd.port, cmd.ssh_args, cmd.cmd_args);
  292. }
  293. }
  294. }
  295. ssh_pid = 0;
  296. cleanup_commands.clear();
  297. }
  298. Error EditorExportPlatformLinuxBSD::run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) {
  299. cleanup();
  300. if (p_device) { // Stop command, cleanup only.
  301. return OK;
  302. }
  303. EditorProgress ep("run", TTR("Running..."), 5);
  304. const String dest = EditorPaths::get_singleton()->get_cache_dir().path_join("linuxbsd");
  305. Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
  306. if (!da->dir_exists(dest)) {
  307. Error err = da->make_dir_recursive(dest);
  308. if (err != OK) {
  309. EditorNode::get_singleton()->show_warning(TTR("Could not create temp directory:") + "\n" + dest);
  310. return err;
  311. }
  312. }
  313. String host = p_preset->get("ssh_remote_deploy/host").operator String();
  314. String port = p_preset->get("ssh_remote_deploy/port").operator String();
  315. if (port.is_empty()) {
  316. port = "22";
  317. }
  318. Vector<String> extra_args_ssh = p_preset->get("ssh_remote_deploy/extra_args_ssh").operator String().split(" ");
  319. Vector<String> extra_args_scp = p_preset->get("ssh_remote_deploy/extra_args_scp").operator String().split(" ");
  320. const String basepath = dest.path_join("tmp_linuxbsd_export");
  321. #define CLEANUP_AND_RETURN(m_err) \
  322. { \
  323. if (da->file_exists(basepath + ".zip")) { \
  324. da->remove(basepath + ".zip"); \
  325. } \
  326. if (da->file_exists(basepath + "_start.sh")) { \
  327. da->remove(basepath + "_start.sh"); \
  328. } \
  329. if (da->file_exists(basepath + "_clean.sh")) { \
  330. da->remove(basepath + "_clean.sh"); \
  331. } \
  332. return m_err; \
  333. } \
  334. ((void)0)
  335. if (ep.step(TTR("Exporting project..."), 1)) {
  336. return ERR_SKIP;
  337. }
  338. Error err = export_project(p_preset, true, basepath + ".zip", p_debug_flags);
  339. if (err != OK) {
  340. DirAccess::remove_file_or_error(basepath + ".zip");
  341. return err;
  342. }
  343. String cmd_args;
  344. {
  345. Vector<String> cmd_args_list;
  346. gen_debug_flags(cmd_args_list, p_debug_flags);
  347. for (int i = 0; i < cmd_args_list.size(); i++) {
  348. if (i != 0) {
  349. cmd_args += " ";
  350. }
  351. cmd_args += cmd_args_list[i];
  352. }
  353. }
  354. const bool use_remote = (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) || (p_debug_flags & DEBUG_FLAG_DUMB_CLIENT);
  355. int dbg_port = EditorSettings::get_singleton()->get("network/debug/remote_port");
  356. print_line("Creating temporary directory...");
  357. ep.step(TTR("Creating temporary directory..."), 2);
  358. String temp_dir;
  359. err = ssh_run_on_remote(host, port, extra_args_ssh, "mktemp -d", &temp_dir);
  360. if (err != OK || temp_dir.is_empty()) {
  361. CLEANUP_AND_RETURN(err);
  362. }
  363. print_line("Uploading archive...");
  364. ep.step(TTR("Uploading archive..."), 3);
  365. err = ssh_push_to_remote(host, port, extra_args_scp, basepath + ".zip", temp_dir);
  366. if (err != OK) {
  367. CLEANUP_AND_RETURN(err);
  368. }
  369. {
  370. String run_script = p_preset->get("ssh_remote_deploy/run_script");
  371. run_script = run_script.replace("{temp_dir}", temp_dir);
  372. run_script = run_script.replace("{archive_name}", basepath.get_file() + ".zip");
  373. run_script = run_script.replace("{exe_name}", basepath.get_file());
  374. run_script = run_script.replace("{cmd_args}", cmd_args);
  375. Ref<FileAccess> f = FileAccess::open(basepath + "_start.sh", FileAccess::WRITE);
  376. if (f.is_null()) {
  377. CLEANUP_AND_RETURN(err);
  378. }
  379. f->store_string(run_script);
  380. }
  381. {
  382. String clean_script = p_preset->get("ssh_remote_deploy/cleanup_script");
  383. clean_script = clean_script.replace("{temp_dir}", temp_dir);
  384. clean_script = clean_script.replace("{archive_name}", basepath.get_file() + ".zip");
  385. clean_script = clean_script.replace("{exe_name}", basepath.get_file());
  386. clean_script = clean_script.replace("{cmd_args}", cmd_args);
  387. Ref<FileAccess> f = FileAccess::open(basepath + "_clean.sh", FileAccess::WRITE);
  388. if (f.is_null()) {
  389. CLEANUP_AND_RETURN(err);
  390. }
  391. f->store_string(clean_script);
  392. }
  393. print_line("Uploading scripts...");
  394. ep.step(TTR("Uploading scripts..."), 4);
  395. err = ssh_push_to_remote(host, port, extra_args_scp, basepath + "_start.sh", temp_dir);
  396. if (err != OK) {
  397. CLEANUP_AND_RETURN(err);
  398. }
  399. err = ssh_run_on_remote(host, port, extra_args_ssh, vformat("chmod +x \"%s/%s\"", temp_dir, basepath.get_file() + "_start.sh"));
  400. if (err != OK || temp_dir.is_empty()) {
  401. CLEANUP_AND_RETURN(err);
  402. }
  403. err = ssh_push_to_remote(host, port, extra_args_scp, basepath + "_clean.sh", temp_dir);
  404. if (err != OK) {
  405. CLEANUP_AND_RETURN(err);
  406. }
  407. err = ssh_run_on_remote(host, port, extra_args_ssh, vformat("chmod +x \"%s/%s\"", temp_dir, basepath.get_file() + "_clean.sh"));
  408. if (err != OK || temp_dir.is_empty()) {
  409. CLEANUP_AND_RETURN(err);
  410. }
  411. print_line("Starting project...");
  412. ep.step(TTR("Starting project..."), 5);
  413. err = ssh_run_on_remote_no_wait(host, port, extra_args_ssh, vformat("\"%s/%s\"", temp_dir, basepath.get_file() + "_start.sh"), &ssh_pid, (use_remote) ? dbg_port : -1);
  414. if (err != OK) {
  415. CLEANUP_AND_RETURN(err);
  416. }
  417. cleanup_commands.clear();
  418. cleanup_commands.push_back(SSHCleanupCommand(host, port, extra_args_ssh, vformat("\"%s/%s\"", temp_dir, basepath.get_file() + "_clean.sh")));
  419. print_line("Project started.");
  420. CLEANUP_AND_RETURN(OK);
  421. #undef CLEANUP_AND_RETURN
  422. }
  423. EditorExportPlatformLinuxBSD::EditorExportPlatformLinuxBSD() {
  424. #ifdef MODULE_SVG_ENABLED
  425. Ref<Image> img = memnew(Image);
  426. const bool upsample = !Math::is_equal_approx(Math::round(EDSCALE), EDSCALE);
  427. ImageLoaderSVG img_loader;
  428. img_loader.create_image_from_string(img, _linuxbsd_logo_svg, EDSCALE, upsample, false);
  429. set_logo(ImageTexture::create_from_image(img));
  430. img_loader.create_image_from_string(img, _linuxbsd_run_icon_svg, EDSCALE, upsample, false);
  431. run_icon = ImageTexture::create_from_image(img);
  432. #endif
  433. Ref<Theme> theme = EditorNode::get_singleton()->get_editor_theme();
  434. if (theme.is_valid()) {
  435. stop_icon = theme->get_icon(SNAME("Stop"), SNAME("EditorIcons"));
  436. } else {
  437. stop_icon.instantiate();
  438. }
  439. }