diff options
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/main/main.cpp b/main/main.cpp index 41ae368087..ca1b03392a 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -722,6 +722,29 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph I = N; } + // Network file system needs to be configured before globals, since globals are based on the + // 'project.godot' file which will only be available through the network if this is enabled + FileAccessNetwork::configure(); + if (remotefs != "") { + + file_access_network_client = memnew(FileAccessNetworkClient); + int port; + if (remotefs.find(":") != -1) { + port = remotefs.get_slicec(':', 1).to_int(); + remotefs = remotefs.get_slicec(':', 0); + } else { + port = 6010; + } + + Error err = file_access_network_client->connect(remotefs, port, remotefs_pass); + if (err) { + OS::get_singleton()->printerr("Could not connect to remotefs: %s:%i.\n", remotefs.utf8().get_data(), port); + goto error; + } + + FileAccess::make_default<FileAccessNetwork>(FileAccess::ACCESS_RESOURCES); + } + if (globals->setup(project_path, main_pack, upwards) == OK) { found_project = true; } else { @@ -729,16 +752,22 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #ifdef TOOLS_ENABLED editor = false; #else - OS::get_singleton()->print("Error: Could not load game path '%s'.\n", project_path.ascii().get_data()); + String error_msg = "Error: Could not load game data at path '" + project_path + "'. Is the .pck file missing?\n"; + OS::get_singleton()->print(error_msg.ascii().get_data()); + OS::get_singleton()->alert(error_msg); goto error; #endif } GLOBAL_DEF("memory/limits/multithreaded_server/rid_pool_prealloc", 60); + ProjectSettings::get_singleton()->set_custom_property_info("memory/limits/multithreaded_server/rid_pool_prealloc", PropertyInfo(Variant::INT, "memory/limits/multithreaded_server/rid_pool_prealloc", PROPERTY_HINT_RANGE, "0,500,1")); // No negative and limit to 500 due to crashes GLOBAL_DEF("network/limits/debugger_stdout/max_chars_per_second", 2048); + ProjectSettings::get_singleton()->set_custom_property_info("network/limits/debugger_stdout/max_chars_per_second", PropertyInfo(Variant::INT, "network/limits/debugger_stdout/max_chars_per_second", PROPERTY_HINT_RANGE, "0, 4096, 1, or_greater")); GLOBAL_DEF("network/limits/debugger_stdout/max_messages_per_frame", 10); + ProjectSettings::get_singleton()->set_custom_property_info("network/limits/debugger_stdout/max_messages_per_frame", PropertyInfo(Variant::INT, "network/limits/debugger_stdout/max_messages_per_frame", PROPERTY_HINT_RANGE, "0, 20, 1, or_greater")); GLOBAL_DEF("network/limits/debugger_stdout/max_errors_per_frame", 10); + ProjectSettings::get_singleton()->set_custom_property_info("network/limits/debugger_stdout/max_errors_per_frame", PropertyInfo(Variant::INT, "network/limits/debugger_stdout/max_errors_per_frame", PROPERTY_HINT_RANGE, "0, 20, 1, or_greater")); if (debug_mode == "remote") { @@ -762,28 +791,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph script_debugger = memnew(ScriptDebuggerLocal); OS::get_singleton()->initialize_debugging(); } - - FileAccessNetwork::configure(); - - if (remotefs != "") { - - file_access_network_client = memnew(FileAccessNetworkClient); - int port; - if (remotefs.find(":") != -1) { - port = remotefs.get_slicec(':', 1).to_int(); - remotefs = remotefs.get_slicec(':', 0); - } else { - port = 6010; - } - - Error err = file_access_network_client->connect(remotefs, port, remotefs_pass); - if (err) { - OS::get_singleton()->printerr("Could not connect to remotefs: %s:%i.\n", remotefs.utf8().get_data(), port); - goto error; - } - - FileAccess::make_default<FileAccessNetwork>(FileAccess::ACCESS_RESOURCES); - } if (script_debugger) { //there is a debugger, parse breakpoints @@ -811,6 +818,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph GLOBAL_DEF("logging/file_logging/enable_file_logging", false); GLOBAL_DEF("logging/file_logging/log_path", "user://logs/log.txt"); GLOBAL_DEF("logging/file_logging/max_log_files", 10); + ProjectSettings::get_singleton()->set_custom_property_info("logging/file_logging/max_log_files", PropertyInfo(Variant::INT, "logging/file_logging/max_log_files", PROPERTY_HINT_RANGE, "0,20,1,or_greater")); //no negative numbers if (FileAccess::get_create_func(FileAccess::ACCESS_USERDATA) && GLOBAL_GET("logging/file_logging/enable_file_logging")) { String base_path = GLOBAL_GET("logging/file_logging/log_path"); int max_files = GLOBAL_GET("logging/file_logging/max_log_files"); @@ -1001,6 +1009,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph Engine::get_singleton()->set_iterations_per_second(GLOBAL_DEF("physics/common/physics_fps", 60)); Engine::get_singleton()->set_physics_jitter_fix(GLOBAL_DEF("physics/common/physics_jitter_fix", 0.5)); Engine::get_singleton()->set_target_fps(GLOBAL_DEF("debug/settings/fps/force_fps", 0)); + ProjectSettings::get_singleton()->set_custom_property_info("debug/settings/fps/force_fps", PropertyInfo(Variant::INT, "debug/settings/fps/force_fps", PROPERTY_HINT_RANGE, "0,120,1,or_greater")); GLOBAL_DEF("debug/settings/stdout/print_fps", false); @@ -1009,10 +1018,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph if (frame_delay == 0) { frame_delay = GLOBAL_DEF("application/run/frame_delay_msec", 0); + ProjectSettings::get_singleton()->set_custom_property_info("application/run/frame_delay_msec", PropertyInfo(Variant::INT, "application/run/frame_delay_msec", PROPERTY_HINT_RANGE, "0,100,1,or_greater")); // No negative numbers } 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("application/run/low_processor_mode_sleep_usec", 8000)); + ProjectSettings::get_singleton()->set_custom_property_info("application/run/low_processor_mode_sleep_usec", PropertyInfo(Variant::INT, "application/run/low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "0,33200,1,or_greater")); // No negative numbers Engine::get_singleton()->set_frame_delay(frame_delay); @@ -1641,7 +1652,7 @@ bool Main::start() { GLOBAL_DEF("display/window/stretch/aspect", "ignore"); ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/aspect", PropertyInfo(Variant::STRING, "display/window/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height,expand")); GLOBAL_DEF("display/window/stretch/shrink", 1); - ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/shrink", PropertyInfo(Variant::STRING, "display/window/stretch/shrink", PROPERTY_HINT_RANGE, "1,8,1")); + ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/shrink", PropertyInfo(Variant::REAL, "display/window/stretch/shrink", PROPERTY_HINT_RANGE, "1,8,1")); sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true)); sml->set_quit_on_go_back(GLOBAL_DEF("application/config/quit_on_go_back", true)); GLOBAL_DEF("gui/common/snap_controls_to_pixels", true); |