summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/config/project_settings.cpp4
-rw-r--r--core/io/zip_io.cpp50
-rw-r--r--core/io/zip_io.h7
3 files changed, 56 insertions, 5 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index 2b18319a25..cb25dc9ebf 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -628,7 +628,7 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bool p_upwards, bool p_ignore_override) {
Error err = _setup(p_path, p_main_pack, p_upwards, p_ignore_override);
- if (err == OK) {
+ if (err == OK && !p_ignore_override) {
String custom_settings = GLOBAL_GET("application/config/project_settings_override");
if (!custom_settings.is_empty()) {
_load_settings_text(custom_settings);
@@ -1207,6 +1207,7 @@ void ProjectSettings::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_order", "name"), &ProjectSettings::get_order);
ClassDB::bind_method(D_METHOD("set_initial_value", "name", "value"), &ProjectSettings::set_initial_value);
ClassDB::bind_method(D_METHOD("set_as_basic", "name", "basic"), &ProjectSettings::set_as_basic);
+ ClassDB::bind_method(D_METHOD("set_as_internal", "name", "internal"), &ProjectSettings::set_as_internal);
ClassDB::bind_method(D_METHOD("add_property_info", "hint"), &ProjectSettings::_add_property_info_bind);
ClassDB::bind_method(D_METHOD("set_restart_if_changed", "name", "restart"), &ProjectSettings::set_restart_if_changed);
ClassDB::bind_method(D_METHOD("clear", "name"), &ProjectSettings::clear);
@@ -1345,6 +1346,7 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF("rendering/rendering_device/staging_buffer/block_size_kb", 256);
GLOBAL_DEF("rendering/rendering_device/staging_buffer/max_size_mb", 128);
GLOBAL_DEF("rendering/rendering_device/staging_buffer/texture_upload_region_size_px", 64);
+ GLOBAL_DEF("rendering/rendering_device/pipeline_cache/save_chunk_size_mb", 3.0);
GLOBAL_DEF("rendering/rendering_device/vulkan/max_descriptors_per_pool", 64);
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Linear Mipmap,Nearest Mipmap"), 1);
diff --git a/core/io/zip_io.cpp b/core/io/zip_io.cpp
index 7f60039578..a0e6bd62de 100644
--- a/core/io/zip_io.cpp
+++ b/core/io/zip_io.cpp
@@ -30,6 +30,48 @@
#include "zip_io.h"
+#include "core/templates/local_vector.h"
+
+int godot_unzip_get_current_file_info(unzFile p_zip_file, unz_file_info64 &r_file_info, String &r_filepath) {
+ const uLong short_file_path_buffer_size = 16384ul;
+ char short_file_path_buffer[short_file_path_buffer_size];
+
+ int err = unzGetCurrentFileInfo64(p_zip_file, &r_file_info, short_file_path_buffer, short_file_path_buffer_size, nullptr, 0, nullptr, 0);
+ if (unlikely((err != UNZ_OK) || (r_file_info.size_filename > short_file_path_buffer_size))) {
+ LocalVector<char> long_file_path_buffer;
+ long_file_path_buffer.resize(r_file_info.size_filename);
+
+ err = unzGetCurrentFileInfo64(p_zip_file, &r_file_info, long_file_path_buffer.ptr(), long_file_path_buffer.size(), nullptr, 0, nullptr, 0);
+ if (err != UNZ_OK) {
+ return err;
+ }
+ r_filepath = String::utf8(long_file_path_buffer.ptr(), r_file_info.size_filename);
+ } else {
+ r_filepath = String::utf8(short_file_path_buffer, r_file_info.size_filename);
+ }
+
+ return err;
+}
+
+int godot_unzip_locate_file(unzFile p_zip_file, String p_filepath, bool p_case_sensitive) {
+ int err = unzGoToFirstFile(p_zip_file);
+ while (err == UNZ_OK) {
+ unz_file_info64 current_file_info;
+ String current_filepath;
+ err = godot_unzip_get_current_file_info(p_zip_file, current_file_info, current_filepath);
+ if (err == UNZ_OK) {
+ bool filepaths_are_equal = p_case_sensitive ? (p_filepath == current_filepath) : (p_filepath.nocasecmp_to(current_filepath) == 0);
+ if (filepaths_are_equal) {
+ return UNZ_OK;
+ }
+ err = unzGoToNextFile(p_zip_file);
+ }
+ }
+ return err;
+}
+
+//
+
void *zipio_open(voidpf opaque, const char *p_fname, int mode) {
Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(opaque);
ERR_FAIL_COND_V(fa == nullptr, nullptr);
@@ -38,17 +80,17 @@ void *zipio_open(voidpf opaque, const char *p_fname, int mode) {
fname.parse_utf8(p_fname);
int file_access_mode = 0;
- if (mode & ZLIB_FILEFUNC_MODE_WRITE) {
- file_access_mode |= FileAccess::WRITE;
- }
if (mode & ZLIB_FILEFUNC_MODE_READ) {
file_access_mode |= FileAccess::READ;
}
+ if (mode & ZLIB_FILEFUNC_MODE_WRITE) {
+ file_access_mode |= FileAccess::WRITE;
+ }
if (mode & ZLIB_FILEFUNC_MODE_CREATE) {
file_access_mode |= FileAccess::WRITE_READ;
}
- (*fa) = FileAccess::open(fname, file_access_mode);
+ (*fa) = FileAccess::open(fname, file_access_mode);
if (fa->is_null()) {
return nullptr;
}
diff --git a/core/io/zip_io.h b/core/io/zip_io.h
index 094d490bcf..c59b981373 100644
--- a/core/io/zip_io.h
+++ b/core/io/zip_io.h
@@ -39,6 +39,13 @@
#include "thirdparty/minizip/unzip.h"
#include "thirdparty/minizip/zip.h"
+// Get the current file info and safely convert the full filepath to a String.
+int godot_unzip_get_current_file_info(unzFile p_zip_file, unz_file_info64 &r_file_info, String &r_filepath);
+// Try to locate the file in the archive specified by the filepath (works with large paths and Unicode).
+int godot_unzip_locate_file(unzFile p_zip_file, String p_filepath, bool p_case_sensitive = true);
+
+//
+
void *zipio_open(voidpf opaque, const char *p_fname, int mode);
uLong zipio_read(voidpf opaque, voidpf stream, void *buf, uLong size);
uLong zipio_write(voidpf opaque, voidpf stream, const void *buf, uLong size);