diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/export/export.cpp | 14 | ||||
-rw-r--r-- | platform/android/file_access_jandroid.cpp | 14 | ||||
-rw-r--r-- | platform/android/java/app/src/com/godot/game/GodotApp.java | 30 | ||||
-rw-r--r-- | platform/android/java/build.gradle | 87 | ||||
-rw-r--r-- | platform/android/java/lib/build.gradle | 29 | ||||
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java | 6 | ||||
-rw-r--r-- | platform/iphone/export/export.cpp | 18 | ||||
-rw-r--r-- | platform/iphone/gl_view.mm | 3 | ||||
-rw-r--r-- | platform/javascript/api/api.cpp | 2 | ||||
-rw-r--r-- | platform/osx/export/export.cpp | 2 | ||||
-rw-r--r-- | platform/uwp/export/export.cpp | 10 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 2 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 6 |
13 files changed, 148 insertions, 75 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 567f7e7b09..94dffd8a84 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -598,7 +598,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { String dst_path = String("lib").plus_file(abi).plus_file(p_so.path.get_file()); Vector<uint8_t> array = FileAccess::get_file_as_array(p_so.path); Error store_err = store_in_apk(ed, dst_path, array); - ERR_FAIL_COND_V(store_err, store_err); + ERR_FAIL_COND_V_MSG(store_err, store_err, "Cannot store in apk file '" + dst_path + "'."); } } if (!exported) { @@ -1308,7 +1308,7 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_xlarge"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/opengl_debug"), false)); - for (unsigned int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) { + for (uint64_t i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) { r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_icons[i].option_id, PROPERTY_HINT_FILE, "*.png"), "")); } @@ -1537,7 +1537,7 @@ public: args.push_back("-a"); args.push_back("android.intent.action.MAIN"); args.push_back("-n"); - args.push_back(get_package_name(package_name) + "/org.godotengine.godot.Godot"); + args.push_back(get_package_name(package_name) + "/com.godot.game.GodotApp"); err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv); if (err || rv != 0) { @@ -1670,7 +1670,7 @@ public: DirAccessRef da = DirAccess::open("res://android"); - ERR_FAIL_COND(!da); + ERR_FAIL_COND_MSG(!da, "Cannot open directory 'res://android'."); Map<String, List<String> > directory_paths; Map<String, List<String> > manifest_sections; Map<String, List<String> > gradle_sections; @@ -1946,7 +1946,7 @@ public: //build project if custom build is enabled String sdk_path = EDITOR_GET("export/android/custom_build_sdk_path"); - ERR_FAIL_COND_V(sdk_path == "", ERR_UNCONFIGURED); + ERR_FAIL_COND_V_MSG(sdk_path == "", ERR_UNCONFIGURED, "Android SDK path must be configured in Editor Settings at 'export/android/custom_build_sdk_path'."); _update_custom_build_project(); @@ -2100,7 +2100,7 @@ public: if (file == "res/drawable-nodpi-v4/icon.png") { bool found = false; - for (unsigned int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) { + for (uint64_t i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) { String icon_path = String(p_preset->get(launcher_icons[i].option_id)).strip_edges(); if (icon_path != "" && icon_path.ends_with(".png")) { FileAccess *f = FileAccess::open(icon_path, FileAccess::READ); @@ -2226,7 +2226,7 @@ public: APKExportData ed; ed.ep = &ep; ed.apk = unaligned_apk; - for (unsigned int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) { + for (uint64_t i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) { String icon_path = String(p_preset->get(launcher_icons[i].option_id)).strip_edges(); if (icon_path != "" && icon_path.ends_with(".png") && FileAccess::exists(icon_path)) { Vector<uint8_t> data = FileAccess::get_file_as_array(icon_path); diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp index 5b8cf01138..d4c2a23aa0 100644 --- a/platform/android/file_access_jandroid.cpp +++ b/platform/android/file_access_jandroid.cpp @@ -94,13 +94,13 @@ void FileAccessJAndroid::seek(size_t p_position) { JNIEnv *env = ThreadAndroid::get_env(); - ERR_FAIL_COND(!is_open()); + ERR_FAIL_COND_MSG(!is_open(), "File must be opened before use."); env->CallVoidMethod(io, _file_seek, id, p_position); } void FileAccessJAndroid::seek_end(int64_t p_position) { - ERR_FAIL_COND(!is_open()); + ERR_FAIL_COND_MSG(!is_open(), "File must be opened before use."); seek(get_len()); } @@ -108,34 +108,34 @@ void FileAccessJAndroid::seek_end(int64_t p_position) { size_t FileAccessJAndroid::get_position() const { JNIEnv *env = ThreadAndroid::get_env(); - ERR_FAIL_COND_V(!is_open(), 0); + ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use."); return env->CallIntMethod(io, _file_tell, id); } size_t FileAccessJAndroid::get_len() const { JNIEnv *env = ThreadAndroid::get_env(); - ERR_FAIL_COND_V(!is_open(), 0); + ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use."); return env->CallIntMethod(io, _file_get_size, id); } bool FileAccessJAndroid::eof_reached() const { JNIEnv *env = ThreadAndroid::get_env(); - ERR_FAIL_COND_V(!is_open(), 0); + ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use."); return env->CallIntMethod(io, _file_eof, id); } uint8_t FileAccessJAndroid::get_8() const { - ERR_FAIL_COND_V(!is_open(), 0); + ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use."); uint8_t byte; get_buffer(&byte, 1); return byte; } int FileAccessJAndroid::get_buffer(uint8_t *p_dst, int p_length) const { - ERR_FAIL_COND_V(!is_open(), 0); + ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use."); if (p_length == 0) return 0; JNIEnv *env = ThreadAndroid::get_env(); diff --git a/platform/android/java/app/src/com/godot/game/GodotApp.java b/platform/android/java/app/src/com/godot/game/GodotApp.java index fabd7b1dbb..d7469a8765 100644 --- a/platform/android/java/app/src/com/godot/game/GodotApp.java +++ b/platform/android/java/app/src/com/godot/game/GodotApp.java @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* GodotApp.java */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + package com.godot.game; import org.godotengine.godot.Godot; diff --git a/platform/android/java/build.gradle b/platform/android/java/build.gradle index 99ffa937b0..2052017888 100644 --- a/platform/android/java/build.gradle +++ b/platform/android/java/build.gradle @@ -20,14 +20,33 @@ allprojects { } } -def binDir = "../../../bin/" +ext { + sconsExt = org.gradle.internal.os.OperatingSystem.current().isWindows() ? ".bat" : "" + + supportedAbis = ["armv7", "arm64v8", "x86", "x86_64"] + supportedTargets = ['release':"release", 'debug':"release_debug"] + + // Used by gradle to specify which architecture to build for by default when running `./gradlew build`. + // This command is usually used by Android Studio. + // If building manually on the command line, it's recommended to use the + // `./gradlew generateGodotTemplates` build command instead after running the `scons` command. + // The defaultAbi must be one of the {supportedAbis} values. + defaultAbi = "arm64v8" +} + +def rootDir = "../../.." +def binDir = "$rootDir/bin/" + +def getSconsTaskName(String buildType) { + return "compileGodotNativeLibs" + buildType.capitalize() +} /** * Copy the generated 'android_debug.apk' binary template into the Godot bin directory. * Depends on the app build task to ensure the binary is generated prior to copying. */ task copyDebugBinaryToBin(type: Copy) { - dependsOn ':app:build' + dependsOn ':app:assembleDebug' from('app/build/outputs/apk/debug') into(binDir) include('android_debug.apk') @@ -38,7 +57,7 @@ task copyDebugBinaryToBin(type: Copy) { * Depends on the app build task to ensure the binary is generated prior to copying. */ task copyReleaseBinaryToBin(type: Copy) { - dependsOn ':app:build' + dependsOn ':app:assembleRelease' from('app/build/outputs/apk/release') into(binDir) include('android_release.apk') @@ -49,7 +68,7 @@ task copyReleaseBinaryToBin(type: Copy) { * Depends on the library build task to ensure the AAR file is generated prior to copying. */ task copyDebugAAR(type: Copy) { - dependsOn ':lib:build' + dependsOn ':lib:assembleDebug' from('lib/build/outputs/aar') into('app/libs/debug') include('godot-lib.debug.aar') @@ -60,7 +79,7 @@ task copyDebugAAR(type: Copy) { * Depends on the library build task to ensure the AAR file is generated prior to copying. */ task copyReleaseAAR(type: Copy) { - dependsOn ':lib:build' + dependsOn ':lib:assembleRelease' from('lib/build/outputs/aar') into('app/libs/release') include('godot-lib.release.aar') @@ -72,8 +91,10 @@ task copyReleaseAAR(type: Copy) { * The zip file also includes some gradle tools to allow building of the custom build. */ task zipCustomBuild(type: Zip) { - dependsOn 'copyDebugAAR' - dependsOn 'copyReleaseAAR' + dependsOn ':generateGodotTemplates' + doFirst { + logger.lifecycle("Generating Godot custom build template") + } from(fileTree(dir: 'app', excludes: ['**/build/**', '**/.gradle/**', '**/*.iml']), fileTree(dir: '.', includes: ['gradle.properties','gradlew', 'gradlew.bat', 'gradle/**'])) include '**/*' archiveName 'android_source.zip' @@ -84,12 +105,48 @@ task zipCustomBuild(type: Zip) { * Master task used to coordinate the tasks defined above to generate the set of Godot templates. */ task generateGodotTemplates(type: GradleBuild) { - tasks = [ - // Copy the generated aar library files to the custom build directory. - 'copyDebugAAR', 'copyReleaseAAR', - // Zip the custom build directory. - 'zipCustomBuild', - // Copy the prebuilt binary templates to the bin directory. - 'copyDebugBinaryToBin', 'copyReleaseBinaryToBin', - ] + // We exclude these gradle tasks so we can run the scons command manually. + for (String buildType : supportedTargets.keySet()) { + startParameter.excludedTaskNames += ":lib:" + getSconsTaskName(buildType) + } + + tasks = [] + + // Only build the apks and aar files for which we have native shared libraries. + for (String target : supportedTargets.keySet()) { + File targetLibs = new File("lib/libs/" + target) + if (targetLibs != null && targetLibs.isDirectory()) { + File[] targetLibsContents = targetLibs.listFiles() + if (targetLibsContents != null && targetLibsContents.length > 0) { + // Copy the generated aar library files to the custom build directory. + tasks += "copy" + target.capitalize() + "AAR" + // Copy the prebuilt binary templates to the bin directory. + tasks += "copy" + target.capitalize() + "BinaryToBin" + } + } + } + + finalizedBy 'zipCustomBuild' +} + +/** + * Clean the generated artifacts. + */ +task cleanGodotTemplates(type: Delete) { + // Delete the generated native libs + delete("lib/libs") + + // Delete the library generated AAR files + delete("lib/build/outputs/aar") + + // Delete the app libs directory contents + delete("app/libs") + + // Delete the generated binary apks + delete("app/build/outputs/apk") + + // Delete the Godot templates in the Godot bin directory + delete("$binDir/android_debug.apk") + delete("$binDir/android_release.apk") + delete("$binDir/android_source.zip") } diff --git a/platform/android/java/lib/build.gradle b/platform/android/java/lib/build.gradle index 6d07504e45..13a14422ed 100644 --- a/platform/android/java/lib/build.gradle +++ b/platform/android/java/lib/build.gradle @@ -5,8 +5,6 @@ dependencies { } def pathToRootDir = "../../../../" -// Note: Only keep the abis you support to speed up the gradle 'assemble' task. -def supportedAbis = ["armv7", "arm64v8", "x86", "x86_64"] android { compileSdkVersion versions.compileSdk @@ -56,27 +54,20 @@ android { // files is only setup for editing support. gradle.startParameter.excludedTaskNames += taskPrefix + "externalNativeBuild" + buildType - // Create tasks to generate the Godot native libraries. - def taskName = "compileGodotNativeLibs" + buildType - def releaseTarget = "release" - if (buildType == "Debug") { - releaseTarget += "_debug" + def releaseTarget = supportedTargets[buildType.toLowerCase()] + if (releaseTarget == null || releaseTarget == "") { + throw new GradleException("Invalid build type: " + buildType) } - def abiTaskNames = [] - // Creating gradle tasks to generate the native libraries for the supported abis. - supportedAbis.each { abi -> - def abiTaskName = taskName + abi.capitalize() - abiTaskNames += abiTaskName - tasks.create(name: abiTaskName, type: Exec) { - executable "scons" - args "--directory=${pathToRootDir}", "platform=android", "target=${releaseTarget}", "android_arch=${abi}" - } + if (!supportedAbis.contains(defaultAbi)) { + throw new GradleException("Invalid default abi: " + defaultAbi) } - // Creating gradle task to run all of the previously generated tasks. - tasks.create(name: taskName, type: GradleBuild) { - tasks = abiTaskNames + // Creating gradle task to generate the native libraries for the default abi. + def taskName = getSconsTaskName(buildType) + tasks.create(name: taskName, type: Exec) { + executable "scons" + sconsExt + args "--directory=${pathToRootDir}", "platform=android", "target=${releaseTarget}", "android_arch=${defaultAbi}", "-j" + Runtime.runtime.availableProcessors() } // Schedule the tasks so the generated libs are present before the aar file is packaged. diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java index a443a0ad90..2beca67922 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java +++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java @@ -96,7 +96,6 @@ public class GodotInputHandler implements InputDeviceListener { GodotLib.joybutton(device_id, button, false); } }); - return true; } } else { final int chr = event.getUnicodeChar(0); @@ -108,7 +107,7 @@ public class GodotInputHandler implements InputDeviceListener { }); }; - return false; + return true; } public boolean onKeyDown(final int keyCode, KeyEvent event) { @@ -142,7 +141,6 @@ public class GodotInputHandler implements InputDeviceListener { GodotLib.joybutton(device_id, button, true); } }); - return true; } } else { final int chr = event.getUnicodeChar(0); @@ -154,7 +152,7 @@ public class GodotInputHandler implements InputDeviceListener { }); }; - return false; + return true; } public boolean onGenericMotionEvent(MotionEvent event) { diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 1cbf4d6a70..baae13c53d 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -287,7 +287,7 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options) r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_40x40", PROPERTY_HINT_FILE, "*.png"), "")); // Spotlight r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_80x80", PROPERTY_HINT_FILE, "*.png"), "")); // Spotlight on devices with retina display - for (unsigned int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) { + for (uint64_t i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) { r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, loading_screen_infos[i].preset_key, PROPERTY_HINT_FILE, "*.png"), "")); } @@ -487,9 +487,9 @@ Error EditorExportPlatformIOS::_export_icons(const Ref<EditorExportPreset> &p_pr String sizes; DirAccess *da = DirAccess::open(p_iconset_dir); - ERR_FAIL_COND_V(!da, ERR_CANT_OPEN); + ERR_FAIL_COND_V_MSG(!da, ERR_CANT_OPEN, "Cannot open directory '" + p_iconset_dir + "'."); - for (unsigned int i = 0; i < (sizeof(icon_infos) / sizeof(icon_infos[0])); ++i) { + for (uint64_t i = 0; i < (sizeof(icon_infos) / sizeof(icon_infos[0])); ++i) { IconInfo info = icon_infos[i]; String icon_path = p_preset->get(info.preset_key); if (icon_path.length() == 0) { @@ -537,16 +537,16 @@ Error EditorExportPlatformIOS::_export_icons(const Ref<EditorExportPreset> &p_pr Error EditorExportPlatformIOS::_export_loading_screens(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir) { DirAccess *da = DirAccess::open(p_dest_dir); - ERR_FAIL_COND_V(!da, ERR_CANT_OPEN); + ERR_FAIL_COND_V_MSG(!da, ERR_CANT_OPEN, "Cannot open directory '" + p_dest_dir + "'."); - for (unsigned int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) { + for (uint64_t i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) { LoadingScreenInfo info = loading_screen_infos[i]; String loading_screen_file = p_preset->get(info.preset_key); if (loading_screen_file.size() > 0) { Error err = da->copy(loading_screen_file, p_dest_dir + info.export_name); if (err) { memdelete(da); - String err_str = String("Failed to export loading screen (") + info.preset_key + ") from path: " + loading_screen_file; + String err_str = String("Failed to export loading screen (") + info.preset_key + ") from path '" + loading_screen_file + "'."; ERR_PRINT(err_str.utf8().get_data()); return err; } @@ -626,7 +626,7 @@ private: static String _hex_pad(uint32_t num) { Vector<char> ret; ret.resize(sizeof(num) * 2); - for (unsigned int i = 0; i < sizeof(num) * 2; ++i) { + for (uint64_t i = 0; i < sizeof(num) * 2; ++i) { uint8_t four_bits = (num >> (sizeof(num) * 8 - (i + 1) * 4)) & 0xF; ret.write[i] = _hex_char(four_bits); } @@ -757,7 +757,7 @@ void EditorExportPlatformIOS::_add_assets_to_project(const Ref<EditorExportPrese Error EditorExportPlatformIOS::_export_additional_assets(const String &p_out_dir, const Vector<String> &p_assets, bool p_is_framework, Vector<IOSExportAsset> &r_exported_assets) { DirAccess *filesystem_da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - ERR_FAIL_COND_V(!filesystem_da, ERR_CANT_CREATE); + ERR_FAIL_COND_V_MSG(!filesystem_da, ERR_CANT_CREATE, "Cannot create DirAccess for path '" + p_out_dir + "'."); for (int f_idx = 0; f_idx < p_assets.size(); ++f_idx) { String asset = p_assets[f_idx]; if (!asset.begins_with("res://")) { @@ -1169,7 +1169,7 @@ bool EditorExportPlatformIOS::can_export(const Ref<EditorExportPreset> &p_preset valid = false; } - for (unsigned int i = 0; i < (sizeof(icon_infos) / sizeof(icon_infos[0])); ++i) { + for (uint64_t i = 0; i < (sizeof(icon_infos) / sizeof(icon_infos[0])); ++i) { IconInfo info = icon_infos[i]; String icon_path = p_preset->get(info.preset_key); if (icon_path.length() == 0) { diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm index 4641b2c4ac..dfca2e3dd7 100644 --- a/platform/iphone/gl_view.mm +++ b/platform/iphone/gl_view.mm @@ -337,12 +337,9 @@ static void clear_touches() { // the same size as our display area. - (void)layoutSubviews { - //printf("HERE\n"); [EAGLContext setCurrentContext:context]; [self destroyFramebuffer]; [self createFramebuffer]; - [self drawView]; - [self drawView]; } - (BOOL)createFramebuffer { diff --git a/platform/javascript/api/api.cpp b/platform/javascript/api/api.cpp index d4dc43d57c..0832ae0360 100644 --- a/platform/javascript/api/api.cpp +++ b/platform/javascript/api/api.cpp @@ -55,7 +55,7 @@ JavaScript *JavaScript::get_singleton() { JavaScript::JavaScript() { - ERR_FAIL_COND(singleton != NULL); + ERR_FAIL_COND_MSG(singleton != NULL, "JavaScript singleton already exist."); singleton = this; } diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 56b0a44dbc..94090bcdc1 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -240,7 +240,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_ { "is32", "s8mk", false, 16 } //16x16 24-bit RLE + 8-bit uncompressed mask }; - for (unsigned int i = 0; i < (sizeof(icon_infos) / sizeof(icon_infos[0])); ++i) { + for (uint64_t i = 0; i < (sizeof(icon_infos) / sizeof(icon_infos[0])); ++i) { Ref<Image> copy = p_icon; // does this make sense? doesn't this just increase the reference count instead of making a copy? Do we even need a copy? copy->convert(Image::FORMAT_RGBA8); copy->resize(icon_infos[i].size, icon_infos[i].size); diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index ea110b11ca..fefad3584b 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -500,7 +500,7 @@ Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t size_t block_size = (p_len - step) > BLOCK_SIZE ? (size_t)BLOCK_SIZE : (p_len - step); - for (uint32_t i = 0; i < block_size; i++) { + for (uint64_t i = 0; i < block_size; i++) { strm_in.write[i] = p_buffer[step + i]; } @@ -524,14 +524,14 @@ Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t //package->store_buffer(strm_out.ptr(), strm.total_out - total_out_before); int start = file_buffer.size(); file_buffer.resize(file_buffer.size() + bh.compressed_size); - for (uint32_t i = 0; i < bh.compressed_size; i++) + for (uint64_t i = 0; i < bh.compressed_size; i++) file_buffer.write[start + i] = strm_out[i]; } else { bh.compressed_size = block_size; //package->store_buffer(strm_in.ptr(), block_size); int start = file_buffer.size(); file_buffer.resize(file_buffer.size() + block_size); - for (uint32_t i = 0; i < bh.compressed_size; i++) + for (uint64_t i = 0; i < bh.compressed_size; i++) file_buffer.write[start + i] = strm_in[i]; } @@ -554,7 +554,7 @@ Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t //package->store_buffer(strm_out.ptr(), strm.total_out - total_out_before); int start = file_buffer.size(); file_buffer.resize(file_buffer.size() + (strm.total_out - total_out_before)); - for (uint32_t i = 0; i < (strm.total_out - total_out_before); i++) + for (uint64_t i = 0; i < (strm.total_out - total_out_before); i++) file_buffer.write[start + i] = strm_out[i]; deflateEnd(&strm); @@ -1249,7 +1249,7 @@ public: Error err = OK; FileAccess *fa_pack = FileAccess::open(p_path, FileAccess::WRITE, &err); - ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE); + ERR_FAIL_COND_V_MSG(err != OK, ERR_CANT_CREATE, "Cannot create file '" + p_path + "'."); AppxPackager packager; packager.init(fa_pack); diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index be325381bb..facf5b8d91 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2663,7 +2663,7 @@ String OS_Windows::get_executable_path() const { void OS_Windows::set_native_icon(const String &p_filename) { FileAccess *f = FileAccess::open(p_filename, FileAccess::READ); - ERR_FAIL_COND(!f); + ERR_FAIL_COND_MSG(!f, "Cannot open file with icon '" + p_filename + "'."); ICONDIR *icon_dir = (ICONDIR *)memalloc(sizeof(ICONDIR)); int pos = 0; diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 20502b61d9..687981f32b 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1566,7 +1566,7 @@ bool OS_X11::is_window_maximize_allowed() { bool found_wm_act_max_horz = false; bool found_wm_act_max_vert = false; - for (unsigned int i = 0; i < len; i++) { + for (uint64_t i = 0; i < len; i++) { if (atoms[i] == wm_act_max_horz) found_wm_act_max_horz = true; if (atoms[i] == wm_act_max_vert) @@ -1612,7 +1612,7 @@ bool OS_X11::is_window_maximized() const { bool found_wm_max_horz = false; bool found_wm_max_vert = false; - for (unsigned int i = 0; i < len; i++) { + for (uint64_t i = 0; i < len; i++) { if (atoms[i] == wm_max_horz) found_wm_max_horz = true; if (atoms[i] == wm_max_vert) @@ -3028,7 +3028,7 @@ void OS_X11::alert(const String &p_alert, const String &p_title) { String program; for (int i = 0; i < path_elems.size(); i++) { - for (unsigned int k = 0; k < sizeof(message_programs) / sizeof(char *); k++) { + for (uint64_t k = 0; k < sizeof(message_programs) / sizeof(char *); k++) { String tested_path = path_elems[i].plus_file(message_programs[k]); if (FileAccess::exists(tested_path)) { |