Skip to main content

Module serialized

Module serialized 

Source
Expand description

SerializedFiles, every format from 1 to 22 (below 9 the header’s endian byte sits at file_size - metadata_size), built from a spec, with overrides for the fields a parser test needs to get wrong.

The layout is the one UnityPy 1.25.2 reads (files/SerializedFile.py:235-324, files/ObjectReader.py:67-130):

  • the header’s four u32s, big-endian whatever the file’s byte order; from format 9 the endian byte and three reserved bytes follow at 16, and at 22 the 64-bit fields (still big-endian: UnityPy switches the byte order only after them, SerializedFile.py:260-269);
  • the metadata, in the file’s byte order, right after the header from format 9, and at the end of the file below 9, where its first byte is the endian byte (SerializedFile.py:266);
  • the objects’ data after the metadata (from format 9; below 9 after the header), at data_offset, each object’s start aligned to 8 within it.

Owner: package C.

Structs§

ExternalSpec
One external.
ObjectSpec
One object.
SerializedSpec
A whole file.
TypeSpec
One type record.

Functions§

build
The file’s bytes.
no_nul_strings
Round 4’s entry: a little-endian format-22 file (engine 2018.4.0f1) of one type, class 1, whose blob has rows rows naming offset 0 of a 65,536-byte string buffer with no NUL (no_nul_blob). complete ends it as a file of no objects ends (no dependencies, objects, scripts, externals or ref types, an empty user information); otherwise it ends right after the string buffer, and the type’s dependency read raises.
one_object
A minimal file of one object whose class has the tree nodes: data is the object’s bytes, class_id its class. Every other field as SerializedSpec::default has it (format 22, little-endian, type trees on).