Help us keep the site up! Got some change to spare? Why not donate a few bits and buy us a coffee. Image

Gothic 3 .pak extractor

Old posts about game archives and other formats.
Post Reply
Slaii
beginner
Posts: 25
Joined: Sun Jun 25, 2006 7:28 pm

Gothic 3 .pak extractor

Post by Slaii »

Hi
Especially Mr. Mouse :wink:

I would like to extract files from my Gothic 3 game, but I cannot open .pak file
Can anybody help me?
some .pak can be ound here:

Code: Select all

http://rapidshare.de/files/36954338/Strings.pak.html
It is strings.pak:: 2.5MB

I looked at it in hex and it looks similiar to some archives I saw before, but I duno.
See attachment
You do not have the required permissions to view the files attached to this post.
john_doe

Post by john_doe »

Already done :)
http://gamefileformats.the-underdogs.in ... orer10.zip
The user interface is in German but it should work without knowing the language.

@MrMouse:
These are the specs, copied from another forum:

Code: Select all

////////////////////////////////////////////////////////////////////////////////
//
//  Gothic3 PAK file format specs.
//  (all values are little-endian)
//  Copyright (c) 2006 Nico Bendlin <nicode@gmx.net>
//
//  +----------------+
//  |  file header   |
//  +----------------+
//  |   file data    |
//  +----------------+
//  |    unknown     |
//  | (not present)  |
//  +----------------+
//  |   file table   |
//  +----------------+
//  |    unknown     |
//  | (empty string) |
//  +----------------+
//
////////////////////////////////////////////////////////////////////////////////

//
// Fix-sized file header
//
struct G3PakFileHeader {
    UInt32  Unknown0;   // Always 0x00000000. Might be part of the signature.
    UInt32  Signature;  // Always 0x30563347 ('G3V0').
    UInt64  Unknown1;   // Always 0x0000000000000000. Interpretation unknown.
    UInt64  Unknown2;   // Always 0x100067F800000001. Might be a UInt16[4] version (1.0.26616.16).
    UInt64  Unknown3;   // Always the same value as FileTable. Might be a file offset to an (currently) unused data block.
    UInt64  FileTable;  // File offset to the root entry of the file table.
    UInt64  Unknown4;   // File offset to an (currently) unused data block after the file table. Might be a comment string.
};

//
// String data (e.g. file names)
//
struct G3PakFileString {
    UInt32  Length;
    UInt8   Data[Length + 1];  // ANSI text. Only present if Length > 0. [Length] must be '\0'.
};

//
// File table entries (directories and files)
//
struct G3PakFileTableEntry {
    //
    // Fix-sized header for all entries
    //
    struct {
        UInt64  FileTime1;   // Windows FILETIME. Might be the CreationTime.
        UInt64  FileTime2;   // Windows FILETIME. Might be the LastAccessTime.
        UInt64  FileTime3;   // Windows FILETIME. Might be the LastWriteTime.
        UInt64  Unknown0;    // Always 0x0000000000000000. Interpretation unknown.
        UInt32  Attributes;  // Windows FILE_ATTRIBUTE_Xxx (other bits should be ignored).
    };
    //
    // Dynamically sized structures for directories and files
    //
    union {
        //
        // Directory entry (FILE_ATTRIBUTE_DIRECTORY in Attributes)
        //
        struct {
            G3PakFileString     FileName;     // String includes the relativ path to the root (path separator is '/') and ends with '/'.
            UInt32              DirCount;     // Count of directory entries that follow (directly after this count).
            G3PakFileTableEntry [DirCount];
            UInt32              FileCount;    // Count of file entries that follow (directly after this count).
            G3PakFileTableEntry [FileCount];
        };
        //
        // File entry (Attributes can include FILE_ATTRIBUTE_COMPRESSED)
        //
        struct {
            UInt64          Offset;    // File offset to raw data.
            UInt64          Bytes;     // Size of raw data in Bytes.
            UInt64          Size;      // Size of file data (uncompressed).
            UInt32          Unknown1;  // Always 0x00000000. Interpretation unknown.
            UInt32          Unknown2;  // 0x00000000 if uncompressed, 0x00000002 if compressed with ZLib (default compression level).
            G3PakFileString FileName;  // String includes the relativ path to the root (path separator is '/').
            G3PakFileString Comment;   // Includes the full native file name and path of the source file.
        };
    };
};
User avatar
lionheartuk
double-veteran
double-veteran
Posts: 746
Joined: Tue May 16, 2006 10:55 pm
Location: Everywhere
Has thanked: 34 times
Been thanked: 38 times

Post by lionheartuk »

john_doe wrote:Already done :)
http://gamefileformats.the-underdogs.in ... orer10.zip
The user interface is in German but it should work without knowing the language.

@MrMouse:
These are the specs, copied from another forum:
nice man.
nice
what forum was it btw?
care to provide a link?
Slaii
beginner
Posts: 25
Joined: Sun Jun 25, 2006 7:28 pm

extractor

Post by Slaii »

Thanks, it works....
john_doe

Post by john_doe »

lionheartuk wrote:what forum was it btw?
care to provide a link?
Here: http://www.worldofgothic.de/foren/?go=index
It's in German, though.

I made the tool and NicoDE gave me his specs since I was missing some stuff (actually just the date/time fields :))
Slaii
beginner
Posts: 25
Joined: Sun Jun 25, 2006 7:28 pm

Gothic 3 packer

Post by Slaii »

And any tool for packing back the files?

I want to make a mod and I need to pack files back (or I should leave them in directory?)
john_doe

Post by john_doe »

Yes, NicoDE made two command line tools, one for extracting and one for creating new archives.
You can get his tool from here: http://forum.worldofplayers.de/forum/sh ... ost2487521
You need to be registered, though.
User avatar
Savage
VIP member
VIP member
Posts: 559
Joined: Sun Apr 17, 2005 11:00 am
Has thanked: 16 times
Been thanked: 18 times

Post by Savage »

The .pak it's a normal zlib no?
User avatar
john_doe
VIP member
VIP member
Posts: 80
Joined: Sat Oct 21, 2006 2:25 pm
Been thanked: 1 time

Post by john_doe »

Yes, it uses the normal zlib library.
Slaii
beginner
Posts: 25
Joined: Sun Jun 25, 2006 7:28 pm

packer

Post by Slaii »

Great, thanks............
Post Reply