diff options
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/main/main.cpp b/main/main.cpp index 958d964b35..ef632e197c 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -205,7 +205,6 @@ void initialize_physics() { } void finalize_physics() { - physics_server->finish(); memdelete(physics_server); @@ -214,7 +213,6 @@ void finalize_physics() { } void finalize_display() { - rendering_server->finish(); memdelete(rendering_server); @@ -244,7 +242,6 @@ void finalize_navigation_server() { #endif void Main::print_help(const char *p_binary) { - print_line(String(VERSION_NAME) + " v" + get_full_version_string() + " - " + String(VERSION_WEBSITE)); OS::get_singleton()->print("Free and open source software under the terms of the MIT license.\n"); OS::get_singleton()->print("(c) 2007-2020 Juan Linietsky, Ariel Manzur.\n"); @@ -390,7 +387,6 @@ void Main::print_help(const char *p_binary) { */ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_phase) { - OS::get_singleton()->initialize(); engine = memnew(Engine); @@ -425,7 +421,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph List<String> main_args; for (int i = 0; i < argc; i++) { - args.push_back(String::utf8(argv[i])); } @@ -434,7 +429,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph I = args.front(); while (I) { - I->get() = unescape_cmdline(I->get().strip_edges()); I = I->next(); } @@ -498,7 +492,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph goto error; } else if (I->get() == "--version") { - print_line(get_full_version_string()); goto error; @@ -512,7 +505,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "--audio-driver") { // audio driver if (I->next()) { - audio_driver = I->next()->get(); bool found = false; @@ -549,7 +541,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "--display-driver") { // force video driver if (I->next()) { - display_driver = I->next()->get(); bool found = false; @@ -598,7 +589,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph Engine::singleton->abort_on_gpu_errors = true; } else if (I->get() == "--disable-wintab") { - disable_wintab = true; } else if (I->get() == "--single-window") { // force single window @@ -609,7 +599,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "--resolution") { // force resolution if (I->next()) { - String vm = I->next()->get(); if (vm.find("x") == -1) { // invalid parameter format @@ -622,7 +611,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph int h = vm.get_slice("x", 1).to_int(); if (w <= 0 || h <= 0) { - OS::get_singleton()->print("Invalid resolution '%s', width and height must be above 0.\n", vm.utf8().get_data()); goto error; } @@ -640,7 +628,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "--position") { // set window position if (I->next()) { - String vm = I->next()->get(); if (vm.find(",") == -1) { // invalid parameter format @@ -668,11 +655,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->set_no_window_mode(true); } else if (I->get() == "--enable-vsync-via-compositor") { - window_vsync_via_compositor = true; saw_vsync_via_compositor_override = true; } else if (I->get() == "--disable-vsync-via-compositor") { - window_vsync_via_compositor = false; saw_vsync_via_compositor_override = true; #endif @@ -683,7 +668,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "-l" || I->get() == "--language") { // language if (I->next()) { - locale = I->next()->get(); N = I->next()->next(); } else { @@ -694,7 +678,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "--remote-fs") { // remote filesystem if (I->next()) { - remotefs = I->next()->get(); N = I->next()->next(); } else { @@ -704,7 +687,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "--remote-fs-password") { // remote filesystem password if (I->next()) { - remotefs_pass = I->next()->get(); N = I->next()->next(); } else { @@ -714,7 +696,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "--render-thread") { // render thread mode if (I->next()) { - if (I->next()->get() == "safe") rtm = OS::RENDER_THREAD_SAFE; else if (I->next()->get() == "unsafe") @@ -754,7 +735,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "--path") { // set path of project to start or edit if (I->next()) { - String p = I->next()->get(); if (OS::get_singleton()->set_cwd(p) == OK) { //nothing @@ -790,7 +770,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "-b" || I->get() == "--breakpoints") { // add breakpoints if (I->next()) { - String bplist = I->next()->get(); breakpoints = bplist.split(","); N = I->next()->next(); @@ -802,7 +781,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "--frame-delay") { // force frame delay if (I->next()) { - frame_delay = I->next()->get().to_int(); N = I->next()->next(); } else { @@ -813,7 +791,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "--time-scale") { // force time scale if (I->next()) { - Engine::get_singleton()->set_time_scale(I->next()->get().to_double()); N = I->next()->next(); } else { @@ -822,9 +799,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } } else if (I->get() == "--main-pack") { - if (I->next()) { - main_pack = I->next()->get(); N = I->next()->next(); } else { @@ -842,7 +817,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #endif } else if (I->get() == "--remote-debug") { if (I->next()) { - debug_uri = I->next()->get(); if (debug_uri.find("://") == -1) { // wrong address OS::get_singleton()->print("Invalid debug host address, it should be of the form <protocol>://<host/IP>:<port>.\n"); @@ -855,7 +829,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } } else if (I->get() == "--allow_focus_steal_pid") { // not exposed to user if (I->next()) { - allow_focus_steal_pid = I->next()->get().to_int64(); N = I->next()->next(); } else { @@ -896,7 +869,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph // '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) { @@ -920,7 +892,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph found_project = true; #endif } else { - #ifdef TOOLS_ENABLED editor = false; #else @@ -1033,13 +1004,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph ProjectSettings::get_singleton()->set_custom_property_info("display/window/size/test_height", PropertyInfo(Variant::INT, "display/window/size/test_height", PROPERTY_HINT_RANGE, "0,4320,or_greater")); // 8K resolution if (use_custom_res) { - if (!force_res) { window_size.width = GLOBAL_GET("display/window/size/width"); window_size.height = GLOBAL_GET("display/window/size/height"); if (globals->has_setting("display/window/size/test_width") && globals->has_setting("display/window/size/test_height")) { - int tw = globals->get("display/window/size/test_width"); if (tw > 0) { window_size.width = tw; @@ -1119,9 +1088,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph /* Determine audio and video drivers */ for (int i = 0; i < DisplayServer::get_create_function_count(); i++) { - if (display_driver == DisplayServer::get_create_function_name(i)) { - display_driver_idx = i; break; } @@ -1136,9 +1103,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) { - if (audio_driver == AudioDriverManager::get_driver(i)->get_name()) { - audio_driver_idx = i; break; } @@ -1243,7 +1208,6 @@ error: } Error Main::setup2(Thread::ID p_main_tid_override) { - preregister_module_types(); preregister_server_types(); @@ -1265,7 +1229,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) { /* Iniitalize Display Server */ { - String rendering_driver; // temp broken Error err; @@ -1417,7 +1380,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) { Input *id = Input::get_singleton(); if (id) { if (bool(GLOBAL_DEF("input_devices/pointing/emulate_touch_from_mouse", false)) && !(editor || project_manager)) { - bool found_touchscreen = false; for (int i = 0; i < DisplayServer::get_singleton()->get_screen_count(); i++) { if (DisplayServer::get_singleton()->screen_is_touchscreen(i)) { @@ -1445,7 +1407,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) { ProjectSettings::get_singleton()->set_custom_property_info("display/mouse_cursor/custom_image", PropertyInfo(Variant::STRING, "display/mouse_cursor/custom_image", PROPERTY_HINT_FILE, "*.png,*.webp")); if (String(ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image")) != String()) { - Ref<Texture2D> cursor = ResourceLoader::load(ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image")); if (cursor.is_valid()) { Vector2 hotspot = ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image_hotspot"); @@ -1480,7 +1441,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) { translation_server->setup(); //register translations, load them, etc. if (locale != "") { - translation_server->set_locale(locale); } translation_server->load_translations(); @@ -1520,7 +1480,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) { static MainTimerSync main_timer_sync; bool Main::start() { - ERR_FAIL_COND_V(!_start_success, false); bool hasicon = false; @@ -1604,7 +1563,6 @@ bool Main::start() { String main_loop_type; #ifdef TOOLS_ENABLED if (doc_tool != "") { - Engine::get_singleton()->set_editor_hint(true); // Needed to instance editor-only classes for their default values { @@ -1700,7 +1658,6 @@ bool Main::start() { #endif } else if (script != "") { - Ref<Script> script_res = ResourceLoader::load(script); ERR_FAIL_COND_V_MSG(script_res.is_null(), false, "Can't load script: " + script); @@ -1712,7 +1669,6 @@ bool Main::start() { } if (script_res->can_instance()) { - StringName instance_type = script_res->get_instance_base_type(); Object *obj = ClassDB::instance(instance_type); MainLoop *script_loop = Object::cast_to<MainLoop>(obj); @@ -1725,7 +1681,6 @@ bool Main::start() { script_loop->set_init_script(script_res); main_loop = script_loop; } else { - return false; } @@ -1741,13 +1696,11 @@ bool Main::start() { DisplayServer::get_singleton()->alert("Error: MainLoop type doesn't exist: " + main_loop_type); return false; } else { - Object *ml = ClassDB::instance(main_loop_type); ERR_FAIL_COND_V_MSG(!ml, false, "Can't instance MainLoop type."); main_loop = Object::cast_to<MainLoop>(ml); if (!main_loop) { - memdelete(ml); ERR_FAIL_V_MSG(false, "Invalid MainLoop type."); } @@ -1755,7 +1708,6 @@ bool Main::start() { } if (main_loop->is_class("SceneTree")) { - SceneTree *sml = Object::cast_to<SceneTree>(main_loop); #ifdef DEBUG_ENABLED @@ -1783,7 +1735,6 @@ bool Main::start() { //first pass, add the constants so they exist before any script is loaded for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { - String s = E->get().name; if (!s.begins_with("autoload/")) continue; @@ -1804,7 +1755,6 @@ bool Main::start() { //second pass, load into global constants List<Node *> to_add; for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { - String s = E->get().name; if (!s.begins_with("autoload/")) continue; @@ -1850,7 +1800,6 @@ bool Main::start() { } for (List<Node *>::Element *E = to_add.front(); E; E = E->next()) { - sml->get_root()->add_child(E->get()); } } @@ -1870,7 +1819,6 @@ bool Main::start() { #endif { - int directional_atlas_size = GLOBAL_GET("rendering/quality/directional_shadow/size"); RenderingServer::get_singleton()->directional_shadow_atlas_set_size(directional_atlas_size); } @@ -1932,7 +1880,6 @@ bool Main::start() { sml->get_root()->set_default_canvas_item_texture_repeat(Viewport::DefaultCanvasItemTextureRepeat(texture_repeat)); } else { - GLOBAL_DEF("display/window/stretch/mode", "disabled"); ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/mode", PropertyInfo(Variant::STRING, "display/window/stretch/mode", PROPERTY_HINT_ENUM, "disabled,2d,viewport")); GLOBAL_DEF("display/window/stretch/aspect", "ignore"); @@ -1952,16 +1899,13 @@ bool Main::start() { String local_game_path; if (game_path != "" && !project_manager) { - local_game_path = game_path.replace("\\", "/"); if (!local_game_path.begins_with("res://")) { bool absolute = (local_game_path.size() > 1) && (local_game_path[0] == '/' || local_game_path[1] == ':'); if (!absolute) { - if (ProjectSettings::get_singleton()->is_using_datapack()) { - local_game_path = "res://" + local_game_path; } else { @@ -1972,7 +1916,6 @@ bool Main::start() { local_game_path = da->get_current_dir().plus_file(local_game_path); memdelete(da); } else { - DirAccess *da = DirAccess::open(local_game_path.substr(0, sep)); if (da) { local_game_path = da->get_current_dir().plus_file(local_game_path.substr(sep + 1, local_game_path.length())); @@ -1987,7 +1930,6 @@ bool Main::start() { #ifdef TOOLS_ENABLED if (editor) { - bool editor_embed_subwindows = EditorSettings::get_singleton()->get_setting("interface/editor/single_window_mode"); if (editor_embed_subwindows) { @@ -2051,7 +1993,6 @@ bool Main::start() { #ifdef TOOLS_ENABLED if (project_manager || (script == "" && test == "" && game_path == "" && !editor)) { - Engine::get_singleton()->set_editor_hint(true); ProjectManager *pmanager = memnew(ProjectManager); ProgressDialog *progress_dialog = memnew(ProgressDialog); @@ -2109,7 +2050,6 @@ static uint64_t physics_process_max = 0; static uint64_t idle_process_max = 0; bool Main::iteration() { - //for now do not error on this //ERR_FAIL_COND_V(iterating, false); @@ -2152,7 +2092,6 @@ bool Main::iteration() { Engine::get_singleton()->_in_physics = true; for (int iters = 0; iters < advance.physics_steps; ++iters) { - uint64_t physics_begin = OS::get_singleton()->get_ticks_usec(); PhysicsServer3D::get_singleton()->sync(); @@ -2194,7 +2133,6 @@ bool Main::iteration() { RenderingServer::get_singleton()->sync(); //sync if still drawing from previous frames. if (DisplayServer::get_singleton()->can_any_window_draw() && !disable_render_loop) { - if ((!force_redraw_requested) && OS::get_singleton()->is_in_low_processor_usage_mode()) { if (RenderingServer::get_singleton()->has_changed()) { RenderingServer::get_singleton()->draw(true, scaled_step); // flush visual commands @@ -2224,7 +2162,6 @@ bool Main::iteration() { Engine::get_singleton()->_idle_frames++; if (frame > 1000000) { - if (editor || project_manager) { if (print_fps) { print_line("Editor FPS: " + itos(frames)); @@ -2294,7 +2231,6 @@ void Main::force_redraw() { * The order matters as some of those steps are linked with each other. */ void Main::cleanup() { - ERR_FAIL_COND(!_start_success); EngineDebugger::deinitialize(); |