-
Notifications
You must be signed in to change notification settings - Fork 2
PC_HEADERLIB Format
Pavle edited this page Oct 8, 2022
·
40 revisions
class HeaderLibrary
{
SResourceHeaderHeader resourceHeaderHeader;
unsigned int referenceCount;
unsigned int flagOffset; //Offset of first flag
unsigned int firstResourceIDOffset; //Offset of first resource id
unsigned int flag; //Flag of first reference
TArray<unsigned int> resourceIDOffsets; //Offsets of resource ids
TArray<string> resourceIDs; //It contains resource id of id map and it also contains resource ids of global resources which are references of some resources (references are only install dependencies (exception is id map reference which is media streamed))
SHeaderLibrary headerLibrary;
};
/*
System memory requirement:
* It's -1 for header libraries
* It's equal to size of the data section for resources that have BIN1/BIN2 header
* For resource types that don't have BIN1/BIN2 header each resource adds 16 (0x10) bytes to the size of data section of the resource library which is the resource library file size minus 24 (0x18)
* For resources that are serializable the resource library memory requirement is smaller than the resource library file size in bytes. For resources that aren't serializable memory requirement of their resource library is bigger than the resource library file size in bytes.
*/
struct SResourceHeaderHeader
{
unsigned int m_type;
unsigned int m_nReferencesChunkSize;
unsigned int m_nStatesChunkSize;
unsigned int m_nDataSize;
unsigned int m_nSystemMemoryRequirement;
unsigned int m_nVideoMemoryRequirement;
};
class SHeaderLibrary
{
TArray<SHeaderLibraryChunk> chunks;
TArray<ZString> externalResourceIds; //Header library references
long long ridSource; //Hash of source resource (TEMP)
};
struct SHeaderLibraryChunk
{
ZString sLibraryID; //Resource id of header library chunk
unsigned int nOffset; //Start file position (always 0)
char nFlags; //Values from anonymous enum in ZResourceLibraryInfo (GLOBAL, NON_STREAMED, MEDIA_STREAMED, INIT_LIBRARY, DYNAMIC)
unsigned int localizationCategory; //1 when chunk has only TELI resources
TArray<ZString> sLanguages; //en, fr, it, de, es, ru, pl, ja, tr, all
TArray<int> states; //Streaming states (streaming state determines in which check point will resources of chunk be loaded)
TArray<TArray<unsigned char> > resourceHeaders; //SResourceHeaderHeader and references chunk data for each resource
TArray<unsigned int> ridMappingIndices; //Resource indices
TArray<unsigned long long> ridMappingIDs; //Resource hashes
};