Deserializing Unreal Packages - Data Structures
November 03, 2012In this article I will be explaining the data structures used in Unreal package files such as .upk, and .u files. The structures explained here are only for the Unreal Engine 3. Data Structures are a little different in Unreal Engine 2, and 1.
String
Strings in the Unreal Engine are rather simple, for each string there will be a integer of 32 bits representing the length of the string.
A negative length indicates that the string is written in Unicode.
The structure is as follows:
Name | Type |
Length | 32Bit Signed Integer |
Text | ASCII/Unicode for each Length unit |
Array
Arrays in the Unreal Engine are just as simple as strings. An array begins with a 32bit integer representing the count. The kind of data followed has to be assumed, it is not described in the file.
The structure is as follows:
Name | Type |
Count | 32Bit Integer |
Object | Object for each Count unit |
Map
Maps in the Unreal Engine are just as simple as arrays except they have two properties for each count unit.
The structure is as follows:
Name | Type |
Count | 32Bit Integer |
Name | Name for each Count unit |
Object | Object for each Count unit |
Name Index
Name indexes are simple integers referencing an index into the Names Table(more later on this). A name index consists of two 32bit integers. The first one represents an index to into the Names Table. The second one is the number, for example: Sprite1, Sprite2.
The structure is as follows:
Name | Type |
Index | 32Bit Integer |
Number | 32Bit Integer |
Object Index
Object indexes are simple integeres referencing an index into the Exports/Imports Table(more later on this). An object index is one integer of 32 bits, which could be a negative, positive, or null.
If an object index is positive, then the number is an index to the Exports Table. The index must be subtracted by 1, and negative itself.
If an object index is negative, then the number is an index to the Imports Table. The index must be subtracted by 1.
If an object index is null, then the the index is not pointing to anything.
The structure is as follows:
Name | Type |
Index | 32Bit Signed Integer |
These are all the basic data structures used by the Unreal Engine 3.