summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp38
1 files changed, 28 insertions, 10 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 2326e519bf..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() {
@@ -524,7 +529,11 @@ Error Main::test_setup() {
}
}
if (text_driver_idx >= 0) {
- TextServerManager::get_singleton()->set_primary_interface(TextServerManager::get_singleton()->get_interface(text_driver_idx));
+ Ref<TextServer> ts = TextServerManager::get_singleton()->get_interface(text_driver_idx);
+ TextServerManager::get_singleton()->set_primary_interface(ts);
+ if (ts->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA)) {
+ ts->load_support_data("res://" + ts->get_support_data_filename());
+ }
} else {
ERR_FAIL_V_MSG(ERR_CANT_CREATE, "TextServer: Unable to create TextServer interface.");
}
@@ -999,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
@@ -1135,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
@@ -1373,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);
@@ -1726,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) {
@@ -1751,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;
@@ -2165,7 +2179,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
if (id) {
agile_input_event_flushing = GLOBAL_DEF("input_devices/buffering/agile_event_flushing", false);
- if (bool(GLOBAL_DEF("input_devices/pointing/emulate_touch_from_mouse", false)) &&
+ if (bool(GLOBAL_DEF_BASIC("input_devices/pointing/emulate_touch_from_mouse", false)) &&
!(editor || project_manager)) {
if (!DisplayServer::get_singleton()->is_touchscreen_available()) {
//only if no touchscreen ui hint, set emulation
@@ -2173,7 +2187,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
}
}
- id->set_emulate_mouse_from_touch(bool(GLOBAL_DEF("input_devices/pointing/emulate_mouse_from_touch", true)));
+ id->set_emulate_mouse_from_touch(bool(GLOBAL_DEF_BASIC("input_devices/pointing/emulate_mouse_from_touch", true)));
}
MAIN_PRINT("Main: Load Translations and Remaps");
@@ -2238,7 +2252,11 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
}
}
if (text_driver_idx >= 0) {
- TextServerManager::get_singleton()->set_primary_interface(TextServerManager::get_singleton()->get_interface(text_driver_idx));
+ Ref<TextServer> ts = TextServerManager::get_singleton()->get_interface(text_driver_idx);
+ TextServerManager::get_singleton()->set_primary_interface(ts);
+ if (ts->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA)) {
+ ts->load_support_data("res://" + ts->get_support_data_filename());
+ }
} else {
ERR_FAIL_V_MSG(ERR_CANT_CREATE, "TextServer: Unable to create TextServer interface.");
}