diff options
Diffstat (limited to 'editor/editor_export.cpp')
-rw-r--r-- | editor/editor_export.cpp | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 72530e23b9..d66b386f93 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -32,6 +32,7 @@ #include "core/crypto/crypto_core.h" #include "core/io/config_file.h" +#include "core/io/file_access_pack.h" // PACK_HEADER_MAGIC, PACK_FORMAT_VERSION #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/io/zip_io.h" @@ -970,11 +971,12 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c int64_t pck_start_pos = f->get_position(); - f->store_32(0x43504447); //GDPC - f->store_32(1); //pack version + f->store_32(PACK_HEADER_MAGIC); + f->store_32(PACK_FORMAT_VERSION); f->store_32(VERSION_MAJOR); f->store_32(VERSION_MINOR); - f->store_32(0); //hmph + f->store_32(VERSION_PATCH); + for (int i = 0; i < 16; i++) { //reserved f->store_32(0); @@ -1049,7 +1051,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c int64_t pck_size = f->get_position() - pck_start_pos; f->store_64(pck_size); - f->store_32(0x43504447); //GDPC + f->store_32(PACK_HEADER_MAGIC); if (r_embedded_size) { *r_embedded_size = f->get_position() - embed_pos; @@ -1483,41 +1485,29 @@ Ref<Texture> EditorExportPlatformPC::get_logo() const { bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const { String err; - bool valid = true; - bool use64 = p_preset->get("binary_format/64_bits"); - - if (use64 && (!exists_export_template(debug_file_64, &err) || !exists_export_template(release_file_64, &err))) { - valid = false; - } - - if (!use64 && (!exists_export_template(debug_file_32, &err) || !exists_export_template(release_file_32, &err))) { - valid = false; - } + bool valid = false; - String custom_debug_binary = p_preset->get("custom_template/debug"); - String custom_release_binary = p_preset->get("custom_template/release"); + // Look for export templates (first official, and if defined custom templates). - if (custom_debug_binary == "" && custom_release_binary == "") { - if (!err.empty()) - r_error = err; - r_missing_templates = !valid; - return valid; - } - - bool dvalid = true; - bool rvalid = true; + bool use64 = p_preset->get("binary_format/64_bits"); + bool dvalid = exists_export_template(use64 ? debug_file_64 : debug_file_32, &err); + bool rvalid = exists_export_template(use64 ? release_file_64 : release_file_32, &err); - if (!FileAccess::exists(custom_debug_binary)) { - dvalid = false; - err += TTR("Custom debug template not found.") + "\n"; + if (p_preset->get("custom_template/debug") != "") { + dvalid = FileAccess::exists(p_preset->get("custom_template/debug")); + if (!dvalid) { + err += TTR("Custom debug template not found.") + "\n"; + } } - - if (!FileAccess::exists(custom_release_binary)) { - rvalid = false; - err += TTR("Custom release template not found.") + "\n"; + if (p_preset->get("custom_template/release") != "") { + rvalid = FileAccess::exists(p_preset->get("custom_template/release")); + if (!rvalid) { + err += TTR("Custom release template not found.") + "\n"; + } } valid = dvalid || rvalid; + r_missing_templates = !valid; if (!err.empty()) r_error = err; @@ -1598,7 +1588,7 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr if (embedded_size >= 0x100000000 && !p_preset->get("binary_format/64_bits")) { EditorNode::get_singleton()->show_warning(TTR("On 32-bit exports the embedded PCK cannot be bigger than 4 GiB.")); - return ERR_UNAVAILABLE; + return ERR_INVALID_PARAMETER; } FixUpEmbeddedPckFunc fixup_func = get_fixup_embedded_pck_func(); |