STU

From owdev
(Redirected from STUD)
Jump to: navigation, search

Format changed as of 1.14, old format (pre-1.13) is Legacy. The older format is still being used in some STU file types.

Notes

"void*" and any pointer (*) is an uint, not long.

Header

uint             instance_count;
STUInstanceInfo* instance_list;             // Size is instance_count
uint             array_reference_count;
STUArrayRefInfo* array_reference_list;      // Size is array_reference_count
uint             instance_field_list_count;
STUFieldInfo*    instance_field_list;       // Size is instance_field_list_count
uint             array_buffer_size;
char*            array_buffer;              // Size is array_buffer_size
uint             data_offset;               // STU instances start at this offset.

STUInstanceInfo

This structure describes each STU in the file.

uint checksum; // CRC32 IEEE / CRC32b of the STU instance name
uint field;    // CRC32b of the parent field. Ignore if 0.
int  index;    // Index of the parent instance. Ignore if -1. instances[index][field] = this.
uint size;     // Absolute size of the instance.
 

STUArrayRefInfo

This structure describes if any array needs STU pre-processing.

uint checksum; // CRC32 IEEE / CRC32b of the STU instance name
uint size;     // Absolute size of each entry(?) or padding bytes.
 

STUFieldInfo

This structure describes a field array, there can be more than 1 field array per STU.

uint      count;  // Number of fields.
STUField* fields; // Size is count

STUField

This structure defines a field. The order is important.

uint checksum; // CRC32 IEEE / CRC32b of the STU field name
uint size;     // Absolute size of each field.

Zero size fields are nested structures.

Parsing STU Instances

Each instance is prefixed with an int. This value is the field info index. Use this field array to get information about a field.

Offsets within a STU instance is either the beginning of the STU or the end of the last nested structure. Whichever is larger.

Nested structures are sandboxed so offset 0 inside the nested structure is the beginning of the nested structure, not the upper structure.

This may also be the beginning of the field, rather than structure.

Nested Structures

TODO

This structure describes a nested structure. This is not consistent.

uint  field_info_index; // Index of field array
void* structure;        // Follow field array

Arrays

This structure describes the array, it's prefixed to each array.

uint  count;              // No. of entries
int   ref_instance_index; // Index of reference STU to process the value(s). Ignore if > 0x7F
void* data;               // Size is count. Each entry size is determined by the STU parsing the array.
uint  unknown;            // Zero

GUID Demangling

TODO