diff options
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/main/main.cpp b/main/main.cpp index 5206e9b84c..f002e22766 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -42,6 +42,7 @@ #include "core/io/dir_access.h" #include "core/io/file_access_pack.h" #include "core/io/file_access_zip.h" +#include "core/io/image.h" #include "core/io/image_loader.h" #include "core/io/ip.h" #include "core/io/resource_loader.h" @@ -629,6 +630,7 @@ void Main::print_help(const char *p_binary) { print_help_option("--generate-spirv-debug-info", "Generate SPIR-V debug information. This allows source-level shader debugging with RenderDoc.\n"); #if defined(DEBUG_ENABLED) || defined(DEV_ENABLED) print_help_option("--extra-gpu-memory-tracking", "Enables additional memory tracking (see class reference for `RenderingDevice.get_driver_and_device_memory_report()` and linked methods). Currently only implemented for Vulkan. Enabling this feature may cause crashes on some systems due to buggy drivers or bugs in the Vulkan Loader. See https://github.com/godotengine/godot/issues/95967\n"); + print_help_option("--accurate-breadcrumbs", "Force barriers between breadcrumbs. Useful for narrowing down a command causing GPU resets. Currently only implemented for Vulkan.\n"); #endif print_help_option("--remote-debug <uri>", "Remote debug (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007).\n"); print_help_option("--single-threaded-scene", "Force scene tree to run in single-threaded mode. Sub-thread groups are disabled and run on the main thread.\n"); @@ -651,7 +653,7 @@ void Main::print_help(const char *p_binary) { print_help_option("--delta-smoothing <enable>", "Enable or disable frame delta smoothing [\"enable\", \"disable\"].\n"); print_help_option("--print-fps", "Print the frames per second to the stdout.\n"); #ifdef TOOLS_ENABLED - print_help_option("--editor-pseudolocalization", "Enable pseudolocalization for the editor and the project manager.\n"); + print_help_option("--editor-pseudolocalization", "Enable pseudolocalization for the editor and the project manager.\n", CLI_OPTION_AVAILABILITY_EDITOR); #endif print_help_title("Standalone tools"); @@ -1235,8 +1237,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #endif } else if (arg == "--generate-spirv-debug-info") { Engine::singleton->generate_spirv_debug_info = true; +#if defined(DEBUG_ENABLED) || defined(DEV_ENABLED) } else if (arg == "--extra-gpu-memory-tracking") { Engine::singleton->extra_gpu_memory_tracking = true; + } else if (arg == "--accurate-breadcrumbs") { + Engine::singleton->accurate_breadcrumbs = true; +#endif } else if (arg == "--tablet-driver") { if (N) { tablet_driver = N->get(); @@ -1592,7 +1598,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (arg.ends_with("project.godot")) { String path; String file = arg; - int sep = MAX(file.rfind("/"), file.rfind("\\")); + int sep = MAX(file.rfind_char('/'), file.rfind_char('\\')); if (sep == -1) { path = "."; } else { @@ -2412,6 +2418,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph if (bool(GLOBAL_GET("display/window/size/no_focus"))) { window_flags |= DisplayServer::WINDOW_FLAG_NO_FOCUS_BIT; } + if (bool(GLOBAL_GET("display/window/size/sharp_corners"))) { + window_flags |= DisplayServer::WINDOW_FLAG_SHARP_CORNERS_BIT; + } window_mode = (DisplayServer::WindowMode)(GLOBAL_GET("display/window/size/mode").operator int()); int initial_position_type = GLOBAL_GET("display/window/size/initial_position_type").operator int(); if (initial_position_type == 0) { // Absolute. @@ -2495,7 +2504,14 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph GLOBAL_DEF_RST_NOVAL("audio/driver/driver", AudioDriverManager::get_driver(0)->get_name()); if (audio_driver.is_empty()) { // Specified in project.godot. - audio_driver = GLOBAL_GET("audio/driver/driver"); + if (project_manager) { + // The project manager doesn't need to play sound (TTS audio output is not emitted by Godot, but by the system itself). + // Disable audio output so it doesn't appear in the list of applications outputting sound in the OS. + // On macOS, this also prevents the project manager from inhibiting suspend. + audio_driver = "Dummy"; + } else { + audio_driver = GLOBAL_GET("audio/driver/driver"); + } } // Make sure that dummy is the last one, which it is assumed to be by design. @@ -2531,7 +2547,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph Engine::get_singleton()->set_physics_ticks_per_second(GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "physics/common/physics_ticks_per_second", PROPERTY_HINT_RANGE, "1,1000,1"), 60)); Engine::get_singleton()->set_max_physics_steps_per_frame(GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "physics/common/max_physics_steps_per_frame", PROPERTY_HINT_RANGE, "1,100,1"), 8)); Engine::get_singleton()->set_physics_jitter_fix(GLOBAL_DEF("physics/common/physics_jitter_fix", 0.5)); - Engine::get_singleton()->set_max_fps(GLOBAL_DEF(PropertyInfo(Variant::INT, "application/run/max_fps", PROPERTY_HINT_RANGE, "0,1000,1"), 0)); GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "audio/driver/output_latency", PROPERTY_HINT_RANGE, "1,100,1"), 15); // Use a safer default output_latency for web to avoid audio cracking on low-end devices, especially mobile. @@ -2552,10 +2567,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->set_environment("MVK_CONFIG_LOG_LEVEL", OS::get_singleton()->_verbose_stdout ? "3" : "1"); // 1 = Errors only, 3 = Info #endif - if (max_fps >= 0) { - Engine::get_singleton()->set_max_fps(max_fps); - } - if (frame_delay == 0) { frame_delay = GLOBAL_DEF(PropertyInfo(Variant::INT, "application/run/frame_delay_msec", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), 0); if (Engine::get_singleton()->is_editor_hint()) { @@ -3001,6 +3012,13 @@ Error Main::setup2(bool p_show_boot_logo) { OS::get_singleton()->benchmark_end_measure("Servers", "Display"); } + // Max FPS needs to be set after the DisplayServer is created. + Engine::get_singleton()->set_max_fps(GLOBAL_DEF(PropertyInfo(Variant::INT, "application/run/max_fps", PROPERTY_HINT_RANGE, "0,1000,1"), 0)); + + if (max_fps >= 0) { + Engine::get_singleton()->set_max_fps(max_fps); + } + #ifdef TOOLS_ENABLED // If the editor is running in windowed mode, ensure the window rect fits // the screen in case screen count or position has changed. @@ -3197,6 +3215,10 @@ Error Main::setup2(bool p_show_boot_logo) { } id->set_emulate_mouse_from_touch(bool(GLOBAL_DEF_BASIC("input_devices/pointing/emulate_mouse_from_touch", true))); + + if (editor) { + id->set_emulate_mouse_from_touch(true); + } } OS::get_singleton()->benchmark_end_measure("Startup", "Setup Window and Boot"); @@ -3428,7 +3450,7 @@ void Main::setup_boot_logo() { if (show_logo) { //boot logo! const bool boot_logo_image = GLOBAL_DEF_BASIC("application/boot_splash/show_image", true); - const String boot_logo_path = String(GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "application/boot_splash/image", PROPERTY_HINT_FILE, "*.png"), String())).strip_edges(); + const String boot_logo_path = ResourceUID::ensure_path(GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "application/boot_splash/image", PROPERTY_HINT_FILE, "*.png"), String())).strip_edges(); const bool boot_logo_scale = GLOBAL_DEF_BASIC("application/boot_splash/fullsize", true); const bool boot_logo_filter = GLOBAL_DEF_BASIC("application/boot_splash/use_filter", true); @@ -4013,12 +4035,12 @@ int Main::start() { EditorNode *editor_node = nullptr; if (editor) { OS::get_singleton()->benchmark_begin_measure("Startup", "Editor"); - editor_node = memnew(EditorNode); if (editor_pseudolocalization) { translation_server->get_editor_domain()->set_pseudolocalization_enabled(true); } + editor_node = memnew(EditorNode); sml->get_root()->add_child(editor_node); if (!_export_preset.is_empty()) { @@ -4123,7 +4145,7 @@ int Main::start() { local_game_path = "res://" + local_game_path; } else { - int sep = local_game_path.rfind("/"); + int sep = local_game_path.rfind_char('/'); if (sep == -1) { Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); @@ -4210,14 +4232,15 @@ int Main::start() { if (project_manager) { OS::get_singleton()->benchmark_begin_measure("Startup", "Project Manager"); Engine::get_singleton()->set_editor_hint(true); - ProjectManager *pmanager = memnew(ProjectManager); - ProgressDialog *progress_dialog = memnew(ProgressDialog); - pmanager->add_child(progress_dialog); if (editor_pseudolocalization) { translation_server->get_editor_domain()->set_pseudolocalization_enabled(true); } + ProjectManager *pmanager = memnew(ProjectManager); + ProgressDialog *progress_dialog = memnew(ProgressDialog); + pmanager->add_child(progress_dialog); + sml->get_root()->add_child(pmanager); OS::get_singleton()->benchmark_end_measure("Startup", "Project Manager"); } |