/*************************************************************************/ /* main.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "main.h" #include "app_icon.gen.h" #include "core/register_core_types.h" #include "drivers/register_driver_types.h" #include "message_queue.h" #include "modules/register_module_types.h" #include "os/os.h" #include "project_settings.h" #include "scene/register_scene_types.h" #include "script_debugger_local.h" #include "script_debugger_remote.h" #include "servers/register_server_types.h" #include "splash.gen.h" #include "input_map.h" #include "io/resource_loader.h" #include "scene/main/scene_tree.h" #include "servers/audio_server.h" #include "io/resource_loader.h" #include "script_language.h" #include "core/io/ip.h" #include "main/tests/test_main.h" #include "os/dir_access.h" #include "scene/main/viewport.h" #include "scene/resources/packed_scene.h" #ifdef TOOLS_ENABLED #include "editor/doc/doc_data.h" #include "editor/editor_node.h" #include "editor/project_manager.h" #endif #include "io/file_access_network.h" #include "servers/physics_2d_server.h" #include "core/io/file_access_pack.h" #include "core/io/file_access_zip.h" #include "core/io/stream_peer_ssl.h" #include "core/io/stream_peer_tcp.h" #include "main/input_default.h" #include "performance.h" #include "translation.h" #include "version.h" static ProjectSettings *globals = NULL; static Engine *engine = NULL; static InputMap *input_map = NULL; static bool _start_success = false; static ScriptDebugger *script_debugger = NULL; AudioServer *audio_server = NULL; static MessageQueue *message_queue = NULL; static Performance *performance = NULL; static PackedData *packed_data = NULL; #ifdef MINIZIP_ENABLED static ZipArchive *zip_packed_data = NULL; #endif static FileAccessNetworkClient *file_access_network_client = NULL; static TranslationServer *translation_server = NULL; static OS::VideoMode video_mode; static bool init_maximized = false; static bool init_windowed = false; static bool init_fullscreen = false; static bool init_use_custom_pos = false; #ifdef DEBUG_ENABLED static bool debug_collisions = false; static bool debug_navigation = false; #endif static int frame_delay = 0; static Vector2 init_custom_pos; static int video_driver_idx = -1; static int audio_driver_idx = -1; static String locale; static bool use_debug_profiler = false; static bool force_lowdpi = false; static int init_screen = -1; static bool use_vsync = true; static bool editor = false; static bool show_help = false; static OS::ProcessID allow_focus_steal_pid = 0; static String unescape_cmdline(const String &p_str) { return p_str.replace("%20", " "); } //#define DEBUG_INIT #ifdef DEBUG_INIT #define MAIN_PRINT(m_txt) print_line(m_txt) #else #define MAIN_PRINT(m_txt) #endif void Main::print_help(const char *p_binary) { OS::get_singleton()->print(VERSION_FULL_NAME " - https://godotengine.org\n"); OS::get_singleton()->print("(c) 2007-2017 Juan Linietsky, Ariel Manzur.\n"); OS::get_singleton()->print("(c) 2014-2017 Godot Engine contributors.\n"); OS::get_singleton()->print("\n"); OS::get_singleton()->print("Usage: %s [options] [path to scene or 'project.godot' file]\n", p_binary); OS::get_singleton()->print("\n"); OS::get_singleton()->print("General options:\n"); OS::get_singleton()->print(" -h, --help Display this help message.\n"); OS::get_singleton()->print(" -v, --verbose Use verbose stdout mode.\n"); OS::get_singleton()->print(" --quiet Quiet mode, silences stdout messages. Errors are still displayed.\n"); OS::get_singleton()->print("\n"); OS::get_singleton()->print("Run options:\n"); #ifdef TOOLS_ENABLED OS::get_singleton()->print(" -e, --editor Start the editor instead of running the scene.\n"); OS::get_singleton()->print(" -p, --project-manager Start the project manager, even if a project is auto-detected.\n"); #endif OS::get_singleton()->print(" -l, --language Use a specific locale ( being a two-letter code).\n"); OS::get_singleton()->print(" --path Path to a project ( must contain a 'project.godot' file).\n"); OS::get_singleton()->print(" --main-pack Path to a pack (.pck) file to load.\n"); OS::get_singleton()->print(" --render-thread Render thread mode ('unsafe', 'safe', 'separate').\n"); OS::get_singleton()->print(" --remote-fs
Remote filesystem ([:] address).\n"); OS::get_singleton()->print(" --remote-fs-password Password for remote filesystem.\n"); OS::get_singleton()->print(" --audio-driver Audio driver ("); for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) { if (i != 0) OS::get_singleton()->print(", "); OS::get_singleton()->print("'%s'", OS::get_singleton()->get_audio_driver_name(i)); } OS::get_singleton()->print(").\n"); OS::get_singleton()->print(" --video-driver Video driver ("); for (int i = 0; i < OS::get_singleton()->get_video_driver_count(); i++) { if (i != 0) OS::get_singleton()->print(", "); OS::get_singleton()->print("'%s'", OS::get_singleton()->get_video_driver_name(i)); } OS::get_singleton()->print(").\n"); OS::get_singleton()->print("\n"); OS::get_singleton()->print("Display options:\n"); OS::get_singleton()->print(" -f, --fullscreen Request fullscreen mode.\n"); OS::get_singleton()->print(" -m, --maximized Request a maximized window.\n"); OS::get_singleton()->print(" -w, --windowed Request windowed mode.\n"); OS::get_singleton()->print(" --resolution x Request window resolution.\n"); OS::get_singleton()->print(" --position , Request window position.\n"); OS::get_singleton()->print(" --low-dpi Force low-DPI mode (macOS only).\n"); OS::get_singleton()->print(" --no-window Disable window creation (Windows only). Useful together with --script.\n"); OS::get_singleton()->print("\n"); OS::get_singleton()->print("Debug options:\n"); OS::get_singleton()->print(" -d, --debug Debug (local stdout debugger).\n"); OS::get_singleton()->print(" -b, --breakpoints Breakpoint list as source::line comma-separated pairs, no spaces (use %%20 instead).\n"); OS::get_singleton()->print(" --profiling Enable profiling in the script debugger.\n"); OS::get_singleton()->print(" --remote-debug
Remote debug (: address).\n"); #ifdef DEBUG_ENABLED OS::get_singleton()->print(" --debug-collisions Show collisions shapes when running the scene.\n"); OS::get_singleton()->print(" --debug-navigation Show navigation polygons when running the scene.\n"); #endif OS::get_singleton()->print(" --frame-delay Simulate high CPU load (delay each frame by milliseconds).\n"); OS::get_singleton()->print(" --time-scale Force time scale (higher values are faster, 1.0 is normal speed).\n"); OS::get_singleton()->print("\n"); OS::get_singleton()->print("Standalone tools:\n"); OS::get_singleton()->print(" -s, --script