1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-23 15:16:17 +00:00

Fixes for new two-dash long command line arguments

- Fixes some single-dash leftovers that were missed in the previous commit
- Reorder the help output for clarity, and document missing options
- Drop obsolete options: --noop, --pack, --editor-scene, --level, --import, --import-script, --no-quit
- Improve error message on malformed arguments and do not display help on error
- Always use long form of arguments when starting a new Godot process from C++, for clarity and easy grepping
- Cleanup obsolete code here and there
This commit is contained in:
Rémi Verschelde
2017-08-19 16:45:03 +02:00
parent 1d757c43d7
commit 93f1fb1c2f
16 changed files with 169 additions and 282 deletions

View File

@@ -2534,11 +2534,6 @@ float _Engine::get_frames_per_second() const {
return Engine::get_singleton()->get_frames_per_second(); return Engine::get_singleton()->get_frames_per_second();
} }
String _Engine::get_custom_level() const {
return Engine::get_singleton()->get_custom_level();
}
void _Engine::set_time_scale(float p_scale) { void _Engine::set_time_scale(float p_scale) {
Engine::get_singleton()->set_time_scale(p_scale); Engine::get_singleton()->set_time_scale(p_scale);
} }
@@ -2588,8 +2583,6 @@ void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_time_scale", "time_scale"), &_Engine::set_time_scale); ClassDB::bind_method(D_METHOD("set_time_scale", "time_scale"), &_Engine::set_time_scale);
ClassDB::bind_method(D_METHOD("get_time_scale"), &_Engine::get_time_scale); ClassDB::bind_method(D_METHOD("get_time_scale"), &_Engine::get_time_scale);
ClassDB::bind_method(D_METHOD("get_custom_level"), &_Engine::get_custom_level);
ClassDB::bind_method(D_METHOD("get_frames_drawn"), &_Engine::get_frames_drawn); ClassDB::bind_method(D_METHOD("get_frames_drawn"), &_Engine::get_frames_drawn);
ClassDB::bind_method(D_METHOD("get_frames_per_second"), &_Engine::get_frames_per_second); ClassDB::bind_method(D_METHOD("get_frames_per_second"), &_Engine::get_frames_per_second);

View File

@@ -639,8 +639,6 @@ public:
void set_time_scale(float p_scale); void set_time_scale(float p_scale);
float get_time_scale(); float get_time_scale();
String get_custom_level() const;
MainLoop *get_main_loop() const; MainLoop *get_main_loop() const;
Dictionary get_version_info() const; Dictionary get_version_info() const;

View File

@@ -39,7 +39,6 @@ class Engine {
friend class Main; friend class Main;
String _custom_level;
uint64_t frames_drawn; uint64_t frames_drawn;
uint32_t _frame_delay; uint32_t _frame_delay;
uint64_t _frame_ticks; uint64_t _frame_ticks;
@@ -70,8 +69,6 @@ public:
virtual float get_frames_per_second() const { return _fps; } virtual float get_frames_per_second() const { return _fps; }
String get_custom_level() const { return _custom_level; }
uint64_t get_frames_drawn(); uint64_t get_frames_drawn();
uint64_t get_fixed_frames() const { return _fixed_frames; } uint64_t get_fixed_frames() const { return _fixed_frames; }

View File

@@ -14960,13 +14960,6 @@
<description> <description>
</description> </description>
<methods> <methods>
<method name="get_custom_level" qualifiers="const">
<return type="String">
</return>
<description>
Returns the value of the commandline argument "-level".
</description>
</method>
<method name="get_frames_drawn"> <method name="get_frames_drawn">
<return type="int"> <return type="int">
</return> </return>

View File

@@ -229,17 +229,17 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
if (p_flags & DEBUG_FLAG_DUMB_CLIENT) { if (p_flags & DEBUG_FLAG_DUMB_CLIENT) {
int port = EditorSettings::get_singleton()->get("filesystem/file_server/port"); int port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password"); String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
r_flags.push_back("-rfs"); r_flags.push_back("--remote-fs");
r_flags.push_back(host + ":" + itos(port)); r_flags.push_back(host + ":" + itos(port));
if (passwd != "") { if (passwd != "") {
r_flags.push_back("-rfs_pass"); r_flags.push_back("--remote-fs-password");
r_flags.push_back(passwd); r_flags.push_back(passwd);
} }
} }
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) { if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) {
r_flags.push_back("-rdebug"); r_flags.push_back("--remote-debug");
r_flags.push_back(host + ":" + String::num(remote_port)); r_flags.push_back(host + ":" + String::num(remote_port));
@@ -248,7 +248,7 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
if (breakpoints.size()) { if (breakpoints.size()) {
r_flags.push_back("-bp"); r_flags.push_back("--breakpoints");
String bpoints; String bpoints;
for (const List<String>::Element *E = breakpoints.front(); E; E = E->next()) { for (const List<String>::Element *E = breakpoints.front(); E; E = E->next()) {
@@ -263,12 +263,12 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) { if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) {
r_flags.push_back("-debugcol"); r_flags.push_back("--debug-collisions");
} }
if (p_flags & DEBUG_FLAG_VIEW_NAVIGATION) { if (p_flags & DEBUG_FLAG_VIEW_NAVIGATION) {
r_flags.push_back("-debugnav"); r_flags.push_back("--debug-navigation");
} }
} }
@@ -714,17 +714,17 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
if (p_flags & DEBUG_FLAG_DUMB_CLIENT) { if (p_flags & DEBUG_FLAG_DUMB_CLIENT) {
int port = EditorSettings::get_singleton()->get("filesystem/file_server/port"); int port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password"); String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
r_flags.push_back("-rfs"); r_flags.push_back("--remote-fs");
r_flags.push_back(host + ":" + itos(port)); r_flags.push_back(host + ":" + itos(port));
if (passwd != "") { if (passwd != "") {
r_flags.push_back("-rfs_pass"); r_flags.push_back("--remote-fs-password");
r_flags.push_back(passwd); r_flags.push_back(passwd);
} }
} }
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) { if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) {
r_flags.push_back("-rdebug"); r_flags.push_back("--remote-debug");
r_flags.push_back(host + ":" + String::num(remote_port)); r_flags.push_back(host + ":" + String::num(remote_port));
@@ -733,7 +733,7 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
if (breakpoints.size()) { if (breakpoints.size()) {
r_flags.push_back("-bp"); r_flags.push_back("--breakpoints");
String bpoints; String bpoints;
for (const List<String>::Element *E = breakpoints.front(); E; E = E->next()) { for (const List<String>::Element *E = breakpoints.front(); E; E = E->next()) {
@@ -748,12 +748,12 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) { if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) {
r_flags.push_back("-debugcol"); r_flags.push_back("--debug-collisions");
} }
if (p_flags & DEBUG_FLAG_VIEW_NAVIGATION) { if (p_flags & DEBUG_FLAG_VIEW_NAVIGATION) {
r_flags.push_back("-debugnav"); r_flags.push_back("--debug-navigation");
} }
} }
EditorExportPlatform::EditorExportPlatform() { EditorExportPlatform::EditorExportPlatform() {
@@ -2231,17 +2231,17 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
if (p_flags&EXPORT_DUMB_CLIENT) { if (p_flags&EXPORT_DUMB_CLIENT) {
int port = EditorSettings::get_singleton()->get("filesystem/file_server/port"); int port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password"); String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
r_flags.push_back("-rfs"); r_flags.push_back("--remote-fs");
r_flags.push_back(host+":"+itos(port)); r_flags.push_back(host+":"+itos(port));
if (passwd!="") { if (passwd!="") {
r_flags.push_back("-rfs_pass"); r_flags.push_back("--remote-fs-password");
r_flags.push_back(passwd); r_flags.push_back(passwd);
} }
} }
if (p_flags&EXPORT_REMOTE_DEBUG) { if (p_flags&EXPORT_REMOTE_DEBUG) {
r_flags.push_back("-rdebug"); r_flags.push_back("--remote-debug");
r_flags.push_back(host+":"+String::num(remote_port)); r_flags.push_back(host+":"+String::num(remote_port));
@@ -2251,7 +2251,7 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
if (breakpoints.size()) { if (breakpoints.size()) {
r_flags.push_back("-bp"); r_flags.push_back("--breakpoints");
String bpoints; String bpoints;
for(const List<String>::Element *E=breakpoints.front();E;E=E->next()) { for(const List<String>::Element *E=breakpoints.front();E;E=E->next()) {
@@ -2267,12 +2267,12 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
if (p_flags&EXPORT_VIEW_COLLISONS) { if (p_flags&EXPORT_VIEW_COLLISONS) {
r_flags.push_back("-debugcol"); r_flags.push_back("--debug-collisions");
} }
if (p_flags&EXPORT_VIEW_NAVIGATION) { if (p_flags&EXPORT_VIEW_NAVIGATION) {
r_flags.push_back("-debugnav"); r_flags.push_back("--debug-navigation");
} }

View File

@@ -1851,47 +1851,6 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
_playing_edited = p_current; _playing_edited = p_current;
} }
void EditorNode::_cleanup_scene() {
#if 0
Node *scene = editor_data.get_edited_scene_root();
editor_selection->clear();
editor_data.clear_editor_states();
editor_history.clear();
_hide_top_editors();
animation_editor->cleanup();
property_editor->edit(NULL);
resources_dock->cleanup();
scene_import_metadata.unref();
//set_edited_scene(NULL);
if (scene) {
if (scene->get_filename()!="") {
previous_scenes.push_back(scene->get_filename());
}
memdelete(scene);
}
editor_data.get_undo_redo().clear_history();
saved_version=editor_data.get_undo_redo().get_version();
run_settings_dialog->set_run_mode(0);
run_settings_dialog->set_custom_arguments("-l $scene");
List<Ref<Resource> > cached;
ResourceCache::get_cached_resources(&cached);
for(List<Ref<Resource> >::Element *E=cached.front();E;E=E->next()) {
String path = E->get()->get_path();
if (path.is_resource_file()) {
ERR_PRINT(("Stray resource not cleaned:"+path).utf8().get_data());
}
}
_update_title();
#endif
}
void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
//print_line("option "+itos(p_option)+" confirm "+itos(p_confirmed)); //print_line("option "+itos(p_option)+" confirm "+itos(p_confirmed));
@@ -1915,8 +1874,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
_scene_tab_changed(idx); _scene_tab_changed(idx);
editor_data.clear_editor_states(); editor_data.clear_editor_states();
//_cleanup_scene();
} break; } break;
case FILE_NEW_INHERITED_SCENE: case FILE_NEW_INHERITED_SCENE:
case FILE_OPEN_SCENE: { case FILE_OPEN_SCENE: {
@@ -2737,8 +2694,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
import_reload_fn = scene->get_filename(); import_reload_fn = scene->get_filename();
_save_scene(import_reload_fn); _save_scene(import_reload_fn);
_cleanup_scene();
} }
@@ -3328,8 +3283,6 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
_scene_tab_changed(idx); _scene_tab_changed(idx);
} }
//_cleanup_scene(); // i'm sorry but this MUST happen to avoid modified resources to not be reloaded.
dependency_errors.clear(); dependency_errors.clear();
Ref<PackedScene> sdata = ResourceLoader::load(lpath, "", true); Ref<PackedScene> sdata = ResourceLoader::load(lpath, "", true);

View File

@@ -58,7 +58,7 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
args.push_back(itos(OS::get_singleton()->get_process_id())); args.push_back(itos(OS::get_singleton()->get_process_id()));
if (debug_collisions) { if (debug_collisions) {
args.push_back("--debug-collision"); args.push_back("--debug-collisions");
} }
if (debug_navigation) { if (debug_navigation) {
@@ -66,7 +66,6 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
} }
int screen = EditorSettings::get_singleton()->get("run/window_placement/screen"); int screen = EditorSettings::get_singleton()->get("run/window_placement/screen");
if (screen == 0) { if (screen == 0) {
screen = OS::get_singleton()->get_current_screen(); screen = OS::get_singleton()->get_current_screen();
} else { } else {
@@ -78,7 +77,6 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
screen_rect.size = OS::get_singleton()->get_screen_size(screen); screen_rect.size = OS::get_singleton()->get_screen_size(screen);
Size2 desired_size; Size2 desired_size;
desired_size.x = ProjectSettings::get_singleton()->get("display/window/size/width"); desired_size.x = ProjectSettings::get_singleton()->get("display/window/size/width");
desired_size.y = ProjectSettings::get_singleton()->get("display/window/size/height"); desired_size.y = ProjectSettings::get_singleton()->get("display/window/size/height");
@@ -95,39 +93,39 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
switch (window_placement) { switch (window_placement) {
case 0: { // top left case 0: { // top left
args.push_back("-p"); args.push_back("--position");
args.push_back(itos(screen_rect.position.x) + "x" + itos(screen_rect.position.y)); args.push_back(itos(screen_rect.position.x) + "," + itos(screen_rect.position.y));
} break; } break;
case 1: { // centered case 1: { // centered
Vector2 pos = screen_rect.position + ((screen_rect.size - desired_size) / 2).floor(); Vector2 pos = screen_rect.position + ((screen_rect.size - desired_size) / 2).floor();
args.push_back("-p"); args.push_back("--position");
args.push_back(itos(pos.x) + "," + itos(pos.y)); args.push_back(itos(pos.x) + "," + itos(pos.y));
} break; } break;
case 2: { // custom pos case 2: { // custom pos
Vector2 pos = EditorSettings::get_singleton()->get("run/window_placement/rect_custom_position"); Vector2 pos = EditorSettings::get_singleton()->get("run/window_placement/rect_custom_position");
pos += screen_rect.position; pos += screen_rect.position;
args.push_back("-p"); args.push_back("--position");
args.push_back(itos(pos.x) + "," + itos(pos.y)); args.push_back(itos(pos.x) + "," + itos(pos.y));
} break; } break;
case 3: { // force maximized case 3: { // force maximized
Vector2 pos = screen_rect.position; Vector2 pos = screen_rect.position;
args.push_back("-p"); args.push_back("--position");
args.push_back(itos(pos.x) + "," + itos(pos.y)); args.push_back(itos(pos.x) + "," + itos(pos.y));
args.push_back("-m"); args.push_back("--maximized");
} break; } break;
case 4: { // force fullscreen case 4: { // force fullscreen
Vector2 pos = screen_rect.position; Vector2 pos = screen_rect.position;
args.push_back("-p"); args.push_back("--position");
args.push_back(itos(pos.x) + "," + itos(pos.y)); args.push_back(itos(pos.x) + "," + itos(pos.y));
args.push_back("-f"); args.push_back("--fullscreen");
} break; } break;
} }
if (p_breakpoints.size()) { if (p_breakpoints.size()) {
args.push_back("-b"); args.push_back("--breakpoints");
String bpoints; String bpoints;
for (const List<String>::Element *E = p_breakpoints.front(); E; E = E->next()) { for (const List<String>::Element *E = p_breakpoints.front(); E; E = E->next()) {
@@ -152,7 +150,7 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
String exec = OS::get_singleton()->get_executable_path(); String exec = OS::get_singleton()->get_executable_path();
printf("running: %ls", exec.c_str()); printf("Running: %ls", exec.c_str());
for (List<String>::Element *E = args.front(); E; E = E->next()) { for (List<String>::Element *E = args.front(); E; E = E->next()) {
printf(" %ls", E->get().c_str()); printf(" %ls", E->get().c_str());

View File

@@ -88,7 +88,5 @@ RunSettingsDialog::RunSettingsDialog() {
get_ok()->set_text(TTR("Close")); get_ok()->set_text(TTR("Close"));
//get_cancel()->set_text("Close"); //get_cancel()->set_text("Close");
arguments->set_text("-l $scene");
set_title(TTR("Scene Run Settings")); set_title(TTR("Scene Run Settings"));
} }

View File

@@ -28,6 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "main.h" #include "main.h"
#include "app_icon.gen.h" #include "app_icon.gen.h"
#include "core/register_core_types.h" #include "core/register_core_types.h"
#include "drivers/register_driver_types.h" #include "drivers/register_driver_types.h"
@@ -110,6 +111,7 @@ static bool force_lowdpi = false;
static int init_screen = -1; static int init_screen = -1;
static bool use_vsync = true; static bool use_vsync = true;
static bool editor = false; static bool editor = false;
static bool show_help = false;
static OS::ProcessID allow_focus_steal_pid = 0; static OS::ProcessID allow_focus_steal_pid = 0;
@@ -128,63 +130,88 @@ static String unescape_cmdline(const String &p_str) {
void Main::print_help(const char *p_binary) { void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(VERSION_FULL_NAME " (c) 2008-2017 Juan Linietsky, Ariel Manzur.\n"); 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("Usage: %s [options] [path to scene or 'project.godot' file]\n", p_binary);
OS::get_singleton()->print("Options:\n"); 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(" -h, --help Display this help message.\n");
OS::get_singleton()->print(" --path <directory> Path to the project (<directory> must contain a 'project.godot' file).\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 #ifdef TOOLS_ENABLED
OS::get_singleton()->print(" -e, --editor Bring up the editor instead of running the scene.\n"); 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 #endif
OS::get_singleton()->print(" --test <test> Run a test ("); OS::get_singleton()->print(" -l, --language <locale> Use a specific locale (<locale> being a two-letter code).\n");
const char **test_names = tests_get_names(); OS::get_singleton()->print(" --path <directory> Path to a project (<directory> must contain a 'project.godot' file).\n");
const char *coma = ""; OS::get_singleton()->print(" --main-pack <file> Path to a pack (.pck) file to load.\n");
while (*test_names) { OS::get_singleton()->print(" --render-thread <mode> Render thread mode ('unsafe', 'safe', 'separate').\n");
OS::get_singleton()->print(" --remote-fs <address> Remote filesystem (<host/IP>[:<port>] address).\n");
OS::get_singleton()->print("%s'%s'", coma, *test_names); OS::get_singleton()->print(" --remote-fs-password <password> Password for remote filesystem.\n");
test_names++;
coma = ", ";
}
OS::get_singleton()->print(").\n");
OS::get_singleton()->print(" -r, --resolution <W>x<H> Request window resolution.\n");
OS::get_singleton()->print(" -p, --position <X>,<Y> Request window position.\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(" --video-driver <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(" --low-dpi Force low-DPI mode (macOS only).\n");
OS::get_singleton()->print(" --audio-driver <driver> Audio driver ("); OS::get_singleton()->print(" --audio-driver <driver> Audio driver (");
for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) { for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) {
if (i != 0) if (i != 0)
OS::get_singleton()->print(", "); OS::get_singleton()->print(", ");
OS::get_singleton()->print("'%s'", OS::get_singleton()->get_audio_driver_name(i)); OS::get_singleton()->print("'%s'", OS::get_singleton()->get_audio_driver_name(i));
} }
OS::get_singleton()->print(").\n"); OS::get_singleton()->print(").\n");
OS::get_singleton()->print(" --render-thread <mode> Render thread mode ('unsafe', 'safe', 'separate').\n"); OS::get_singleton()->print(" --video-driver <driver> Video driver (");
OS::get_singleton()->print(" -s, --script <script> Run a script.\n"); 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 <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 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(" -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 <address> Remote debug (<host/IP>:<port> 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 <ms> Simulate high CPU load (delay each frame by <ms> milliseconds).\n"); OS::get_singleton()->print(" --frame-delay <ms> Simulate high CPU load (delay each frame by <ms> milliseconds).\n");
OS::get_singleton()->print(" --time-scale <scale> Force time scale (higher values are faster, 1.0 is normal speed).\n"); OS::get_singleton()->print(" --time-scale <scale> Force time scale (higher values are faster, 1.0 is normal speed).\n");
OS::get_singleton()->print(" -b, --breakpoints Breakpoint list as source::line comma-separated pairs, no spaces (use %%20, %%2C, ... instead).\n"); OS::get_singleton()->print("\n");
OS::get_singleton()->print(" -v, --verbose Use verbose stdout mode.\n");
OS::get_singleton()->print(" -l, --language <locale> Use a specific locale (<locale> being a two-letter code).\n"); OS::get_singleton()->print("Standalone tools:\n");
OS::get_singleton()->print(" --remote-debug <address> Remote debug (<ip>:<port> host address).\n"); OS::get_singleton()->print(" -s, --script <script> Run a script.\n");
OS::get_singleton()->print(" --remote-fs <host/IP>[:<port>] Remote filesystem.\n");
OS::get_singleton()->print(" --remote-fs-password <password> Password for remote filesystem.\n");
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
OS::get_singleton()->print(" --export <target> Export the project using the given export target.\n");
OS::get_singleton()->print(" --export-debug Use together with --export, enables debug mode for the template.\n");
OS::get_singleton()->print(" --doctool <file> Dump the whole engine API to <file> in XML format. If <file> exists, it will be merged.\n"); OS::get_singleton()->print(" --doctool <file> Dump the whole engine API to <file> in XML format. If <file> exists, it will be merged.\n");
OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n"); OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n");
OS::get_singleton()->print(" --export <target> Export the project using the given export target.\n"); #ifdef DEBUG_METHODS_ENABLED
OS::get_singleton()->print(" --gdnative-generate-json-api Generate JSON dump of the Godot API for GDNative bindings.\n");
#endif
OS::get_singleton()->print(" --test <test> Run a unit test (");
const char **test_names = tests_get_names();
const char *comma = "";
while (*test_names) {
OS::get_singleton()->print("%s'%s'", comma, *test_names);
test_names++;
comma = ", ";
}
OS::get_singleton()->print(").\n");
#endif #endif
} }
@@ -254,15 +281,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
String remotefs; String remotefs;
String remotefs_pass; String remotefs_pass;
String screen = "";
List<String> pack_list;
Vector<String> breakpoints; Vector<String> breakpoints;
bool use_custom_res = true; bool use_custom_res = true;
bool force_res = false; bool force_res = false;
I = args.front();
packed_data = PackedData::get_singleton(); packed_data = PackedData::get_singleton();
if (!packed_data) if (!packed_data)
packed_data = memnew(PackedData); packed_data = memnew(PackedData);
@@ -279,18 +301,17 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
packed_data->add_pack_source(zip_packed_data); packed_data->add_pack_source(zip_packed_data);
#endif #endif
I = args.front();
while (I) { while (I) {
List<String>::Element *N = I->next(); List<String>::Element *N = I->next();
if (I->get() == "--noop") { if (I->get() == "-h" || I->get() == "--help" || I->get() == "/?") { // display help
// no op
} else if (I->get() == "-h" || I->get() == "--help" || I->get() == "/?") { // display help
show_help = true;
goto error; goto error;
} else if (I->get() == "-r" || I->get() == "--resolution") { // force resolution } else if (I->get() == "--resolution") { // force resolution
if (I->next()) { if (I->next()) {
@@ -298,16 +319,16 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (vm.find("x") == -1) { // invalid parameter format if (vm.find("x") == -1) { // invalid parameter format
OS::get_singleton()->print("Invalid resolution argument: %s\n", vm.utf8().get_data()); OS::get_singleton()->print("Invalid resolution '%s', it should be e.g. '1280x720'.\n", vm.utf8().get_data());
goto error; goto error;
} }
int w = vm.get_slice("x", 0).to_int(); int w = vm.get_slice("x", 0).to_int();
int h = vm.get_slice("x", 1).to_int(); int h = vm.get_slice("x", 1).to_int();
if (w == 0 || h == 0) { if (w <= 0 || h <= 0) {
OS::get_singleton()->print("Invalid resolution, width and height must be above 0\n"); OS::get_singleton()->print("Invalid resolution '%s', width and height must be above 0.\n", vm.utf8().get_data());
goto error; goto error;
} }
@@ -317,10 +338,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Invalid resolution argument, needs resolution\n"); OS::get_singleton()->print("Missing resolution argument, aborting.\n");
goto error; goto error;
} }
} else if (I->get() == "-p" || I->get() == "--position") { // position } else if (I->get() == "--position") { // set window position
if (I->next()) { if (I->next()) {
@@ -328,7 +349,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (vm.find(",") == -1) { // invalid parameter format if (vm.find(",") == -1) { // invalid parameter format
OS::get_singleton()->print("Invalid position argument: %s\n", vm.utf8().get_data()); OS::get_singleton()->print("Invalid position '%s', it should be e.g. '80,128'.\n", vm.utf8().get_data());
goto error; goto error;
} }
@@ -340,7 +361,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Invalid position argument, needs position\n"); OS::get_singleton()->print("Missing position argument, aborting.\n");
goto error; goto error;
} }
@@ -350,7 +371,7 @@ 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 } else if (I->get() == "-w" || I->get() == "--windowed") { // force windowed window
init_windowed = true; init_windowed = true;
} else if (I->get() == "--profile") { // enable profiler } else if (I->get() == "--profiling") { // enable profiling
use_debug_profiler = true; use_debug_profiler = true;
} else if (I->get() == "--video-driver") { // force video driver } else if (I->get() == "--video-driver") { // force video driver
@@ -360,7 +381,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
video_driver = I->next()->get(); video_driver = I->next()->get();
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Invalid --video-driver argument, needs driver name\n"); OS::get_singleton()->print("Missing video driver argument, aborting.\n");
goto error; goto error;
} }
} else if (I->get() == "-l" || I->get() == "--language") { // language } else if (I->get() == "-l" || I->get() == "--language") { // language
@@ -370,10 +391,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
locale = I->next()->get(); locale = I->next()->get();
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Invalid language argument, needs language code\n"); OS::get_singleton()->print("Missing language argument, aborting.\n");
goto error; goto error;
} }
} else if (I->get() == "--low-dpi") { // force low DPI } else if (I->get() == "--low-dpi") { // force low DPI (macOS only)
force_lowdpi = true; force_lowdpi = true;
} else if (I->get() == "--remote-fs") { // remote filesystem } else if (I->get() == "--remote-fs") { // remote filesystem
@@ -383,6 +404,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
remotefs = I->next()->get(); remotefs = I->next()->get();
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Missing remote filesystem address, aborting.\n");
goto error; goto error;
} }
} else if (I->get() == "--remote-fs-password") { // remote filesystem password } else if (I->get() == "--remote-fs-password") { // remote filesystem password
@@ -392,9 +414,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
remotefs_pass = I->next()->get(); remotefs_pass = I->next()->get();
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Missing remote filesystem password, aborting.\n");
goto error; goto error;
} }
} else if (I->get() == "--render-thread") { // rendering thread } else if (I->get() == "--render-thread") { // render thread mode
if (I->next()) { if (I->next()) {
@@ -407,6 +430,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Missing render thread mode argument, aborting.\n");
goto error; goto error;
} }
@@ -417,6 +441,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
audio_driver = I->next()->get(); audio_driver = I->next()->get();
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Missing audio driver argument, aborting.\n");
goto error; goto error;
} }
@@ -427,7 +452,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "-e" || I->get() == "--editor") { // starts editor } else if (I->get() == "-e" || I->get() == "--editor") { // starts editor
editor = true; editor = true;
} else if (I->get() == "--no-window") { // disable window creation } else if (I->get() == "--no-window") { // disable window creation, Windows only
OS::get_singleton()->set_no_window_mode(true); OS::get_singleton()->set_no_window_mode(true);
} else if (I->get() == "--quiet") { // quieter output } else if (I->get() == "--quiet") { // quieter output
@@ -447,6 +472,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} }
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Missing relative or absolute path, aborting.\n");
goto error; goto error;
} }
} else if (I->get().ends_with("project.godot")) { } else if (I->get().ends_with("project.godot")) {
@@ -474,6 +500,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
breakpoints = bplist.split(","); breakpoints = bplist.split(",");
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Missing list of breakpoints, aborting.\n");
goto error; goto error;
} }
@@ -484,6 +511,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
frame_delay = I->next()->get().to_int(); frame_delay = I->next()->get().to_int();
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Missing frame delay argument, aborting.\n");
goto error; goto error;
} }
@@ -494,20 +522,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
Engine::get_singleton()->set_time_scale(I->next()->get().to_double()); Engine::get_singleton()->set_time_scale(I->next()->get().to_double());
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Missing time scale argument, aborting.\n");
goto error; goto error;
} }
} else if (I->get() == "--pack") {
if (I->next()) {
pack_list.push_back(I->next()->get());
N = I->next()->next();
} else {
goto error;
};
} else if (I->get() == "--main-pack") { } else if (I->get() == "--main-pack") {
if (I->next()) { if (I->next()) {
@@ -515,46 +533,39 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
main_pack = I->next()->get(); main_pack = I->next()->get();
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Missing path to main pack file, aborting.\n");
goto error; goto error;
}; };
} else if (I->get() == "--debug" || I->get() == "-d") { } else if (I->get() == "-d" || I->get() == "--debug") {
debug_mode = "local"; debug_mode = "local";
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
} else if (I->get() == "--debug-collision") { } else if (I->get() == "--debug-collisions") {
debug_collisions = true; debug_collisions = true;
} else if (I->get() == "--debug-navigation") { } else if (I->get() == "--debug-navigation") {
debug_navigation = true; debug_navigation = true;
#endif #endif
} else if (I->get() == "--editor-scene") {
if (I->next()) {
ProjectSettings::get_singleton()->set("editor_scene", game_path = I->next()->get());
} else {
goto error;
}
} else if (I->get() == "--remote-debug") { } else if (I->get() == "--remote-debug") {
if (I->next()) { if (I->next()) {
debug_mode = "remote"; debug_mode = "remote";
debug_host = I->next()->get(); debug_host = I->next()->get();
if (debug_host.find(":") == -1) { //wrong host if (debug_host.find(":") == -1) { // wrong address
OS::get_singleton()->print("Invalid debug host string\n"); OS::get_singleton()->print("Invalid debug host address, it should be of the form <host/IP>:<port>.\n");
goto error; goto error;
} }
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Missing remote debug host address, aborting.\n");
goto error; goto error;
} }
} else if (I->get() == "--allow_focus_steal_pid") { } else if (I->get() == "--allow_focus_steal_pid") { // not exposed to user
if (I->next()) { if (I->next()) {
allow_focus_steal_pid = I->next()->get().to_int64(); allow_focus_steal_pid = I->next()->get().to_int64();
N = I->next()->next(); N = I->next()->next();
} else { } else {
OS::get_singleton()->print("Missing editor PID argument, aborting.\n");
goto error; goto error;
} }
} else { } else {
@@ -618,7 +629,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
Error err = file_access_network_client->connect(remotefs, port, remotefs_pass); Error err = file_access_network_client->connect(remotefs, port, remotefs_pass);
if (err) { if (err) {
OS::get_singleton()->printerr("Could not connect to remotefs: %s:%i\n", remotefs.utf8().get_data(), port); OS::get_singleton()->printerr("Could not connect to remotefs: %s:%i.\n", remotefs.utf8().get_data(), port);
goto error; goto error;
} }
@@ -654,7 +665,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
editor = false; editor = false;
#else #else
OS::get_singleton()->print("error: Couldn't load game path '%s'\n", game_path.ascii().get_data()); OS::get_singleton()->print("Error: Could not load game path '%s'.\n", game_path.ascii().get_data());
goto error; goto error;
#endif #endif
@@ -744,11 +755,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->_render_thread_mode = OS::RenderThreadMode(rtm); OS::get_singleton()->_render_thread_mode = OS::RenderThreadMode(rtm);
} }
/* Determine Video Driver */ /* Determine audio and video drivers */
if (audio_driver == "") { // specified in project.godot
audio_driver = GLOBAL_DEF("audio/driver", OS::get_singleton()->get_audio_driver_name(0));
}
for (int i = 0; i < OS::get_singleton()->get_video_driver_count(); i++) { for (int i = 0; i < OS::get_singleton()->get_video_driver_count(); i++) {
@@ -766,6 +773,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
//goto error; //goto error;
} }
if (audio_driver == "") { // specified in project.godot
audio_driver = GLOBAL_DEF("audio/driver", OS::get_singleton()->get_audio_driver_name(0));
}
for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) { for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) {
if (audio_driver == OS::get_singleton()->get_audio_driver_name(i)) { if (audio_driver == OS::get_singleton()->get_audio_driver_name(i)) {
@@ -833,7 +844,8 @@ error:
args.clear(); args.clear();
main_args.clear(); main_args.clear();
print_help(execpath); if (show_help)
print_help(execpath);
if (performance) if (performance)
memdelete(performance); memdelete(performance);
@@ -1053,23 +1065,18 @@ bool Main::start() {
String game_path; String game_path;
String script; String script;
String test; String test;
String screen;
String _export_preset; String _export_preset;
String _import;
String _import_script;
bool noquit = false;
bool export_debug = false; bool export_debug = false;
bool project_manager_request = false; bool project_manager_request = false;
List<String> args = OS::get_singleton()->get_cmdline_args(); List<String> args = OS::get_singleton()->get_cmdline_args();
for (int i = 0; i < args.size(); i++) { for (int i = 0; i < args.size(); i++) {
//parameters that do not have an argument to the right //parameters that do not have an argument to the right
if (args[i] == "--no-docbase") { if (args[i] == "--no-docbase") {
doc_base = false; doc_base = false;
} else if (args[i] == "--no-quit") { } else if (args[i] == "-e" || args[i] == "--editor") {
noquit = true;
} else if (args[i] == "--editor" || args[i] == "-e") {
editor = true; editor = true;
} else if (args[i] == "-P" || args[i] == "--project-manager") { } else if (args[i] == "-p" || args[i] == "--project-manager") {
project_manager_request = true; project_manager_request = true;
} else if (args[i].length() && args[i][0] != '-' && game_path == "") { } else if (args[i].length() && args[i][0] != '-' && game_path == "") {
game_path = args[i]; game_path = args[i];
@@ -1081,10 +1088,8 @@ bool Main::start() {
doc_tool = args[i + 1]; doc_tool = args[i + 1];
for (int j = i + 2; j < args.size(); j++) for (int j = i + 2; j < args.size(); j++)
removal_docs.push_back(args[j]); removal_docs.push_back(args[j]);
} else if (args[i] == "--script" || args[i] == "-s") { } else if (args[i] == "-s" || args[i] == "--script") {
script = args[i + 1]; script = args[i + 1];
} else if (args[i] == "--level" || args[i] == "-l") {
Engine::get_singleton()->_custom_level = args[i + 1];
} else if (args[i] == "--test") { } else if (args[i] == "--test") {
test = args[i + 1]; test = args[i + 1];
} else if (args[i] == "--export") { } else if (args[i] == "--export") {
@@ -1094,12 +1099,6 @@ bool Main::start() {
editor = true; //needs editor editor = true; //needs editor
_export_preset = args[i + 1]; _export_preset = args[i + 1];
export_debug = true; export_debug = true;
} else if (args[i] == "--import") {
editor = true; //needs editor
_import = args[i + 1];
} else if (args[i] == "--import-script") {
editor = true; //needs editor
_import_script = args[i + 1];
} else { } else {
// The parameter does not match anything known, don't skip the next argument // The parameter does not match anything known, don't skip the next argument
parsed_pair = false; parsed_pair = false;
@@ -1205,7 +1204,7 @@ bool Main::start() {
if (!main_loop) { if (!main_loop) {
if (!ClassDB::class_exists(main_loop_type)) { if (!ClassDB::class_exists(main_loop_type)) {
OS::get_singleton()->alert("godot: error: MainLoop type doesn't exist: " + main_loop_type); OS::get_singleton()->alert("Error: MainLoop type doesn't exist: " + main_loop_type);
return false; return false;
} else { } else {
@@ -1355,19 +1354,8 @@ bool Main::start() {
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (editor) { if (editor) {
if (_import != "") { Error serr = editor_node->load_scene(local_game_path);
//editor_node->import_scene(_import,local_game_path,_import_script);
if (!noquit)
sml->quit();
game_path = ""; //no load anything
} else {
Error serr = editor_node->load_scene(local_game_path);
}
OS::get_singleton()->set_context(OS::CONTEXT_EDITOR); OS::get_singleton()->set_context(OS::CONTEXT_EDITOR);
//editor_node->set_edited_scene(game);
} }
#endif #endif
} }
@@ -1441,7 +1429,6 @@ bool Main::start() {
n->set_name(name); n->set_name(name);
//defer so references are all valid on _ready() //defer so references are all valid on _ready()
//sml->get_root()->add_child(n);
to_add.push_back(n); to_add.push_back(n);
if (global_var) { if (global_var) {
@@ -1466,7 +1453,6 @@ bool Main::start() {
ERR_EXPLAIN("Failed loading scene: " + local_game_path); ERR_EXPLAIN("Failed loading scene: " + local_game_path);
ERR_FAIL_COND_V(!scene, false) ERR_FAIL_COND_V(!scene, false)
//sml->get_root()->add_child(scene);
sml->add_current_scene(scene); sml->add_current_scene(scene);
String iconpath = GLOBAL_DEF("application/config/icon", "Variant()"); String iconpath = GLOBAL_DEF("application/config/icon", "Variant()");
@@ -1480,27 +1466,6 @@ bool Main::start() {
} }
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
/*if (_export_platform!="") {
sml->quit();
}*/
/*
if (sml->get_root_node()) {
Console *console = memnew( Console );
sml->get_root_node()->cast_to<RootNode>()->set_console(console);
if (GLOBAL_DEF("console/visible_default",false).operator bool()) {
console->show();
} else {P
console->hide();
};
}
*/
if (project_manager_request || (script == "" && test == "" && game_path == "" && !editor)) { if (project_manager_request || (script == "" && test == "" && game_path == "" && !editor)) {
ProjectManager *pmanager = memnew(ProjectManager); ProjectManager *pmanager = memnew(ProjectManager);
@@ -1509,7 +1474,6 @@ bool Main::start() {
sml->get_root()->add_child(pmanager); sml->get_root()->add_child(pmanager);
OS::get_singleton()->set_context(OS::CONTEXT_PROJECTMAN); OS::get_singleton()->set_context(OS::CONTEXT_PROJECTMAN);
} }
#endif #endif
} }
@@ -1590,10 +1554,6 @@ bool Main::iteration() {
time_accum -= frame_slice; time_accum -= frame_slice;
message_queue->flush(); message_queue->flush();
/*
if (AudioServer::get_singleton())
AudioServer::get_singleton()->update();
*/
fixed_process_ticks = MAX(fixed_process_ticks, OS::get_singleton()->get_ticks_usec() - fixed_begin); // keep the largest one for reference fixed_process_ticks = MAX(fixed_process_ticks, OS::get_singleton()->get_ticks_usec() - fixed_begin); // keep the largest one for reference
fixed_process_max = MAX(OS::get_singleton()->get_ticks_usec() - fixed_begin, fixed_process_max); fixed_process_max = MAX(OS::get_singleton()->get_ticks_usec() - fixed_begin, fixed_process_max);
@@ -1642,7 +1602,6 @@ bool Main::iteration() {
script_debugger->idle_poll(); script_debugger->idle_poll();
} }
//x11_delay_usec(10000);
frames++; frames++;
Engine::get_singleton()->_idle_frames++; Engine::get_singleton()->_idle_frames++;
@@ -1744,7 +1703,6 @@ void Main::cleanup() {
unregister_core_driver_types(); unregister_core_driver_types();
unregister_core_types(); unregister_core_types();
//PerformanceMetrics::finish();
OS::get_singleton()->clear_last_error(); OS::get_singleton()->clear_last_error();
OS::get_singleton()->finalize_core(); OS::get_singleton()->finalize_core();
} }

View File

@@ -1220,10 +1220,10 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
/*String host = EditorSettings::get_singleton()->get("filesystem/file_server/host"); /*String host = EditorSettings::get_singleton()->get("filesystem/file_server/host");
int port = EditorSettings::get_singleton()->get("filesystem/file_server/post"); int port = EditorSettings::get_singleton()->get("filesystem/file_server/post");
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password"); String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
cl.push_back("-rfs"); cl.push_back("--remote-fs");
cl.push_back(host+":"+itos(port)); cl.push_back(host+":"+itos(port));
if (passwd!="") { if (passwd!="") {
cl.push_back("-rfs_pass"); cl.push_back("--remote-fs-password");
cl.push_back(passwd); cl.push_back(passwd);
}*/ }*/
@@ -1243,10 +1243,10 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
err = save_pack(pf); err = save_pack(pf);
memdelete(pf); memdelete(pf);
cl.push_back("-use_apk_expansion"); cl.push_back("--use_apk_expansion");
cl.push_back("-apk_expansion_md5"); cl.push_back("--apk_expansion_md5");
cl.push_back(FileAccess::get_md5(fullpath)); cl.push_back(FileAccess::get_md5(fullpath));
cl.push_back("-apk_expansion_key"); cl.push_back("--apk_expansion_key");
cl.push_back(apk_expansion_pkey.strip_edges()); cl.push_back(apk_expansion_pkey.strip_edges());
} else { } else {
@@ -1262,10 +1262,10 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
} }
if (use_32_fb) if (use_32_fb)
cl.push_back("-use_depth_32"); cl.push_back("--use_depth_32");
if (immersive) if (immersive)
cl.push_back("-use_immersive"); cl.push_back("--use_immersive");
if (cl.size()) { if (cl.size()) {
//add comandline //add comandline
@@ -3330,10 +3330,10 @@ public:
/*String host = EditorSettings::get_singleton()->get("filesystem/file_server/host"); /*String host = EditorSettings::get_singleton()->get("filesystem/file_server/host");
int port = EditorSettings::get_singleton()->get("filesystem/file_server/post"); int port = EditorSettings::get_singleton()->get("filesystem/file_server/post");
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password"); String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
cl.push_back("-rfs"); cl.push_back("--remote-fs");
cl.push_back(host+":"+itos(port)); cl.push_back(host+":"+itos(port));
if (passwd!="") { if (passwd!="") {
cl.push_back("-rfs_pass"); cl.push_back("--remote-fs-password");
cl.push_back(passwd); cl.push_back(passwd);
}*/ }*/
@@ -3350,10 +3350,10 @@ public:
return OK; return OK;
} }
cl.push_back("-use_apk_expansion"); cl.push_back("--use_apk_expansion");
cl.push_back("-apk_expansion_md5"); cl.push_back("--apk_expansion_md5");
cl.push_back(FileAccess::get_md5(fullpath)); cl.push_back(FileAccess::get_md5(fullpath));
cl.push_back("-apk_expansion_key"); cl.push_back("--apk_expansion_key");
cl.push_back(apk_expansion_pkey.strip_edges()); cl.push_back(apk_expansion_pkey.strip_edges());
} else { } else {
@@ -3367,10 +3367,10 @@ public:
} }
if (use_32_fb) if (use_32_fb)
cl.push_back("-use_depth_32"); cl.push_back("--use_depth_32");
if (immersive) if (immersive)
cl.push_back("-use_immersive"); cl.push_back("--use_immersive");
if (cl.size()) { if (cl.size()) {
//add comandline //add comandline

View File

@@ -616,7 +616,6 @@ static void engine_handle_cmd(struct android_app *app, int32_t cmd) {
//do initialization here, when there's OpenGL! hackish but the only way //do initialization here, when there's OpenGL! hackish but the only way
engine->os = new OS_Android(_gfx_init, engine); engine->os = new OS_Android(_gfx_init, engine);
//char *args[]={"-test","gui",NULL};
__android_log_print(ANDROID_LOG_INFO, "godot", "pre asdasd setup..."); __android_log_print(ANDROID_LOG_INFO, "godot", "pre asdasd setup...");
#if 0 #if 0
Error err = Main::setup("apk",2,args); Error err = Main::setup("apk",2,args);

View File

@@ -387,7 +387,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
new_cmdline = new String[ 2 ]; new_cmdline = new String[ 2 ];
} }
new_cmdline[cll]="-main_pack"; new_cmdline[cll]="--main_pack";
new_cmdline[cll+1]=expansion_pack_path; new_cmdline[cll+1]=expansion_pack_path;
command_line=new_cmdline; command_line=new_cmdline;
} }
@@ -452,9 +452,9 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
for(int i=0;i<command_line.length;i++) { for(int i=0;i<command_line.length;i++) {
boolean has_extra = i< command_line.length -1; boolean has_extra = i< command_line.length -1;
if (command_line[i].equals("-use_depth_32")) { if (command_line[i].equals("--use_depth_32")) {
use_32_bits=true; use_32_bits=true;
} else if (command_line[i].equals("-use_immersive")) { } else if (command_line[i].equals("--use_immersive")) {
use_immersive=true; use_immersive=true;
if(Build.VERSION.SDK_INT >= 19.0){ // check if the application runs on an android 4.4+ if(Build.VERSION.SDK_INT >= 19.0){ // check if the application runs on an android 4.4+
window.getDecorView().setSystemUiVisibility( window.getDecorView().setSystemUiVisibility(
@@ -467,12 +467,12 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
UiChangeListener(); UiChangeListener();
} }
} else if (command_line[i].equals("-use_apk_expansion")) { } else if (command_line[i].equals("--use_apk_expansion")) {
use_apk_expansion=true; use_apk_expansion=true;
} else if (has_extra && command_line[i].equals("-apk_expansion_md5")) { } else if (has_extra && command_line[i].equals("--apk_expansion_md5")) {
main_pack_md5=command_line[i+1]; main_pack_md5=command_line[i+1];
i++; i++;
} else if (has_extra && command_line[i].equals("-apk_expansion_key")) { } else if (has_extra && command_line[i].equals("--apk_expansion_key")) {
main_pack_key=command_line[i+1]; main_pack_key=command_line[i+1];
SharedPreferences prefs = getSharedPreferences("app_data_keys", MODE_PRIVATE); SharedPreferences prefs = getSharedPreferences("app_data_keys", MODE_PRIVATE);
Editor editor = prefs.edit(); Editor editor = prefs.edit();

View File

@@ -844,7 +844,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
} else { } else {
//__android_log_print(ANDROID_LOG_INFO,"godot","cmdline arg %i is: %s\n",i,rawString); //__android_log_print(ANDROID_LOG_INFO,"godot","cmdline arg %i is: %s\n",i,rawString);
if (strcmp(rawString, "-main_pack") == 0) if (strcmp(rawString, "--main_pack") == 0)
use_apk_expansion = true; use_apk_expansion = true;
} }
@@ -867,7 +867,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
__android_log_print(ANDROID_LOG_INFO, "godot", "**SETUP"); __android_log_print(ANDROID_LOG_INFO, "godot", "**SETUP");
#if 0 #if 0
char *args[]={"-test","render",NULL}; char *args[]={"--test","render",NULL};
__android_log_print(ANDROID_LOG_INFO,"godot","pre asdasd setup..."); __android_log_print(ANDROID_LOG_INFO,"godot","pre asdasd setup...");
Error err = Main::setup("apk",2,args,false); Error err = Main::setup("apk",2,args,false);
#else #else

View File

@@ -42,7 +42,7 @@ int add_path(int p_argc, char **p_args) {
if (!str) if (!str)
return p_argc; return p_argc;
p_args[p_argc++] = "-path"; p_args[p_argc++] = "--path";
[str retain]; // memory leak lol (maybe make it static here and delete it in ViewController destructor? @todo [str retain]; // memory leak lol (maybe make it static here and delete it in ViewController destructor? @todo
p_args[p_argc++] = (char *)[str cString]; p_args[p_argc++] = (char *)[str cString];
p_args[p_argc] = NULL; p_args[p_argc] = NULL;

View File

@@ -512,7 +512,7 @@ void App::UpdateWindowSize(Size size) {
char **App::get_command_line(unsigned int *out_argc) { char **App::get_command_line(unsigned int *out_argc) {
static char *fail_cl[] = { "-path", "game", NULL }; static char *fail_cl[] = { "--path", "game", NULL };
*out_argc = 2; *out_argc = 2;
FILE *f = _wfopen(L"__cl__.cl", L"rb"); FILE *f = _wfopen(L"__cl__.cl", L"rb");

View File

@@ -1330,7 +1330,7 @@ public:
} }
if (!(p_flags & DEBUG_FLAG_DUMB_CLIENT)) { if (!(p_flags & DEBUG_FLAG_DUMB_CLIENT)) {
cl.push_back("-path"); cl.push_back("--path");
cl.push_back("game"); cl.push_back("game");
} }