Add blueprint information to docs

This commit is contained in:
Crypto137 2023-11-15 01:41:41 +03:00
parent e62d015a1c
commit f893b0f360

View file

@ -11,6 +11,13 @@ byte Version;
The magic string defines what format is used in the file. The version depends on the game version: game versions 1.9-1.17 used Calligraphy version 10, and all later game versions starting with 1.18 released on January 24th 2014 use Calligraphy version 11.
All strings in Calligraphy files are fixed-length ASCII strings with the length encoded in a 16-bit value preceding the text:
```csharp
ushort StringLength;
char[StringLength] String;
```
## Directory
Directory (`.directory`) files contain information required for the initialization of the `DataDirectory` singleton class. There's a total of five directory files, each containing a number of records with slightly different structures.
@ -29,8 +36,7 @@ Record[RecordsLength] Records;
ulong Id;
ulong Guid;
byte Flags;
ushort FilePathLength;
char[FilePathLength] FilePath;
string FilePath;
```
`Prototype.directory` (signature `PDR`) has a modified structure:
@ -40,8 +46,7 @@ ulong PrototypeId;
ulong PrototypeGuid;
ulong BlueprintId; // Even though it's called BlueprintId, this is actually a parent default prototype id
byte Flags;
ushort FilePathLength;
char[FilePathLength] FilePath;
string FilePath;
```
`Replacement.directory` (signature `RDR`) is a special directory used for handling deprecated GUIDs. Replacement records are managed by the `ReplacementDirectory` class. This file has a different record structure:
@ -49,8 +54,7 @@ char[FilePathLength] FilePath;
```csharp
ulong OldGuid;
ulong NewGuid;
ushort NameLength;
char[NameLength] Name;
string Name;
```
Please note that file paths contained in these directory files use the `\` symbol as the path delimiter, while [pak files](./PakFile.md) use `/`. To use these paths for reading files from the pak file system you need to replace `\` with `/` while reading them.
@ -86,15 +90,78 @@ Each asset in an asset type has the following structure:
ulong AssetId; // Processed by the client as the StringId for the name
ulong AssetGuid;
byte Flags;
ushort NameLength;
char[NameLength] Name;
string Name;
```
## Blueprint
TODO
Blueprint (`.blueprint`, signature `BPT`) files contain definitions for various prototype types. Each blueprint is paired with a default prototype (`.defaults`) that contains default values for all fields defined in the blueprint.
Blueprint files have the following structure:
```csharp
CalligraphyHeader Header;
string RuntimeBinding; // Name of the class that handles prototypes that use this blueprint
ulong DefaultPrototypeId;
ushort ParentsLength;
BlueprintReference[ParentsLength] Parents;
ushort ContributingBlueprintsLength;
BlueprintReference[ContributingBlueprintsLength] ContributingBlueprints;
ushort MembersLength;
BlueprintMember[MembersLength] Members;
```
Blueprint references actually reference the default prototype bound to a blueprint, and not the blueprint itself. They have the following structure:
```csharp
ulong PrototypeId;
byte Flags;
```
Blueprint members are definitions for prototype fields that have the following structure:
```csharp
ulong FieldId; // Processed by the client as a StringId
string FieldName;
byte ValueType;
byte ContainerType;
if (ValueType == Asset || ValueType == Curve
|| ValueType == Prototype || ValueType == RHStruct)
ulong Subtype;
```
`ValueType` defines the type of data stored in a field. Calligraphy supports nine value types:
```csharp
enum CalligraphyValueType : byte
{
Asset = 0x41, // A (Id reference to an asset)
Boolean = 0x42, // B (Stored as a UInt64)
Curve = 0x43, // C (Id reference to a curve)
Double = 0x44, // D (For all floating point values)
Long = 0x4c, // L (For all integer values)
Prototype = 0x50, // P (Id reference to another prototype)
RHStruct = 0x52, // R (Embedded prototype without an id)
String = 0x53, // S (Id reference to a localized string)
Type = 0x54 // T (Id reference to an AssetType)
}
```
`ContainerType` defines whether a field contains a single value or a list of multiple values:
```csharp
enum CalligraphyContainerType : byte
{
Simple = 0x53, // Simple
List = 0x4c // List (only for assets, prototypes, rhstructs, and types)
}
```
`Subtype` specifies the id of the parent value that the value in this field has to inherit from. For example, for prototypes it is the id of the default prototype. Only assets, curves, and prototypes have subtypes.
## Prototype