Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/io/file_access_pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files,
// Search for the header at the start offset - standalone PCK file.
f->seek(p_offset);
uint32_t magic = f->get_32();
if (magic == PACK_HEADER_MAGIC) {
if (magic == PACK_HEADER_MAGIC || magic == PACK_HEADER_ALTER) {
pck_header_found = true;
}

Expand All @@ -213,7 +213,7 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files,
for (int i = 0; i < 8; i++) {
f->seek(pck_off);
magic = f->get_32();
if (magic == PACK_HEADER_MAGIC) {
if (magic == PACK_HEADER_MAGIC || magic == PACK_HEADER_ALTER) {
#ifdef DEBUG_ENABLED
print_verbose("PCK header found in executable pck section, loading from offset 0x" + String::num_int64(pck_off - 4, 16));
#endif
Expand All @@ -236,12 +236,12 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files,
f->seek(f->get_position() - 4);
magic = f->get_32();

if (magic == PACK_HEADER_MAGIC) {
if (magic == PACK_HEADER_MAGIC || magic == PACK_HEADER_ALTER) {
f->seek(f->get_position() - 12);
uint64_t ds = f->get_64();
f->seek(f->get_position() - ds - 8);
magic = f->get_32();
if (magic == PACK_HEADER_MAGIC) {
if (magic == PACK_HEADER_MAGIC || magic == PACK_HEADER_ALTER) {
#ifdef DEBUG_ENABLED
print_verbose("PCK header found at the end of executable, loading from offset 0x" + String::num_int64(f->get_position() - 4, 16));
#endif
Expand Down
1 change: 1 addition & 0 deletions core/io/file_access_pack.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

// Godot's packed file magic header ("GDPC" in ASCII).
#define PACK_HEADER_MAGIC 0x43504447
#define PACK_HEADER_ALTER 0x25110501
// The current packed file format version number.
#define PACK_FORMAT_VERSION 2

Expand Down
2 changes: 1 addition & 1 deletion core/io/pck_packer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Error PCKPacker::pck_start(const String &p_pck_path, int p_alignment, const Stri

alignment = p_alignment;

file->store_32(PACK_HEADER_MAGIC);
file->store_32(PACK_HEADER_ALTER);
file->store_32(PACK_FORMAT_VERSION);
file->store_32(GODOT_VERSION_MAJOR);
file->store_32(GODOT_VERSION_MINOR);
Expand Down
4 changes: 2 additions & 2 deletions editor/export/editor_export_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1952,7 +1952,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, b

int64_t pck_start_pos = f->get_position();

f->store_32(PACK_HEADER_MAGIC);
f->store_32(PACK_HEADER_ALTER);
f->store_32(PACK_FORMAT_VERSION);
f->store_32(GODOT_VERSION_MAJOR);
f->store_32(GODOT_VERSION_MINOR);
Expand Down Expand Up @@ -2121,7 +2121,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, b

uint64_t pck_size = f->get_position() - pck_start_pos;
f->store_64(pck_size);
f->store_32(PACK_HEADER_MAGIC);
f->store_32(PACK_HEADER_ALTER);

if (r_embedded_size) {
*r_embedded_size = f->get_position() - embed_pos;
Expand Down