summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/dir_access_jandroid.cpp6
-rw-r--r--platform/android/dir_access_jandroid.h2
-rw-r--r--platform/android/export/export.cpp49
-rw-r--r--platform/iphone/export/export.cpp24
-rw-r--r--platform/javascript/audio_driver_javascript.cpp9
-rw-r--r--platform/javascript/audio_driver_javascript.h1
-rw-r--r--platform/javascript/export/export.cpp4
-rw-r--r--platform/javascript/os_javascript.cpp9
-rw-r--r--platform/javascript/os_javascript.h3
-rw-r--r--platform/osx/export/export.cpp4
-rw-r--r--platform/uwp/export/export.cpp32
11 files changed, 75 insertions, 68 deletions
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp
index af31c758ee..62cc7a380f 100644
--- a/platform/android/dir_access_jandroid.cpp
+++ b/platform/android/dir_access_jandroid.cpp
@@ -212,6 +212,12 @@ Error DirAccessJAndroid::remove(String p_name) {
ERR_FAIL_V(ERR_UNAVAILABLE);
}
+String DirAccessJAndroid::get_filesystem_type() const {
+
+ return "APK";
+}
+
+
//FileType get_file_type() const;
size_t DirAccessJAndroid::get_space_left() {
diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h
index 1d989dd35e..e7a2d5ada1 100644
--- a/platform/android/dir_access_jandroid.h
+++ b/platform/android/dir_access_jandroid.h
@@ -75,6 +75,8 @@ public:
virtual Error rename(String p_from, String p_to);
virtual Error remove(String p_name);
+ virtual String get_filesystem_type() const;
+
//virtual FileType get_file_type() const;
size_t get_space_left();
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 405fe0b294..f293eef2ba 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -426,7 +426,7 @@ class EditorExportAndroid : public EditorExportPlatform {
if (pname.length() == 0) {
if (r_error) {
- *r_error = "Package name is missing.";
+ *r_error = TTR("Package name is missing.");
}
return false;
}
@@ -437,7 +437,7 @@ class EditorExportAndroid : public EditorExportPlatform {
CharType c = pname[i];
if (first && c == '.') {
if (r_error) {
- *r_error = "Package segments must be of non-zero length.";
+ *r_error = TTR("Package segments must be of non-zero length.");
}
return false;
}
@@ -448,19 +448,19 @@ class EditorExportAndroid : public EditorExportPlatform {
}
if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_')) {
if (r_error) {
- *r_error = "The character '" + String::chr(c) + "' is not allowed in Android application package names.";
+ *r_error = vformat(TTR("The character '%s' is not allowed in Android application package names."), String::chr(c));
}
return false;
}
if (first && (c >= '0' && c <= '9')) {
if (r_error) {
- *r_error = "A digit cannot be the first character in a package segment.";
+ *r_error = TTR("A digit cannot be the first character in a package segment.");
}
return false;
}
if (first && c == '_') {
if (r_error) {
- *r_error = "The character '" + String::chr(c) + "' cannot be the first character in a package segment.";
+ *r_error = vformat(TTR("The character '%s' cannot be the first character in a package segment."), String::chr(c));
}
return false;
}
@@ -469,14 +469,14 @@ class EditorExportAndroid : public EditorExportPlatform {
if (segments == 0) {
if (r_error) {
- *r_error = "The package must have at least one '.' separator.";
+ *r_error = TTR("The package must have at least one '.' separator.");
}
return false;
}
if (first) {
if (r_error) {
- *r_error = "Package segments must be of non-zero length.";
+ *r_error = TTR("Package segments must be of non-zero length.");
}
return false;
}
@@ -584,7 +584,7 @@ class EditorExportAndroid : public EditorExportPlatform {
static Error save_apk_so(void *p_userdata, const SharedObject &p_so) {
if (!p_so.path.get_file().begins_with("lib")) {
String err = "Android .so file names must start with \"lib\", but got: " + p_so.path;
- ERR_PRINT(err.utf8().get_data());
+ ERR_PRINTS(err);
return FAILED;
}
APKExportData *ed = (APKExportData *)p_userdata;
@@ -605,7 +605,7 @@ class EditorExportAndroid : public EditorExportPlatform {
if (!exported) {
String abis_string = String(" ").join(abis);
String err = "Cannot determine ABI for library \"" + p_so.path + "\". One of the supported ABIs must be used as a tag: " + abis_string;
- ERR_PRINT(err.utf8().get_data());
+ ERR_PRINTS(err);
return FAILED;
}
return OK;
@@ -1390,7 +1390,7 @@ public:
if (FileAccess::exists(p_preset->get("custom_package/debug"))) {
r_missing_templates = false;
} else {
- err += "Custom debug package not found.\n";
+ err += TTR("Custom debug template not found.") + "\n";
}
}
@@ -1398,7 +1398,7 @@ public:
if (FileAccess::exists(p_preset->get("custom_package/release"))) {
r_missing_templates = false;
} else {
- err += "Custom release package not found.\n";
+ err += TTR("Custom release template not found.") + "\n";
}
}
@@ -1409,7 +1409,7 @@ public:
if (!FileAccess::exists(adb)) {
valid = false;
- err += "ADB executable not configured in the Editor Settings.\n";
+ err += TTR("ADB executable not configured in the Editor Settings.") + "\n";
}
String js = EditorSettings::get_singleton()->get("export/android/jarsigner");
@@ -1417,7 +1417,7 @@ public:
if (!FileAccess::exists(js)) {
valid = false;
- err += "OpenJDK 8 jarsigner not configured in the Editor Settings.\n";
+ err += TTR("OpenJDK jarsigner not configured in the Editor Settings.") + "\n";
}
String dk = p_preset->get("keystore/debug");
@@ -1427,7 +1427,7 @@ public:
dk = EditorSettings::get_singleton()->get("export/android/debug_keystore");
if (!FileAccess::exists(dk)) {
valid = false;
- err += "Debug keystore not configured in the Editor Settings nor in the preset.\n";
+ err += TTR("Debug keystore not configured in the Editor Settings nor in the preset.") + "\n";
}
}
@@ -1435,19 +1435,12 @@ public:
if (apk_expansion) {
- /*
- if (apk_expansion_salt=="") {
- valid=false;
- err+="Invalid SALT for apk expansion.\n";
- }
- */
-
String apk_expansion_pkey = p_preset->get("apk_expansion/public_key");
if (apk_expansion_pkey == "") {
valid = false;
- err += "Invalid public key for APK expansion.\n";
+ err += TTR("Invalid public key for APK expansion.") + "\n";
}
}
@@ -1457,7 +1450,7 @@ public:
if (!is_package_name_valid(get_package_name(pn), &pn_err)) {
valid = false;
- err += "Invalid package name - " + pn_err + "\n";
+ err += TTR("Invalid package name:") + " " + pn_err + "\n";
}
r_error = err;
@@ -1656,16 +1649,6 @@ public:
if (p_flags & DEBUG_FLAG_DUMB_CLIENT) {
- /*String host = EditorSettings::get_singleton()->get("filesystem/file_server/host");
- int port = EditorSettings::get_singleton()->get("filesystem/file_server/post");
- String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
- cl.push_back("--remote-fs");
- cl.push_back(host+":"+itos(port));
- if (passwd!="") {
- cl.push_back("--remote-fs-password");
- cl.push_back(passwd);
- }*/
-
APKExportData ed;
ed.ep = &ep;
ed.apk = unaligned_apk;
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index ef81981ec0..849e6d4a14 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -105,7 +105,7 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
if (pname.length() == 0) {
if (r_error) {
- *r_error = "Identifier is missing.";
+ *r_error = TTR("Identifier is missing.");
}
return false;
}
@@ -116,7 +116,7 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
CharType c = pname[i];
if (first && c == '.') {
if (r_error) {
- *r_error = "Identifier segments must be of non-zero length.";
+ *r_error = TTR("Identifier segments must be of non-zero length.");
}
return false;
}
@@ -127,19 +127,19 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
}
if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_')) {
if (r_error) {
- *r_error = "The character '" + String::chr(c) + "' is not allowed in Identifier.";
+ *r_error = vformat(TTR("The character '%s' is not allowed in Identifier."), String::chr(c));
}
return false;
}
if (first && (c >= '0' && c <= '9')) {
if (r_error) {
- *r_error = "A digit cannot be the first character in a Identifier segment.";
+ *r_error = TTR("A digit cannot be the first character in a Identifier segment.");
}
return false;
}
if (first && c == '_') {
if (r_error) {
- *r_error = "The character '" + String::chr(c) + "' cannot be the first character in a Identifier segment.";
+ *r_error = vformat(TTR("The character '%s' cannot be the first character in a Identifier segment."), String::chr(c));
}
return false;
}
@@ -148,14 +148,14 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
if (segments == 0) {
if (r_error) {
- *r_error = "The Identifier must have at least one '.' separator.";
+ *r_error = TTR("The Identifier must have at least one '.' separator.");
}
return false;
}
if (first) {
if (r_error) {
- *r_error = "Identifier segments must be of non-zero length.";
+ *r_error = TTR("Identifier segments must be of non-zero length.");
}
return false;
}
@@ -1036,7 +1036,7 @@ bool EditorExportPlatformIOS::can_export(const Ref<EditorExportPreset> &p_preset
if (FileAccess::exists(p_preset->get("custom_package/debug"))) {
r_missing_templates = false;
} else {
- err += "Custom debug package not found.\n";
+ err += TTR("Custom debug template not found.") + "\n";
}
}
@@ -1044,7 +1044,7 @@ bool EditorExportPlatformIOS::can_export(const Ref<EditorExportPreset> &p_preset
if (FileAccess::exists(p_preset->get("custom_package/release"))) {
r_missing_templates = false;
} else {
- err += "Custom release package not found.\n";
+ err += TTR("Custom release template not found.") + "\n";
}
}
@@ -1052,14 +1052,14 @@ bool EditorExportPlatformIOS::can_export(const Ref<EditorExportPreset> &p_preset
String team_id = p_preset->get("application/app_store_team_id");
if (team_id.length() == 0) {
- err += "App Store Team ID not specified - cannot configure the project.\n";
+ err += TTR("App Store Team ID not specified - cannot configure the project.") + "\n";
valid = false;
}
String identifier = p_preset->get("application/identifier");
String pn_err;
if (!is_package_name_valid(identifier, &pn_err)) {
- err += "Invalid Identifier - " + pn_err + "\n";
+ err += TTR("Invalid Identifier:") + " " + pn_err + "\n";
valid = false;
}
@@ -1068,7 +1068,7 @@ bool EditorExportPlatformIOS::can_export(const Ref<EditorExportPreset> &p_preset
String icon_path = p_preset->get(info.preset_key);
if (icon_path.length() == 0) {
if (info.is_required) {
- err += "Required icon is not specified in the preset.\n";
+ err += TTR("Required icon is not specified in the preset.") + "\n";
valid = false;
}
break;
diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp
index fcfc75280d..16fdc267f3 100644
--- a/platform/javascript/audio_driver_javascript.cpp
+++ b/platform/javascript/audio_driver_javascript.cpp
@@ -146,6 +146,15 @@ void AudioDriverJavaScript::start() {
/* clang-format on */
}
+void AudioDriverJavaScript::resume() {
+ /* clang-format off */
+ EM_ASM({
+ if (_audioDriver_audioContext.resume)
+ _audioDriver_audioContext.resume();
+ });
+ /* clang-format on */
+}
+
int AudioDriverJavaScript::get_mix_rate() const {
/* clang-format off */
diff --git a/platform/javascript/audio_driver_javascript.h b/platform/javascript/audio_driver_javascript.h
index bf7e2bcce6..9dcba02c96 100644
--- a/platform/javascript/audio_driver_javascript.h
+++ b/platform/javascript/audio_driver_javascript.h
@@ -49,6 +49,7 @@ public:
virtual Error init();
virtual void start();
+ void resume();
virtual int get_mix_rate() const;
virtual SpeakerMode get_speaker_mode() const;
virtual void lock();
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index b3f90b9011..123c6ae645 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -155,7 +155,7 @@ bool EditorExportPlatformJavaScript::can_export(const Ref<EditorExportPreset> &p
if (FileAccess::exists(p_preset->get("custom_template/debug"))) {
valid = true;
} else {
- err += "Custom debug template not found.\n";
+ err += TTR("Custom debug template not found.") + "\n";
}
}
@@ -163,7 +163,7 @@ bool EditorExportPlatformJavaScript::can_export(const Ref<EditorExportPreset> &p
if (FileAccess::exists(p_preset->get("custom_template/release"))) {
valid = true;
} else {
- err += "Custom release template not found.\n";
+ err += TTR("Custom release template not found.") + "\n";
}
}
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index cc3018716d..b92634c8d6 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -245,6 +245,8 @@ EM_BOOL OS_JavaScript::keydown_callback(int p_event_type, const EmscriptenKeyboa
return false;
}
os->input->parse_input_event(ev);
+ // Resume audio context after input in case autoplay was denied.
+ os->audio_driver_javascript.resume();
return true;
}
@@ -335,6 +337,8 @@ EM_BOOL OS_JavaScript::mouse_button_callback(int p_event_type, const EmscriptenM
ev->set_button_mask(mask);
os->input->parse_input_event(ev);
+ // Resume audio context after input in case autoplay was denied.
+ os->audio_driver_javascript.resume();
// Prevent multi-click text selection and wheel-click scrolling anchor.
// Context menu is prevented through contextmenu event.
return true;
@@ -663,6 +667,8 @@ EM_BOOL OS_JavaScript::touch_press_callback(int p_event_type, const EmscriptenTo
os->input->parse_input_event(ev);
}
+ // Resume audio context after input in case autoplay was denied.
+ os->audio_driver_javascript.resume();
return true;
}
@@ -970,7 +976,8 @@ bool OS_JavaScript::main_loop_iterate() {
}
}
- process_joypads();
+ if (emscripten_sample_gamepad_data() == EMSCRIPTEN_RESULT_SUCCESS)
+ process_joypads();
if (just_exited_fullscreen) {
if (window_maximized) {
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 64148915a5..a9f9e23463 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -58,6 +58,7 @@ class OS_JavaScript : public OS_Unix {
int last_click_button_index;
MainLoop *main_loop;
+ int video_driver_index;
AudioDriverJavaScript audio_driver_javascript;
bool idb_available;
@@ -85,8 +86,6 @@ class OS_JavaScript : public OS_Unix {
static void file_access_close_callback(const String &p_file, int p_flags);
- int video_driver_index;
-
protected:
virtual int get_current_video_driver() const;
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 845ef4e893..b8f6977b39 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -749,7 +749,7 @@ bool EditorExportPlatformOSX::can_export(const Ref<EditorExportPreset> &p_preset
if (FileAccess::exists(p_preset->get("custom_package/debug"))) {
valid = true;
} else {
- err += "Custom debug package not found.\n";
+ err += TTR("Custom debug template not found.") + "\n";
}
}
@@ -757,7 +757,7 @@ bool EditorExportPlatformOSX::can_export(const Ref<EditorExportPreset> &p_preset
if (FileAccess::exists(p_preset->get("custom_package/release"))) {
valid = true;
} else {
- err += "Custom release package not found.\n";
+ err += TTR("Custom release template not found.") + "\n";
}
}
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 6f4898c005..6808016f13 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -73,7 +73,7 @@ static const char *uwp_uap_capabilities[] = {
"voipCall",
NULL
};
-static const char *uwp_device_capabilites[] = {
+static const char *uwp_device_capabilities[] = {
"bluetooth",
"location",
"microphone",
@@ -841,7 +841,7 @@ class EditorExportUWP : public EditorExportPlatform {
}
uap++;
}
- const char **device = uwp_device_capabilites;
+ const char **device = uwp_device_capabilities;
while (*device) {
if ((bool)p_preset->get("capabilities/" + String(*device))) {
capabilities_elements += " <DeviceCapability Name=\"" + String(*device) + "\" />\n";
@@ -1105,7 +1105,7 @@ public:
uap++;
}
- const char **device = uwp_device_capabilites;
+ const char **device = uwp_device_capabilities;
while (*device) {
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/" + String(*device).camelcase_to_underscore(false)), false));
device++;
@@ -1151,12 +1151,12 @@ public:
if (!FileAccess::exists(custom_debug_binary)) {
dvalid = false;
- err = "\nCustom debug binary not found.";
+ err += TTR("Custom debug template not found.") + "\n";
}
if (!FileAccess::exists(custom_release_binary)) {
rvalid = false;
- err += "\nCustom release binary not found.";
+ err += TTR("Custom release template not found.") + "\n";
}
if (dvalid || rvalid)
@@ -1169,57 +1169,57 @@ public:
if (!_valid_resource_name(p_preset->get("package/unique_name"))) {
valid = false;
- err += "\nInvalid unique name.";
+ err += TTR("Invalid package unique name.") + "\n";
}
if (!_valid_guid(p_preset->get("identity/product_guid"))) {
valid = false;
- err += "\nInvalid product GUID.";
+ err += TTR("Invalid product GUID.") + "\n";
}
if (!_valid_guid(p_preset->get("identity/publisher_guid"))) {
valid = false;
- err += "\nInvalid publisher GUID.";
+ err += TTR("Invalid publisher GUID.") + "\n";
}
if (!_valid_bgcolor(p_preset->get("images/background_color"))) {
valid = false;
- err += "\nInvalid background color.";
+ err += TTR("Invalid background color.") + "\n";
}
if (!p_preset->get("images/store_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/store_logo"))), 50, 50)) {
valid = false;
- err += "\nInvalid Store Logo image dimensions (should be 50x50).";
+ err += TTR("Invalid Store Logo image dimensions (should be 50x50).") + "\n";
}
if (!p_preset->get("images/square44x44_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square44x44_logo"))), 44, 44)) {
valid = false;
- err += "\nInvalid square 44x44 logo image dimensions (should be 44x44).";
+ err += TTR("Invalid square 44x44 logo image dimensions (should be 44x44).") + "\n";
}
if (!p_preset->get("images/square71x71_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square71x71_logo"))), 71, 71)) {
valid = false;
- err += "\nInvalid square 71x71 logo image dimensions (should be 71x71).";
+ err += TTR("Invalid square 71x71 logo image dimensions (should be 71x71).") + "\n";
}
if (!p_preset->get("images/square150x150_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square150x150_logo"))), 150, 0)) {
valid = false;
- err += "\nInvalid square 150x150 logo image dimensions (should be 150x150).";
+ err += TTR("Invalid square 150x150 logo image dimensions (should be 150x150).") + "\n";
}
if (!p_preset->get("images/square310x310_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square310x310_logo"))), 310, 310)) {
valid = false;
- err += "\nInvalid square 310x310 logo image dimensions (should be 310x310).";
+ err += TTR("Invalid square 310x310 logo image dimensions (should be 310x310).") + "\n";
}
if (!p_preset->get("images/wide310x150_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/wide310x150_logo"))), 310, 150)) {
valid = false;
- err += "\nInvalid wide 310x150 logo image dimensions (should be 310x150).";
+ err += TTR("Invalid wide 310x150 logo image dimensions (should be 310x150).") + "\n";
}
if (!p_preset->get("images/splash_screen").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/splash_screen"))), 620, 300)) {
valid = false;
- err += "\nInvalid splash screen image dimensions (should be 620x300).";
+ err += TTR("Invalid splash screen image dimensions (should be 620x300).") + "\n";
}
r_error = err;