From bf8ec7b81b33b81e8f2fc61143ace32a29be4130 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Sat, 10 Feb 2024 21:58:08 +0200 Subject: [Export] Use relative file base offset for embedded PCK. --- core/io/file_access_pack.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'core/io/file_access_pack.cpp') diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 7595bc41f5..991b94db38 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -196,6 +196,8 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files, return false; } + int64_t pck_start_pos = f->get_position() - 4; + uint32_t version = f->get_32(); uint32_t ver_major = f->get_32(); uint32_t ver_minor = f->get_32(); @@ -208,6 +210,7 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files, uint64_t file_base = f->get_64(); bool enc_directory = (pack_flags & PACK_DIR_ENCRYPTED); + bool rel_filebase = (pack_flags & PACK_REL_FILEBASE); for (int i = 0; i < 16; i++) { //reserved @@ -216,6 +219,10 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files, int file_count = f->get_32(); + if (rel_filebase) { + file_base += pck_start_pos; + } + if (enc_directory) { Ref fae; fae.instantiate(); -- cgit v1.2.3