diff options
Diffstat (limited to 'platform')
| -rw-r--r-- | platform/android/java/app/config.gradle | 2 | ||||
| -rw-r--r-- | platform/linuxbsd/detect.py | 3 | ||||
| -rw-r--r-- | platform/linuxbsd/x11/display_server_x11.cpp | 5 | ||||
| -rw-r--r-- | platform/macos/detect.py | 8 | ||||
| -rw-r--r-- | platform/macos/display_server_macos.mm | 5 | ||||
| -rw-r--r-- | platform/macos/godot_content_view.mm | 27 | ||||
| -rw-r--r-- | platform/web/display_server_web.cpp | 7 | ||||
| -rw-r--r-- | platform/windows/display_server_windows.cpp | 5 | ||||
| -rw-r--r-- | platform/windows/os_windows.cpp | 83 | ||||
| -rw-r--r-- | platform/windows/os_windows.h | 3 |
10 files changed, 121 insertions, 27 deletions
diff --git a/platform/android/java/app/config.gradle b/platform/android/java/app/config.gradle index a6fa2271ee..4bac6c814a 100644 --- a/platform/android/java/app/config.gradle +++ b/platform/android/java/app/config.gradle @@ -1,5 +1,5 @@ ext.versions = [ - androidGradlePlugin: '7.3.0', + androidGradlePlugin: '7.2.1', compileSdk : 33, // Also update 'platform/android/export/export_plugin.cpp#OPENGL_MIN_SDK_VERSION' minSdk : 21, diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index 0bebd29f89..dadc03685b 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -463,6 +463,9 @@ def configure(env: "Environment"): else: env.Append(LINKFLAGS=["-T", "platform/linuxbsd/pck_embed.legacy.ld"]) + if platform.system() == "FreeBSD": + env.Append(LINKFLAGS=["-lkvm"]) + ## Cross-compilation # TODO: Support cross-compilation on architectures other than x86. host_is_64_bit = sys.maxsize > 2**32 diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index 9d9d4ae43e..ac4fbe2068 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -2671,6 +2671,11 @@ void DisplayServerX11::cursor_set_custom_image(const Ref<Resource> &p_cursor, Cu Ref<Image> image = texture->get_image(); ERR_FAIL_COND(!image.is_valid()); + if (image->is_compressed()) { + image = image->duplicate(true); + Error err = image->decompress(); + ERR_FAIL_COND_MSG(err != OK, "Couldn't decompress VRAM-compressed custom mouse cursor image. Switch to a lossless compression mode in the Import dock."); + } // Create the cursor structure XcursorImage *cursor_image = XcursorImageCreate(texture_size.width, texture_size.height); diff --git a/platform/macos/detect.py b/platform/macos/detect.py index 7c63fe9211..1fefdb3c68 100644 --- a/platform/macos/detect.py +++ b/platform/macos/detect.py @@ -118,10 +118,10 @@ def configure(env: "Environment"): env.Append(CCFLAGS=["-arch", "arm64", "-mmacosx-version-min=11.0"]) env.Append(LINKFLAGS=["-arch", "arm64", "-mmacosx-version-min=11.0"]) elif env["arch"] == "x86_64": - print("Building for macOS 10.12+.") - env.Append(ASFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"]) - env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"]) - env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"]) + print("Building for macOS 10.13+.") + env.Append(ASFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.13"]) + env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.13"]) + env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.13"]) env.Append(CCFLAGS=["-fobjc-arc"]) diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 1bff23f227..5a7c309448 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -3300,6 +3300,11 @@ void DisplayServerMacOS::cursor_set_custom_image(const Ref<Resource> &p_cursor, Ref<Image> image = texture->get_image(); ERR_FAIL_COND(!image.is_valid()); + if (image->is_compressed()) { + image = image->duplicate(true); + Error err = image->decompress(); + ERR_FAIL_COND_MSG(err != OK, "Couldn't decompress VRAM-compressed custom mouse cursor image. Switch to a lossless compression mode in the Import dock."); + } NSBitmapImageRep *imgrep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nullptr diff --git a/platform/macos/godot_content_view.mm b/platform/macos/godot_content_view.mm index 485f80a22e..9f5bb2ef5c 100644 --- a/platform/macos/godot_content_view.mm +++ b/platform/macos/godot_content_view.mm @@ -115,13 +115,7 @@ self.layerContentsRedrawPolicy = NSViewLayerContentsRedrawDuringViewResize; self.layerContentsPlacement = NSViewLayerContentsPlacementTopLeft; - if (@available(macOS 10.13, *)) { - [self registerForDraggedTypes:[NSArray arrayWithObject:NSPasteboardTypeFileURL]]; -#if !defined(__aarch64__) // Do not build deprectead 10.13 code on ARM. - } else { - [self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]]; -#endif - } + [self registerForDraggedTypes:[NSArray arrayWithObject:NSPasteboardTypeFileURL]]; marked_text = [[NSMutableAttributedString alloc] init]; return self; } @@ -321,20 +315,11 @@ Vector<String> files; NSPasteboard *pboard = [sender draggingPasteboard]; - if (@available(macOS 10.13, *)) { - NSArray *items = pboard.pasteboardItems; - for (NSPasteboardItem *item in items) { - NSString *url = [item stringForType:NSPasteboardTypeFileURL]; - NSString *file = [NSURL URLWithString:url].path; - files.push_back(String::utf8([file UTF8String])); - } -#if !defined(__aarch64__) // Do not build deprectead 10.13 code on ARM. - } else { - NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType]; - for (NSString *file in filenames) { - files.push_back(String::utf8([file UTF8String])); - } -#endif + NSArray *items = pboard.pasteboardItems; + for (NSPasteboardItem *item in items) { + NSString *url = [item stringForType:NSPasteboardTypeFileURL]; + NSString *file = [NSURL URLWithString:url].path; + files.push_back(String::utf8([file UTF8String])); } Variant v = files; diff --git a/platform/web/display_server_web.cpp b/platform/web/display_server_web.cpp index da55e8560a..28f1914c37 100644 --- a/platform/web/display_server_web.cpp +++ b/platform/web/display_server_web.cpp @@ -426,7 +426,12 @@ void DisplayServerWeb::cursor_set_custom_image(const Ref<Resource> &p_cursor, Cu ERR_FAIL_COND(!image.is_valid()); - image = image->duplicate(); + image = image->duplicate(true); + + if (image->is_compressed()) { + Error err = image->decompress(); + ERR_FAIL_COND_MSG(err != OK, "Couldn't decompress VRAM-compressed custom mouse cursor image. Switch to a lossless compression mode in the Import dock."); + } if (atlas_texture.is_valid()) { image->crop_from_point( diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index e910fd471f..02bb30ed38 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -1742,6 +1742,11 @@ void DisplayServerWindows::cursor_set_custom_image(const Ref<Resource> &p_cursor Ref<Image> image = texture->get_image(); ERR_FAIL_COND(!image.is_valid()); + if (image->is_compressed()) { + image = image->duplicate(true); + Error err = image->decompress(); + ERR_FAIL_COND_MSG(err != OK, "Couldn't decompress VRAM-compressed custom mouse cursor image. Switch to a lossless compression mode in the Import dock."); + } UINT image_size = texture_size.width * texture_size.height; diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 456240ba2d..5a749a9d6f 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -51,6 +51,7 @@ #include <direct.h> #include <knownfolders.h> #include <process.h> +#include <psapi.h> #include <regstr.h> #include <shlobj.h> #include <wbemcli.h> @@ -683,6 +684,43 @@ static void _append_to_pipe(char *p_bytes, int p_size, String *r_pipe, Mutex *p_ } } +Dictionary OS_Windows::get_memory_info() const { + Dictionary meminfo; + + meminfo["physical"] = -1; + meminfo["free"] = -1; + meminfo["available"] = -1; + meminfo["stack"] = -1; + + PERFORMANCE_INFORMATION pref_info; + pref_info.cb = sizeof(pref_info); + GetPerformanceInfo(&pref_info, sizeof(pref_info)); + + typedef void(WINAPI * PGetCurrentThreadStackLimits)(PULONG_PTR, PULONG_PTR); + PGetCurrentThreadStackLimits GetCurrentThreadStackLimits = (PGetCurrentThreadStackLimits)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetCurrentThreadStackLimits"); + + ULONG_PTR LowLimit = 0; + ULONG_PTR HighLimit = 0; + if (GetCurrentThreadStackLimits) { + GetCurrentThreadStackLimits(&LowLimit, &HighLimit); + } + + if (pref_info.PhysicalTotal * pref_info.PageSize != 0) { + meminfo["physical"] = pref_info.PhysicalTotal * pref_info.PageSize; + } + if (pref_info.PhysicalAvailable * pref_info.PageSize != 0) { + meminfo["free"] = pref_info.PhysicalAvailable * pref_info.PageSize; + } + if (pref_info.CommitLimit * pref_info.PageSize != 0) { + meminfo["available"] = pref_info.CommitLimit * pref_info.PageSize; + } + if (HighLimit - LowLimit != 0) { + meminfo["stack"] = HighLimit - LowLimit; + } + + return meminfo; +} + Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex, bool p_open_console) { String path = p_path.replace("/", "\\"); String command = _quote_command_line_argument(path); @@ -1313,6 +1351,51 @@ Error OS_Windows::shell_open(String p_uri) { } } +Error OS_Windows::shell_show_in_file_manager(String p_path, bool p_open_folder) { + p_path = p_path.trim_suffix("file://"); + + bool open_folder = false; + if (DirAccess::dir_exists_absolute(p_path) && p_open_folder) { + open_folder = true; + } + + if (p_path.begins_with("\"")) { + p_path = String("\"") + p_path; + } + if (p_path.ends_with("\"")) { + p_path = p_path + String("\""); + } + p_path = p_path.replace("/", "\\"); + + INT_PTR ret = OK; + if (open_folder) { + ret = (INT_PTR)ShellExecuteW(nullptr, nullptr, L"explorer.exe", LPCWSTR(p_path.utf16().get_data()), nullptr, SW_SHOWNORMAL); + } else { + ret = (INT_PTR)ShellExecuteW(nullptr, nullptr, L"explorer.exe", LPCWSTR((String("/select,") + p_path).utf16().get_data()), nullptr, SW_SHOWNORMAL); + } + + if (ret > 32) { + return OK; + } else { + switch (ret) { + case ERROR_FILE_NOT_FOUND: + case SE_ERR_DLLNOTFOUND: + return ERR_FILE_NOT_FOUND; + case ERROR_PATH_NOT_FOUND: + return ERR_FILE_BAD_PATH; + case ERROR_BAD_FORMAT: + return ERR_FILE_CORRUPT; + case SE_ERR_ACCESSDENIED: + return ERR_UNAUTHORIZED; + case 0: + case SE_ERR_OOM: + return ERR_OUT_OF_MEMORY; + default: + return FAILED; + } + } +} + String OS_Windows::get_locale() const { const _WinLocale *wl = &_win_locales[0]; diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 05110c2614..960c3f30a9 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -178,6 +178,8 @@ public: virtual void delay_usec(uint32_t p_usec) const override; virtual uint64_t get_ticks_usec() const override; + virtual Dictionary get_memory_info() const override; + virtual Error execute(const String &p_path, const List<String> &p_arguments, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr, bool p_open_console = false) override; virtual Error create_process(const String &p_path, const List<String> &p_arguments, ProcessID *r_child_id = nullptr, bool p_open_console = false) override; virtual Error kill(const ProcessID &p_pid) override; @@ -212,6 +214,7 @@ public: virtual String get_unique_id() const override; virtual Error shell_open(String p_uri) override; + virtual Error shell_show_in_file_manager(String p_path, bool p_open_folder) override; void run(); |
