|
@@ -733,6 +733,7 @@ Error Main::test_setup() {
|
|
physics_server_2d_manager = memnew(PhysicsServer2DManager);
|
|
physics_server_2d_manager = memnew(PhysicsServer2DManager);
|
|
|
|
|
|
// From `Main::setup2()`.
|
|
// From `Main::setup2()`.
|
|
|
|
+ register_early_core_singletons();
|
|
initialize_modules(MODULE_INITIALIZATION_LEVEL_CORE);
|
|
initialize_modules(MODULE_INITIALIZATION_LEVEL_CORE);
|
|
register_core_extensions();
|
|
register_core_extensions();
|
|
|
|
|
|
@@ -1869,12 +1870,55 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|
if (editor) {
|
|
if (editor) {
|
|
Engine::get_singleton()->set_editor_hint(true);
|
|
Engine::get_singleton()->set_editor_hint(true);
|
|
Engine::get_singleton()->set_extension_reloading_enabled(true);
|
|
Engine::get_singleton()->set_extension_reloading_enabled(true);
|
|
|
|
+
|
|
|
|
+ main_args.push_back("--editor");
|
|
|
|
+ if (!init_windowed && !init_fullscreen) {
|
|
|
|
+ init_maximized = true;
|
|
|
|
+ window_mode = DisplayServer::WINDOW_MODE_MAXIMIZED;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!project_manager && !editor) {
|
|
|
|
+ // If we didn't find a project, we fall back to the project manager.
|
|
|
|
+ project_manager = !found_project && !cmdline_tool;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (project_manager) {
|
|
|
|
+ Engine::get_singleton()->set_project_manager_hint(true);
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+ OS::get_singleton()->set_cmdline(execpath, main_args, user_args);
|
|
|
|
+
|
|
|
|
+ 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));
|
|
|
|
+ if (max_fps >= 0) {
|
|
|
|
+ Engine::get_singleton()->set_max_fps(max_fps);
|
|
|
|
+ }
|
|
|
|
+
|
|
// Initialize user data dir.
|
|
// Initialize user data dir.
|
|
OS::get_singleton()->ensure_user_data_dir();
|
|
OS::get_singleton()->ensure_user_data_dir();
|
|
|
|
|
|
|
|
+ OS::get_singleton()->set_low_processor_usage_mode(GLOBAL_DEF("application/run/low_processor_mode", false));
|
|
|
|
+ OS::get_singleton()->set_low_processor_usage_mode_sleep_usec(
|
|
|
|
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "application/run/low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "0,33200,1,or_greater"), 6900)); // Roughly 144 FPS
|
|
|
|
+
|
|
|
|
+ GLOBAL_DEF("application/run/delta_smoothing", true);
|
|
|
|
+ if (!delta_smoothing_override) {
|
|
|
|
+ OS::get_singleton()->set_delta_smoothing(GLOBAL_GET("application/run/delta_smoothing"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ GLOBAL_DEF("debug/settings/stdout/print_fps", false);
|
|
|
|
+ GLOBAL_DEF("debug/settings/stdout/print_gpu_profile", false);
|
|
|
|
+ GLOBAL_DEF("debug/settings/stdout/verbose_stdout", false);
|
|
|
|
+ GLOBAL_DEF("debug/settings/physics_interpolation/enable_warnings", true);
|
|
|
|
+ if (!OS::get_singleton()->_verbose_stdout) { // Not manually overridden.
|
|
|
|
+ OS::get_singleton()->_verbose_stdout = GLOBAL_GET("debug/settings/stdout/verbose_stdout");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ register_early_core_singletons();
|
|
initialize_modules(MODULE_INITIALIZATION_LEVEL_CORE);
|
|
initialize_modules(MODULE_INITIALIZATION_LEVEL_CORE);
|
|
register_core_extensions(); // core extensions must be registered after globals setup and before display
|
|
register_core_extensions(); // core extensions must be registered after globals setup and before display
|
|
|
|
|
|
@@ -1899,20 +1943,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|
#ifdef TOOLS_ENABLED
|
|
#ifdef TOOLS_ENABLED
|
|
if (editor) {
|
|
if (editor) {
|
|
packed_data->set_disabled(true);
|
|
packed_data->set_disabled(true);
|
|
- main_args.push_back("--editor");
|
|
|
|
- if (!init_windowed && !init_fullscreen) {
|
|
|
|
- init_maximized = true;
|
|
|
|
- window_mode = DisplayServer::WINDOW_MODE_MAXIMIZED;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!project_manager && !editor) {
|
|
|
|
- // If we didn't find a project, we fall back to the project manager.
|
|
|
|
- project_manager = !found_project && !cmdline_tool;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (project_manager) {
|
|
|
|
- Engine::get_singleton()->set_project_manager_hint(true);
|
|
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
@@ -1984,8 +2014,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|
|
|
|
|
Logger::set_flush_stdout_on_print(GLOBAL_GET("application/run/flush_stdout_on_print"));
|
|
Logger::set_flush_stdout_on_print(GLOBAL_GET("application/run/flush_stdout_on_print"));
|
|
|
|
|
|
- OS::get_singleton()->set_cmdline(execpath, main_args, user_args);
|
|
|
|
-
|
|
|
|
{
|
|
{
|
|
String driver_hints = "";
|
|
String driver_hints = "";
|
|
String driver_hints_with_d3d12 = "";
|
|
String driver_hints_with_d3d12 = "";
|
|
@@ -2544,9 +2572,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|
window_vsync_mode = DisplayServer::VSyncMode::VSYNC_DISABLED;
|
|
window_vsync_mode = DisplayServer::VSyncMode::VSYNC_DISABLED;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- 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));
|
|
|
|
|
|
|
|
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "audio/driver/output_latency", PROPERTY_HINT_RANGE, "1,100,1"), 15);
|
|
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.
|
|
// Use a safer default output_latency for web to avoid audio cracking on low-end devices, especially mobile.
|
|
@@ -2554,15 +2579,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|
|
|
|
|
Engine::get_singleton()->set_audio_output_latency(GLOBAL_GET("audio/driver/output_latency"));
|
|
Engine::get_singleton()->set_audio_output_latency(GLOBAL_GET("audio/driver/output_latency"));
|
|
|
|
|
|
- GLOBAL_DEF("debug/settings/stdout/print_fps", false);
|
|
|
|
- GLOBAL_DEF("debug/settings/stdout/print_gpu_profile", false);
|
|
|
|
- GLOBAL_DEF("debug/settings/stdout/verbose_stdout", false);
|
|
|
|
- GLOBAL_DEF("debug/settings/physics_interpolation/enable_warnings", true);
|
|
|
|
-
|
|
|
|
- if (!OS::get_singleton()->_verbose_stdout) { // Not manually overridden.
|
|
|
|
- OS::get_singleton()->_verbose_stdout = GLOBAL_GET("debug/settings/stdout/verbose_stdout");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
#if defined(MACOS_ENABLED) || defined(IOS_ENABLED)
|
|
#if defined(MACOS_ENABLED) || defined(IOS_ENABLED)
|
|
OS::get_singleton()->set_environment("MVK_CONFIG_LOG_LEVEL", OS::get_singleton()->_verbose_stdout ? "3" : "1"); // 1 = Errors only, 3 = Info
|
|
OS::get_singleton()->set_environment("MVK_CONFIG_LOG_LEVEL", OS::get_singleton()->_verbose_stdout ? "3" : "1"); // 1 = Errors only, 3 = Info
|
|
#endif
|
|
#endif
|
|
@@ -2578,15 +2594,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|
Engine::get_singleton()->set_audio_output_latency(audio_output_latency);
|
|
Engine::get_singleton()->set_audio_output_latency(audio_output_latency);
|
|
}
|
|
}
|
|
|
|
|
|
- OS::get_singleton()->set_low_processor_usage_mode(GLOBAL_DEF("application/run/low_processor_mode", false));
|
|
|
|
- OS::get_singleton()->set_low_processor_usage_mode_sleep_usec(
|
|
|
|
- GLOBAL_DEF(PropertyInfo(Variant::INT, "application/run/low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "0,33200,1,or_greater"), 6900)); // Roughly 144 FPS
|
|
|
|
-
|
|
|
|
- GLOBAL_DEF("application/run/delta_smoothing", true);
|
|
|
|
- if (!delta_smoothing_override) {
|
|
|
|
- OS::get_singleton()->set_delta_smoothing(GLOBAL_GET("application/run/delta_smoothing"));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
GLOBAL_DEF("display/window/ios/allow_high_refresh_rate", true);
|
|
GLOBAL_DEF("display/window/ios/allow_high_refresh_rate", true);
|
|
GLOBAL_DEF("display/window/ios/hide_home_indicator", true);
|
|
GLOBAL_DEF("display/window/ios/hide_home_indicator", true);
|
|
GLOBAL_DEF("display/window/ios/hide_status_bar", true);
|
|
GLOBAL_DEF("display/window/ios/hide_status_bar", true);
|
|
@@ -3013,10 +3020,9 @@ Error Main::setup2(bool p_show_boot_logo) {
|
|
}
|
|
}
|
|
|
|
|
|
// Max FPS needs to be set after the DisplayServer is created.
|
|
// 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);
|
|
|
|
|
|
+ RenderingDevice *rd = RenderingDevice::get_singleton();
|
|
|
|
+ if (rd) {
|
|
|
|
+ rd->_set_max_fps(engine->get_max_fps());
|
|
}
|
|
}
|
|
|
|
|
|
#ifdef TOOLS_ENABLED
|
|
#ifdef TOOLS_ENABLED
|