Skip to content

Structure of Serialized Binary Resources

Pavle edited this page Sep 7, 2022 · 4 revisions
struct BinaryBulkDataHeader
{
    string magic; //BIN2 (PC) and BIN1 (XBOX, PS3 and PS4)
    Flags flags;
    unsigned char alignment;
    unsigned char numberOfCustomDataSections;
    unsigned char unused_byte;
    unsigned char dataLength0;
    unsigned char dataLength1;
    unsigned char dataLength2;
    unsigned char dataLength3;
    int unused_dword;
};

struct Resource
{
    BinaryBulkDataHeader binaryBulkDataHeader;
    TArray<unsigned char> dataSection;
    TArray<CustomDataSection> customDataSections;
};

struct CustomDataSection
{
    SCustomSectionHeader customSectionHeader;
    TArray<unsigned char> customSectionData;
};

struct SCustomSectionHeader
{
    unsigned int guid;
    unsigned int length;
};

struct RebaseSection
{
    unsigned int guid;
    unsigned int length;
    unsigned int dataSectionOffsetCount;
    TArray<unsigned int> dataSectionOffsets;
};

struct TypeIDData
{
    unsigned int typeID;
    unsigned int typeSize;
    unsigned int typeNameLength;
    ZString typeName;
};

struct TypeReindexingSection
{
    unsigned int guid;
    unsigned int length;
    unsigned int dataSectionOffsetCount;
    TArray<unsigned int> dataSectionOffsets; //STypeID offsets
    unsigned int typeNameCount;
    TArray<TypeIDData> typeIDs;
};

struct RuntimeResourceIDReindexingSection
{
    unsigned int guid;
    unsigned int length;
    unsigned int dataSectionOffsetCount;
    TArray<unsigned int> dataSectionOffsets; //ZRuntimeResourceID offsets
}
Clone this wiki locally