summaryrefslogtreecommitdiffstats
path: root/editor/editor_run_native.cpp
diff options
context:
space:
mode:
authorAlexander Hartmann <alex.hart.278@gmail.com>2024-02-21 00:01:33 +0100
committerAlexander Hartmann <alex.hart.278@gmail.com>2024-02-23 01:37:32 +0100
commit293c34a2d20dc86f1962f7c41c2f3f33abf8abc3 (patch)
treeedb20cf789f472102ab1b67e23d09492f833a72c /editor/editor_run_native.cpp
parent1aab6e96b96af734d1fe5979d30d1a4232cb270d (diff)
downloadredot-engine-293c34a2d20dc86f1962f7c41c2f3f33abf8abc3.tar.gz
Display a warning if device CPU architecture is not active in the export preset.
Diffstat (limited to 'editor/editor_run_native.cpp')
-rw-r--r--editor/editor_run_native.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp
index a380ebd4ad..4eb3f07c47 100644
--- a/editor/editor_run_native.cpp
+++ b/editor/editor_run_native.cpp
@@ -79,6 +79,11 @@ void EditorRunNative::_notification(int p_what) {
}
}
+void EditorRunNative::_confirm_run_native() {
+ run_confirmed = true;
+ resume_run_native();
+}
+
Error EditorRunNative::start_run_native(int p_id) {
if (p_id < 0) {
return OK;
@@ -86,9 +91,9 @@ Error EditorRunNative::start_run_native(int p_id) {
int platform = p_id / 10000;
int idx = p_id % 10000;
+ resume_id = p_id;
if (!EditorNode::get_singleton()->ensure_main_scene(true)) {
- resume_id = p_id;
return OK;
}
@@ -110,6 +115,22 @@ Error EditorRunNative::start_run_native(int p_id) {
return ERR_UNAVAILABLE;
}
+ String architecture = eep->get_device_architecture(idx);
+ if (!run_confirmed && !architecture.is_empty()) {
+ String preset_arch = "architectures/" + architecture;
+ bool is_arch_enabled = preset->get(preset_arch);
+
+ if (!is_arch_enabled) {
+ String warning_message = vformat(TTR("Warning: The CPU architecture '%s' is not active in your export preset.\n\n"), Variant(architecture));
+ warning_message += TTR("Run 'Remote Debug' anyway?");
+
+ run_native_confirm->set_text(warning_message);
+ run_native_confirm->popup_centered();
+ return OK;
+ }
+ }
+ run_confirmed = false;
+
emit_signal(SNAME("native_run"), preset);
int flags = 0;
@@ -174,5 +195,9 @@ EditorRunNative::EditorRunNative() {
add_child(result_dialog);
result_dialog->hide();
+ run_native_confirm = memnew(ConfirmationDialog);
+ add_child(run_native_confirm);
+ run_native_confirm->connect("confirmed", callable_mp(this, &EditorRunNative::_confirm_run_native));
+
set_process(true);
}