PixelJunk Eden data extractor

Recently Q-Games ported one of their games – PixelJunk Eden to Windows. Actually it’s their first Windows release. From tech perspective it’s not as impressive as PixelJunk Shooter series, but still it was quite interesting to poke around this game’s files. Unfortunately game data was stored in custom format and encrypted. I wonder why people waste time to encrypt game data.

I tried to reverse engineer data files and wrote a simple extractor program. You can download sources here. The rest of the post contains information about encryption and file formats.

Files are encrypted using a homemade xor encryption scheme:

int seed = fileSize + 0x006FD37D;
for ( unsigned i = 0; i < fileSize; ++i )
    int const xorKey = seed * ( seed * seed * 0x73 - 0x1B ) + 0x0D;
    fileByteArr[ i ] ^= xorKey;

Game data is stored in lump_x_x.pak files with description in the lump.idx file. Lump.idx consits of 1 header, multiple lump_x_x.pak descriptors and multiple packed file descriptors. All files (*.idx and *.pak) are encrypted using the mentioned above xor scheme.

lump.idx header:

struct IndexHeader
    char m_magic[ 4 ]; // "PACK"
    unsigned m_unknown0;
    unsigned m_unknown1;
    unsigned m_packedFileMaxID; // packed file num - 1
    unsigned m_lumpFileMaxSize;
    unsigned m_lumpFileNum;
    char m_align[ 230 ];

lump.idx file descriptors of lump_x_x.pak files:

struct IndexLumpDesc
    unsigned m_unknown;
    unsigned m_lumpSize;
    unsigned char m_lumpPartID;
    unsigned char m_lumpID;
    char m_align[ 2 ];

lump.idx file descriptors of packed files:

struct IndexFileDesc
    char m_filename[ 120 ];
    unsigned m_offset;
    unsigned m_size;

lump_x_x.pak files contain packed files at specified offsets. Every packed file is stored at offset aligned to 128 bytes.

This entry was posted in C++. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s