Formats/SSXTricky:PBD Level File

PBD Header

enum class eDataFormatType : byte {
    GenericFormat,
    Ps2Format,
    XboxFormat,
    NgcFormat
};

struct tPbdHeader {
    byte version[3];
    eDataFormatType format;

    uint32 NumPlayerStarts; //Not Used
    uint32 NumPatches;
    uint32 NumInstances;
    uint32 NumParticleInstances;
    uint32 NumMaterials;
    uint32 NumMaterialBlocks;
    uint32 NumLights;
    uint32 NumSplines;
    uint32 NumSplineSegments;
    uint32 NumTextureFlips;
    uint32 NumPrefabs;
    uint32 NumParticleModels;
    uint32 NumTextures; //Not Used
    uint32 NumCameras;
    uint32 LightMapSize; //Not Used

    uint32 PlayerStartOffset; //Not Used
    uint32 PatchOffset;
    uint32 InstanceOffset;
    uint32 ParticleInstancesOffset;
    uint32 MaterialOffset;
    uint32 MaterialBlocksOffset;
    uint32 LightsOffset;
    uint32 SplineOffset;
    uint32 SplineSegmentOffset;
    uint32 TextureFlipOffset;
    uint32 PrefabPointerOffset;
    uint32 PrefabsOffset;
    uint32 ParticleModelPointerOffset;
    uint32 ParticleModelsOffset;
    uint32 CameraPointerOffset;
    uint32 CamerasOffset;
    uint32 HashOffset;
    uint32 MeshDataOffset
};

Patch Data

public struct Patch
{
    Vector4 LightMapPoint;

    Vector4 UVPoint1;
    Vector4 UVPoint2;
    Vector4 UVPoint3;
    Vector4 UVPoint4;

    Vector4 R4C4;
    Vector4 R4C3;
    Vector4 R4C2;
    Vector4 R4C1;
    Vector4 R3C4;
    Vector4 R3C3;
    Vector4 R3C2;
    Vector4 R3C1;
    Vector4 R2C4;
    Vector4 R2C3;
    Vector4 R2C2;
    Vector4 R2C1;
    Vector4 R1C4;
    Vector4 R1C3;
    Vector4 R1C2;
    Vector4 R1C1;

    Vector3 LowestXYZ;
    Vector3 HighestXYZ;

    Vector4 Point1;
    Vector4 Point2;
    Vector4 Point3;
    Vector4 Point4;

    uint32 PatchStyle;
    uint16 Unknown1;
    uint16 PatchVisablity;
    uint16 TextureAssigment;
    uint16 LightmapID;

    //Always the same
    uint32 Unknown2;
    uint32 Unknown3; 
    uint32 Unknown4; 
}

Instance Data

    public struct Instance
    {
        public Matrix4x4 matrix4X4;
        public Vector4 Unknown1;
        public Vector4 Unknown2;
        public Vector4 Unknown3;
        public Vector4 Unknown4;
        public Vector4 Unknown5;
        public Vector4 Unknown6;
        public Vector4 Unknown7;
        public Vector4 RGBA;
        public int ModelID;
        public int PrevInstance; //Seems to be used if instances are grouped together for animations (Mainly Fences)
        public int NextInstance;

        public Vector3 LowestXYZ;
        public Vector3 HighestXYZ;

        public uint32 UnknownInt8;
        public uint32 UnknownInt9;
        public uint32 UnknownInt10;
        public uint32 ModelID2;
        public uint32 UnknownInt11;
        public uint32 UnknownInt12;
        public uint32 UnknownInt13;
    }

Particle Instances

    public struct ParticleInstance
    {
        public Matrix4x4 matrix4X4;
        public uint32 UnknownInt1;
        public Vector3 LowestXYZ;
        public Vector3 HighestXYZ;
        public uint32 UnknownInt2;
        public uint32 UnknownInt3;
        public uint32 UnknownInt4;
        public uint32 UnknownInt5;
        public uint32 UnknownInt6;
    }

Spline And Spline Segment Data

    public struct Spline
    {
        Vector3 LowestXYZ;
        Vector3 HighestXYZ;
        uint32 Unknown1;
        uint32 SplineSegmentCount;
        uint32 SplineSegmentPosition;
        uint32 Unknown2;
    }

    public struct SplinesSegments
    {
        Vector4 Point4;
        Vector4 Point3;
        Vector4 Point2;
        Vector4 ControlPoint;
        Vector4 AnimationFloats; //Not really sure how they are used
        uint32 PreviousSegment;
        uint32 NextSegment;
        uint32 SplineParent;
        Vector3 LowestXYZ;
        Vector3 HighestXYZ;
        float SegmentDisatnce;
        float PreviousSegmentsDistance;
        uint32 Unknown1;
    }

Materials and Material Blocks

    public struct TrickyMaterial
    {
        public int TextureID;
        public int UnknownInt2;
        public int UnknownInt3;

        public float UnknownFloat1;
        public float UnknownFloat2;
        public float UnknownFloat3;
        public float UnknownFloat4;

        public int UnknownInt8;

        public float UnknownFloat5;
        public float UnknownFloat6;
        public float UnknownFloat7;
        public float UnknownFloat8;

        public int UnknownInt13;
        public int UnknownInt14;
        public int UnknownInt15;
        public int UnknownInt16;
        public int UnknownInt17;
        public int UnknownInt18;

        public int TextureFlipbookID;
        public int UnknownInt20;

    }

    public struct MaterialBlock
    {
        public int BlockCount;
        public int[] MaterialIDS;
    }