diff options
Diffstat (limited to 'platform')
42 files changed, 312 insertions, 342 deletions
diff --git a/platform/android/SCsub b/platform/android/SCsub index d8013b0baf..7e9dac926c 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -29,10 +29,14 @@ for x in android_files: env_thirdparty = env_android.Clone() env_thirdparty.disable_warnings() -android_objects.append(env_thirdparty.SharedObject("#thirdparty/misc/ifaddrs-android.cc")) +thirdparty_obj = env_thirdparty.SharedObject("#thirdparty/misc/ifaddrs-android.cc") +android_objects.append(thirdparty_obj) lib = env_android.add_shared_library("#bin/libgodot", [android_objects], SHLIBSUFFIX=env["SHLIBSUFFIX"]) +# Needed to force rebuilding the platform files when the thirdparty code is updated. +env.Depends(lib, thirdparty_obj) + lib_arch_dir = "" if env["android_arch"] == "armv7": lib_arch_dir = "armeabi-v7a" diff --git a/platform/android/detect.py b/platform/android/detect.py index 60d4146712..650606ff8b 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -334,6 +334,6 @@ def get_ndk_version(path): key_value = list(map(lambda x: x.strip(), line.split("="))) if key_value[0] == "Pkg.Revision": return key_value[1] - except: + except Exception: print("Could not read source prop file '%s'" % prop_file_path) return None diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index eed3b226c8..e1f9180992 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -240,6 +240,9 @@ static const LauncherIcon launcher_adaptive_icon_backgrounds[icon_densities_coun { "res/mipmap/icon_background.png", 432 } }; +static const int EXPORT_FORMAT_APK = 0; +static const int EXPORT_FORMAT_AAB = 1; + class EditorExportPlatformAndroid : public EditorExportPlatform { GDCLASS(EditorExportPlatformAndroid, EditorExportPlatform); @@ -647,7 +650,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { if (DirAccess::exists(plugins_dir)) { Vector<String> plugins_filenames = list_gdap_files(plugins_dir); - if (!plugins_filenames.empty()) { + if (!plugins_filenames.is_empty()) { Ref<ConfigFile> config_file = memnew(ConfigFile); for (int i = 0; i < plugins_filenames.size(); i++) { PluginConfig config = load_plugin_config(config_file, plugins_dir.plus_file(plugins_filenames[i])); @@ -750,7 +753,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { PackedStringArray user_perms = p_preset->get("permissions/custom_permissions"); for (int i = 0; i < user_perms.size(); i++) { String user_perm = user_perms[i].strip_edges(); - if (!user_perm.empty()) { + if (!user_perm.is_empty()) { r_permissions.push_back(user_perm); } } @@ -975,7 +978,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { encode_uint32(xr_mode_index == /* XRMode.OVR */ 1 && focus_awareness ? 0xFFFFFFFF : 0, &p_manifest.write[iofs + 16]); } - if (tname == "meta-data" && attrname == "value" && value == "plugins_value" && !plugins_names.empty()) { + if (tname == "meta-data" && attrname == "value" && value == "plugins_value" && !plugins_names.is_empty()) { // Update the meta-data 'android:value' attribute with the list of enabled plugins. string_table.write[attr_value] = plugins_names; } @@ -1471,7 +1474,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { // TODO: Figure out how to handle remaining boot splash parameters (e.g: fullsize, filter) String project_splash_path = ProjectSettings::get_singleton()->get("application/boot_splash/image"); - if (!project_splash_path.empty()) { + if (!project_splash_path.is_empty()) { splash_image.instance(); const Error err = ImageLoader::load_image(project_splash_path, splash_image); if (err) { @@ -1505,19 +1508,19 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { // Regular icon: user selection -> project icon -> default. String path = static_cast<String>(p_preset->get(launcher_icon_option)).strip_edges(); - if (path.empty() || ImageLoader::load_image(path, icon) != OK) { + if (path.is_empty() || ImageLoader::load_image(path, icon) != OK) { ImageLoader::load_image(project_icon_path, icon); } // Adaptive foreground: user selection -> regular icon (user selection -> project icon -> default). path = static_cast<String>(p_preset->get(launcher_adaptive_icon_foreground_option)).strip_edges(); - if (path.empty() || ImageLoader::load_image(path, foreground) != OK) { + if (path.is_empty() || ImageLoader::load_image(path, foreground) != OK) { foreground = icon; } // Adaptive background: user selection -> default. path = static_cast<String>(p_preset->get(launcher_adaptive_icon_background_option)).strip_edges(); - if (!path.empty()) { + if (!path.is_empty()) { ImageLoader::load_image(path, background); } } @@ -1538,14 +1541,14 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { const Ref<Image> &foreground, const Ref<Image> &background) { // Store the splash image - if (splash_image.is_valid() && !splash_image->empty()) { + if (splash_image.is_valid() && !splash_image->is_empty()) { Vector<uint8_t> data; _load_image_data(splash_image, data); store_image(SPLASH_IMAGE_EXPORT_PATH, data); } // Store the splash bg color image - if (splash_bg_color_image.is_valid() && !splash_bg_color_image->empty()) { + if (splash_bg_color_image.is_valid() && !splash_bg_color_image->is_empty()) { Vector<uint8_t> data; _load_image_data(splash_bg_color_image, data); store_image(SPLASH_BG_COLOR_PATH, data); @@ -1555,20 +1558,20 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { // the default image from the export template will be used. for (int i = 0; i < icon_densities_count; ++i) { - if (main_image.is_valid() && !main_image->empty()) { + if (main_image.is_valid() && !main_image->is_empty()) { Vector<uint8_t> data; _process_launcher_icons(launcher_icons[i].export_path, main_image, launcher_icons[i].dimensions, data); store_image(launcher_icons[i], data); } - if (foreground.is_valid() && !foreground->empty()) { + if (foreground.is_valid() && !foreground->is_empty()) { Vector<uint8_t> data; _process_launcher_icons(launcher_adaptive_icon_foregrounds[i].export_path, foreground, launcher_adaptive_icon_foregrounds[i].dimensions, data); store_image(launcher_adaptive_icon_foregrounds[i], data); } - if (background.is_valid() && !background->empty()) { + if (background.is_valid() && !background->is_empty()) { Vector<uint8_t> data; _process_launcher_icons(launcher_adaptive_icon_backgrounds[i].export_path, background, launcher_adaptive_icon_backgrounds[i].dimensions, data); @@ -1613,7 +1616,7 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.apk"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.apk"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "custom_template/use_custom_build"), false)); - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "custom_template/export_format", PROPERTY_HINT_ENUM, "Export APK,Export AAB"), 0)); + r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "custom_template/export_format", PROPERTY_HINT_ENUM, "Export APK,Export AAB"), EXPORT_FORMAT_APK)); Vector<PluginConfig> plugins_configs = get_plugins(); for (int i = 0; i < plugins_configs.size(); i++) { @@ -1772,7 +1775,7 @@ public: } // Export to temporary APK before sending to device. - Error err = export_project(p_preset, true, tmp_export_path, p_debug_flags); + Error err = export_project_helper(p_preset, true, tmp_export_path, EXPORT_FORMAT_APK, true, p_debug_flags); if (err != OK) { CLEANUP_AND_RETURN(err); @@ -1962,7 +1965,7 @@ public: String rk = p_preset->get("keystore/release"); - if (!rk.empty() && !FileAccess::exists(rk)) { + if (!rk.is_empty() && !FileAccess::exists(rk)) { valid = false; err += TTR("Release keystore incorrectly configured in the export preset.") + "\n"; } @@ -2019,7 +2022,7 @@ public: // Ensure that `Use Custom Build` is enabled if a plugin is selected. String enabled_plugins_names = get_plugins_names(get_enabled_plugins(p_preset)); bool custom_build_enabled = p_preset->get("custom_template/use_custom_build"); - if (!enabled_plugins_names.empty() && !custom_build_enabled) { + if (!enabled_plugins_names.is_empty() && !custom_build_enabled) { valid = false; err += TTR("\"Use Custom Build\" must be enabled to use the plugins."); err += "\n"; @@ -2050,7 +2053,7 @@ public: } } - if (int(p_preset->get("custom_template/export_format")) == 1 && /*AAB*/ + if (int(p_preset->get("custom_template/export_format")) == EXPORT_FORMAT_AAB && !bool(p_preset->get("custom_template/use_custom_build"))) { valid = false; err += TTR("\"Export AAB\" is only valid when \"Use Custom Build\" is enabled."); @@ -2170,7 +2173,7 @@ public: Error sign_apk(const Ref<EditorExportPreset> &p_preset, bool p_debug, String export_path, EditorProgress ep) { int export_format = int(p_preset->get("custom_template/export_format")); - String export_label = export_format == 1 ? "AAB" : "APK"; + String export_label = export_format == EXPORT_FORMAT_AAB ? "AAB" : "APK"; String release_keystore = p_preset->get("keystore/release"); String release_username = p_preset->get("keystore/release_user"); String release_password = p_preset->get("keystore/release_password"); @@ -2189,7 +2192,7 @@ public: password = p_preset->get("keystore/debug_password"); user = p_preset->get("keystore/debug_user"); - if (keystore.empty()) { + if (keystore.is_empty()) { keystore = EditorSettings::get_singleton()->get("export/android/debug_keystore"); password = EditorSettings::get_singleton()->get("export/android/debug_keystore_pass"); user = EditorSettings::get_singleton()->get("export/android/debug_keystore_user"); @@ -2267,6 +2270,12 @@ public: } virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) override { + int export_format = int(p_preset->get("custom_template/export_format")); + bool should_sign = p_preset->get("package/signed"); + return export_project_helper(p_preset, p_debug, p_path, export_format, should_sign, p_flags); + } + + Error export_project_helper(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int export_format, bool should_sign, int p_flags) { ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags); String src_apk; @@ -2275,9 +2284,7 @@ public: EditorProgress ep("export", "Exporting for Android", 105, true); bool use_custom_build = bool(p_preset->get("custom_template/use_custom_build")); - int export_format = int(p_preset->get("custom_template/export_format")); bool p_give_internet = p_flags & (DEBUG_FLAG_DUMB_CLIENT | DEBUG_FLAG_REMOTE_DEBUG); - bool _signed = p_preset->get("package/signed"); bool apk_expansion = p_preset->get("apk_expansion/enable"); Vector<String> enabled_abis = get_enabled_abis(p_preset); @@ -2295,7 +2302,7 @@ public: // Write command line flags into the command_line_flags variable. get_command_line_flags(p_preset, p_path, p_flags, command_line_flags); - if (export_format == 1) { + if (export_format == EXPORT_FORMAT_AAB) { if (!p_path.ends_with(".aab")) { EditorNode::get_singleton()->show_warning(TTR("Invalid filename! Android App Bundle requires the *.aab extension.")); return ERR_UNCONFIGURED; @@ -2305,12 +2312,12 @@ public: return ERR_UNCONFIGURED; } } - if (export_format == 0 && !p_path.ends_with(".apk")) { + if (export_format == EXPORT_FORMAT_APK && !p_path.ends_with(".apk")) { EditorNode::get_singleton()->show_warning( TTR("Invalid filename! Android APK requires the *.apk extension.")); return ERR_UNCONFIGURED; } - if (export_format > 1 || export_format < 0) { + if (export_format > EXPORT_FORMAT_AAB || export_format < EXPORT_FORMAT_APK) { EditorNode::add_io_error("Unsupported export format!\n"); return ERR_UNCONFIGURED; //TODO: is this the right error? } @@ -2377,7 +2384,7 @@ public: String version_code = itos(p_preset->get("version/code")); String version_name = p_preset->get("version/name"); String enabled_abi_string = String("|").join(enabled_abis); - String sign_flag = _signed ? "true" : "false"; + String sign_flag = should_sign ? "true" : "false"; String zipalign_flag = "true"; Vector<PluginConfig> enabled_plugins = get_enabled_plugins(p_preset); @@ -2392,10 +2399,10 @@ public: } String build_type = p_debug ? "Debug" : "Release"; - if (export_format == 1) { + if (export_format == EXPORT_FORMAT_AAB) { String bundle_build_command = vformat("bundle%s", build_type); cmdline.push_back(bundle_build_command); - } else if (export_format == 0) { + } else if (export_format == EXPORT_FORMAT_APK) { String apk_build_command = vformat("assemble%s", build_type); cmdline.push_back(apk_build_command); } @@ -2409,7 +2416,7 @@ public: cmdline.push_back("-Pplugins_maven_repos=" + custom_maven_repos); // argument to specify the list of custom maven repos for the plugins dependencies. cmdline.push_back("-Pperform_zipalign=" + zipalign_flag); // argument to specify whether the build should be zipaligned. cmdline.push_back("-Pperform_signing=" + sign_flag); // argument to specify whether the build should be signed. - if (_signed && !p_debug) { + if (should_sign && !p_debug) { // Pass the release keystore info as well String release_keystore = p_preset->get("keystore/release"); String release_username = p_preset->get("keystore/release_user"); @@ -2434,9 +2441,9 @@ public: List<String> copy_args; String copy_command; - if (export_format == 1) { + if (export_format == EXPORT_FORMAT_AAB) { copy_command = vformat("copyAndRename%sAab", build_type); - } else if (export_format == 0) { + } else if (export_format == EXPORT_FORMAT_APK) { copy_command = vformat("copyAndRename%sApk", build_type); } @@ -2549,27 +2556,27 @@ public: } // Process the splash image - if (file == SPLASH_IMAGE_EXPORT_PATH && splash_image.is_valid() && !splash_image->empty()) { + if (file == SPLASH_IMAGE_EXPORT_PATH && splash_image.is_valid() && !splash_image->is_empty()) { _load_image_data(splash_image, data); } // Process the splash bg color image - if (file == SPLASH_BG_COLOR_PATH && splash_bg_color_image.is_valid() && !splash_bg_color_image->empty()) { + if (file == SPLASH_BG_COLOR_PATH && splash_bg_color_image.is_valid() && !splash_bg_color_image->is_empty()) { _load_image_data(splash_bg_color_image, data); } for (int i = 0; i < icon_densities_count; ++i) { - if (main_image.is_valid() && !main_image->empty()) { + if (main_image.is_valid() && !main_image->is_empty()) { if (file == launcher_icons[i].export_path) { _process_launcher_icons(file, main_image, launcher_icons[i].dimensions, data); } } - if (foreground.is_valid() && !foreground->empty()) { + if (foreground.is_valid() && !foreground->is_empty()) { if (file == launcher_adaptive_icon_foregrounds[i].export_path) { _process_launcher_icons(file, foreground, launcher_adaptive_icon_foregrounds[i].dimensions, data); } } - if (background.is_valid() && !background->empty()) { + if (background.is_valid() && !background->is_empty()) { if (file == launcher_adaptive_icon_backgrounds[i].export_path) { _process_launcher_icons(file, background, launcher_adaptive_icon_backgrounds[i].dimensions, data); } @@ -2590,7 +2597,7 @@ public: } } - if (file.begins_with("META-INF") && _signed) { + if (file.begins_with("META-INF") && should_sign) { skip = true; } @@ -2620,7 +2627,7 @@ public: ret = unzGoToNextFile(pkg); } - if (!invalid_abis.empty()) { + if (!invalid_abis.is_empty()) { String unsupported_arch = String(", ").join(invalid_abis); EditorNode::add_io_error("Missing libraries in the export template for the selected architectures: " + unsupported_arch + ".\n" + "Please build a template with all required libraries, or uncheck the missing architectures in the export preset."); @@ -2678,7 +2685,7 @@ public: CLEANUP_AND_RETURN(err); } - if (_signed) { + if (should_sign) { err = sign_apk(p_preset, p_debug, tmp_unaligned_path, ep); if (err != OK) { CLEANUP_AND_RETURN(err); diff --git a/platform/android/export/gradle_export_util.h b/platform/android/export/gradle_export_util.h index a9f38869e0..7e1ff2e026 100644 --- a/platform/android/export/gradle_export_util.h +++ b/platform/android/export/gradle_export_util.h @@ -261,7 +261,7 @@ String _get_instrumentation_tag(const Ref<EditorExportPreset> &p_preset) { } String _get_plugins_tag(const String &plugins_names) { - if (!plugins_names.empty()) { + if (!plugins_names.is_empty()) { return vformat(" <meta-data tools:node=\"replace\" android:name=\"plugins\" android:value=\"%s\" />\n", plugins_names); } else { return " <meta-data tools:node=\"remove\" android:name=\"plugins\" />\n"; diff --git a/platform/android/java_godot_wrapper.cpp b/platform/android/java_godot_wrapper.cpp index 7919e47b5c..818e55476e 100644 --- a/platform/android/java_godot_wrapper.cpp +++ b/platform/android/java_godot_wrapper.cpp @@ -103,7 +103,7 @@ jobject GodotJavaWrapper::get_member_object(const char *p_name, const char *p_cl jobject GodotJavaWrapper::get_class_loader() { if (_get_class_loader) { JNIEnv *env = ThreadAndroid::get_env(); - return env->CallObjectMethod(godot_instance, _get_class_loader); + return env->CallObjectMethod(activity, _get_class_loader); } else { return nullptr; } diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index b90fb3ce6e..7260bca93a 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -139,7 +139,7 @@ MainLoop *OS_Android::get_main_loop() const { void OS_Android::main_loop_begin() { if (main_loop) - main_loop->init(); + main_loop->initialize(); } bool OS_Android::main_loop_iterate() { @@ -151,7 +151,7 @@ bool OS_Android::main_loop_iterate() { void OS_Android::main_loop_end() { if (main_loop) - main_loop->finish(); + main_loop->finalize(); } void OS_Android::main_loop_focusout() { diff --git a/platform/android/os_android.h b/platform/android/os_android.h index cac7efaa88..d9a07411ad 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -68,15 +68,15 @@ private: GodotIOJavaWrapper *godot_io_java; public: - virtual void initialize_core(); - virtual void initialize(); + virtual void initialize_core() override; + virtual void initialize() override; - virtual void initialize_joypads(); + virtual void initialize_joypads() override; - virtual void set_main_loop(MainLoop *p_main_loop); - virtual void delete_main_loop(); + virtual void set_main_loop(MainLoop *p_main_loop) override; + virtual void delete_main_loop() override; - virtual void finalize(); + virtual void finalize() override; typedef int64_t ProcessID; @@ -84,14 +84,14 @@ public: GodotJavaWrapper *get_godot_java(); GodotIOJavaWrapper *get_godot_io_java(); - virtual bool request_permission(const String &p_name); - virtual bool request_permissions(); - virtual Vector<String> get_granted_permissions() const; + virtual bool request_permission(const String &p_name) override; + virtual bool request_permissions() override; + virtual Vector<String> get_granted_permissions() const override; - virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false); + virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false) override; - virtual String get_name() const; - virtual MainLoop *get_main_loop() const; + virtual String get_name() const override; + virtual MainLoop *get_main_loop() const override; void main_loop_begin(); bool main_loop_iterate(); @@ -109,19 +109,19 @@ public: void set_native_window(ANativeWindow *p_native_window); ANativeWindow *get_native_window() const; - virtual Error shell_open(String p_uri); - virtual String get_user_data_dir() const; - virtual String get_resource_dir() const; - virtual String get_locale() const; - virtual String get_model_name() const; + virtual Error shell_open(String p_uri) override; + virtual String get_user_data_dir() const override; + virtual String get_resource_dir() const override; + virtual String get_locale() const override; + virtual String get_model_name() const override; - virtual String get_unique_id() const; + virtual String get_unique_id() const override; - virtual String get_system_dir(SystemDir p_dir) const; + virtual String get_system_dir(SystemDir p_dir) const override; - void vibrate_handheld(int p_duration_ms); + void vibrate_handheld(int p_duration_ms) override; - virtual bool _check_internal_feature_support(const String &p_feature); + virtual bool _check_internal_feature_support(const String &p_feature) override; OS_Android(GodotJavaWrapper *p_godot_java, GodotIOJavaWrapper *p_godot_io_java, bool p_use_apk_expansion); ~OS_Android(); }; diff --git a/platform/android/plugin/godot_plugin_config.h b/platform/android/plugin/godot_plugin_config.h index ecb9c0c7f5..26876b640f 100644 --- a/platform/android/plugin/godot_plugin_config.h +++ b/platform/android/plugin/godot_plugin_config.h @@ -101,7 +101,7 @@ struct PluginConfig { static inline String resolve_local_dependency_path(String plugin_config_dir, String dependency_path) { String absolute_path; - if (!dependency_path.empty()) { + if (!dependency_path.is_empty()) { if (dependency_path.is_abs_path()) { absolute_path = ProjectSettings::get_singleton()->globalize_path(dependency_path); } else { @@ -115,7 +115,7 @@ static inline String resolve_local_dependency_path(String plugin_config_dir, Str static inline PluginConfig resolve_prebuilt_plugin(PluginConfig prebuilt_plugin, String plugin_config_dir) { PluginConfig resolved = prebuilt_plugin; resolved.binary = resolved.binary_type == BINARY_TYPE_LOCAL ? resolve_local_dependency_path(plugin_config_dir, prebuilt_plugin.binary) : prebuilt_plugin.binary; - if (!prebuilt_plugin.local_dependencies.empty()) { + if (!prebuilt_plugin.local_dependencies.is_empty()) { resolved.local_dependencies.clear(); for (int i = 0; i < prebuilt_plugin.local_dependencies.size(); i++) { resolved.local_dependencies.push_back(resolve_local_dependency_path(plugin_config_dir, prebuilt_plugin.local_dependencies[i])); @@ -131,19 +131,19 @@ static inline Vector<PluginConfig> get_prebuilt_plugins(String plugins_base_dir) } static inline bool is_plugin_config_valid(PluginConfig plugin_config) { - bool valid_name = !plugin_config.name.empty(); + bool valid_name = !plugin_config.name.is_empty(); bool valid_binary_type = plugin_config.binary_type == BINARY_TYPE_LOCAL || plugin_config.binary_type == BINARY_TYPE_REMOTE; bool valid_binary = false; if (valid_binary_type) { - valid_binary = !plugin_config.binary.empty() && + valid_binary = !plugin_config.binary.is_empty() && (plugin_config.binary_type == BINARY_TYPE_REMOTE || FileAccess::exists(plugin_config.binary)); } bool valid_local_dependencies = true; - if (!plugin_config.local_dependencies.empty()) { + if (!plugin_config.local_dependencies.is_empty()) { for (int i = 0; i < plugin_config.local_dependencies.size(); i++) { if (!FileAccess::exists(plugin_config.local_dependencies[i])) { valid_local_dependencies = false; @@ -182,7 +182,7 @@ static inline PluginConfig load_plugin_config(Ref<ConfigFile> config_file, const if (config_file->has_section(DEPENDENCIES_SECTION)) { Vector<String> local_dependencies_paths = config_file->get_value(DEPENDENCIES_SECTION, DEPENDENCIES_LOCAL_KEY, Vector<String>()); - if (!local_dependencies_paths.empty()) { + if (!local_dependencies_paths.is_empty()) { for (int i = 0; i < local_dependencies_paths.size(); i++) { plugin_config.local_dependencies.push_back(resolve_local_dependency_path(config_base_dir, local_dependencies_paths[i])); } @@ -202,7 +202,7 @@ static inline PluginConfig load_plugin_config(Ref<ConfigFile> config_file, const static inline String get_plugins_binaries(String binary_type, Vector<PluginConfig> plugins_configs) { String plugins_binaries; - if (!plugins_configs.empty()) { + if (!plugins_configs.is_empty()) { Vector<String> binaries; for (int i = 0; i < plugins_configs.size(); i++) { PluginConfig config = plugins_configs[i]; @@ -231,7 +231,7 @@ static inline String get_plugins_binaries(String binary_type, Vector<PluginConfi static inline String get_plugins_custom_maven_repos(Vector<PluginConfig> plugins_configs) { String custom_maven_repos; - if (!plugins_configs.empty()) { + if (!plugins_configs.is_empty()) { Vector<String> repos_urls; for (int i = 0; i < plugins_configs.size(); i++) { PluginConfig config = plugins_configs[i]; @@ -249,7 +249,7 @@ static inline String get_plugins_custom_maven_repos(Vector<PluginConfig> plugins static inline String get_plugins_names(Vector<PluginConfig> plugins_configs) { String plugins_names; - if (!plugins_configs.empty()) { + if (!plugins_configs.is_empty()) { Vector<String> names; for (int i = 0; i < plugins_configs.size(); i++) { PluginConfig config = plugins_configs[i]; diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index 0456458326..ad4af9ba6a 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -12,7 +12,6 @@ def get_name(): def can_build(): - if sys.platform == "darwin" or ("OSXCROSS_IOS" in os.environ): return True @@ -41,14 +40,12 @@ def get_opts(): def get_flags(): - return [ ("tools", False), ] def configure(env): - ## Build type if env["target"].startswith("release"): diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 3406c75c35..7cd67bc0ad 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -218,7 +218,7 @@ public: da->list_dir_begin(); while (true) { String file = da->get_next(); - if (file.empty()) { + if (file.is_empty()) { break; } @@ -259,7 +259,7 @@ public: if (DirAccess::exists(plugins_dir)) { Vector<String> plugins_filenames = list_plugin_config_files(plugins_dir, true); - if (!plugins_filenames.empty()) { + if (!plugins_filenames.is_empty()) { Ref<ConfigFile> config_file = memnew(ConfigFile); for (int i = 0; i < plugins_filenames.size(); i++) { PluginConfig config = load_plugin_config(config_file, plugins_dir.plus_file(plugins_filenames[i])); @@ -815,7 +815,7 @@ Error EditorExportPlatformIOS::_export_loading_screen_file(const Ref<EditorExpor const String splash_path = ProjectSettings::get_singleton()->get("application/boot_splash/image"); - if (!splash_path.empty()) { + if (!splash_path.is_empty()) { splash.instance(); const Error err = splash->load(splash_path); if (err) { @@ -1430,7 +1430,7 @@ Error EditorExportPlatformIOS::_export_ios_plugins(const Ref<EditorExportPreset> String key = *K; String value = plugin.plist[key]; - if (key.empty() || value.empty()) { + if (key.is_empty() || value.is_empty()) { continue; } @@ -1457,7 +1457,7 @@ Error EditorExportPlatformIOS::_export_ios_plugins(const Ref<EditorExportPreset> String key = *K; String value = plist_values[key]; - if (key.empty() || value.empty()) { + if (key.is_empty() || value.is_empty()) { continue; } @@ -1930,7 +1930,7 @@ bool EditorExportPlatformIOS::can_export(const Ref<EditorExportPreset> &p_preset err += etc_error; } - if (!err.empty()) { + if (!err.is_empty()) { r_error = err; } diff --git a/platform/iphone/os_iphone.mm b/platform/iphone/os_iphone.mm index dac61f2d9d..7d95b493b0 100644 --- a/platform/iphone/os_iphone.mm +++ b/platform/iphone/os_iphone.mm @@ -149,7 +149,7 @@ void OSIPhone::set_main_loop(MainLoop *p_main_loop) { main_loop = p_main_loop; if (main_loop) { - main_loop->init(); + main_loop->initialize(); } } @@ -159,7 +159,7 @@ MainLoop *OSIPhone::get_main_loop() const { void OSIPhone::delete_main_loop() { if (main_loop) { - main_loop->finish(); + main_loop->finalize(); memdelete(main_loop); }; diff --git a/platform/iphone/plugin/godot_plugin_config.h b/platform/iphone/plugin/godot_plugin_config.h index 5323f94989..e536616994 100644 --- a/platform/iphone/plugin/godot_plugin_config.h +++ b/platform/iphone/plugin/godot_plugin_config.h @@ -97,7 +97,7 @@ struct PluginConfig { static inline String resolve_local_dependency_path(String plugin_config_dir, String dependency_path) { String absolute_path; - if (dependency_path.empty()) { + if (dependency_path.is_empty()) { return absolute_path; } @@ -114,7 +114,7 @@ static inline String resolve_local_dependency_path(String plugin_config_dir, Str static inline String resolve_system_dependency_path(String dependency_path) { String absolute_path; - if (dependency_path.empty()) { + if (dependency_path.is_empty()) { return absolute_path; } @@ -133,7 +133,7 @@ static inline Vector<String> resolve_local_dependencies(String plugin_config_dir for (int i = 0; i < p_paths.size(); i++) { String path = resolve_local_dependency_path(plugin_config_dir, p_paths[i]); - if (path.empty()) { + if (path.is_empty()) { continue; } @@ -149,7 +149,7 @@ static inline Vector<String> resolve_system_dependencies(Vector<String> p_paths) for (int i = 0; i < p_paths.size(); i++) { String path = resolve_system_dependency_path(p_paths[i]); - if (path.empty()) { + if (path.is_empty()) { continue; } @@ -160,10 +160,10 @@ static inline Vector<String> resolve_system_dependencies(Vector<String> p_paths) } static inline bool validate_plugin(PluginConfig &plugin_config) { - bool valid_name = !plugin_config.name.empty(); - bool valid_binary_name = !plugin_config.binary.empty(); - bool valid_initialize = !plugin_config.initialization_method.empty(); - bool valid_deinitialize = !plugin_config.deinitialization_method.empty(); + bool valid_name = !plugin_config.name.is_empty(); + bool valid_binary_name = !plugin_config.binary.is_empty(); + bool valid_initialize = !plugin_config.initialization_method.is_empty(); + bool valid_deinitialize = !plugin_config.deinitialization_method.is_empty(); bool fields_value = valid_name && valid_binary_name && valid_initialize && valid_deinitialize; @@ -247,7 +247,7 @@ static inline PluginConfig load_plugin_config(Ref<ConfigFile> config_file, const for (int i = 0; i < keys.size(); i++) { String value = config_file->get_value(PLIST_SECTION, keys[i], String()); - if (value.empty()) { + if (value.is_empty()) { continue; } diff --git a/platform/javascript/api/javascript_tools_editor_plugin.cpp b/platform/javascript/api/javascript_tools_editor_plugin.cpp index 8d781703ed..2096dacdd8 100644 --- a/platform/javascript/api/javascript_tools_editor_plugin.cpp +++ b/platform/javascript/api/javascript_tools_editor_plugin.cpp @@ -53,8 +53,7 @@ void JavaScriptToolsEditorPlugin::initialize() { } JavaScriptToolsEditorPlugin::JavaScriptToolsEditorPlugin(EditorNode *p_editor) { - Variant v; - add_tool_menu_item("Download Project Source", this, "_download_zip", v); + add_tool_menu_item("Download Project Source", callable_mp(this, &JavaScriptToolsEditorPlugin::_download_zip)); } void JavaScriptToolsEditorPlugin::_download_zip(Variant p_v) { @@ -73,10 +72,6 @@ void JavaScriptToolsEditorPlugin::_download_zip(Variant p_v) { godot_js_editor_download_file("/tmp/project.zip", "project.zip", "application/zip"); } -void JavaScriptToolsEditorPlugin::_bind_methods() { - ClassDB::bind_method("_download_zip", &JavaScriptToolsEditorPlugin::_download_zip); -} - void JavaScriptToolsEditorPlugin::_zip_file(String p_path, String p_base_path, zipFile p_zip) { FileAccess *f = FileAccess::open(p_path, FileAccess::READ); if (!f) { @@ -113,7 +108,7 @@ void JavaScriptToolsEditorPlugin::_zip_recursive(String p_path, String p_base_pa } dir->list_dir_begin(); String cur = dir->get_next(); - while (!cur.empty()) { + while (!cur.is_empty()) { String cs = p_path.plus_file(cur); if (cur == "." || cur == ".." || cur == ".import") { // Skip diff --git a/platform/javascript/api/javascript_tools_editor_plugin.h b/platform/javascript/api/javascript_tools_editor_plugin.h index cc09fa4cd3..df1197139c 100644 --- a/platform/javascript/api/javascript_tools_editor_plugin.h +++ b/platform/javascript/api/javascript_tools_editor_plugin.h @@ -41,10 +41,6 @@ class JavaScriptToolsEditorPlugin : public EditorPlugin { private: void _zip_file(String p_path, String p_base_path, zipFile p_zip); void _zip_recursive(String p_path, String p_base_path, zipFile p_zip); - -protected: - static void _bind_methods(); - void _download_zip(Variant p_v); public: diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 178088e234..d53c774e77 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -23,12 +23,12 @@ def get_opts(): return [ ("initial_memory", "Initial WASM memory (in MiB)", 16), - BoolVariable("use_assertions", "Use emscripten runtime assertions", False), + BoolVariable("use_assertions", "Use Emscripten runtime assertions", False), BoolVariable("use_thinlto", "Use ThinLTO", False), - BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False), - BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN)", False), - BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN)", False), - BoolVariable("use_safe_heap", "Use emscripten SAFE_HEAP sanitizer", False), + BoolVariable("use_ubsan", "Use Emscripten undefined behavior sanitizer (UBSAN)", False), + BoolVariable("use_asan", "Use Emscripten address sanitizer (ASAN)", False), + BoolVariable("use_lsan", "Use Emscripten leak sanitizer (LSAN)", False), + BoolVariable("use_safe_heap", "Use Emscripten SAFE_HEAP sanitizer", False), # eval() can be a security concern, so it can be disabled. BoolVariable("javascript_eval", "Enable JavaScript eval interface", True), BoolVariable("threads_enabled", "Enable WebAssembly Threads support (limited browser support)", False), @@ -50,9 +50,7 @@ def get_flags(): def configure(env): - try: - env["initial_memory"] = int(env["initial_memory"]) - except: + if not isinstance(env["initial_memory"], int): print("Initial memory must be a valid integer") sys.exit(255) diff --git a/platform/javascript/display_server_javascript.cpp b/platform/javascript/display_server_javascript.cpp index 92e13553fc..643530541d 100644 --- a/platform/javascript/display_server_javascript.cpp +++ b/platform/javascript/display_server_javascript.cpp @@ -93,7 +93,7 @@ EM_BOOL DisplayServerJavaScript::fullscreen_change_callback(int p_event_type, co DisplayServerJavaScript *display = get_singleton(); // Empty ID is canvas. String target_id = String::utf8(p_event->id); - if (target_id.empty() || target_id == String::utf8(display->canvas_id)) { + if (target_id.is_empty() || target_id == String::utf8(display->canvas_id)) { // This event property is the only reliable data on // browser fullscreen state. if (p_event->isFullscreen) { diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index f77bf6ab97..6ae49c2162 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -37,16 +37,13 @@ #include "platform/javascript/logo.gen.h" #include "platform/javascript/run_icon.gen.h" -#define EXPORT_TEMPLATE_WEBASSEMBLY_RELEASE "webassembly_release.zip" -#define EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG "webassembly_debug.zip" - class EditorHTTPServer : public Reference { private: Ref<TCP_Server> server; Ref<StreamPeerTCP> connection; - uint64_t time; + uint64_t time = 0; uint8_t req_buf[4096]; - int req_pos; + int req_pos = 0; void _clear_client() { connection = Ref<StreamPeerTCP>(); @@ -122,7 +119,7 @@ public: filepath = cache_path.plus_file(req[1].get_file()); // TODO dangerous? ctype = "application/wasm"; } - if (filepath.empty() || !FileAccess::exists(filepath)) { + if (filepath.is_empty() || !FileAccess::exists(filepath)) { String s = "HTTP/1.1 404 Not Found\r\n"; s += "Connection: Close\r\n"; s += "\r\n"; @@ -211,7 +208,12 @@ class EditorExportPlatformJavaScript : public EditorExportPlatform { Ref<ImageTexture> logo; Ref<ImageTexture> run_icon; Ref<ImageTexture> stop_icon; - int menu_options; + int menu_options = 0; + + Ref<EditorHTTPServer> server; + bool server_quit = false; + Mutex server_lock; + Thread *server_thread = nullptr; enum ExportMode { EXPORT_MODE_NORMAL = 0, @@ -241,12 +243,6 @@ class EditorExportPlatformJavaScript : public EditorExportPlatform { void _fix_html(Vector<uint8_t> &p_html, const Ref<EditorExportPreset> &p_preset, const String &p_name, bool p_debug, int p_flags, const Vector<SharedObject> p_shared_objects); -private: - Ref<EditorHTTPServer> server; - bool server_quit; - Mutex server_lock; - Thread *server_thread; - static void _server_thread_poll(void *data); public: @@ -398,7 +394,7 @@ bool EditorExportPlatformJavaScript::can_export(const Ref<EditorExportPreset> &p } } - if (!err.empty()) { + if (!err.is_empty()) { r_error = err; } @@ -489,7 +485,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese //write if (file == "godot.html") { - if (!custom_html.empty()) { + if (!custom_html.is_empty()) { continue; } _fix_html(data, p_preset, p_path.get_file().get_basename(), p_debug, p_flags, shared_objects); @@ -524,7 +520,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese } while (unzGoToNextFile(pkg) == UNZ_OK); unzClose(pkg); - if (!custom_html.empty()) { + if (!custom_html.is_empty()) { FileAccess *f = FileAccess::open(custom_html, FileAccess::READ); if (!f) { EditorNode::get_singleton()->show_warning(TTR("Could not read custom HTML shell:") + "\n" + custom_html); @@ -547,7 +543,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese Ref<Image> splash; const String splash_path = String(GLOBAL_GET("application/boot_splash/image")).strip_edges(); - if (!splash_path.empty()) { + if (!splash_path.is_empty()) { splash.instance(); const Error err = splash->load(splash_path); if (err) { @@ -568,7 +564,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese // This way, the favicon can be displayed immediately when loading the page. Ref<Image> favicon; const String favicon_path = String(GLOBAL_GET("application/config/icon")).strip_edges(); - if (!favicon_path.empty()) { + if (!favicon_path.is_empty()) { favicon.instance(); const Error err = favicon->load(favicon_path); if (err) { @@ -685,7 +681,6 @@ void EditorExportPlatformJavaScript::_server_thread_poll(void *data) { EditorExportPlatformJavaScript::EditorExportPlatformJavaScript() { server.instance(); - server_quit = false; server_thread = Thread::create(_server_thread_poll, this); Ref<Image> img = memnew(Image(_javascript_logo)); @@ -702,8 +697,6 @@ EditorExportPlatformJavaScript::EditorExportPlatformJavaScript() { } else { stop_icon.instance(); } - - menu_options = 0; } EditorExportPlatformJavaScript::~EditorExportPlatformJavaScript() { diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp index cb0e48b8a9..b81de88fbf 100644 --- a/platform/javascript/http_client_javascript.cpp +++ b/platform/javascript/http_client_javascript.cpp @@ -78,15 +78,15 @@ Error HTTPClient::prepare_request(Method p_method, const String &p_url, const Ve ERR_FAIL_INDEX_V(p_method, METHOD_MAX, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V_MSG(p_method == METHOD_TRACE || p_method == METHOD_CONNECT, ERR_UNAVAILABLE, "HTTP methods TRACE and CONNECT are not supported for the HTML5 platform."); ERR_FAIL_COND_V(status != STATUS_CONNECTED, ERR_INVALID_PARAMETER); - ERR_FAIL_COND_V(host.empty(), ERR_UNCONFIGURED); + ERR_FAIL_COND_V(host.is_empty(), ERR_UNCONFIGURED); ERR_FAIL_COND_V(port < 0, ERR_UNCONFIGURED); ERR_FAIL_COND_V(!p_url.begins_with("/"), ERR_INVALID_PARAMETER); String url = (use_tls ? "https://" : "http://") + host + ":" + itos(port) + p_url; godot_xhr_reset(xhr_id); godot_xhr_open(xhr_id, _methods[p_method], url.utf8().get_data(), - username.empty() ? nullptr : username.utf8().get_data(), - password.empty() ? nullptr : password.utf8().get_data()); + username.is_empty() ? nullptr : username.utf8().get_data(), + password.is_empty() ? nullptr : password.utf8().get_data()); for (int i = 0; i < p_headers.size(); i++) { int header_separator = p_headers[i].find(": "); @@ -132,7 +132,7 @@ HTTPClient::Status HTTPClient::get_status() const { } bool HTTPClient::has_response() const { - return !polled_response_header.empty(); + return !polled_response_header.is_empty(); } bool HTTPClient::is_response_chunked() const { @@ -145,7 +145,7 @@ int HTTPClient::get_response_code() const { } Error HTTPClient::get_response_headers(List<String> *r_response) { - if (polled_response_header.empty()) + if (polled_response_header.is_empty()) return ERR_INVALID_PARAMETER; Vector<String> header_lines = polled_response_header.split("\r\n", false); diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index 277aafc107..a819731328 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -12,7 +12,6 @@ def get_name(): def can_build(): - if os.name != "posix" or sys.platform == "darwin": return False @@ -81,12 +80,10 @@ def get_opts(): def get_flags(): - return [] def configure(env): - ## Build type if env["target"] == "release": diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index 136bee68e3..9669de5ed6 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -95,6 +95,15 @@ static const double abs_resolution_mult = 10000.0; static const double abs_resolution_range_mult = 10.0; +// Hints for X11 fullscreen +struct Hints { + unsigned long flags = 0; + unsigned long functions = 0; + unsigned long decorations = 0; + long inputMode = 0; + unsigned long status = 0; +}; + bool DisplayServerX11::has_feature(Feature p_feature) const { switch (p_feature) { case FEATURE_SUBWINDOWS: @@ -613,7 +622,7 @@ String DisplayServerX11::_clipboard_get(Atom p_source, Window x11_window) const if (utf8_atom != None) { ret = _clipboard_get_impl(p_source, x11_window, utf8_atom); } - if (ret.empty()) { + if (ret.is_empty()) { ret = _clipboard_get_impl(p_source, x11_window, XA_STRING); } return ret; @@ -625,7 +634,7 @@ String DisplayServerX11::clipboard_get() const { String ret; ret = _clipboard_get(XInternAtom(x11_display, "CLIPBOARD", 0), windows[MAIN_WINDOW_ID].x11_window); - if (ret.empty()) { + if (ret.is_empty()) { ret = _clipboard_get(XA_PRIMARY, windows[MAIN_WINDOW_ID].x11_window); } diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h index 0507ef3fff..6f437f3be9 100644 --- a/platform/linuxbsd/display_server_x11.h +++ b/platform/linuxbsd/display_server_x11.h @@ -61,15 +61,6 @@ #include <X11/extensions/Xrandr.h> #include <X11/keysym.h> -// Hints for X11 fullscreen -typedef struct { - unsigned long flags = 0; - unsigned long functions = 0; - unsigned long decorations = 0; - long inputMode = 0; - unsigned long status = 0; -} Hints; - typedef struct _xrr_monitor_info { Atom name; Bool primary = false; diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index ac88d457a7..4bc3c9421e 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -65,9 +65,9 @@ void OS_LinuxBSD::initialize_joypads() { String OS_LinuxBSD::get_unique_id() const { static String machine_id; - if (machine_id.empty()) { + if (machine_id.is_empty()) { if (FileAccess *f = FileAccess::open("/etc/machine-id", FileAccess::READ)) { - while (machine_id.empty() && !f->eof_reached()) { + while (machine_id.is_empty() && !f->eof_reached()) { machine_id = f->get_line().strip_edges(); } f->close(); @@ -246,7 +246,7 @@ void OS_LinuxBSD::run() { return; } - main_loop->init(); + main_loop->initialize(); //uint64_t last_ticks=get_ticks_usec(); @@ -263,7 +263,7 @@ void OS_LinuxBSD::run() { } }; - main_loop->finish(); + main_loop->finalize(); } void OS_LinuxBSD::disable_crash_handler() { diff --git a/platform/linuxbsd/os_linuxbsd.h b/platform/linuxbsd/os_linuxbsd.h index 6e93bf6ef2..89d0bcd0f2 100644 --- a/platform/linuxbsd/os_linuxbsd.h +++ b/platform/linuxbsd/os_linuxbsd.h @@ -43,7 +43,7 @@ #include "servers/rendering_server.h" class OS_LinuxBSD : public OS_Unix { - virtual void delete_main_loop(); + virtual void delete_main_loop() override; bool force_quit; @@ -68,36 +68,36 @@ class OS_LinuxBSD : public OS_Unix { MainLoop *main_loop; protected: - virtual void initialize(); - virtual void finalize(); + virtual void initialize() override; + virtual void finalize() override; - virtual void initialize_joypads(); + virtual void initialize_joypads() override; - virtual void set_main_loop(MainLoop *p_main_loop); + virtual void set_main_loop(MainLoop *p_main_loop) override; public: - virtual String get_name() const; + virtual String get_name() const override; - virtual MainLoop *get_main_loop() const; + virtual MainLoop *get_main_loop() const override; - virtual String get_config_path() const; - virtual String get_data_path() const; - virtual String get_cache_path() const; + virtual String get_config_path() const override; + virtual String get_data_path() const override; + virtual String get_cache_path() const override; - virtual String get_system_dir(SystemDir p_dir) const; + virtual String get_system_dir(SystemDir p_dir) const override; - virtual Error shell_open(String p_uri); + virtual Error shell_open(String p_uri) override; - virtual String get_unique_id() const; + virtual String get_unique_id() const override; - virtual bool _check_internal_feature_support(const String &p_feature); + virtual bool _check_internal_feature_support(const String &p_feature) override; void run(); - void disable_crash_handler(); - bool is_disable_crash_handler() const; + virtual void disable_crash_handler() override; + virtual bool is_disable_crash_handler() const override; - virtual Error move_to_trash(const String &p_path); + virtual Error move_to_trash(const String &p_path) override; OS_LinuxBSD(); }; diff --git a/platform/osx/detect.py b/platform/osx/detect.py index ea41479bb0..466f68d269 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -12,7 +12,6 @@ def get_name(): def can_build(): - if sys.platform == "darwin" or ("OSXCROSS_ROOT" in os.environ): return True @@ -31,6 +30,7 @@ def get_opts(): " validation layers)", False, ), + EnumVariable("macports_clang", "Build using Clang from MacPorts", "no", ("no", "5.0", "devel")), EnumVariable("debug_symbols", "Add debugging symbols to release/release_debug builds", "yes", ("yes", "no")), BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False), BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False), @@ -40,12 +40,10 @@ def get_opts(): def get_flags(): - return [] def configure(env): - ## Build type if env["target"] == "release": diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index c4c2426f1f..8d82119ae2 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -751,28 +751,32 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; ERR_FAIL_COND_V(!DS_OSX->windows.has(window_id), NO); DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; - NSPasteboard *pboard = [sender draggingPasteboard]; -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 - NSArray<NSURL *> *filenames = [pboard propertyListForType:NSPasteboardTypeFileURL]; -#else - NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType]; -#endif + if (!wd.drop_files_callback.is_null()) { + Vector<String> files; + NSPasteboard *pboard = [sender draggingPasteboard]; - Vector<String> files; - for (NSUInteger i = 0; i < filenames.count; i++) { #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 - NSString *ns = [[filenames objectAtIndex:i] path]; + NSArray *items = pboard.pasteboardItems; + for (NSPasteboardItem *item in items) { + NSString *path = [item stringForType:NSPasteboardTypeFileURL]; + NSString *ns = [NSURL URLWithString:path].path; + char *utfs = strdup([ns UTF8String]); + String ret; + ret.parse_utf8(utfs); + free(utfs); + files.push_back(ret); + } #else - NSString *ns = [filenames objectAtIndex:i]; + NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType]; + for (NSString *ns in filenames) { + char *utfs = strdup([ns UTF8String]); + String ret; + ret.parse_utf8(utfs); + free(utfs); + files.push_back(ret); + } #endif - char *utfs = strdup([ns UTF8String]); - String ret; - ret.parse_utf8(utfs); - free(utfs); - files.push_back(ret); - } - if (!wd.drop_files_callback.is_null()) { Variant v = files; Variant *vp = &v; Variant ret; diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index eecd2ed641..57ad6dc688 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -457,7 +457,7 @@ Error EditorExportPlatformOSX::_code_sign(const Ref<EditorExportPreset> &p_prese PackedStringArray user_args = p_preset->get("codesign/custom_options"); for (int i = 0; i < user_args.size(); i++) { String user_arg = user_args[i].strip_edges(); - if (!user_arg.empty()) { + if (!user_arg.is_empty()) { args.push_back(user_arg); } } @@ -665,7 +665,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p Ref<Image> icon; icon.instance(); icon->load(iconpath); - if (!icon->empty()) { + if (!icon->is_empty()) { _make_icon(icon, data); } } @@ -927,7 +927,7 @@ bool EditorExportPlatformOSX::can_export(const Ref<EditorExportPreset> &p_preset } } - if (!err.empty()) { + if (!err.is_empty()) { r_error = err; } return valid; diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 5a9e43450f..f6eee31a6a 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -40,7 +40,7 @@ #include "servers/audio_server.h" class OS_OSX : public OS_Unix { - virtual void delete_main_loop(); + virtual void delete_main_loop() override; bool force_quit; @@ -61,45 +61,45 @@ public: String open_with_filename; protected: - virtual void initialize_core(); - virtual void initialize(); - virtual void finalize(); + virtual void initialize_core() override; + virtual void initialize() override; + virtual void finalize() override; - virtual void initialize_joypads(); + virtual void initialize_joypads() override; - virtual void set_main_loop(MainLoop *p_main_loop); + virtual void set_main_loop(MainLoop *p_main_loop) override; public: - virtual String get_name() const; + virtual String get_name() const override; - virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false); + virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false) override; - virtual MainLoop *get_main_loop() const; + virtual MainLoop *get_main_loop() const override; - virtual String get_config_path() const; - virtual String get_data_path() const; - virtual String get_cache_path() const; - virtual String get_bundle_resource_dir() const; - virtual String get_godot_dir_name() const; + virtual String get_config_path() const override; + virtual String get_data_path() const override; + virtual String get_cache_path() const override; + virtual String get_bundle_resource_dir() const override; + virtual String get_godot_dir_name() const override; - virtual String get_system_dir(SystemDir p_dir) const; + virtual String get_system_dir(SystemDir p_dir) const override; - Error shell_open(String p_uri); + Error shell_open(String p_uri) override; - String get_locale() const; + String get_locale() const override; - virtual String get_executable_path() const; + virtual String get_executable_path() const override; - virtual String get_unique_id() const; //++ + virtual String get_unique_id() const override; //++ - virtual bool _check_internal_feature_support(const String &p_feature); + virtual bool _check_internal_feature_support(const String &p_feature) override; void run(); - void disable_crash_handler(); - bool is_disable_crash_handler() const; + virtual void disable_crash_handler() override; + virtual bool is_disable_crash_handler() const override; - virtual Error move_to_trash(const String &p_path); + virtual Error move_to_trash(const String &p_path) override; OS_OSX(); }; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index ed03e953a5..c3e362bbe8 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -99,7 +99,7 @@ public: String OS_OSX::get_unique_id() const { static String serial_number; - if (serial_number.empty()) { + if (serial_number.is_empty()) { io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); CFStringRef serialNumberAsCFString = NULL; if (platformExpert) { @@ -312,7 +312,7 @@ void OS_OSX::run() { if (!main_loop) return; - main_loop->init(); + main_loop->initialize(); bool quit = false; while (!force_quit && !quit) { @@ -329,7 +329,7 @@ void OS_OSX::run() { ERR_PRINT("NSException: " + String([exception reason].UTF8String)); } }; - main_loop->finish(); + main_loop->finalize(); } Error OS_OSX::move_to_trash(const String &p_path) { diff --git a/platform/server/detect.py b/platform/server/detect.py index bf4744a234..db503584d3 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -21,7 +21,6 @@ def get_program_suffix(): def can_build(): - if os.name != "posix": return False @@ -46,7 +45,6 @@ def get_opts(): def get_flags(): - return [] diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp index f8b420b1c8..77cf15c489 100644 --- a/platform/server/os_server.cpp +++ b/platform/server/os_server.cpp @@ -150,10 +150,6 @@ void OS_Server::set_main_loop(MainLoop *p_main_loop) { input->set_main_loop(p_main_loop); } -bool OS_Server::can_draw() const { - return false; //can never draw -}; - String OS_Server::get_name() const { return "Server"; } diff --git a/platform/server/os_server.h b/platform/server/os_server.h index 95b6b5143b..b707549b17 100644 --- a/platform/server/os_server.h +++ b/platform/server/os_server.h @@ -89,8 +89,6 @@ public: virtual MainLoop *get_main_loop() const; - virtual bool can_draw() const; - virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0); virtual VideoMode get_video_mode(int p_screen = 0) const; virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const; diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py index 2af7803749..fda8fdec66 100644 --- a/platform/uwp/detect.py +++ b/platform/uwp/detect.py @@ -30,7 +30,6 @@ def get_opts(): def get_flags(): - return [ ("tools", False), ("xaudio2", True), @@ -39,7 +38,6 @@ def get_flags(): def configure(env): - env.msvc = True if env["bits"] != "default": diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index 00b57c48f3..344521baf1 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -641,7 +641,7 @@ class EditorExportPlatformUWP : public EditorExportPlatform { }; bool _valid_resource_name(const String &p_name) const { - if (p_name.empty()) { + if (p_name.is_empty()) { return false; } if (p_name.ends_with(".")) { @@ -687,7 +687,7 @@ class EditorExportPlatformUWP : public EditorExportPlatform { } bool _valid_bgcolor(const String &p_color) const { - if (p_color.empty()) { + if (p_color.is_empty()) { return true; } if (p_color.begins_with("#") && p_color.is_valid_html_color()) { @@ -763,7 +763,7 @@ class EditorExportPlatformUWP : public EditorExportPlatform { String architecture = arch == ARM ? "arm" : arch == X86 ? "x86" : "x64"; result = result.replace("$architecture$", architecture); - result = result.replace("$display_name$", String(p_preset->get("package/display_name")).empty() ? (String)ProjectSettings::get_singleton()->get("application/config/name") : String(p_preset->get("package/display_name"))); + result = result.replace("$display_name$", String(p_preset->get("package/display_name")).is_empty() ? (String)ProjectSettings::get_singleton()->get("application/config/name") : String(p_preset->get("package/display_name"))); result = result.replace("$publisher_display_name$", p_preset->get("package/publisher_display_name")); result = result.replace("$app_description$", p_preset->get("package/description")); @@ -782,7 +782,7 @@ class EditorExportPlatformUWP : public EditorExportPlatform { } String show_name_on_tiles = ""; - if (!name_on_tiles.empty()) { + if (!name_on_tiles.is_empty()) { show_name_on_tiles = "<uap:ShowNameOnTiles>\n" + name_on_tiles + " </uap:ShowNameOnTiles>"; } @@ -803,7 +803,7 @@ class EditorExportPlatformUWP : public EditorExportPlatform { } String rotation_preference = ""; - if (!rotations.empty()) { + if (!rotations.is_empty()) { rotation_preference = "<uap:InitialRotationPreference>\n" + rotations + " </uap:InitialRotationPreference>"; } @@ -837,7 +837,7 @@ class EditorExportPlatformUWP : public EditorExportPlatform { } String capabilities_string = "<Capabilities />"; - if (!capabilities_elements.empty()) { + if (!capabilities_elements.is_empty()) { capabilities_string = "<Capabilities>\n" + capabilities_elements + " </Capabilities>"; } diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 780eba8407..693d8a69f1 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -156,10 +156,6 @@ void OS_UWP::initialize_core() { cursor_shape = CURSOR_ARROW; } -bool OS_UWP::can_draw() const { - return !minimized; -}; - void OS_UWP::set_window(Windows::UI::Core::CoreWindow ^ p_window) { window = p_window; } diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index fd25cefe2b..bf3c31f867 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -194,7 +194,6 @@ public: virtual TimeZoneInfo get_time_zone_info() const; virtual uint64_t get_unix_time() const; - virtual bool can_draw() const; virtual Error set_cwd(const String &p_cwd); virtual void delay_usec(uint32_t p_usec) const; diff --git a/platform/windows/detect.py b/platform/windows/detect.py index ee13e3c774..5216fca2ca 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -68,7 +68,7 @@ def get_opts(): EnumVariable("windows_subsystem", "Windows subsystem", "default", ("default", "console", "gui")), BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False), ("msvc_version", "MSVC version to use. Ignored if VCINSTALLDIR is set in shell env.", None), - BoolVariable("use_mingw", "Use the Mingw compiler, even if MSVC is installed. Only used on Windows.", False), + BoolVariable("use_mingw", "Use the Mingw compiler, even if MSVC is installed.", False), BoolVariable("use_llvm", "Use the LLVM compiler", False), BoolVariable("use_thinlto", "Use ThinLTO", False), BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True), @@ -76,12 +76,10 @@ def get_opts(): def get_flags(): - return [] def build_res_file(target, source, env): - if env["bits"] == "32": cmdbase = env["mingw_prefix_32"] else: @@ -95,7 +93,7 @@ def build_res_file(target, source, env): out = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE).communicate() if len(out[1]): return 1 - except: + except Exception: return 1 return 0 diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 62fcd20f61..ee96441c6c 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -903,6 +903,9 @@ void DisplayServerWindows::_get_window_style(bool p_main_window, bool p_fullscre r_style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU; } } + if (!p_borderless) { + r_style |= WS_VISIBLE; + } if (p_no_activate_focus) { r_style_ex |= WS_EX_TOPMOST | WS_EX_NOACTIVATE; @@ -910,7 +913,7 @@ void DisplayServerWindows::_get_window_style(bool p_main_window, bool p_fullscre r_style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS; } -void DisplayServerWindows::_update_window_style(WindowID p_window, bool p_repaint, bool p_maximized) { +void DisplayServerWindows::_update_window_style(WindowID p_window, bool p_repaint) { _THREAD_SAFE_METHOD_ ERR_FAIL_COND(!windows.has(p_window)); @@ -943,6 +946,7 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window) RECT rect; wd.fullscreen = false; + wd.maximized = wd.was_maximized; if (wd.pre_fs_valid) { rect = wd.pre_fs_rect; @@ -951,13 +955,16 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window) rect.right = wd.width; rect.top = 0; rect.bottom = wd.height; + wd.pre_fs_valid = true; } - _update_window_style(p_window, false, wd.was_maximized); + _update_window_style(p_window, false); MoveWindow(wd.hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); - - wd.pre_fs_valid = true; + } else if (p_mode == WINDOW_MODE_WINDOWED) { + ShowWindow(wd.hWnd, SW_RESTORE); + wd.maximized = false; + wd.minimized = false; } if (p_mode == WINDOW_MODE_MAXIMIZED) { @@ -966,12 +973,6 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window) wd.minimized = false; } - if (p_mode == WINDOW_MODE_WINDOWED) { - ShowWindow(wd.hWnd, SW_RESTORE); - wd.maximized = false; - wd.minimized = false; - } - if (p_mode == WINDOW_MODE_MINIMIZED) { ShowWindow(wd.hWnd, SW_MINIMIZE); wd.maximized = false; @@ -2956,7 +2957,7 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode, Rect2i r; r.position = screen_get_position(i); r.size = screen_get_size(i); - Rect2 inters = r.clip(p_rect); + Rect2 inters = r.intersection(p_rect); int area = inters.size.width * inters.size.height; if (area >= nearest_area) { screen_rect = r; @@ -2992,6 +2993,9 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode, windows.erase(id); return INVALID_WINDOW_ID; } + if (p_mode != WINDOW_MODE_FULLSCREEN) { + wd.pre_fs_valid = true; + } #ifdef VULKAN_ENABLED if (rendering_driver == "vulkan") { diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h index 684746919a..4038fb0dad 100644 --- a/platform/windows/display_server_windows.h +++ b/platform/windows/display_server_windows.h @@ -417,7 +417,7 @@ private: void _drag_event(WindowID p_window, float p_x, float p_y, int idx); void _touch_event(WindowID p_window, bool p_pressed, float p_x, float p_y, int idx); - void _update_window_style(WindowID p_window, bool p_repaint = true, bool p_maximized = false); + void _update_window_style(WindowID p_window, bool p_repaint = true); void _update_window_mouse_passthrough(WindowID p_window); void _update_real_mouse_position(WindowID p_window); diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp index c2436e8b64..58c814b1c4 100644 --- a/platform/windows/export/export.cpp +++ b/platform/windows/export/export.cpp @@ -299,7 +299,7 @@ Error EditorExportPlatformWindows::_code_sign(const Ref<EditorExportPreset> &p_p PackedStringArray user_args = p_preset->get("codesign/custom_options"); for (int i = 0; i < user_args.size(); i++) { String user_arg = user_args[i].strip_edges(); - if (!user_arg.empty()) { + if (!user_arg.is_empty()) { args.push_back(user_arg); } } diff --git a/platform/windows/godot.natvis b/platform/windows/godot.natvis index 1f625cfb77..d85dfbc3d3 100644 --- a/platform/windows/godot.natvis +++ b/platform/windows/godot.natvis @@ -10,16 +10,6 @@ </Expand> </Type> - <Type Name="PoolVector<*>"> - <Expand> - <Item Name="[size]">alloc ? (alloc->size / sizeof($T1)) : 0</Item> - <ArrayItems> - <Size>alloc ? (alloc->size / sizeof($T1)) : 0</Size> - <ValuePointer>alloc ? (($T1 *)alloc->mem) : 0</ValuePointer> - </ArrayItems> - </Expand> - </Type> - <Type Name="List<*>"> <Expand> <Item Name="[size]">_data ? (_data->size_cache) : 0</Item> @@ -36,7 +26,7 @@ <DisplayString Condition="type == Variant::NIL">nil</DisplayString> <DisplayString Condition="type == Variant::BOOL">{_data._bool}</DisplayString> <DisplayString Condition="type == Variant::INT">{_data._int}</DisplayString> - <DisplayString Condition="type == Variant::REAL">{_data._real}</DisplayString> + <DisplayString Condition="type == Variant::FLOAT">{_data._float}</DisplayString> <DisplayString Condition="type == Variant::TRANSFORM2D">{_data._transform2d}</DisplayString> <DisplayString Condition="type == Variant::AABB">{_data._aabb}</DisplayString> <DisplayString Condition="type == Variant::BASIS">{_data._basis}</DisplayString> @@ -49,24 +39,26 @@ <DisplayString Condition="type == Variant::QUAT">{*(Quat *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::COLOR">{*(Color *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::NODE_PATH">{*(NodePath *)_data._mem}</DisplayString> - <DisplayString Condition="type == Variant::RID">{*(RID *)_data._mem}</DisplayString> + <DisplayString Condition="type == Variant::RID">{*(::RID *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::OBJECT">{*(Object *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::DICTIONARY">{*(Dictionary *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::ARRAY">{*(Array *)_data._mem}</DisplayString> - <DisplayString Condition="type == Variant::POOL_BYTE_ARRAY">{*(PoolByteArray *)_data._mem}</DisplayString> - <DisplayString Condition="type == Variant::POOL_INT_ARRAY">{*(PoolIntArray *)_data._mem}</DisplayString> - <DisplayString Condition="type == Variant::POOL_REAL_ARRAY">{*(PoolRealArray *)_data._mem}</DisplayString> - <DisplayString Condition="type == Variant::POOL_STRING_ARRAY">{*(PoolStringArray *)_data._mem}</DisplayString> - <DisplayString Condition="type == Variant::POOL_VECTOR2_ARRAY">{*(PoolVector2Array *)_data._mem}</DisplayString> - <DisplayString Condition="type == Variant::POOL_VECTOR3_ARRAY">{*(PoolVector3Array *)_data._mem}</DisplayString> - <DisplayString Condition="type == Variant::POOL_COLOR_ARRAY">{*(PoolColorArray *)_data._mem}</DisplayString> + <DisplayString Condition="type == Variant::PACKED_BYTE_ARRAY">{*(PackedByteArray *)_data._mem}</DisplayString> + <DisplayString Condition="type == Variant::PACKED_INT32_ARRAY">{*(PackedInt32Array *)_data._mem}</DisplayString> + <DisplayString Condition="type == Variant::PACKED_INT64_ARRAY">{*(PackedInt64Array *)_data._mem}</DisplayString> + <DisplayString Condition="type == Variant::PACKED_FLOAT32_ARRAY">{*(PackedFloat32Array *)_data._mem}</DisplayString> + <DisplayString Condition="type == Variant::PACKED_FLOAT64_ARRAY">{*(PackedFloat64Array *)_data._mem}</DisplayString> + <DisplayString Condition="type == Variant::PACKED_STRING_ARRAY">{*(PackedStringArray *)_data._mem}</DisplayString> + <DisplayString Condition="type == Variant::PACKED_VECTOR2_ARRAY">{*(PackedVector2Array *)_data._mem}</DisplayString> + <DisplayString Condition="type == Variant::PACKED_VECTOR3_ARRAY">{*(PackedVector3Array *)_data._mem}</DisplayString> + <DisplayString Condition="type == Variant::PACKED_COLOR_ARRAY">{*(PackedColorArray *)_data._mem}</DisplayString> - <StringView Condition="type == Variant::STRING && ((String *)(_data._mem))->_cowdata._ptr">((String *)(_data._mem))->_cowdata._ptr,su</StringView> + <StringView Condition="type == Variant::STRING && ((String *)(_data._mem))->_cowdata._ptr">((String *)(_data._mem))->_cowdata._ptr,s32</StringView> <Expand> <Item Name="[value]" Condition="type == Variant::BOOL">_data._bool</Item> <Item Name="[value]" Condition="type == Variant::INT">_data._int</Item> - <Item Name="[value]" Condition="type == Variant::REAL">_data._real</Item> + <Item Name="[value]" Condition="type == Variant::FLOAT">_data._float</Item> <Item Name="[value]" Condition="type == Variant::TRANSFORM2D">_data._transform2d</Item> <Item Name="[value]" Condition="type == Variant::AABB">_data._aabb</Item> <Item Name="[value]" Condition="type == Variant::BASIS">_data._basis</Item> @@ -79,32 +71,34 @@ <Item Name="[value]" Condition="type == Variant::QUAT">*(Quat *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::COLOR">*(Color *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::NODE_PATH">*(NodePath *)_data._mem</Item> - <Item Name="[value]" Condition="type == Variant::RID">*(RID *)_data._mem</Item> + <Item Name="[value]" Condition="type == Variant::RID">*(::RID *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::OBJECT">*(Object *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::DICTIONARY">*(Dictionary *)_data._mem</Item> <Item Name="[value]" Condition="type == Variant::ARRAY">*(Array *)_data._mem</Item> - <Item Name="[value]" Condition="type == Variant::POOL_BYTE_ARRAY">*(PoolByteArray *)_data._mem</Item> - <Item Name="[value]" Condition="type == Variant::POOL_INT_ARRAY">*(PoolIntArray *)_data._mem</Item> - <Item Name="[value]" Condition="type == Variant::POOL_REAL_ARRAY">*(PoolRealArray *)_data._mem</Item> - <Item Name="[value]" Condition="type == Variant::POOL_STRING_ARRAY">*(PoolStringArray *)_data._mem</Item> - <Item Name="[value]" Condition="type == Variant::POOL_VECTOR2_ARRAY">*(PoolVector2Array *)_data._mem</Item> - <Item Name="[value]" Condition="type == Variant::POOL_VECTOR3_ARRAY">*(PoolVector3Array *)_data._mem</Item> - <Item Name="[value]" Condition="type == Variant::POOL_COLOR_ARRAY">*(PoolColorArray *)_data._mem</Item> + <Item Name="[value]" Condition="type == Variant::PACKED_BYTE_ARRAY">*(PackedByteArray *)_data._mem</Item> + <Item Name="[value]" Condition="type == Variant::PACKED_INT32_ARRAY">*(PackedInt32Array *)_data._mem</Item> + <Item Name="[value]" Condition="type == Variant::PACKED_INT64_ARRAY">*(PackedInt64Array *)_data._mem</Item> + <Item Name="[value]" Condition="type == Variant::PACKED_FLOAT32_ARRAY">*(PackedFloat32Array *)_data._mem</Item> + <Item Name="[value]" Condition="type == Variant::PACKED_FLOAT64_ARRAY">*(PackedFloat64Array *)_data._mem</Item> + <Item Name="[value]" Condition="type == Variant::PACKED_STRING_ARRAY">*(PackedStringArray *)_data._mem</Item> + <Item Name="[value]" Condition="type == Variant::PACKED_VECTOR2_ARRAY">*(PackedVector2Array *)_data._mem</Item> + <Item Name="[value]" Condition="type == Variant::PACKED_VECTOR3_ARRAY">*(PackedVector3Array *)_data._mem</Item> + <Item Name="[value]" Condition="type == Variant::PACKED_COLOR_ARRAY">*(PackedColorArray *)_data._mem</Item> </Expand> </Type> <Type Name="String"> <DisplayString Condition="_cowdata._ptr == 0">[empty]</DisplayString> - <DisplayString Condition="_cowdata._ptr != 0">{_cowdata._ptr,su}</DisplayString> - <StringView Condition="_cowdata._ptr != 0">_cowdata._ptr,su</StringView> + <DisplayString Condition="_cowdata._ptr != 0">{_cowdata._ptr,s32}</DisplayString> + <StringView Condition="_cowdata._ptr != 0">_cowdata._ptr,s32</StringView> </Type> <Type Name="StringName"> <DisplayString Condition="_data && _data->cname">{_data->cname}</DisplayString> - <DisplayString Condition="_data && !_data->cname">{_data->name,su}</DisplayString> + <DisplayString Condition="_data && !_data->cname">{_data->name,s32}</DisplayString> <DisplayString Condition="!_data">[empty]</DisplayString> <StringView Condition="_data && _data->cname">_data->cname</StringView> - <StringView Condition="_data && !_data->cname">_data->name,su</StringView> + <StringView Condition="_data && !_data->cname">_data->name,s32</StringView> </Type> <Type Name="Vector2"> diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 451f3bf18c..bdc1f0973f 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -614,7 +614,7 @@ void OS_Windows::run() { if (!main_loop) return; - main_loop->init(); + main_loop->initialize(); while (!force_quit) { DisplayServer::get_singleton()->process_events(); // get rid of pending events @@ -622,7 +622,7 @@ void OS_Windows::run() { break; }; - main_loop->finish(); + main_loop->finalize(); } MainLoop *OS_Windows::get_main_loop() const { diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 5451e15d36..14d09d2b35 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -93,14 +93,14 @@ class OS_Windows : public OS { // functions used by main to initialize/deinitialize the OS protected: - virtual void initialize(); + virtual void initialize() override; - virtual void set_main_loop(MainLoop *p_main_loop); - virtual void delete_main_loop(); + virtual void set_main_loop(MainLoop *p_main_loop) override; + virtual void delete_main_loop() override; - virtual void finalize(); - virtual void finalize_core(); - virtual String get_stdin_string(bool p_block); + virtual void finalize() override; + virtual void finalize_core() override; + virtual String get_stdin_string(bool p_block) override; String _quote_command_line_argument(const String &p_text) const; @@ -111,66 +111,66 @@ protected: Map<ProcessID, ProcessInfo> *process_map; public: - virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false); - virtual Error close_dynamic_library(void *p_library_handle); - virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false); + virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false) override; + virtual Error close_dynamic_library(void *p_library_handle) override; + virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false) override; - virtual MainLoop *get_main_loop() const; + virtual MainLoop *get_main_loop() const override; - virtual String get_name() const; + virtual String get_name() const override; - virtual int get_tablet_driver_count() const; - virtual String get_tablet_driver_name(int p_driver) const; - virtual String get_current_tablet_driver() const; - virtual void set_current_tablet_driver(const String &p_driver); + virtual int get_tablet_driver_count() const override; + virtual String get_tablet_driver_name(int p_driver) const override; + virtual String get_current_tablet_driver() const override; + virtual void set_current_tablet_driver(const String &p_driver) override; - virtual void initialize_joypads() {} + virtual void initialize_joypads() override {} - virtual Date get_date(bool utc) const; - virtual Time get_time(bool utc) const; - virtual TimeZoneInfo get_time_zone_info() const; - virtual double get_unix_time() const; + virtual Date get_date(bool utc) const override; + virtual Time get_time(bool utc) const override; + virtual TimeZoneInfo get_time_zone_info() const override; + virtual double get_unix_time() const override; - virtual Error set_cwd(const String &p_cwd); + virtual Error set_cwd(const String &p_cwd) override; - virtual void delay_usec(uint32_t p_usec) const; - virtual uint64_t get_ticks_usec() const; + virtual void delay_usec(uint32_t p_usec) const override; + virtual uint64_t get_ticks_usec() const override; - virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = nullptr, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr); - virtual Error kill(const ProcessID &p_pid); - virtual int get_process_id() const; + virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = nullptr, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr) override; + virtual Error kill(const ProcessID &p_pid) override; + virtual int get_process_id() const override; - virtual bool has_environment(const String &p_var) const; - virtual String get_environment(const String &p_var) const; - virtual bool set_environment(const String &p_var, const String &p_value) const; + virtual bool has_environment(const String &p_var) const override; + virtual String get_environment(const String &p_var) const override; + virtual bool set_environment(const String &p_var, const String &p_value) const override; - virtual String get_executable_path() const; + virtual String get_executable_path() const override; - virtual String get_locale() const; + virtual String get_locale() const override; - virtual int get_processor_count() const; + virtual int get_processor_count() const override; - virtual String get_config_path() const; - virtual String get_data_path() const; - virtual String get_cache_path() const; - virtual String get_godot_dir_name() const; + virtual String get_config_path() const override; + virtual String get_data_path() const override; + virtual String get_cache_path() const override; + virtual String get_godot_dir_name() const override; - virtual String get_system_dir(SystemDir p_dir) const; - virtual String get_user_data_dir() const; + virtual String get_system_dir(SystemDir p_dir) const override; + virtual String get_user_data_dir() const override; - virtual String get_unique_id() const; + virtual String get_unique_id() const override; - virtual Error shell_open(String p_uri); + virtual Error shell_open(String p_uri) override; void run(); - virtual bool _check_internal_feature_support(const String &p_feature); + virtual bool _check_internal_feature_support(const String &p_feature) override; - void disable_crash_handler(); - bool is_disable_crash_handler() const; - virtual void initialize_debugging(); + virtual void disable_crash_handler() override; + virtual bool is_disable_crash_handler() const override; + virtual void initialize_debugging() override; - virtual Error move_to_trash(const String &p_path); + virtual Error move_to_trash(const String &p_path) override; void set_main_window(HWND p_main_window) { main_window = p_main_window; } |