The Forum is up for sale: XeNTaX Forum looking for new owner

Surviving Mars .hpk

The Original Forum. Game archives, full of resources. How to open them? Get help here.
Post Reply
hhrhhr
advanced
Posts: 62
Joined: Thu Mar 18, 2010 7:02 am
Has thanked: 1 time
Been thanked: 20 times

Surviving Mars .hpk

Post by hhrhhr »

hpk format:

Code: Select all

// header, 36 bytes
char magick[4]; // "BPUL"
uint unk1;      // 36 (header size or data offset??)
uint unk2[5];   // 1, -1, 0, 0, 1

uint entry_offset;  // absolute
uint entry_size;    // entry_offset + entry_size = EOF

// data
char filedata[xxx];

// file desc
struct dir_entry[xxx] {
    uint ptr;   // entry[ptr] -> next item
    uint attr;  // 0 - directory, 1 - file
    short sz;
    char name[sz]   // name of current dir or file
}

// entry_offset
struct entry[xxx] {   // xxx = entry_size >> 3
    uint offset;        // absolute, pointer to dir_entry (included dir, file or filedata)
    uint size;          // size of dir_entry or zsize of file
}
LZ4 packed file:

Code: Select all

char magik[4];          // "LZ4\x20"
uint size;              // unpacked size
uint block_size;        // 2^17
uint h_size;            // header size; if size==0, then EOF here
uint chunk_offset[xxx]; // xxx = (h_size - 16) >> 2, absolute offsets of chunk begins

struct chunk[xxx] {     // offset = h_size
    char lz_data[];     // full LZ4 block (unpacked == block_size)
}
char lz_data_tail[];    // partial LZ4 block (unpacked < block_size)
for unpack used LZ4_decompress_safe (src, dst, zsize, size). if (entry.size == size - h_size) then file content is not packed.

implementation in Lua here.
merlinsvk
ultra-veteran
ultra-veteran
Posts: 411
Joined: Mon Oct 27, 2008 12:11 am
Location: Slovakia
Has thanked: 35 times
Been thanked: 121 times

Re: Surviving Mars .hpk

Post by merlinsvk »

Or you can use HPK Archiver, modded by Atom0s

https://github.com/atom0s/HpkArchiver

Win build:
HPK_archiver_1_0_14_mod.7z
You do not have the required permissions to view the files attached to this post.
Post Reply