summaryrefslogtreecommitdiff
path: root/editor/editor_export.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_export.cpp')
-rw-r--r--editor/editor_export.cpp70
1 files changed, 33 insertions, 37 deletions
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 9510092a86..3d8ea0b040 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -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"
@@ -376,6 +377,12 @@ Error EditorExportPlatform::_save_zip_file(void *p_userdata, const String &p_pat
return OK;
}
+Ref<ImageTexture> EditorExportPlatform::get_option_icon(int p_index) const {
+ Ref<Theme> theme = EditorNode::get_singleton()->get_editor_theme();
+ ERR_FAIL_COND_V(theme.is_null(), Ref<ImageTexture>());
+ return theme->get_icon("Play", "EditorIcons");
+}
+
String EditorExportPlatform::find_export_template(String template_file_name, String *err) const {
String current_version = VERSION_FULL_CONFIG;
@@ -741,7 +748,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
config.instance();
Error err = config->load(path + ".import");
if (err != OK) {
- ERR_PRINTS("Could not parse: '" + path + "', not exported.");
+ ERR_PRINT("Could not parse: '" + path + "', not exported.");
continue;
}
@@ -964,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);
@@ -1043,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;
@@ -1403,7 +1411,7 @@ bool EditorExport::poll_export_platforms() {
bool changed = false;
for (int i = 0; i < export_platforms.size(); i++) {
- if (export_platforms.write[i]->poll_devices()) {
+ if (export_platforms.write[i]->poll_export()) {
changed = true;
}
}
@@ -1477,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;
- }
-
- String custom_debug_binary = p_preset->get("custom_template/debug");
- String custom_release_binary = p_preset->get("custom_template/release");
+ bool valid = false;
- if (custom_debug_binary == "" && custom_release_binary == "") {
- if (!err.empty())
- r_error = err;
- r_missing_templates = !valid;
- return valid;
- }
+ // Look for export templates (first official, and if defined custom templates).
- 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;
@@ -1592,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();