diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/SCsub | 16 | ||||
| -rw-r--r-- | core/bind/core_bind.cpp | 7 | ||||
| -rw-r--r-- | core/bind/core_bind.h | 1 | ||||
| -rw-r--r-- | core/os/os.cpp | 3 | ||||
| -rw-r--r-- | core/os/os.h | 1 | ||||
| -rw-r--r-- | core/project_settings.cpp | 26 | ||||
| -rw-r--r-- | core/project_settings.h | 6 | ||||
| -rw-r--r-- | core/variant_call.cpp | 2 |
8 files changed, 27 insertions, 35 deletions
diff --git a/core/SCsub b/core/SCsub index c6d0b7e5b1..fe379d6936 100644 --- a/core/SCsub +++ b/core/SCsub @@ -8,22 +8,6 @@ from platform_methods import run_in_subprocess env.core_sources = [] -# Generate global defaults -gd_call = "" -gd_inc = "" - -for x in env.global_defaults: - env.core_sources.append("#platform/" + x + "/globals/global_defaults.cpp") - gd_inc += '#include "platform/' + x + '/globals/global_defaults.h"\n' - gd_call += "\tregister_" + x + "_global_defaults();\n" - -gd_cpp = '#include "core/project_settings.h"\n' -gd_cpp += gd_inc -gd_cpp += "void ProjectSettings::register_global_defaults() {\n" + gd_call + "\n}\n" - -with open("global_defaults.gen.cpp", "w") as f: - f.write(gd_cpp) - # Generate AES256 script encryption key import os diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 8641af84d9..6ea70a2916 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -132,7 +132,7 @@ bool _ResourceLoader::exists(const String &p_path, const String &p_type_hint) { void _ResourceLoader::_bind_methods() { ClassDB::bind_method(D_METHOD("load_interactive", "path", "type_hint"), &_ResourceLoader::load_interactive, DEFVAL("")); - ClassDB::bind_method(D_METHOD("load", "path", "type_hint", "p_no_cache"), &_ResourceLoader::load, DEFVAL(""), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("load", "path", "type_hint", "no_cache"), &_ResourceLoader::load, DEFVAL(""), DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_recognized_extensions_for_type", "type"), &_ResourceLoader::get_recognized_extensions_for_type); ClassDB::bind_method(D_METHOD("set_abort_on_missing_resources", "abort"), &_ResourceLoader::set_abort_on_missing_resources); ClassDB::bind_method(D_METHOD("get_dependencies", "path"), &_ResourceLoader::get_dependencies); @@ -827,6 +827,10 @@ uint64_t _OS::get_system_time_secs() const { return OS::get_singleton()->get_system_time_secs(); } +uint64_t _OS::get_system_time_msecs() const { + return OS::get_singleton()->get_system_time_msecs(); +} + void _OS::delay_usec(uint32_t p_usec) const { OS::get_singleton()->delay_usec(p_usec); @@ -1182,6 +1186,7 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_datetime_from_unix_time", "unix_time_val"), &_OS::get_datetime_from_unix_time); ClassDB::bind_method(D_METHOD("get_unix_time_from_datetime", "datetime"), &_OS::get_unix_time_from_datetime); ClassDB::bind_method(D_METHOD("get_system_time_secs"), &_OS::get_system_time_secs); + ClassDB::bind_method(D_METHOD("get_system_time_msecs"), &_OS::get_system_time_msecs); ClassDB::bind_method(D_METHOD("set_icon", "icon"), &_OS::set_icon); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 4cdf09d522..39704286b6 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -281,6 +281,7 @@ public: Dictionary get_time_zone_info() const; uint64_t get_unix_time() const; uint64_t get_system_time_secs() const; + uint64_t get_system_time_msecs() const; int get_static_memory_usage() const; int get_static_memory_peak_usage() const; diff --git a/core/os/os.cpp b/core/os/os.cpp index 7547b6a042..ea60a03373 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -61,6 +61,9 @@ uint64_t OS::get_unix_time() const { uint64_t OS::get_system_time_secs() const { return 0; } +uint64_t OS::get_system_time_msecs() const { + return 0; +} void OS::debug_break(){ // something diff --git a/core/os/os.h b/core/os/os.h index 05ec3ac424..046686ff51 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -328,6 +328,7 @@ public: virtual TimeZoneInfo get_time_zone_info() const = 0; virtual uint64_t get_unix_time() const; virtual uint64_t get_system_time_secs() const; + virtual uint64_t get_system_time_msecs() const; virtual void delay_usec(uint32_t p_usec) const = 0; virtual uint64_t get_ticks_usec() const = 0; diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 031ac06063..f3368a5595 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -43,8 +43,6 @@ #include <zlib.h> -#define FORMAT_VERSION 4 - ProjectSettings *ProjectSettings::singleton = NULL; ProjectSettings *ProjectSettings::get_singleton() { @@ -271,9 +269,9 @@ bool ProjectSettings::_load_resource_pack(const String &p_pack) { return true; } -void ProjectSettings::_convert_to_last_version() { - if (!has_setting("config_version") || (int)get_setting("config_version") <= 3) { +void ProjectSettings::_convert_to_last_version(int p_from_version) { + if (p_from_version <= 3) { // Converts the actions from array to dictionary (array of events to dictionary with deadzone + events) for (Map<StringName, ProjectSettings::VariantContainer>::Element *E = props.front(); E; E = E->next()) { Variant value = E->get().variant; @@ -396,7 +394,6 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b // Optional, we don't mind if it fails _load_settings_text("res://override.cfg"); } - return err; } @@ -443,10 +440,6 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b if (resource_path.length() && resource_path[resource_path.length() - 1] == '/') resource_path = resource_path.substr(0, resource_path.length() - 1); // chop end - // If we're loading a project.godot from source code, we can operate some - // ProjectSettings conversions if need be. - _convert_to_last_version(); - return OK; } @@ -537,8 +530,8 @@ Error ProjectSettings::_load_settings_text(const String p_path) { int lines = 0; String error_text; - String section; + int config_version = 0; while (true) { @@ -549,6 +542,9 @@ Error ProjectSettings::_load_settings_text(const String p_path) { err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true); if (err == ERR_FILE_EOF) { memdelete(f); + // If we're loading a project.godot from source code, we can operate some + // ProjectSettings conversions if need be. + _convert_to_last_version(config_version); return OK; } else if (err != OK) { ERR_PRINTS("Error parsing " + p_path + " at line " + itos(lines) + ": " + error_text + " File might be corrupted."); @@ -558,13 +554,13 @@ Error ProjectSettings::_load_settings_text(const String p_path) { if (assign != String()) { if (section == String() && assign == "config_version") { - int config_version = value; - if (config_version > FORMAT_VERSION) { + config_version = value; + if (config_version > CONFIG_VERSION) { memdelete(f); - ERR_FAIL_COND_V(config_version > FORMAT_VERSION, ERR_FILE_CANT_OPEN); + ERR_EXPLAIN(vformat("Can't open project at '%s', its `config_version` (%d) is from a more recent and incompatible version of the engine. Expected config version: %d.", p_path, config_version, CONFIG_VERSION)); + ERR_FAIL_COND_V(config_version > CONFIG_VERSION, ERR_FILE_CANT_OPEN); } } else { - // config_version is checked and dropped if (section == String()) { set(assign, value); } else { @@ -740,7 +736,7 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin file->store_line("; param=value ; assign values to parameters"); file->store_line(""); - file->store_string("config_version=" + itos(FORMAT_VERSION) + "\n"); + file->store_string("config_version=" + itos(CONFIG_VERSION) + "\n"); if (p_custom_features != String()) file->store_string("custom_features=\"" + p_custom_features + "\"\n"); file->store_string("\n"); diff --git a/core/project_settings.h b/core/project_settings.h index f150e4499b..2cb159e1c7 100644 --- a/core/project_settings.h +++ b/core/project_settings.h @@ -106,7 +106,7 @@ protected: Error _save_custom_bnd(const String &p_file); - void _convert_to_last_version(); + void _convert_to_last_version(int p_from_version); bool _load_resource_pack(const String &p_pack); @@ -118,6 +118,8 @@ protected: static void _bind_methods(); public: + static const int CONFIG_VERSION = 4; + void set_setting(const String &p_setting, const Variant &p_value); Variant get_setting(const String &p_setting) const; @@ -152,8 +154,6 @@ public: void set_disable_feature_overrides(bool p_disable); - void register_global_defaults(); - bool is_using_datapack() const; void set_registering_order(bool p_enable); diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 0c6e43fe36..aa180cd4ac 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -291,6 +291,7 @@ struct _VariantCall { VCALL_LOCALMEM0R(String, is_valid_identifier); VCALL_LOCALMEM0R(String, is_valid_integer); VCALL_LOCALMEM0R(String, is_valid_float); + VCALL_LOCALMEM1R(String, is_valid_hex_number); VCALL_LOCALMEM0R(String, is_valid_html_color); VCALL_LOCALMEM0R(String, is_valid_ip_address); VCALL_LOCALMEM0R(String, to_int); @@ -1534,6 +1535,7 @@ void register_variant_methods() { ADDFUNC0R(STRING, BOOL, String, is_valid_identifier, varray()); ADDFUNC0R(STRING, BOOL, String, is_valid_integer, varray()); ADDFUNC0R(STRING, BOOL, String, is_valid_float, varray()); + ADDFUNC1R(STRING, BOOL, String, is_valid_hex_number, BOOL, "with_prefix", varray(false)); ADDFUNC0R(STRING, BOOL, String, is_valid_html_color, varray()); ADDFUNC0R(STRING, BOOL, String, is_valid_ip_address, varray()); ADDFUNC0R(STRING, INT, String, to_int, varray()); |