summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-10-02 16:38:39 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-10-03 17:36:14 -0300
commit3cadecf17be08198f8a28e0674bfde30c8fc824f (patch)
treed7f50c210e56efbce70253485c69c23aa3af5bad
parenta848fa6cdeb00f0c40f259cde2d59112272e3c51 (diff)
fixed the OS.has_feature() API, and added support for 32 and 64.
-rw-r--r--core/bind/core_bind.cpp7
-rw-r--r--core/bind/core_bind.h2
-rw-r--r--core/io/resource_import.cpp2
-rw-r--r--core/os/os.cpp9
-rw-r--r--core/os/os.h2
-rw-r--r--core/project_settings.cpp2
-rw-r--r--editor/editor_export.cpp6
-rw-r--r--editor/project_settings_editor.cpp2
-rw-r--r--platform/osx/export/export.cpp10
9 files changed, 38 insertions, 4 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 7de1c7e6b9..9c655b9460 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,
@@ -1105,6 +1110,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 6f3606dcc3..d69cb86e48 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -317,6 +317,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/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/os/os.cpp b/core/os/os.cpp
index ff17cdb508..f2295823b2 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -494,7 +494,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 +506,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;
diff --git a/core/os/os.h b/core/os/os.h
index 5de07be005..e819666a73 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -427,7 +427,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..3e27597e74 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;
}
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index db12998dd2..bc20a99809 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -1141,6 +1141,12 @@ void EditorExportPlatformPC::get_preset_features(const Ref<EditorExportPreset> &
if (p_preset->get("texture_format/etc2")) {
r_features->push_back("etc2");
}
+
+ if (p_preset->get("binary_format/64_bits")) {
+ r_features->push_back("64");
+ } else {
+ r_features->push_back("32");
+ }
}
void EditorExportPlatformPC::get_export_options(List<ExportOption> *r_options) {
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 56e593e34b..288328c7ed 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -907,6 +907,8 @@ void ProjectSettingsEditor::_copy_to_platform_about_to_show() {
presets.insert("pvrtc");
presets.insert("debug");
presets.insert("release");
+ presets.insert("32");
+ presets.insert("64");
for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) {
List<String> p;
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 2ec76fe0dd..0fd21d62ee 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -97,6 +97,16 @@ void EditorExportPlatformOSX::get_preset_features(const Ref<EditorExportPreset>
if (p_preset->get("texture_format/etc2")) {
r_features->push_back("etc2");
}
+
+ int bits = p_preset->get("application/bits_mode");
+
+ if (bits == 0 || bits == 1) {
+ r_features->push_back("64");
+ }
+
+ if (bits == 0 || bits == 2) {
+ r_features->push_back("32");
+ }
}
void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) {