Gildor's Forums

Author Topic: Understanding PAK files.  (Read 2485 times)
s1l0x
Newbie
*
Posts: 2


View Profile
Understanding PAK files.
« on: January 22, 2019, 02:49 »

Hello! I am currently starting a new project for myself, an application that can automatically run through pak files and extract all the files. I understand that this can already be done with Umodel and such but I'm trying to spend some time and understand pak files. My main request here was if there are any resources that are available that may be able to help, or should I just begin by analyzing source code. Any information would be helpful!
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7971



View Profile WWW
Re: Understanding PAK files.
« Reply #1 on: January 22, 2019, 08:24 »

Hi. Read UnrealPak project of UE4 source code.
Logged
espnsThirtyForThirty
Newbie
*
Posts: 7


View Profile
Re: Understanding PAK files.
« Reply #2 on: December 22, 2021, 23:26 »

I was wondering what's in the name table (and similarly the import and export tables) in UnPackage.cpp. I know that this probably sounds dumb, but I just found where in the code the name table was finished loading at (or at least, where it appears to me that it's finished loading) and I printed out the contents. It looks like a bunch of non ascii characters, so I was just wondering what's in there and how it's supposed to be interpreted.

I was also wondering how the pak structure changes between engine versions. I know you said to check out the pack project in UE4 source, so I was wondering if it was changed at all from previous versions (I'm interested in working with Bioshock and Bioshock Infinite, which I know were modified versions of UE2 and 3 respectively). Finally, I was wondering where this project is found/ which files it encompasses. I've searched the directories of my UE4 source and found the files PakFileUtilities.cpp (and .h) and PakFileDerivedDataBackend.cpp (and .h) as well as a few C# files but I'm very new to working on Unreal in this way and am unsure where to start.
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7971



View Profile WWW
Re: Understanding PAK files.
« Reply #3 on: December 22, 2021, 23:40 »

I was wondering what's in the name table (and similarly the import and export tables) in UnPackage.cpp. I know that this probably sounds dumb, but I just found where in the code the name table was finished loading at (or at least, where it appears to me that it's finished loading) and I printed out the contents. It looks like a bunch of non ascii characters, so I was just wondering what's in there and how it's supposed to be interpreted.
Name table is not a part of pak, it's part of package (uasset). It contains strings which are used in the engine's FName objects, which are used nearly everywhere. It is typically ASCII, but some Asian developers seems has people who doesn't know English, so they use national language there. UModel doesn't support Unicode anywhere, so characters are replaced.

Quote
I was also wondering how the pak structure changes between engine versions. I know you said to check out the pack project in UE4 source, so I was wondering if it was changed at all from previous versions (I'm interested in working with Bioshock and Bioshock Infinite, which I know were modified versions of UE2 and 3 respectively). Finally, I was wondering where this project is found/ which files it encompasses. I've searched the directories of my UE4 source and found the files PakFileUtilities.cpp (and .h) and PakFileDerivedDataBackend.cpp (and .h) as well as a few C# files but I'm very new to working on Unreal in this way and am unsure where to start.
For pak file versions - see PakFile_Version_... constants. In UModel I've added comments saying which UE4 version received that update.

Bioshock is not using pak files, so if you're interested only in this game, you have no point to read UE4 pak file code.

For Bioshock-specific code, you may search for "Bioshock" string everywhere in UModel/Unreal directory, to see how it differs from original UE2/UE3. Actually, for Bioshock 1 and 2, there are a lot of changes, and much less for Bioshock 3.
Logged
espnsThirtyForThirty
Newbie
*
Posts: 7


View Profile
Re: Understanding PAK files.
« Reply #4 on: December 23, 2021, 00:16 »

Thanks for such a quick reply! I'm currently going through the project looking at all of the differences. So is it just that the first two BioShock games don't use pak files, or does 3 also not use pak files? I'm curious, because if they don't use pak files, do they also use something different than uasset and umap? And if so how would I go about finding that data? I'm interested in making a simple decooker which really only places assets in a map according to their specified transformations (just location rotation and scale for available objects) for bioshock 1 or 3.
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7971



View Profile WWW
Re: Understanding PAK files.
« Reply #5 on: December 23, 2021, 00:27 »

Pak files appeared in UE4. All older engine versions used plain package files store in OS file system. They name different file extensions - upk in UE3, uasset in UE4, and lots of different extensions in UE1 and UE2 - just check "PackageExtensions" array in GameFileSystem.cpp. Internally they're all "packages" - has UnPackage for loading them in UModel (different name in UE source code - ULinkerLoad in UE1-UE3, FLinkerLoad in recent UE4).
Logged
Jump to:  

Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Leviathan design by Bloc | XHTML | CSS