diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/main/main.cpp b/main/main.cpp index eff30bee9b..c5a9f94417 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -208,6 +208,11 @@ static bool dump_extension_api = false; #endif bool profile_gpu = false; +// Constants. + +static const String NULL_DISPLAY_DRIVER("headless"); +static const String NULL_AUDIO_DRIVER("Dummy"); + /* Helper methods */ bool Main::is_cmdline_tool() { @@ -1003,8 +1008,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "--headless") { // enable headless mode (no audio, no rendering). - audio_driver = "Dummy"; - display_driver = "headless"; + audio_driver = NULL_AUDIO_DRIVER; + display_driver = NULL_DISPLAY_DRIVER; } else if (I->get() == "--profiling") { // enable profiling @@ -1139,8 +1144,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph // `--doctool` implies `--headless` to avoid spawning an unnecessary window // and speed up class reference generation. - audio_driver = "Dummy"; - display_driver = "headless"; + audio_driver = NULL_AUDIO_DRIVER; + display_driver = NULL_DISPLAY_DRIVER; main_args.push_back(I->get()); #endif } else if (I->get() == "--path") { // set path of project to start or edit @@ -1377,6 +1382,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph ResourceUID::get_singleton()->load_from_cache(); // load UUIDs from cache. + if (ProjectSettings::get_singleton()->has_custom_feature("dedicated_server")) { + audio_driver = NULL_AUDIO_DRIVER; + display_driver = NULL_DISPLAY_DRIVER; + } + GLOBAL_DEF(PropertyInfo(Variant::INT, "network/limits/debugger/max_chars_per_second", PROPERTY_HINT_RANGE, "0, 4096, 1, or_greater"), 32768); GLOBAL_DEF(PropertyInfo(Variant::INT, "network/limits/debugger/max_queued_messages", PROPERTY_HINT_RANGE, "0, 8192, 1, or_greater"), 2048); GLOBAL_DEF(PropertyInfo(Variant::INT, "network/limits/debugger/max_errors_per_second", PROPERTY_HINT_RANGE, "0, 200, 1, or_greater"), 400); @@ -1730,7 +1740,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph // Display driver, e.g. X11, Wayland. // Make sure that headless is the last one, which it is assumed to be by design. - DEV_ASSERT(String("headless") == DisplayServer::get_create_function_name(DisplayServer::get_create_function_count() - 1)); + DEV_ASSERT(NULL_DISPLAY_DRIVER == DisplayServer::get_create_function_name(DisplayServer::get_create_function_count() - 1)); for (int i = 0; i < DisplayServer::get_create_function_count(); i++) { String name = DisplayServer::get_create_function_name(i); if (display_driver == name) { @@ -1755,7 +1765,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } // Make sure that dummy is the last one, which it is assumed to be by design. - DEV_ASSERT(String("Dummy") == AudioDriverManager::get_driver(AudioDriverManager::get_driver_count() - 1)->get_name()); + DEV_ASSERT(NULL_AUDIO_DRIVER == AudioDriverManager::get_driver(AudioDriverManager::get_driver_count() - 1)->get_name()); for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) { if (audio_driver == AudioDriverManager::get_driver(i)->get_name()) { audio_driver_idx = i; |