diff options
Diffstat (limited to 'platform')
59 files changed, 174 insertions, 108 deletions
diff --git a/platform/android/export/gradle_export_util.h b/platform/android/export/gradle_export_util.h index 7896392d16..018ae649d6 100644 --- a/platform/android/export/gradle_export_util.h +++ b/platform/android/export/gradle_export_util.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GODOT_GRADLE_EXPORT_UTIL_H -#define GODOT_GRADLE_EXPORT_UTIL_H +#ifndef ANDROID_GRADLE_EXPORT_UTIL_H +#define ANDROID_GRADLE_EXPORT_UTIL_H #include "core/io/dir_access.h" #include "core/io/file_access.h" @@ -106,4 +106,4 @@ String _get_activity_tag(const Ref<EditorExportPreset> &p_preset); String _get_application_tag(const Ref<EditorExportPreset> &p_preset, bool p_has_read_write_storage_permission); -#endif // GODOT_GRADLE_EXPORT_UTIL_H +#endif // ANDROID_GRADLE_EXPORT_UTIL_H diff --git a/platform/android/file_access_filesystem_jandroid.cpp b/platform/android/file_access_filesystem_jandroid.cpp index c1a48e025e..733d92f741 100644 --- a/platform/android/file_access_filesystem_jandroid.cpp +++ b/platform/android/file_access_filesystem_jandroid.cpp @@ -30,6 +30,7 @@ #include "file_access_filesystem_jandroid.h" #include "core/os/os.h" +#include "core/templates/local_vector.h" #include "thread_jandroid.h" #include <unistd.h> @@ -166,6 +167,51 @@ uint8_t FileAccessFilesystemJAndroid::get_8() const { return byte; } +String FileAccessFilesystemJAndroid::get_line() const { + ERR_FAIL_COND_V_MSG(!is_open(), String(), "File must be opened before use."); + + const size_t buffer_size_limit = 2048; + const uint64_t file_size = get_length(); + const uint64_t start_position = get_position(); + + String result; + LocalVector<uint8_t> line_buffer; + size_t current_buffer_size = 0; + uint64_t line_buffer_position = 0; + + while (true) { + size_t line_buffer_size = MIN(buffer_size_limit, file_size - get_position()); + if (line_buffer_size <= 0) { + break; + } + + current_buffer_size += line_buffer_size; + line_buffer.resize(current_buffer_size); + + uint64_t bytes_read = get_buffer(&line_buffer[line_buffer_position], current_buffer_size - line_buffer_position); + if (bytes_read <= 0) { + break; + } + + for (; bytes_read > 0; line_buffer_position++, bytes_read--) { + uint8_t elem = line_buffer[line_buffer_position]; + if (elem == '\n' || elem == '\0') { + // Found the end of the line + const_cast<FileAccessFilesystemJAndroid *>(this)->seek(start_position + line_buffer_position + 1); + if (result.parse_utf8((const char *)line_buffer.ptr(), line_buffer_position)) { + return String(); + } + return result; + } + } + } + + if (result.parse_utf8((const char *)line_buffer.ptr(), line_buffer_position)) { + return String(); + } + return result; +} + uint64_t FileAccessFilesystemJAndroid::get_buffer(uint8_t *p_dst, uint64_t p_length) const { if (_file_read) { ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use."); diff --git a/platform/android/file_access_filesystem_jandroid.h b/platform/android/file_access_filesystem_jandroid.h index 18d5df1628..7deb8de37b 100644 --- a/platform/android/file_access_filesystem_jandroid.h +++ b/platform/android/file_access_filesystem_jandroid.h @@ -74,6 +74,7 @@ public: virtual bool eof_reached() const override; ///< reading passed EOF virtual uint8_t get_8() const override; ///< get a byte + virtual String get_line() const override; ///< get a line virtual uint64_t get_buffer(uint8_t *p_dst, uint64_t p_length) const override; virtual Error get_error() const override; ///< get last error diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt b/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt index c7bd55b620..c9282dd247 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt @@ -54,11 +54,19 @@ internal enum class StorageScope { */ UNKNOWN; - companion object { + class Identifier(context: Context) { + + private val internalAppDir: String? = context.filesDir.canonicalPath + private val internalCacheDir: String? = context.cacheDir.canonicalPath + private val externalAppDir: String? = context.getExternalFilesDir(null)?.canonicalPath + private val sharedDir : String? = Environment.getExternalStorageDirectory().canonicalPath + private val downloadsSharedDir: String? = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).canonicalPath + private val documentsSharedDir: String? = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).canonicalPath + /** * Determines which [StorageScope] the given path falls under. */ - fun getStorageScope(context: Context, path: String?): StorageScope { + fun identifyStorageScope(path: String?): StorageScope { if (path == null) { return UNKNOWN } @@ -70,23 +78,19 @@ internal enum class StorageScope { val canonicalPathFile = pathFile.canonicalPath - val internalAppDir = context.filesDir.canonicalPath ?: return UNKNOWN - if (canonicalPathFile.startsWith(internalAppDir)) { + if (internalAppDir != null && canonicalPathFile.startsWith(internalAppDir)) { return APP } - val internalCacheDir = context.cacheDir.canonicalPath ?: return UNKNOWN - if (canonicalPathFile.startsWith(internalCacheDir)) { + if (internalCacheDir != null && canonicalPathFile.startsWith(internalCacheDir)) { return APP } - val externalAppDir = context.getExternalFilesDir(null)?.canonicalPath ?: return UNKNOWN - if (canonicalPathFile.startsWith(externalAppDir)) { + if (externalAppDir != null && canonicalPathFile.startsWith(externalAppDir)) { return APP } - val sharedDir = Environment.getExternalStorageDirectory().canonicalPath ?: return UNKNOWN - if (canonicalPathFile.startsWith(sharedDir)) { + if (sharedDir != null && canonicalPathFile.startsWith(sharedDir)) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { // Before R, apps had access to shared storage so long as they have the right // permissions (and flag on Q). @@ -95,13 +99,8 @@ internal enum class StorageScope { // Post R, access is limited based on the target destination // 'Downloads' and 'Documents' are still accessible - val downloadsSharedDir = - Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).canonicalPath - ?: return SHARED - val documentsSharedDir = - Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).canonicalPath - ?: return SHARED - if (canonicalPathFile.startsWith(downloadsSharedDir) || canonicalPathFile.startsWith(documentsSharedDir)) { + if ((downloadsSharedDir != null && canonicalPathFile.startsWith(downloadsSharedDir)) + || (documentsSharedDir != null && canonicalPathFile.startsWith(documentsSharedDir))) { return APP } diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/directory/FilesystemDirectoryAccess.kt b/platform/android/java/lib/src/org/godotengine/godot/io/directory/FilesystemDirectoryAccess.kt index c3acf42568..54fc56fa3e 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/directory/FilesystemDirectoryAccess.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/directory/FilesystemDirectoryAccess.kt @@ -54,6 +54,7 @@ internal class FilesystemDirectoryAccess(private val context: Context): private data class DirData(val dirFile: File, val files: Array<File>, var current: Int = 0) + private val storageScopeIdentifier = StorageScope.Identifier(context) private val storageManager = context.getSystemService(Context.STORAGE_SERVICE) as StorageManager private var lastDirId = STARTING_DIR_ID private val dirs = SparseArray<DirData>() @@ -62,7 +63,7 @@ internal class FilesystemDirectoryAccess(private val context: Context): // Directory access is available for shared storage on Android 11+ // On Android 10, access is also available as long as the `requestLegacyExternalStorage` // tag is available. - return StorageScope.getStorageScope(context, path) != StorageScope.UNKNOWN + return storageScopeIdentifier.identifyStorageScope(path) != StorageScope.UNKNOWN } override fun hasDirId(dirId: Int) = dirs.indexOfKey(dirId) >= 0 @@ -102,7 +103,7 @@ internal class FilesystemDirectoryAccess(private val context: Context): } } - override fun fileExists(path: String) = FileAccessHandler.fileExists(context, path) + override fun fileExists(path: String) = FileAccessHandler.fileExists(context, storageScopeIdentifier, path) override fun dirNext(dirId: Int): String { val dirData = dirs[dirId] @@ -199,7 +200,7 @@ internal class FilesystemDirectoryAccess(private val context: Context): if (fromFile.isDirectory) { fromFile.renameTo(File(to)) } else { - FileAccessHandler.renameFile(context, from, to) + FileAccessHandler.renameFile(context, storageScopeIdentifier, from, to) } } catch (e: SecurityException) { false @@ -218,7 +219,7 @@ internal class FilesystemDirectoryAccess(private val context: Context): if (deleteFile.isDirectory) { deleteFile.delete() } else { - FileAccessHandler.removeFile(context, filename) + FileAccessHandler.removeFile(context, storageScopeIdentifier, filename) } } else { true diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/file/DataAccess.kt b/platform/android/java/lib/src/org/godotengine/godot/io/file/DataAccess.kt index aef1bed8ce..463dabfb23 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/file/DataAccess.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/file/DataAccess.kt @@ -161,8 +161,9 @@ internal abstract class DataAccess(private val filePath: String) { fun read(buffer: ByteBuffer): Int { return try { val readBytes = fileChannel.read(buffer) + endOfFile = readBytes == -1 + || (fileChannel.position() >= fileChannel.size() && fileChannel.size() > 0) if (readBytes == -1) { - endOfFile = true 0 } else { readBytes diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/file/FileAccessHandler.kt b/platform/android/java/lib/src/org/godotengine/godot/io/file/FileAccessHandler.kt index a4e0a82d6e..04b6772c45 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/file/FileAccessHandler.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/file/FileAccessHandler.kt @@ -49,8 +49,8 @@ class FileAccessHandler(val context: Context) { private const val INVALID_FILE_ID = 0 private const val STARTING_FILE_ID = 1 - fun fileExists(context: Context, path: String?): Boolean { - val storageScope = StorageScope.getStorageScope(context, path) + internal fun fileExists(context: Context, storageScopeIdentifier: StorageScope.Identifier, path: String?): Boolean { + val storageScope = storageScopeIdentifier.identifyStorageScope(path) if (storageScope == StorageScope.UNKNOWN) { return false } @@ -62,8 +62,8 @@ class FileAccessHandler(val context: Context) { } } - fun removeFile(context: Context, path: String?): Boolean { - val storageScope = StorageScope.getStorageScope(context, path) + internal fun removeFile(context: Context, storageScopeIdentifier: StorageScope.Identifier, path: String?): Boolean { + val storageScope = storageScopeIdentifier.identifyStorageScope(path) if (storageScope == StorageScope.UNKNOWN) { return false } @@ -75,8 +75,8 @@ class FileAccessHandler(val context: Context) { } } - fun renameFile(context: Context, from: String?, to: String?): Boolean { - val storageScope = StorageScope.getStorageScope(context, from) + internal fun renameFile(context: Context, storageScopeIdentifier: StorageScope.Identifier, from: String?, to: String?): Boolean { + val storageScope = storageScopeIdentifier.identifyStorageScope(from) if (storageScope == StorageScope.UNKNOWN) { return false } @@ -89,13 +89,14 @@ class FileAccessHandler(val context: Context) { } } + private val storageScopeIdentifier = StorageScope.Identifier(context) private val files = SparseArray<DataAccess>() private var lastFileId = STARTING_FILE_ID private fun hasFileId(fileId: Int) = files.indexOfKey(fileId) >= 0 fun fileOpen(path: String?, modeFlags: Int): Int { - val storageScope = StorageScope.getStorageScope(context, path) + val storageScope = storageScopeIdentifier.identifyStorageScope(path) if (storageScope == StorageScope.UNKNOWN) { return INVALID_FILE_ID } @@ -162,10 +163,10 @@ class FileAccessHandler(val context: Context) { files[fileId].flush() } - fun fileExists(path: String?) = Companion.fileExists(context, path) + fun fileExists(path: String?) = Companion.fileExists(context, storageScopeIdentifier, path) fun fileLastModified(filepath: String?): Long { - val storageScope = StorageScope.getStorageScope(context, filepath) + val storageScope = storageScopeIdentifier.identifyStorageScope(filepath) if (storageScope == StorageScope.UNKNOWN) { return 0L } diff --git a/platform/android/java_godot_view_wrapper.h b/platform/android/java_godot_view_wrapper.h index b1f258bbb5..c52f459d64 100644 --- a/platform/android/java_godot_view_wrapper.h +++ b/platform/android/java_godot_view_wrapper.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GODOT_JAVA_GODOT_VIEW_WRAPPER_H -#define GODOT_JAVA_GODOT_VIEW_WRAPPER_H +#ifndef JAVA_GODOT_VIEW_WRAPPER_H +#define JAVA_GODOT_VIEW_WRAPPER_H #include <android/log.h> #include <jni.h> @@ -57,4 +57,4 @@ public: ~GodotJavaViewWrapper(); }; -#endif // GODOT_JAVA_GODOT_VIEW_WRAPPER_H +#endif // JAVA_GODOT_VIEW_WRAPPER_H diff --git a/platform/ios/display_server_ios.h b/platform/ios/display_server_ios.h index bfd611adb7..5dd4d177ea 100644 --- a/platform/ios/display_server_ios.h +++ b/platform/ios/display_server_ios.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef display_server_ios_h -#define display_server_ios_h +#ifndef DISPLAY_SERVER_IOS_H +#define DISPLAY_SERVER_IOS_H #include "core/input/input.h" #include "servers/display_server.h" @@ -214,4 +214,4 @@ public: void resize_window(CGSize size); }; -#endif /* DISPLAY_SERVER_IOS_H */ +#endif // DISPLAY_SERVER_IOS_H diff --git a/platform/ios/export/export_plugin.h b/platform/ios/export/export_plugin.h index a30cb4644f..91b13419f1 100644 --- a/platform/ios/export/export_plugin.h +++ b/platform/ios/export/export_plugin.h @@ -290,4 +290,4 @@ public: } }; -#endif +#endif // IOS_EXPORT_PLUGIN_H diff --git a/platform/ios/export/godot_plugin_config.h b/platform/ios/export/godot_plugin_config.h index d2a2de4947..5ca8b05b42 100644 --- a/platform/ios/export/godot_plugin_config.h +++ b/platform/ios/export/godot_plugin_config.h @@ -129,4 +129,4 @@ struct PluginConfigIOS { static PluginConfigIOS load_plugin_config(Ref<ConfigFile> config_file, const String &path); }; -#endif // GODOT_PLUGIN_CONFIG_H +#endif // IOS_GODOT_PLUGIN_CONFIG_H diff --git a/platform/ios/ios.h b/platform/ios/ios.h index 0607d7b395..0b3842b233 100644 --- a/platform/ios/ios.h +++ b/platform/ios/ios.h @@ -58,4 +58,4 @@ public: iOS(); }; -#endif +#endif // IOS_H diff --git a/platform/ios/os_ios.h b/platform/ios/os_ios.h index bbc77d48de..cfd1771653 100644 --- a/platform/ios/os_ios.h +++ b/platform/ios/os_ios.h @@ -121,4 +121,4 @@ public: #endif // OS_IOS_H -#endif // IOS_ENABLED +#endif // OS_IOS_H diff --git a/platform/javascript/audio_driver_javascript.h b/platform/javascript/audio_driver_javascript.h index b7b0b3ac96..807e2f936b 100644 --- a/platform/javascript/audio_driver_javascript.h +++ b/platform/javascript/audio_driver_javascript.h @@ -158,4 +158,4 @@ public: }; #endif -#endif +#endif // AUDIO_DRIVER_JAVASCRIPT_H diff --git a/platform/javascript/export/export.h b/platform/javascript/export/export.h index 41cc66cfb8..29c335ed0e 100644 --- a/platform/javascript/export/export.h +++ b/platform/javascript/export/export.h @@ -33,4 +33,4 @@ void register_javascript_exporter(); -#endif +#endif // JAVASCRIPT_EXPORT_H diff --git a/platform/javascript/export/export_plugin.h b/platform/javascript/export/export_plugin.h index 1aaec5454d..a6df8e7094 100644 --- a/platform/javascript/export/export_plugin.h +++ b/platform/javascript/export/export_plugin.h @@ -144,4 +144,4 @@ public: ~EditorExportPlatformJavaScript(); }; -#endif +#endif // JAVASCRIPT_EXPORT_PLUGIN_H diff --git a/platform/javascript/export/export_server.h b/platform/javascript/export/export_server.h index a831b76076..7cdbcec064 100644 --- a/platform/javascript/export/export_server.h +++ b/platform/javascript/export/export_server.h @@ -248,4 +248,4 @@ public: } }; -#endif +#endif // JAVASCRIPT_EXPORT_SERVER_H diff --git a/platform/javascript/godot_audio.h b/platform/javascript/godot_audio.h index 012f8daeb7..3855b7301e 100644 --- a/platform/javascript/godot_audio.h +++ b/platform/javascript/godot_audio.h @@ -63,4 +63,4 @@ extern void godot_audio_script_start(float *p_in_buf, int p_in_size, float *p_ou } #endif -#endif /* GODOT_AUDIO_H */ +#endif // GODOT_AUDIO_H diff --git a/platform/javascript/godot_js.h b/platform/javascript/godot_js.h index 1a383c9799..567b491336 100644 --- a/platform/javascript/godot_js.h +++ b/platform/javascript/godot_js.h @@ -127,4 +127,4 @@ extern void godot_js_display_vk_hide(); } #endif -#endif /* GODOT_JS_H */ +#endif // GODOT_JS_H diff --git a/platform/javascript/godot_webgl2.h b/platform/javascript/godot_webgl2.h index 7c357ff66d..968b70f84b 100644 --- a/platform/javascript/godot_webgl2.h +++ b/platform/javascript/godot_webgl2.h @@ -34,4 +34,4 @@ #include "GLES3/gl3.h" #include "webgl/webgl2.h" -#endif +#endif // GODOT_WEBGL2_H diff --git a/platform/javascript/http_client_javascript.h b/platform/javascript/http_client_javascript.h index 096aa6a153..fcd225ffc9 100644 --- a/platform/javascript/http_client_javascript.h +++ b/platform/javascript/http_client_javascript.h @@ -105,4 +105,5 @@ public: HTTPClientJavaScript(); ~HTTPClientJavaScript(); }; + #endif // HTTP_CLIENT_JAVASCRIPT_H diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index 0c672111cc..6900a34ee3 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -107,4 +107,4 @@ public: OS_JavaScript(); }; -#endif +#endif // OS_JAVASCRIPT_H diff --git a/platform/linuxbsd/crash_handler_linuxbsd.h b/platform/linuxbsd/crash_handler_linuxbsd.h index 2e44476c3f..1b77352cca 100644 --- a/platform/linuxbsd/crash_handler_linuxbsd.h +++ b/platform/linuxbsd/crash_handler_linuxbsd.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef CRASH_HANDLER_X11_H -#define CRASH_HANDLER_X11_H +#ifndef CRASH_HANDLER_LINUXBSD_H +#define CRASH_HANDLER_LINUXBSD_H class CrashHandler { bool disabled; @@ -44,4 +44,4 @@ public: ~CrashHandler(); }; -#endif // CRASH_HANDLER_X11_H +#endif // CRASH_HANDLER_LINUXBSD_H diff --git a/platform/linuxbsd/detect_prime_x11.h b/platform/linuxbsd/detect_prime_x11.h index e60f9ebfdf..21ebaead32 100644 --- a/platform/linuxbsd/detect_prime_x11.h +++ b/platform/linuxbsd/detect_prime_x11.h @@ -34,4 +34,5 @@ int detect_prime(); #endif -#endif + +#endif // DETECT_PRIME_X11_H diff --git a/platform/linuxbsd/export/export_plugin.cpp b/platform/linuxbsd/export/export_plugin.cpp index 4e14920e79..d54e07d8a5 100644 --- a/platform/linuxbsd/export/export_plugin.cpp +++ b/platform/linuxbsd/export/export_plugin.cpp @@ -84,7 +84,7 @@ void EditorExportPlatformLinuxBSD::set_extension(const String &p_extension, cons } String EditorExportPlatformLinuxBSD::get_template_file_name(const String &p_target, const String &p_arch) const { - return "linux_x11_" + p_arch + "_" + p_target; + return "linux_" + p_target + "." + p_arch; } List<String> EditorExportPlatformLinuxBSD::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const { diff --git a/platform/linuxbsd/export/export_plugin.h b/platform/linuxbsd/export/export_plugin.h index e04bcc20f9..ccdf2ecc9f 100644 --- a/platform/linuxbsd/export/export_plugin.h +++ b/platform/linuxbsd/export/export_plugin.h @@ -49,4 +49,4 @@ public: virtual Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) override; }; -#endif +#endif // LINUXBSD_EXPORT_PLUGIN_H diff --git a/platform/linuxbsd/freedesktop_screensaver.h b/platform/linuxbsd/freedesktop_screensaver.h index b2303791bd..1b632b9103 100644 --- a/platform/linuxbsd/freedesktop_screensaver.h +++ b/platform/linuxbsd/freedesktop_screensaver.h @@ -28,6 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#ifndef FREEDESKTOP_SCREENSAVER_H +#define FREEDESKTOP_SCREENSAVER_H + #ifdef DBUS_ENABLED #include <dbus/dbus.h> @@ -45,3 +48,5 @@ public: }; #endif // DBUS_ENABLED + +#endif // FREEDESKTOP_SCREENSAVER_H diff --git a/platform/linuxbsd/os_linuxbsd.h b/platform/linuxbsd/os_linuxbsd.h index 3f97b86eae..13c07842fb 100644 --- a/platform/linuxbsd/os_linuxbsd.h +++ b/platform/linuxbsd/os_linuxbsd.h @@ -105,4 +105,4 @@ public: OS_LinuxBSD(); }; -#endif +#endif // OS_LINUXBSD_H diff --git a/platform/linuxbsd/vulkan_context_x11.h b/platform/linuxbsd/vulkan_context_x11.h index a89afa2eff..0c4a6cd278 100644 --- a/platform/linuxbsd/vulkan_context_x11.h +++ b/platform/linuxbsd/vulkan_context_x11.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef VULKAN_DEVICE_X11_H -#define VULKAN_DEVICE_X11_H +#ifndef VULKAN_CONTEXT_X11_H +#define VULKAN_CONTEXT_X11_H #include "drivers/vulkan/vulkan_context.h" #include <X11/Xlib.h> @@ -44,4 +44,4 @@ public: ~VulkanContextX11(); }; -#endif // VULKAN_DEVICE_X11_H +#endif // VULKAN_CONTEXT_X11_H diff --git a/platform/macos/dir_access_macos.h b/platform/macos/dir_access_macos.h index 2b234ad96c..1ac1b995de 100644 --- a/platform/macos/dir_access_macos.h +++ b/platform/macos/dir_access_macos.h @@ -51,5 +51,6 @@ protected: virtual bool is_hidden(const String &p_name); }; -#endif //UNIX ENABLED -#endif +#endif // UNIX ENABLED || LIBC_FILEIO_ENABLED + +#endif // DIR_ACCESS_MACOS_H diff --git a/platform/macos/dir_access_macos.mm b/platform/macos/dir_access_macos.mm index 8f3906c6b8..94d937a7dc 100644 --- a/platform/macos/dir_access_macos.mm +++ b/platform/macos/dir_access_macos.mm @@ -78,4 +78,4 @@ bool DirAccessMacOS::is_hidden(const String &p_name) { return [hidden boolValue]; } -#endif //posix_enabled +#endif // UNIX_ENABLED || LIBC_FILEIO_ENABLED diff --git a/platform/macos/export/codesign.h b/platform/macos/export/codesign.h index 3a08c0ea86..fea7b117d0 100644 --- a/platform/macos/export/codesign.h +++ b/platform/macos/export/codesign.h @@ -38,8 +38,8 @@ // - Requirements code generator is not implemented (only hard-coded requirements for the ad-hoc signing is supported). // - RFC5652/CMS blob generation is not implemented, supports ad-hoc signing only. -#ifndef CODESIGN_H -#define CODESIGN_H +#ifndef MACOS_CODESIGN_H +#define MACOS_CODESIGN_H #include "core/crypto/crypto_core.h" #include "core/io/dir_access.h" @@ -365,4 +365,4 @@ public: #endif // MODULE_REGEX_ENABLED -#endif // CODESIGN_H +#endif // MACOS_CODESIGN_H diff --git a/platform/macos/export/export_plugin.cpp b/platform/macos/export/export_plugin.cpp index 8cb69997d9..fd0781ac50 100644 --- a/platform/macos/export/export_plugin.cpp +++ b/platform/macos/export/export_plugin.cpp @@ -766,7 +766,7 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p int ret = unzGoToFirstFile(src_pkg_zip); - String binary_to_use = "godot_macos_" + String(p_debug ? "debug" : "release") + ".64"; + String binary_to_use = "godot_macos_" + String(p_debug ? "debug" : "release") + ".universal"; String pkg_name; if (String(ProjectSettings::get_singleton()->get("application/config/name")) != "") { @@ -1064,19 +1064,19 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p } if (data.size() > 0) { - if (file.find("/data.mono.macos.64.release_debug/") != -1) { + if (file.find("/data.mono.macos.release_debug.universal/") != -1) { if (!p_debug) { ret = unzGoToNextFile(src_pkg_zip); continue; // skip } - file = file.replace("/data.mono.macos.64.release_debug/", "/GodotSharp/"); + file = file.replace("/data.mono.macos.release_debug.universal/", "/GodotSharp/"); } - if (file.find("/data.mono.macos.64.release/") != -1) { + if (file.find("/data.mono.macos.release.universal/") != -1) { if (p_debug) { ret = unzGoToNextFile(src_pkg_zip); continue; // skip } - file = file.replace("/data.mono.macos.64.release/", "/GodotSharp/"); + file = file.replace("/data.mono.macos.release.universal/", "/GodotSharp/"); } if (file.ends_with(".dylib")) { diff --git a/platform/macos/export/export_plugin.h b/platform/macos/export/export_plugin.h index 410ec22545..e2e9cc3d22 100644 --- a/platform/macos/export/export_plugin.h +++ b/platform/macos/export/export_plugin.h @@ -134,4 +134,4 @@ public: ~EditorExportPlatformMacOS(); }; -#endif +#endif // MACOS_EXPORT_PLUGIN_H diff --git a/platform/macos/export/lipo.h b/platform/macos/export/lipo.h index 0e419be17e..516ef99860 100644 --- a/platform/macos/export/lipo.h +++ b/platform/macos/export/lipo.h @@ -30,8 +30,8 @@ // Universal / Universal 2 fat binary file creator and extractor. -#ifndef LIPO_H -#define LIPO_H +#ifndef MACOS_LIPO_H +#define MACOS_LIPO_H #include "core/io/file_access.h" #include "core/object/ref_counted.h" @@ -73,4 +73,4 @@ public: #endif // MODULE_REGEX_ENABLED -#endif // LIPO_H +#endif // MACOS_LIPO_H diff --git a/platform/macos/export/macho.h b/platform/macos/export/macho.h index 6cfc3c44f5..7ef0d9067e 100644 --- a/platform/macos/export/macho.h +++ b/platform/macos/export/macho.h @@ -30,8 +30,8 @@ // Mach-O binary object file format parser and editor. -#ifndef MACHO_H -#define MACHO_H +#ifndef MACOS_MACHO_H +#define MACOS_MACHO_H #include "core/crypto/crypto.h" #include "core/crypto/crypto_core.h" @@ -212,4 +212,4 @@ public: #endif // MODULE_REGEX_ENABLED -#endif // MACHO_H +#endif // MACOS_MACHO_H diff --git a/platform/macos/export/plist.h b/platform/macos/export/plist.h index ba9eaec196..79cb928d0a 100644 --- a/platform/macos/export/plist.h +++ b/platform/macos/export/plist.h @@ -30,8 +30,8 @@ // Property list file format (application/x-plist) parser, property list ASN-1 serialization. -#ifndef PLIST_H -#define PLIST_H +#ifndef MACOS_PLIST_H +#define MACOS_PLIST_H #include "core/crypto/crypto_core.h" #include "core/io/file_access.h" @@ -113,4 +113,4 @@ public: #endif // MODULE_REGEX_ENABLED -#endif // PLIST_H +#endif // MACOS_PLIST_H diff --git a/platform/macos/gl_manager_macos_legacy.h b/platform/macos/gl_manager_macos_legacy.h index 9f866f2b32..8752086551 100644 --- a/platform/macos/gl_manager_macos_legacy.h +++ b/platform/macos/gl_manager_macos_legacy.h @@ -94,4 +94,5 @@ public: }; #endif // MACOS_ENABLED && GLES3_ENABLED + #endif // GL_MANAGER_MACOS_LEGACY_H diff --git a/platform/macos/godot_window.h b/platform/macos/godot_window.h index 16ff101142..9fc5599e86 100644 --- a/platform/macos/godot_window.h +++ b/platform/macos/godot_window.h @@ -44,4 +44,4 @@ @end -#endif //GODOT_WINDOW_H +#endif // GODOT_WINDOW_H diff --git a/platform/macos/godot_window_delegate.h b/platform/macos/godot_window_delegate.h index 8a1f681fcd..98c226aa2f 100644 --- a/platform/macos/godot_window_delegate.h +++ b/platform/macos/godot_window_delegate.h @@ -44,4 +44,4 @@ @end -#endif //GODOT_WINDOW_DELEGATE_H +#endif // GODOT_WINDOW_DELEGATE_H diff --git a/platform/macos/macos_terminal_logger.h b/platform/macos/macos_terminal_logger.h index bad2c1d657..a811a5cbaf 100644 --- a/platform/macos/macos_terminal_logger.h +++ b/platform/macos/macos_terminal_logger.h @@ -41,4 +41,5 @@ public: }; #endif // MACOS_ENABLED + #endif // MACOS_TERMINAL_LOGGER_H diff --git a/platform/macos/os_macos.h b/platform/macos/os_macos.h index 914cdb9af7..a6c23ab71e 100644 --- a/platform/macos/os_macos.h +++ b/platform/macos/os_macos.h @@ -117,4 +117,4 @@ public: ~OS_MacOS(); }; -#endif +#endif // OS_MACOS_H diff --git a/platform/macos/vulkan_context_macos.h b/platform/macos/vulkan_context_macos.h index 4dc6a12756..579c42b042 100644 --- a/platform/macos/vulkan_context_macos.h +++ b/platform/macos/vulkan_context_macos.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef VULKAN_DEVICE_MACOS_H -#define VULKAN_DEVICE_MACOS_H +#ifndef VULKAN_CONTEXT_MACOS_H +#define VULKAN_CONTEXT_MACOS_H #include "drivers/vulkan/vulkan_context.h" #import <AppKit/AppKit.h> @@ -44,4 +44,4 @@ public: ~VulkanContextMacOS(); }; -#endif // VULKAN_DEVICE_MACOS_H +#endif // VULKAN_CONTEXT_MACOS_H diff --git a/platform/register_platform_apis.h b/platform/register_platform_apis.h index 8b6d23a7a4..9dd90d9b20 100644 --- a/platform/register_platform_apis.h +++ b/platform/register_platform_apis.h @@ -28,10 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef REGISTER_APIS_H -#define REGISTER_APIS_H +#ifndef REGISTER_PLATFORM_APIS_H +#define REGISTER_PLATFORM_APIS_H void register_platform_apis(); void unregister_platform_apis(); -#endif +#endif // REGISTER_PLATFORM_APIS_H diff --git a/platform/uwp/app_uwp.h b/platform/uwp/app_uwp.h index 9aadcfac75..82ad3ca01a 100644 --- a/platform/uwp/app_uwp.h +++ b/platform/uwp/app_uwp.h @@ -112,4 +112,5 @@ namespace GodotUWP } /* clang-format on */ + #endif // APP_UWP_H diff --git a/platform/uwp/export/app_packager.h b/platform/uwp/export/app_packager.h index dc5a5259ec..effe96ae67 100644 --- a/platform/uwp/export/app_packager.h +++ b/platform/uwp/export/app_packager.h @@ -146,4 +146,4 @@ public: ~AppxPackager(); }; -#endif +#endif // UWP_APP_PACKAGER_H diff --git a/platform/uwp/export/export_plugin.h b/platform/uwp/export/export_plugin.h index d92687075c..02dbcb726b 100644 --- a/platform/uwp/export/export_plugin.h +++ b/platform/uwp/export/export_plugin.h @@ -446,4 +446,4 @@ public: EditorExportPlatformUWP(); }; -#endif +#endif // UWP_EXPORT_PLUGIN_H diff --git a/platform/uwp/joypad_uwp.h b/platform/uwp/joypad_uwp.h index 0869f1961d..81f84152b9 100644 --- a/platform/uwp/joypad_uwp.h +++ b/platform/uwp/joypad_uwp.h @@ -78,4 +78,4 @@ private: void joypad_vibration_stop(int p_device, uint64_t p_timestamp); }; -#endif +#endif // JOYPAD_UWP_H diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 1614bfdcc3..f37759c66f 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -557,6 +557,7 @@ uint64_t OS_UWP::get_ticks_usec() const { void OS_UWP::process_events() { joypad->process_controllers(); process_key_events(); + input->flush_buffered_events(); } void OS_UWP::process_key_events() { diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index bddf63ff18..b9d035ff41 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -252,4 +252,4 @@ public: ~OS_UWP(); }; -#endif +#endif // OS_UWP_H diff --git a/platform/windows/detect.py b/platform/windows/detect.py index b82fe5e7ad..6a7caf4656 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -198,7 +198,6 @@ def configure_msvc(env, manual_msvc_config): elif env["target"] == "debug": env.AppendUnique(CCFLAGS=["/Zi", "/FS", "/Od", "/EHsc"]) # Allow big objects. Only needed for debug, see MinGW branch for rationale. - env.AppendUnique(CCFLAGS=["/bigobj"]) env.Append(LINKFLAGS=["/DEBUG"]) if env["debug_symbols"]: @@ -221,6 +220,10 @@ def configure_msvc(env, manual_msvc_config): env.AppendUnique(CCFLAGS=["/Gd", "/GR", "/nologo"]) env.AppendUnique(CCFLAGS=["/utf-8"]) # Force to use Unicode encoding. env.AppendUnique(CXXFLAGS=["/TP"]) # assume all sources are C++ + # Once it was thought that only debug builds would be too large, + # but this has recently stopped being true. See the mingw function + # for notes on why this shouldn't be enabled for gcc + env.AppendUnique(CCFLAGS=["/bigobj"]) if manual_msvc_config: # should be automatic if SCons found it if os.getenv("WindowsSdkDir") is not None: diff --git a/platform/windows/export/export.h b/platform/windows/export/export.h index 09399f2bee..1054e04b1e 100644 --- a/platform/windows/export/export.h +++ b/platform/windows/export/export.h @@ -33,4 +33,4 @@ void register_windows_exporter(); -#endif +#endif // WINDOWS_EXPORT_H diff --git a/platform/windows/export/export_plugin.cpp b/platform/windows/export/export_plugin.cpp index 16c67345e0..45bfc761fe 100644 --- a/platform/windows/export/export_plugin.cpp +++ b/platform/windows/export/export_plugin.cpp @@ -104,7 +104,7 @@ Error EditorExportPlatformWindows::export_project(const Ref<EditorExportPreset> } String EditorExportPlatformWindows::get_template_file_name(const String &p_target, const String &p_arch) const { - return "windows_" + p_arch + "_" + p_target + ".exe"; + return "windows_" + p_target + "_" + p_arch + ".exe"; } List<String> EditorExportPlatformWindows::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const { diff --git a/platform/windows/export/export_plugin.h b/platform/windows/export/export_plugin.h index 51f98365a9..bb8d6a15f2 100644 --- a/platform/windows/export/export_plugin.h +++ b/platform/windows/export/export_plugin.h @@ -54,4 +54,4 @@ public: virtual Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) override; }; -#endif +#endif // WINDOWS_EXPORT_PLUGIN_H diff --git a/platform/windows/godot.natvis b/platform/windows/godot.natvis index bb855e4ac8..899956d65a 100644 --- a/platform/windows/godot.natvis +++ b/platform/windows/godot.natvis @@ -41,10 +41,12 @@ <DisplayString Condition="type == Variant::AABB">{_data._aabb}</DisplayString> <DisplayString Condition="type == Variant::BASIS">{_data._basis}</DisplayString> <DisplayString Condition="type == Variant::TRANSFORM3D">{_data._transform}</DisplayString> + <DisplayString Condition="type == Variant::PROJECTION">{_data._projection}</DisplayString> <DisplayString Condition="type == Variant::STRING">{*(String *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::VECTOR2">{*(Vector2 *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::RECT2">{*(Rect2 *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::VECTOR3">{*(Vector3 *)_data._mem}</DisplayString> + <DisplayString Condition="type == Variant::VECTOR4">{*(Vector4 *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::PLANE">{*(Plane *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::QUATERNION">{*(Quaternion *)_data._mem}</DisplayString> <DisplayString Condition="type == Variant::COLOR">{*(Color *)_data._mem}</DisplayString> diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 6f414c094c..b5423e62bf 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -951,9 +951,9 @@ String OS_Windows::get_user_data_dir() const { } String OS_Windows::get_unique_id() const { - HW_PROFILE_INFO HwProfInfo; - ERR_FAIL_COND_V(!GetCurrentHwProfile(&HwProfInfo), ""); - return String::utf16((const char16_t *)(HwProfInfo.szHwProfileGuid), HW_PROFILE_GUIDLEN); + HW_PROFILE_INFOA HwProfInfo; + ERR_FAIL_COND_V(!GetCurrentHwProfileA(&HwProfInfo), ""); + return String((HwProfInfo.szHwProfileGuid), HW_PROFILE_GUIDLEN); } bool OS_Windows::_check_internal_feature_support(const String &p_feature) { diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index dc702c66e1..7d2d4ae705 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -185,4 +185,4 @@ public: ~OS_Windows(); }; -#endif +#endif // OS_WINDOWS_H diff --git a/platform/windows/vulkan_context_win.h b/platform/windows/vulkan_context_win.h index e68f0125ca..d5950a129a 100644 --- a/platform/windows/vulkan_context_win.h +++ b/platform/windows/vulkan_context_win.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef VULKAN_DEVICE_WIN_H -#define VULKAN_DEVICE_WIN_H +#ifndef VULKAN_CONTEXT_WIN_H +#define VULKAN_CONTEXT_WIN_H #include "drivers/vulkan/vulkan_context.h" @@ -46,4 +46,4 @@ public: ~VulkanContextWindows(); }; -#endif // VULKAN_DEVICE_WIN_H +#endif // VULKAN_CONTEXT_WIN_H diff --git a/platform/windows/windows_terminal_logger.h b/platform/windows/windows_terminal_logger.h index 1045f12201..348a49c845 100644 --- a/platform/windows/windows_terminal_logger.h +++ b/platform/windows/windows_terminal_logger.h @@ -44,4 +44,4 @@ public: #endif -#endif +#endif // WINDOWS_TERMINAL_LOGGER_H |