diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index cb1b958cca9..a19819a1f82 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -211,6 +211,7 @@ EditorExportPreset::EditorExportPreset() { void EditorExportPlatform::gen_debug_flags(Vector &r_flags, int p_flags) { String host = EditorSettings::get_singleton()->get("network/debug/remote_host"); + int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) host = "localhost"; @@ -230,7 +231,7 @@ void EditorExportPlatform::gen_debug_flags(Vector &r_flags, int p_flags) r_flags.push_back("-rdebug"); - r_flags.push_back(host + ":" + String::num(GLOBAL_DEF("network/debug/remote_port", 6007))); + r_flags.push_back(host + ":" + String::num(remote_port)); List breakpoints; ScriptEditor::get_singleton()->get_breakpoints(&breakpoints); @@ -621,6 +622,7 @@ Error EditorExportPlatform::save_zip(const Ref &p_preset, co void EditorExportPlatform::gen_export_flags(Vector &r_flags, int p_flags) { String host = EditorSettings::get_singleton()->get("network/debug/remote_host"); + int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) host = "localhost"; @@ -640,7 +642,7 @@ void EditorExportPlatform::gen_export_flags(Vector &r_flags, int p_flags r_flags.push_back("-rdebug"); - r_flags.push_back(host + ":" + String::num(GLOBAL_DEF("network/debug/remote_port", 6007))); + r_flags.push_back(host + ":" + String::num(remote_port)); List breakpoints; ScriptEditor::get_singleton()->get_breakpoints(&breakpoints); @@ -2109,6 +2111,7 @@ static int _get_pad(int p_alignment, int p_n) { void EditorExportPlatform::gen_export_flags(Vector &r_flags, int p_flags) { String host = EditorSettings::get_singleton()->get("network/debug/remote_host"); + int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); if (p_flags&EXPORT_REMOTE_DEBUG_LOCALHOST) host="localhost"; @@ -2128,7 +2131,7 @@ void EditorExportPlatform::gen_export_flags(Vector &r_flags, int p_flags r_flags.push_back("-rdebug"); - r_flags.push_back(host+":"+String::num(GLOBAL_DEF("network/debug/remote_port", 6007))); + r_flags.push_back(host+":"+String::num(remote_port)); List breakpoints; ScriptEditor::get_singleton()->get_breakpoints(&breakpoints); diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp index c97dc9a88ea..a8106b4eec3 100644 --- a/editor/editor_run.cpp +++ b/editor/editor_run.cpp @@ -42,6 +42,7 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li String resource_path = GlobalConfig::get_singleton()->get_resource_path(); String remote_host = EditorSettings::get_singleton()->get("network/debug/remote_host"); + int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); if (resource_path != "") { args.push_back("-path"); @@ -50,7 +51,7 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li if (true) { args.push_back("-rdebug"); - args.push_back(remote_host + ":" + String::num(GLOBAL_GET("network/debug/remote_port"))); + args.push_back(remote_host + ":" + String::num(remote_port)); } args.push_back("-epid"); diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 7f1e6023bfd..6d22935dcb7 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1035,14 +1035,17 @@ void ScriptEditorDebugger::start() { EditorNode::get_singleton()->make_bottom_panel_item_visible(this); } - uint16_t port = GLOBAL_GET("network/debug/remote_port"); perf_history.clear(); for (int i = 0; i < Performance::MONITOR_MAX; i++) { perf_max[i] = 0; } - server->listen(port); + int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); + if (server->listen(remote_port) != OK) { + EditorNode::get_log()->add_message(String("** Error listening on port ") + itos(remote_port) + String(" **")); + return; + } set_process(true); } diff --git a/main/main.cpp b/main/main.cpp index e13fb8d3dbf..e00c136596b 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -581,12 +581,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph GLOBAL_DEF("memory/multithread/thread_rid_pool_prealloc", 60); GLOBAL_DEF("network/debug/max_remote_stdout_chars_per_second", 2048); - GLOBAL_DEF("network/debug/remote_port", 6007); if (debug_mode == "remote") { ScriptDebuggerRemote *sdr = memnew(ScriptDebuggerRemote); - uint16_t debug_port = GLOBAL_GET("network/debug/remote_port"); + uint16_t debug_port = 6007; if (debug_host.find(":") != -1) { int sep_pos = debug_host.find_last(":"); debug_port = debug_host.substr(sep_pos + 1, debug_host.length()).to_int(); diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 84fc4f10bfd..51597526ab1 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -1714,7 +1714,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) { args.push_back("--remove-all"); err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv); - int port = GlobalConfig::get_singleton()->get("network/debug/remote_port"); + int port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); args.clear(); args.push_back("reverse"); args.push_back("tcp:"+itos(port)); @@ -2993,7 +2993,7 @@ public: args.push_back("--remove-all"); err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv); - int port = GlobalConfig::get_singleton()->get("network/debug/remote_port"); + int port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); args.clear(); args.push_back("reverse"); args.push_back("tcp:" + itos(port));