Browse Source

fixed the OS.has_feature() API, and added support for 32 and 64.

Juan Linietsky 8 years ago
parent
commit
3cadecf17b

+ 7 - 0
core/bind/core_bind.cpp

@@ -453,6 +453,11 @@ int _OS::get_power_percent_left() {
 	return OS::get_singleton()->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 {
 enum Weekday {
 	DAY_SUNDAY,
 	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("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("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_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_seconds_left"), &_OS::get_power_seconds_left);
 	ClassDB::bind_method(D_METHOD("get_power_percent_left"), &_OS::get_power_percent_left);
 	ClassDB::bind_method(D_METHOD("get_power_percent_left"), &_OS::get_power_percent_left);

+ 2 - 0
core/bind/core_bind.h

@@ -317,6 +317,8 @@ public:
 	int get_power_seconds_left();
 	int get_power_seconds_left();
 	int get_power_percent_left();
 	int get_power_percent_left();
 
 
+	bool has_feature(const String &p_feature) const;
+
 	static _OS *get_singleton() { return singleton; }
 	static _OS *get_singleton() { return singleton; }
 
 
 	_OS();
 	_OS();

+ 1 - 1
core/io/resource_import.cpp

@@ -77,7 +77,7 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy
 		if (assign != String()) {
 		if (assign != String()) {
 			if (!path_found && assign.begins_with("path.") && r_path_and_type.path == String()) {
 			if (!path_found && assign.begins_with("path.") && r_path_and_type.path == String()) {
 				String feature = assign.get_slicec('.', 1);
 				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;
 					r_path_and_type.path = value;
 					path_found = true; //first match must have priority
 					path_found = true; //first match must have priority
 				}
 				}

+ 8 - 1
core/os/os.cpp

@@ -494,7 +494,7 @@ int OS::get_power_percent_left() {
 	return -1;
 	return -1;
 }
 }
 
 
-bool OS::check_feature_support(const String &p_feature) {
+bool OS::has_feature(const String &p_feature) {
 
 
 	if (p_feature == get_name())
 	if (p_feature == get_name())
 		return true;
 		return true;
@@ -506,6 +506,13 @@ bool OS::check_feature_support(const String &p_feature) {
 		return true;
 		return true;
 #endif
 #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))
 	if (_check_internal_feature_support(p_feature))
 		return true;
 		return true;
 
 

+ 1 - 1
core/os/os.h

@@ -427,7 +427,7 @@ public:
 	virtual int get_power_seconds_left();
 	virtual int get_power_seconds_left();
 	virtual int get_power_percent_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.
 	 * Returns the stack bottom of the main thread of the application.

+ 1 - 1
core/project_settings.cpp

@@ -152,7 +152,7 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) {
 				bool override_valid = false;
 				bool override_valid = false;
 				for (int i = 1; i < s.size(); i++) {
 				for (int i = 1; i < s.size(); i++) {
 					String feature = s[i].strip_edges();
 					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;
 						override_valid = true;
 						break;
 						break;
 					}
 					}

+ 6 - 0
editor/editor_export.cpp

@@ -1141,6 +1141,12 @@ void EditorExportPlatformPC::get_preset_features(const Ref<EditorExportPreset> &
 	if (p_preset->get("texture_format/etc2")) {
 	if (p_preset->get("texture_format/etc2")) {
 		r_features->push_back("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) {
 void EditorExportPlatformPC::get_export_options(List<ExportOption> *r_options) {

+ 2 - 0
editor/project_settings_editor.cpp

@@ -907,6 +907,8 @@ void ProjectSettingsEditor::_copy_to_platform_about_to_show() {
 	presets.insert("pvrtc");
 	presets.insert("pvrtc");
 	presets.insert("debug");
 	presets.insert("debug");
 	presets.insert("release");
 	presets.insert("release");
+	presets.insert("32");
+	presets.insert("64");
 
 
 	for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) {
 	for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) {
 		List<String> p;
 		List<String> p;

+ 10 - 0
platform/osx/export/export.cpp

@@ -97,6 +97,16 @@ void EditorExportPlatformOSX::get_preset_features(const Ref<EditorExportPreset>
 	if (p_preset->get("texture_format/etc2")) {
 	if (p_preset->get("texture_format/etc2")) {
 		r_features->push_back("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) {
 void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) {