summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/bind/core_bind.cpp18
-rw-r--r--core/bind/core_bind.h5
-rw-r--r--core/io/http_client.cpp2
-rw-r--r--core/io/logger.cpp5
-rw-r--r--core/io/marshalls.cpp3
-rw-r--r--core/io/resource_import.cpp2
-rw-r--r--core/io/resource_loader.cpp2
-rw-r--r--core/os/os.cpp15
-rw-r--r--core/os/os.h9
-rw-r--r--core/project_settings.cpp22
-rw-r--r--core/project_settings.h5
-rw-r--r--core/string_db.h3
-rw-r--r--core/translation.cpp2
13 files changed, 76 insertions, 17 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index f47d540351..b47e611a51 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -453,6 +453,11 @@ int _OS::get_power_percent_left() {
return OS::get_singleton()->get_power_percent_left();
}
+bool _OS::has_feature(const String &p_feature) const {
+
+ return OS::get_singleton()->has_feature(p_feature);
+}
+
/*
enum Weekday {
DAY_SUNDAY,
@@ -755,6 +760,11 @@ bool _OS::can_draw() const {
return OS::get_singleton()->can_draw();
}
+bool _OS::is_userfs_persistent() const {
+
+ return OS::get_singleton()->is_userfs_persistent();
+}
+
int _OS::get_processor_count() const {
return OS::get_singleton()->get_processor_count();
@@ -858,6 +868,10 @@ void _OS::hide_virtual_keyboard() {
OS::get_singleton()->hide_virtual_keyboard();
}
+int _OS::get_virtual_keyboard_height() {
+ return OS::get_singleton()->get_virtual_keyboard_height();
+}
+
void _OS::print_all_resources(const String &p_to_file) {
OS::get_singleton()->print_all_resources(p_to_file);
@@ -1051,6 +1065,7 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_model_name"), &_OS::get_model_name);
ClassDB::bind_method(D_METHOD("can_draw"), &_OS::can_draw);
+ ClassDB::bind_method(D_METHOD("is_userfs_persistent"), &_OS::is_userfs_persistent);
ClassDB::bind_method(D_METHOD("is_stdout_verbose"), &_OS::is_stdout_verbose);
ClassDB::bind_method(D_METHOD("can_use_threads"), &_OS::can_use_threads);
@@ -1064,6 +1079,7 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_virtual_keyboard"), &_OS::has_virtual_keyboard);
ClassDB::bind_method(D_METHOD("show_virtual_keyboard", "existing_text"), &_OS::show_virtual_keyboard, DEFVAL(""));
ClassDB::bind_method(D_METHOD("hide_virtual_keyboard"), &_OS::hide_virtual_keyboard);
+ ClassDB::bind_method(D_METHOD("get_virtual_keyboard_height"), &_OS::get_virtual_keyboard_height);
ClassDB::bind_method(D_METHOD("print_resources_in_use", "short"), &_OS::print_resources_in_use, DEFVAL(false));
ClassDB::bind_method(D_METHOD("print_all_resources", "tofile"), &_OS::print_all_resources, DEFVAL(""));
@@ -1099,6 +1115,8 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_use_vsync", "enable"), &_OS::set_use_vsync);
ClassDB::bind_method(D_METHOD("is_vsync_enabled"), &_OS::is_vsync_enabled);
+ ClassDB::bind_method(D_METHOD("has_feature", "tag_name"), &_OS::has_feature);
+
ClassDB::bind_method(D_METHOD("get_power_state"), &_OS::get_power_state);
ClassDB::bind_method(D_METHOD("get_power_seconds_left"), &_OS::get_power_seconds_left);
ClassDB::bind_method(D_METHOD("get_power_percent_left"), &_OS::get_power_percent_left);
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index f12ab9f000..7f8c734e36 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -204,6 +204,7 @@ public:
bool has_virtual_keyboard() const;
void show_virtual_keyboard(const String &p_existing_text = "");
void hide_virtual_keyboard();
+ int get_virtual_keyboard_height();
void print_resources_in_use(bool p_short = false);
void print_all_resources(const String &p_to_file);
@@ -266,6 +267,8 @@ public:
bool can_draw() const;
+ bool is_userfs_persistent() const;
+
bool is_stdout_verbose() const;
int get_processor_count() const;
@@ -315,6 +318,8 @@ public:
int get_power_seconds_left();
int get_power_percent_left();
+ bool has_feature(const String &p_feature) const;
+
static _OS *get_singleton() { return singleton; }
_OS();
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index dd56db9bf9..b8c0a2b616 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -297,7 +297,7 @@ Error HTTPClient::poll() {
case StreamPeerTCP::STATUS_CONNECTED: {
if (ssl) {
Ref<StreamPeerSSL> ssl = StreamPeerSSL::create();
- Error err = ssl->connect_to_stream(tcp_connection, true, ssl_verify_host ? conn_host : String());
+ Error err = ssl->connect_to_stream(tcp_connection, ssl_verify_host, ssl_verify_host ? conn_host : String());
if (err != OK) {
close();
status = STATUS_SSL_HANDSHAKE_ERROR;
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index 7ea5f06d7e..b94007d316 100644
--- a/core/io/logger.cpp
+++ b/core/io/logger.cpp
@@ -177,11 +177,14 @@ void RotatedFileLogger::logv(const char *p_format, va_list p_list, bool p_err) {
const int static_buf_size = 512;
char static_buf[static_buf_size];
char *buf = static_buf;
+ va_list list_copy;
+ va_copy(list_copy, p_list);
int len = vsnprintf(buf, static_buf_size, p_format, p_list);
if (len >= static_buf_size) {
buf = (char *)Memory::alloc_static(len + 1);
- vsnprintf(buf, len + 1, p_format, p_list);
+ vsnprintf(buf, len + 1, p_format, list_copy);
}
+ va_end(list_copy);
file->store_buffer((uint8_t *)buf, len);
if (len >= static_buf_size) {
Memory::free_static(buf);
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 0834d6c321..d388a622de 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -1140,8 +1140,9 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
if (buf) {
encode_uint32(0, buf);
buf += 4;
- r_len += 4;
}
+ r_len += 4;
+
} else {
_encode_string(obj->get_class(), buf, r_len);
diff --git a/core/io/resource_import.cpp b/core/io/resource_import.cpp
index bc7ea47762..401d704222 100644
--- a/core/io/resource_import.cpp
+++ b/core/io/resource_import.cpp
@@ -77,7 +77,7 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy
if (assign != String()) {
if (!path_found && assign.begins_with("path.") && r_path_and_type.path == String()) {
String feature = assign.get_slicec('.', 1);
- if (OS::get_singleton()->check_feature_support(feature)) {
+ if (OS::get_singleton()->has_feature(feature)) {
r_path_and_type.path = value;
path_found = true; //first match must have priority
}
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 89cb4a22c2..ed0d491679 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -492,7 +492,7 @@ void ResourceLoader::reload_translation_remaps() {
void ResourceLoader::load_translation_remaps() {
- if (!ProjectSettings::get_singleton()->has("locale/translation_remaps"))
+ if (!ProjectSettings::get_singleton()->has_setting("locale/translation_remaps"))
return;
Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps");
diff --git a/core/os/os.cpp b/core/os/os.cpp
index ff17cdb508..eb5d5be33d 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -193,6 +193,10 @@ void OS::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_scr
void OS::hide_virtual_keyboard() {
}
+int OS::get_virtual_keyboard_height() const {
+ return 0;
+}
+
void OS::print_all_resources(String p_to_file) {
ERR_FAIL_COND(p_to_file != "" && _OSPRF);
@@ -494,7 +498,7 @@ int OS::get_power_percent_left() {
return -1;
}
-bool OS::check_feature_support(const String &p_feature) {
+bool OS::has_feature(const String &p_feature) {
if (p_feature == get_name())
return true;
@@ -506,6 +510,13 @@ bool OS::check_feature_support(const String &p_feature) {
return true;
#endif
+ if (sizeof(void *) == 8 && p_feature == "64") {
+ return true;
+ }
+ if (sizeof(void *) == 4 && p_feature == "32") {
+ return true;
+ }
+
if (_check_internal_feature_support(p_feature))
return true;
@@ -530,7 +541,7 @@ OS::OS() {
_render_thread_mode = RENDER_THREAD_SAFE;
- _allow_hidpi = true;
+ _allow_hidpi = false;
_stack_bottom = (void *)(&stack_bottom);
_logger = NULL;
diff --git a/core/os/os.h b/core/os/os.h
index c9d25792b9..48effe99da 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -204,7 +204,7 @@ public:
virtual String get_installed_templates_path() const { return ""; }
virtual String get_executable_path() const;
- virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL) = 0;
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false) = 0;
virtual Error kill(const ProcessID &p_pid) = 0;
virtual int get_process_id() const;
@@ -283,6 +283,8 @@ public:
virtual bool can_draw() const = 0;
+ virtual bool is_userfs_persistent() const { return true; }
+
bool is_stdout_verbose() const;
virtual void disable_crash_handler() {}
@@ -313,6 +315,9 @@ public:
virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2());
virtual void hide_virtual_keyboard();
+ // returns height of the currently shown virtual keyboard (0 if keyboard is hidden)
+ virtual int get_virtual_keyboard_height() const;
+
virtual void set_cursor_shape(CursorShape p_shape) = 0;
virtual bool get_swap_ok_cancel() { return false; }
@@ -425,7 +430,7 @@ public:
virtual int get_power_seconds_left();
virtual int get_power_percent_left();
- bool check_feature_support(const String &p_feature);
+ bool has_feature(const String &p_feature);
/**
* Returns the stack bottom of the main thread of the application.
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 14ebe87dc5..3994011c06 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -152,7 +152,7 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) {
bool override_valid = false;
for (int i = 1; i < s.size(); i++) {
String feature = s[i].strip_edges();
- if (OS::get_singleton()->check_feature_support(feature) || custom_features.has(feature)) {
+ if (OS::get_singleton()->has_feature(feature) || custom_features.has(feature)) {
override_valid = true;
break;
}
@@ -420,7 +420,7 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) {
return OK;
}
-bool ProjectSettings::has(String p_var) const {
+bool ProjectSettings::has_setting(String p_var) const {
_THREAD_SAFE_METHOD_
@@ -667,8 +667,8 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin
file->store_line("; Engine configuration file.");
file->store_line("; It's best edited using the editor UI and not directly,");
file->store_line("; since the parameters that go here are not all obvious.");
- file->store_line("; ");
- file->store_line("; Format: ");
+ file->store_line(";");
+ file->store_line("; Format:");
file->store_line("; [section] ; section goes between []");
file->store_line("; param=value ; assign values to parameters");
file->store_line("");
@@ -800,7 +800,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default) {
Variant ret;
- if (ProjectSettings::get_singleton()->has(p_var)) {
+ if (ProjectSettings::get_singleton()->has_setting(p_var)) {
ret = ProjectSettings::get_singleton()->get(p_var);
} else {
ProjectSettings::get_singleton()->set(p_var, p_default);
@@ -907,9 +907,19 @@ Variant ProjectSettings::property_get_revert(const String &p_name) {
return props[p_name].initial;
}
+void ProjectSettings::set_setting(const String &p_setting, const Variant &p_value) {
+ set(p_setting, p_value);
+}
+
+Variant ProjectSettings::get_setting(const String &p_setting) const {
+ return get(p_setting);
+}
+
void ProjectSettings::_bind_methods() {
- ClassDB::bind_method(D_METHOD("has", "name"), &ProjectSettings::has);
+ ClassDB::bind_method(D_METHOD("has_setting", "name"), &ProjectSettings::has_setting);
+ ClassDB::bind_method(D_METHOD("set_setting", "name", "value"), &ProjectSettings::set_setting);
+ ClassDB::bind_method(D_METHOD("get_setting", "name"), &ProjectSettings::get_setting);
ClassDB::bind_method(D_METHOD("set_order", "name", "position"), &ProjectSettings::set_order);
ClassDB::bind_method(D_METHOD("get_order", "name"), &ProjectSettings::get_order);
ClassDB::bind_method(D_METHOD("set_initial_value", "name", "value"), &ProjectSettings::set_initial_value);
diff --git a/core/project_settings.h b/core/project_settings.h
index 718ab2a011..ea6034dc84 100644
--- a/core/project_settings.h
+++ b/core/project_settings.h
@@ -119,7 +119,10 @@ protected:
static void _bind_methods();
public:
- bool has(String p_var) const;
+ void set_setting(const String &p_setting, const Variant &p_value);
+ Variant get_setting(const String &p_setting) const;
+
+ bool has_setting(String p_var) const;
String localize_path(const String &p_path) const;
String globalize_path(const String &p_path) const;
diff --git a/core/string_db.h b/core/string_db.h
index 2bef29fab8..de91e2abd8 100644
--- a/core/string_db.h
+++ b/core/string_db.h
@@ -113,6 +113,9 @@ public:
else
return 0;
}
+ _FORCE_INLINE_ const void *data_unique_pointer() const {
+ return (void *)_data;
+ }
bool operator!=(const StringName &p_name) const;
_FORCE_INLINE_ operator String() const {
diff --git a/core/translation.cpp b/core/translation.cpp
index f1f9c72b85..27e3b202d0 100644
--- a/core/translation.cpp
+++ b/core/translation.cpp
@@ -1052,7 +1052,7 @@ TranslationServer *TranslationServer::singleton = NULL;
bool TranslationServer::_load_translations(const String &p_from) {
- if (ProjectSettings::get_singleton()->has(p_from)) {
+ if (ProjectSettings::get_singleton()->has_setting(p_from)) {
PoolVector<String> translations = ProjectSettings::get_singleton()->get(p_from);
int tcount = translations.size();