From 17c4cd6412e3491f33713c63e4d3cc80c959319f Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Wed, 27 Jul 2022 17:48:34 -0500 Subject: Update export dialog to handle many architectures --- platform/uwp/export/export_plugin.cpp | 63 ++++++++++++----------------------- platform/uwp/export/export_plugin.h | 10 ++---- 2 files changed, 24 insertions(+), 49 deletions(-) (limited to 'platform/uwp') diff --git a/platform/uwp/export/export_plugin.cpp b/platform/uwp/export/export_plugin.cpp index 7bf8a0f4c7..a99776497b 100644 --- a/platform/uwp/export/export_plugin.cpp +++ b/platform/uwp/export/export_plugin.cpp @@ -52,24 +52,14 @@ Ref EditorExportPlatformUWP::get_logo() const { void EditorExportPlatformUWP::get_preset_features(const Ref &p_preset, List *r_features) const { r_features->push_back("s3tc"); r_features->push_back("etc"); - switch ((int)p_preset->get("architecture/target")) { - case EditorExportPlatformUWP::ARM: { - r_features->push_back("arm"); - } break; - case EditorExportPlatformUWP::X86: { - r_features->push_back("32"); - } break; - case EditorExportPlatformUWP::X64: { - r_features->push_back("64"); - } break; - } + r_features->push_back(p_preset->get("binary_format/architecture")); } void EditorExportPlatformUWP::get_export_options(List *r_options) { r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "architecture/target", PROPERTY_HINT_ENUM, "arm,x86,x64"), 1)); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "binary_format/architecture", PROPERTY_HINT_ENUM, "x86_64,x86_32,arm32"), "x86_64")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "command_line/extra_args"), "")); @@ -143,23 +133,18 @@ bool EditorExportPlatformUWP::can_export(const Ref &p_preset bool valid = false; // Look for export templates (first official, and if defined custom templates). - - Platform arch = (Platform)(int)(p_preset->get("architecture/target")); - String platform_infix; - switch (arch) { - case EditorExportPlatformUWP::ARM: { - platform_infix = "arm"; - } break; - case EditorExportPlatformUWP::X86: { - platform_infix = "x86"; - } break; - case EditorExportPlatformUWP::X64: { - platform_infix = "x64"; - } break; + String arch = p_preset->get("binary_format/architecture"); + String arch_infix; + if (arch == "arm32") { + arch_infix = "arm"; + } else if (arch == "x86_32") { + arch_infix = "x86"; + } else if (arch == "x86_64") { + arch_infix = "x64"; } - bool dvalid = exists_export_template("uwp_" + platform_infix + "_debug.zip", &err); - bool rvalid = exists_export_template("uwp_" + platform_infix + "_release.zip", &err); + bool dvalid = exists_export_template("uwp_" + arch_infix + "_debug.zip", &err); + bool rvalid = exists_export_template("uwp_" + arch_infix + "_release.zip", &err); if (p_preset->get("custom_template/debug") != "") { dvalid = FileAccess::exists(p_preset->get("custom_template/debug")); @@ -263,25 +248,21 @@ Error EditorExportPlatformUWP::export_project(const Ref &p_p src_appx = src_appx.strip_edges(); - Platform arch = (Platform)(int)p_preset->get("architecture/target"); + String arch = p_preset->get("binary_format/architecture"); if (src_appx.is_empty()) { - String err, infix; - switch (arch) { - case ARM: { - infix = "_arm_"; - } break; - case X86: { - infix = "_x86_"; - } break; - case X64: { - infix = "_x64_"; - } break; + String err, arch_infix; + if (arch == "arm32") { + arch_infix = "arm"; + } else if (arch == "x86_32") { + arch_infix = "x86"; + } else if (arch == "x86_64") { + arch_infix = "x64"; } if (p_debug) { - src_appx = find_export_template("uwp" + infix + "debug.zip", &err); + src_appx = find_export_template("uwp_" + arch_infix + "_debug.zip", &err); } else { - src_appx = find_export_template("uwp" + infix + "release.zip", &err); + src_appx = find_export_template("uwp_" + arch_infix + "_release.zip", &err); } if (src_appx.is_empty()) { EditorNode::add_io_error(err); diff --git a/platform/uwp/export/export_plugin.h b/platform/uwp/export/export_plugin.h index 5c50baf9c3..4a3c5db377 100644 --- a/platform/uwp/export/export_plugin.h +++ b/platform/uwp/export/export_plugin.h @@ -90,12 +90,6 @@ class EditorExportPlatformUWP : public EditorExportPlatform { Ref logo; - enum Platform { - ARM, - X86, - X64 - }; - bool _valid_resource_name(const String &p_name) const { if (p_name.is_empty()) { return false; @@ -215,8 +209,8 @@ class EditorExportPlatformUWP : public EditorExportPlatform { String version = itos(p_preset->get("version/major")) + "." + itos(p_preset->get("version/minor")) + "." + itos(p_preset->get("version/build")) + "." + itos(p_preset->get("version/revision")); result = result.replace("$version_string$", version); - Platform arch = (Platform)(int)p_preset->get("architecture/target"); - String architecture = arch == ARM ? "arm" : (arch == X86 ? "x86" : "x64"); + String arch = p_preset->get("binary_format/architecture"); + String architecture = arch == "arm32" ? "arm" : (arch == "x86_32" ? "x86" : "x64"); result = result.replace("$architecture$", architecture); result = result.replace("$display_name$", String(p_preset->get("package/display_name")).is_empty() ? (String)ProjectSettings::get_singleton()->get("application/config/name") : String(p_preset->get("package/display_name"))); -- cgit v1.2.3