@@ -556,16 +556,20 @@ void Main::print_help(const char *p_binary) {
556556 print_help_option (" --quit-after <int>" , " Quit after the given number of iterations. Set to 0 to disable.\n " );
557557 print_help_option (" -l, --language <locale>" , " Use a specific locale (<locale> being a two-letter code).\n " );
558558 print_help_option (" --path <directory>" , " Path to a project (<directory> must contain a \" project.godot\" file).\n " );
559+ #ifdef OVERRIDE_ENABLED
559560 print_help_option (" --scene <path>" , " Path or UID of a scene in the project that should be started.\n " );
560561 print_help_option (" -u, --upwards" , " Scan folders upwards for project.godot file.\n " );
561562 print_help_option (" --main-pack <file>" , " Path to a pack (.pck) file to load.\n " );
563+ #endif // OVERRIDE_ENABLED
562564#ifdef DISABLE_DEPRECATED
563565 print_help_option (" --render-thread <mode>" , " Render thread mode (\" safe\" , \" separate\" ).\n " );
564566#else
565567 print_help_option (" --render-thread <mode>" , " Render thread mode (\" unsafe\" [deprecated], \" safe\" , \" separate\" ).\n " );
566- #endif
568+ #endif // DISABLE_DEPRECATED
569+ #ifdef OVERRIDE_ENABLED
567570 print_help_option (" --remote-fs <address>" , " Remote filesystem (<host/IP>[:<port>] address).\n " );
568571 print_help_option (" --remote-fs-password <password>" , " Password for remote filesystem.\n " );
572+ #endif // OVERRIDE_ENABLED
569573
570574 print_help_option (" --audio-driver <driver>" , " Audio driver [" );
571575 for (int i = 0 ; i < AudioDriverManager::get_driver_count (); i++) {
@@ -662,10 +666,12 @@ void Main::print_help(const char *p_binary) {
662666 print_help_option (" --editor-pseudolocalization" , " Enable pseudolocalization for the editor and the project manager.\n " , CLI_OPTION_AVAILABILITY_EDITOR);
663667#endif
664668
669+ #ifdef OVERRIDE_ENABLED
665670 print_help_title (" Standalone tools" );
666671 print_help_option (" -s, --script <script>" , " Run a script.\n " );
667672 print_help_option (" --main-loop <main_loop_name>" , " Run a MainLoop specified by its global class name.\n " );
668673 print_help_option (" --check-only" , " Only parse for errors and quit (use with --script).\n " );
674+ #endif // OVERRIDE_ENABLED
669675#ifdef TOOLS_ENABLED
670676 print_help_option (" --import" , " Starts the editor, waits for any resources to be imported, and then quits.\n " , CLI_OPTION_AVAILABILITY_EDITOR);
671677 print_help_option (" --export-release <preset> <path>" , " Export the project in release mode using the given preset and output path. The preset name should match one defined in \" export_presets.cfg\" .\n " , CLI_OPTION_AVAILABILITY_EDITOR);
@@ -1432,7 +1438,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
14321438 OS::get_singleton ()->print (" Missing language argument, aborting.\n " );
14331439 goto error;
14341440 }
1435-
1441+ # ifdef OVERRIDE_ENABLED
14361442 } else if (arg == " --remote-fs" ) { // remote filesystem
14371443
14381444 if (N) {
@@ -1451,6 +1457,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
14511457 OS::get_singleton ()->print (" Missing remote filesystem password, aborting.\n " );
14521458 goto error;
14531459 }
1460+ #endif // OVERRIDE_ENABLED
14541461 } else if (arg == " --render-thread" ) { // render thread mode
14551462
14561463 if (N) {
@@ -1651,8 +1658,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
16511658 OS::get_singleton ()->print (" Missing relative or absolute path, aborting.\n " );
16521659 goto error;
16531660 }
1661+ #ifdef OVERRIDE_ENABLED
16541662 } else if (arg == " -u" || arg == " --upwards" ) { // scan folders upwards
16551663 upwards = true ;
1664+ #endif // OVERRIDE_ENABLED
16561665 } else if (arg == " --quit" ) { // Auto quit at the end of the first main loop iteration
16571666 quit_after = 1 ;
16581667#ifdef TOOLS_ENABLED
@@ -1723,7 +1732,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
17231732 OS::get_singleton ()->print (" Missing time scale argument, aborting.\n " );
17241733 goto error;
17251734 }
1726-
1735+ # ifdef OVERRIDE_ENABLED
17271736 } else if (arg == " --main-pack" ) {
17281737 if (N) {
17291738 main_pack = N->get ();
@@ -1732,7 +1741,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
17321741 OS::get_singleton ()->print (" Missing path to main pack file, aborting.\n " );
17331742 goto error;
17341743 }
1735-
1744+ #endif // OVERRIDE_ENABLED
17361745 } else if (arg == " -d" || arg == " --debug" ) {
17371746 debug_uri = " local://" ;
17381747 OS::get_singleton ()->_debug_stdout = true ;
@@ -1913,6 +1922,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
19131922 }
19141923#endif
19151924
1925+ #ifdef OVERRIDE_ENABLED
19161926 // Network file system needs to be configured before globals, since globals are based on the
19171927 // 'project.godot' file which will only be available through the network if this is enabled
19181928 if (!remotefs.is_empty ()) {
@@ -1930,6 +1940,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
19301940 goto error;
19311941 }
19321942 }
1943+ #endif // OVERRIDE_ENABLED
19331944
19341945 OS::get_singleton ()->_in_editor = editor;
19351946 if (globals->setup (project_path, main_pack, upwards, editor) == OK) {
@@ -3815,6 +3826,7 @@ int Main::start() {
38153826 } else if (E->get () == " --install-android-build-template" ) {
38163827 install_android_build_template = true ;
38173828#endif // TOOLS_ENABLED
3829+ #ifdef OVERRIDE_ENABLED
38183830 } else if (E->get () == " --scene" ) {
38193831 E = E->next ();
38203832 if (E) {
@@ -3839,6 +3851,7 @@ int Main::start() {
38393851 // for non-game applications.
38403852 game_path = scene_path;
38413853 }
3854+ #endif // OVERRIDE_ENABLED
38423855 }
38433856 // Then parameters that have an argument to the right.
38443857 else if (E->next ()) {
@@ -4043,6 +4056,19 @@ int Main::start() {
40434056
40444057#endif // TOOLS_ENABLED
40454058
4059+ #ifdef OVERRIDE_ENABLED
4060+ bool disable_override = GLOBAL_GET (" application/config/disable_project_settings_override" );
4061+ if (disable_override) {
4062+ script = String ();
4063+ game_path = String ();
4064+ main_loop_type = String ();
4065+ }
4066+ #else
4067+ script = String ();
4068+ game_path = String ();
4069+ main_loop_type = String ();
4070+ #endif // OVERRIDE_ENABLED
4071+
40464072 if (script.is_empty () && game_path.is_empty ()) {
40474073 const String main_scene = GLOBAL_GET (" application/run/main_scene" );
40484074 if (main_scene.begins_with (" uid://" )) {
0 commit comments