diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/input_default.cpp | 2 | ||||
-rw-r--r-- | main/main.cpp | 74 | ||||
-rw-r--r-- | main/tests/test_string.cpp | 2 |
3 files changed, 58 insertions, 20 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp index fb831b7647..5057c5f53a 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -713,6 +713,7 @@ static const char *s_ControllerMappings[] = { "030000005e040000a102000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000005e040000d102000001010000,Microsoft X-Box One pad,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,", "030000005e040000dd02000003020000,Microsoft X-Box One pad v2,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,", + "030000005e040000e302000003020000,Microsoft X-Box One Elite pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000666600000488000000010000,Super Joy Box 5 Pro,a:b2,b:b1,x:b3,y:b0,back:b9,start:b8,leftshoulder:b6,rightshoulder:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b4,righttrigger:b5,dpup:b12,dpleft:b15,dpdown:b14,dpright:b13,", "030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,y:b4,x:b3,start:b8,guide:b5,back:b2,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b9,righttrigger:b10,", "030000006d04000016c2000010010000,Logitech Logitech Dual Action,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,", @@ -725,6 +726,7 @@ static const char *s_ControllerMappings[] = { "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006e0500000320000010010000,JC-U3613M - DirectInput Mode,x:b0,a:b2,b:b3,y:b1,back:b10,guide:b12,start:b11,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,", "030000006f0e00000103000000020000,Logic3 Controller,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,", + "030000006f0e00001302000000010000,Afterglow Gamepad for Xbox 360,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006f0e00001304000000010000,Generic X-Box pad,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:a0,rightstick:a3,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,", "030000006f0e00001e01000011010000,Rock Candy Gamepad for PS3,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,guide:b12,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,", "030000006f0e00001f01000000010000,Generic X-Box pad,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,", diff --git a/main/main.cpp b/main/main.cpp index b51ea3211c..e9eca4af39 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -106,6 +106,7 @@ static OS::VideoMode video_mode; static bool init_maximized = false; static bool init_windowed = false; static bool init_fullscreen = false; +static bool init_always_on_top = false; static bool init_use_custom_pos = false; #ifdef DEBUG_ENABLED static bool debug_collisions = false; @@ -121,6 +122,7 @@ static bool force_lowdpi = false; static int init_screen = -1; static bool use_vsync = true; static bool editor = false; +static bool project_manager = false; static bool show_help = false; static bool disable_render_loop = false; static int fixed_fps = -1; @@ -224,6 +226,7 @@ void Main::print_help(const char *p_binary) { 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(" -t, --always-on-top Request an always-on-top window.\n"); OS::get_singleton()->print(" --resolution <W>x<H> Request window resolution.\n"); OS::get_singleton()->print(" --position <X>,<Y> Request window position.\n"); OS::get_singleton()->print(" --low-dpi Force low-DPI mode (macOS and Windows only).\n"); @@ -430,6 +433,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "-w" || I->get() == "--windowed") { // force windowed window init_windowed = true; + } else if (I->get() == "-t" || I->get() == "--always-on-top") { // force always-on-top window + + init_always_on_top = true; } else if (I->get() == "--profiling") { // enable profiling use_debug_profiler = true; @@ -511,6 +517,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "-e" || I->get() == "--editor") { // starts editor editor = true; + } else if (I->get() == "-p" || I->get() == "--project-manager") { // starts project manager + + project_manager = true; } else if (I->get() == "--no-window") { // disable window creation, Windows only OS::get_singleton()->set_no_window_mode(true); @@ -665,6 +674,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph GLOBAL_DEF("memory/limits/multithreaded_server/rid_pool_prealloc", 60); GLOBAL_DEF("network/limits/debugger_stdout/max_chars_per_second", 2048); + GLOBAL_DEF("network/limits/debugger_stdout/max_messages_per_frame", 10); + GLOBAL_DEF("network/limits/debugger_stdout/max_errors_per_frame", 10); if (debug_mode == "remote") { @@ -742,6 +753,15 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph goto error; #endif + } else if (String(GLOBAL_DEF("application/run/main_scene", "")) == "") { +#ifdef TOOLS_ENABLED + if (!editor) { +#endif + OS::get_singleton()->print("Error: Can't run project: no main scene defined.\n"); + goto error; +#ifdef TOOLS_ENABLED + } +#endif } GLOBAL_DEF("logging/file_logging/enable_file_logging", false); @@ -777,8 +797,18 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #ifdef TOOLS_ENABLED - if (main_args.size() == 0 && (!ProjectSettings::get_singleton()->has_setting("application/run/main_loop_type")) && (!ProjectSettings::get_singleton()->has_setting("application/run/main_scene") || String(ProjectSettings::get_singleton()->get("application/run/main_scene")) == "")) + if (!project_manager) { + // Determine if the project manager should be requested + project_manager = + main_args.size() == 0 && + !ProjectSettings::get_singleton()->has_setting("application/run/main_loop_type") && + (!ProjectSettings::get_singleton()->has_setting("application/run/main_scene") || + String(ProjectSettings::get_singleton()->get("application/run/main_scene")) == ""); + } + + if (project_manager) { use_custom_res = false; //project manager (run without arguments) + } #endif @@ -795,6 +825,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph GLOBAL_DEF("display/window/size/resizable", true); GLOBAL_DEF("display/window/size/borderless", false); GLOBAL_DEF("display/window/size/fullscreen", false); + GLOBAL_DEF("display/window/size/always_on_top", false); GLOBAL_DEF("display/window/size/test_width", 0); GLOBAL_DEF("display/window/size/test_height", 0); @@ -817,6 +848,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph video_mode.resizable = GLOBAL_GET("display/window/size/resizable"); video_mode.borderless_window = GLOBAL_GET("display/window/size/borderless"); video_mode.fullscreen = GLOBAL_GET("display/window/size/fullscreen"); + video_mode.always_on_top = GLOBAL_GET("display/window/size/always_on_top"); } if (!force_lowdpi) { @@ -828,9 +860,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation", 2); GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation.mobile", 3); - if (editor) { - OS::get_singleton()->_allow_hidpi = true; //editors always in hidpi + if (editor || project_manager) { + // The editor and project manager always detect and use hiDPI if needed + OS::get_singleton()->_allow_hidpi = true; } + Engine::get_singleton()->_pixel_snap = GLOBAL_DEF("rendering/quality/2d/use_pixel_snap", false); OS::get_singleton()->_keep_screen_on = GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true); if (rtm == -1) { @@ -901,12 +935,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->set_screen_orientation(OS::SCREEN_LANDSCAPE); } - Engine::get_singleton()->set_iterations_per_second(GLOBAL_DEF("physics/common/fixed_fps", 60)); + Engine::get_singleton()->set_iterations_per_second(GLOBAL_DEF("physics/common/physics_fps", 60)); Engine::get_singleton()->set_target_fps(GLOBAL_DEF("debug/settings/fps/force_fps", 0)); GLOBAL_DEF("debug/settings/stdout/print_fps", OS::get_singleton()->is_stdout_verbose()); - if (!OS::get_singleton()->_verbose_stdout) //overrided + if (!OS::get_singleton()->_verbose_stdout) //overridden OS::get_singleton()->_verbose_stdout = GLOBAL_DEF("debug/settings/stdout/verbose_stdout", false); if (frame_delay == 0) { @@ -1020,6 +1054,9 @@ Error Main::setup2(Thread::ID p_main_tid_override) { } else if (init_fullscreen) { OS::get_singleton()->set_window_fullscreen(true); } + if (init_always_on_top) { + OS::get_singleton()->set_window_always_on_top(true); + } register_server_types(); @@ -1183,7 +1220,6 @@ bool Main::start() { String test; String _export_preset; bool export_debug = false; - bool project_manager_request = false; List<String> args = OS::get_singleton()->get_cmdline_args(); for (int i = 0; i < args.size(); i++) { @@ -1193,7 +1229,7 @@ bool Main::start() { } else if (args[i] == "-e" || args[i] == "--editor") { editor = true; } else if (args[i] == "-p" || args[i] == "--project-manager") { - project_manager_request = true; + project_manager = true; } else if (args[i].length() && args[i][0] != '-' && game_path == "") { game_path = args[i]; } @@ -1471,7 +1507,7 @@ bool Main::start() { } String local_game_path; - if (game_path != "" && !project_manager_request) { + if (game_path != "" && !project_manager) { local_game_path = game_path.replace("\\", "/"); @@ -1516,7 +1552,7 @@ bool Main::start() { #endif } - if (!project_manager_request && !editor) { + if (!project_manager && !editor) { if (game_path != "" || script != "") { //autoload List<PropertyInfo> props; @@ -1624,7 +1660,7 @@ bool Main::start() { } #ifdef TOOLS_ENABLED - if (project_manager_request || (script == "" && test == "" && game_path == "" && !editor)) { + if (project_manager || (script == "" && test == "" && game_path == "" && !editor)) { ProjectManager *pmanager = memnew(ProjectManager); ProgressDialog *progress_dialog = memnew(ProgressDialog); @@ -1773,7 +1809,7 @@ bool Main::iteration() { if (frame > 1000000) { - if (GLOBAL_DEF("debug/settings/stdout/print_fps", OS::get_singleton()->is_stdout_verbose())) { + if (GLOBAL_DEF("debug/settings/stdout/print_fps", OS::get_singleton()->is_stdout_verbose()) && !editor) { print_line("FPS: " + itos(frames)); }; @@ -1820,6 +1856,9 @@ void Main::cleanup() { ERR_FAIL_COND(!_start_success); + message_queue->flush(); + memdelete(message_queue); + if (script_debugger) { if (use_debug_profiler) { script_debugger->profiling_end(); @@ -1843,11 +1882,6 @@ void Main::cleanup() { EditorNode::unregister_editor_types(); #endif - if (audio_server) { - audio_server->finish(); - memdelete(audio_server); - } - if (arvr_server) { // cleanup now before we pull the rug from underneath... memdelete(arvr_server); @@ -1859,6 +1893,11 @@ void Main::cleanup() { unregister_scene_types(); unregister_server_types(); + if (audio_server) { + audio_server->finish(); + memdelete(audio_server); + } + OS::get_singleton()->finalize(); finalize_physics(); @@ -1877,9 +1916,6 @@ void Main::cleanup() { if (engine) memdelete(engine); - message_queue->flush(); - memdelete(message_queue); - unregister_core_driver_types(); unregister_core_types(); diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp index 5179f6d6d1..af948556c4 100644 --- a/main/tests/test_string.cpp +++ b/main/tests/test_string.cpp @@ -893,7 +893,7 @@ TestFunc test_funcs[] = { MainLoop *test() { - /** A character length != wchar_t may be forced, so the tests wont work */ + /** A character length != wchar_t may be forced, so the tests won't work */ ERR_FAIL_COND_V(sizeof(CharType) != sizeof(wchar_t), NULL); |