public static Formats.Meshes.MeshRiggingGroup ParseMeshRiggingGroup(this SsbhParser parser)
        {
            var result = new Formats.Meshes.MeshRiggingGroup();

            result.MeshName     = parser.ReadOffsetReadString();
            result.MeshSubIndex = parser.ReadInt64();
            result.Flags        = parser.ReadInt64();
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.Buffers = new Formats.Meshes.MeshBoneBuffer[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.Buffers[i] = parser.ParseMeshBoneBuffer();
                }

                parser.Seek(previousPosition);
            }
            return(result);
        }
        public static Formats.Rendering.Nrpd ParseNrpd(this SsbhParser parser)
        {
            var result = new Formats.Rendering.Nrpd();

            result.Magic        = parser.ReadUInt32();
            result.MajorVersion = parser.ReadUInt16();
            result.MinorVersion = parser.ReadUInt16();
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.FrameBufferContainers = new Formats.Rendering.NrpdFrameBufferContainer[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.FrameBufferContainers[i] = parser.ParseNrpdFrameBufferContainer();
                }

                parser.Seek(previousPosition);
            }
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.StateContainers = new Formats.Rendering.NrpdStateContainer[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.StateContainers[i] = parser.ParseNrpdStateContainer();
                }

                parser.Seek(previousPosition);
            }
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.RenderPasses = new Formats.Rendering.NrpdRenderPass[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.RenderPasses[i] = parser.ParseNrpdRenderPass();
                }

                parser.Seek(previousPosition);
            }
            return(result);
        }
        public static Formats.Meshes.MeshObject ParseMeshObject(this SsbhParser parser)
        {
            var result = new Formats.Meshes.MeshObject();

            result.Name                         = parser.ReadOffsetReadString();
            result.SubIndex                     = parser.ReadInt64();
            result.ParentBoneName               = parser.ReadOffsetReadString();
            result.VertexCount                  = parser.ReadInt32();
            result.IndexCount                   = parser.ReadInt32();
            result.Unk2                         = parser.ReadUInt32();
            result.VertexOffset                 = parser.ReadInt32();
            result.VertexOffset2                = parser.ReadInt32();
            result.FinalBufferOffset            = parser.ReadInt32();
            result.BufferIndex                  = parser.ReadInt32();
            result.Stride                       = parser.ReadInt32();
            result.Stride2                      = parser.ReadInt32();
            result.Unk6                         = parser.ReadInt32();
            result.Unk7                         = parser.ReadInt32();
            result.ElementOffset                = parser.ReadUInt32();
            result.Unk8                         = parser.ReadInt32();
            result.DrawElementType              = (Formats.Meshes.DrawElementType)parser.ReadInt32();
            result.RiggingType                  = (Formats.Meshes.RiggingType)parser.ReadInt32();
            result.Unk11                        = parser.ReadInt32();
            result.Unk12                        = parser.ReadInt32();
            result.BoundingSphereCenter         = parser.ReadVector3();
            result.BoundingSphereRadius         = parser.ReadSingle();
            result.BoundingBoxMin               = parser.ReadVector3();
            result.BoundingBoxMax               = parser.ReadVector3();
            result.OrientedBoundingBoxCenter    = parser.ReadVector3();
            result.OrientedBoundingBoxTransform = parser.ReadMatrix3x3();
            result.OrientedBoundingBoxSize      = parser.ReadVector3();
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.Attributes = new Formats.Meshes.MeshAttribute[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.Attributes[i] = parser.ParseMeshAttribute();
                }

                parser.Seek(previousPosition);
            }
            return(result);
        }
        public static Formats.Materials.Matl ParseMatl(this SsbhParser parser)
        {
            var result = new Formats.Materials.Matl();

            result.Magic        = parser.ReadUInt32();
            result.MajorVersion = parser.ReadInt16();
            result.MinorVersion = parser.ReadInt16();
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.Entries = new Formats.Materials.MatlEntry[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.Entries[i] = parser.ParseMatlEntry();
                }

                parser.Seek(previousPosition);
            }
            return(result);
        }
        public static Formats.Meshes.MeshAttribute ParseMeshAttribute(this SsbhParser parser)
        {
            var result = new Formats.Meshes.MeshAttribute();

            result.Index        = parser.ReadInt32();
            result.DataType     = (Formats.Meshes.MeshAttribute.AttributeDataType)parser.ReadUInt32();
            result.BufferIndex  = parser.ReadInt32();
            result.BufferOffset = parser.ReadInt32();
            result.Unk4         = parser.ReadInt32();
            result.Unk5         = parser.ReadInt32();
            result.Name         = parser.ReadOffsetReadString();
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.AttributeStrings = new Formats.SsbhString[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.AttributeStrings[i] = parser.ParseSsbhString();
                }

                parser.Seek(previousPosition);
            }
            return(result);
        }
        public static Formats.ModlEntry ParseModlEntry(this SsbhParser parser)
        {
            var result = new Formats.ModlEntry();

            result.MeshName      = parser.ReadOffsetReadString();
            result.SubIndex      = parser.ReadInt64();
            result.MaterialLabel = parser.ReadOffsetReadString();
            return(result);
        }
        public static Formats.Animation.AnimTrack ParseAnimTrack(this SsbhParser parser)
        {
            var result = new Formats.Animation.AnimTrack();

            result.Name       = parser.ReadOffsetReadString();
            result.Flags      = parser.ReadUInt32();
            result.FrameCount = parser.ReadUInt32();
            result.Unk3       = parser.ReadUInt32();
            result.DataOffset = parser.ReadUInt32();
            result.DataSize   = parser.ReadInt64();
            return(result);
        }
        public static Formats.Animation.Anim ParseAnim(this SsbhParser parser)
        {
            var result = new Formats.Animation.Anim();

            result.Magic           = parser.ReadUInt32();
            result.VersionMajor    = parser.ReadUInt16();
            result.VersionMinor    = parser.ReadUInt16();
            result.FinalFrameIndex = parser.ReadSingle();
            result.Unk1            = parser.ReadUInt16();
            result.Unk2            = parser.ReadUInt16();
            result.Name            = parser.ReadOffsetReadString();
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.Animations = new Formats.Animation.AnimGroup[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.Animations[i] = parser.ParseAnimGroup();
                }

                parser.Seek(previousPosition);
            }
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);

                result.Buffer = parser.ReadBytes((int)elementCount);

                parser.Seek(previousPosition);
            }
            return(result);
        }
        public static Formats.Rendering.ShdrShader ParseShdrShader(this SsbhParser parser)
        {
            var result = new Formats.Rendering.ShdrShader();

            result.Name = parser.ReadOffsetReadString();
            result.Unk1 = parser.ReadUInt32();
            result.Unk2 = parser.ReadUInt32();
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);

                result.ShaderBinary = parser.ReadBytes((int)elementCount);

                parser.Seek(previousPosition);
            }
            result.ShaderFileSize = parser.ReadInt64();
            result.Padding1       = parser.ReadInt64();
            result.Padding2       = parser.ReadInt64();
            return(result);
        }
        public static Formats.Materials.MatlAttribute ParseMatlAttribute(this SsbhParser parser)
        {
            var result = new Formats.Materials.MatlAttribute();

            result.ParamId      = (Formats.Materials.MatlEnums.ParamId)parser.ReadUInt64();
            result.OffsetToData = parser.Position + parser.ReadInt64();
            result.DataType     = (Formats.Materials.MatlEnums.ParamDataType)parser.ReadUInt64();

            // This only needs to be generated for MATL attributes.
            long temp = parser.Position;

            result.PostProcess(parser);
            parser.Seek(temp);
            return(result);
        }
        public static Formats.Meshes.MeshBuffer ParseMeshBuffer(this SsbhParser parser)
        {
            var result = new Formats.Meshes.MeshBuffer();

            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);

                result.Buffer = parser.ReadBytes((int)elementCount);

                parser.Seek(previousPosition);
            }
            return(result);
        }
        public static Formats.Animation.AnimNode ParseAnimNode(this SsbhParser parser)
        {
            var result = new Formats.Animation.AnimNode();

            result.Name = parser.ReadOffsetReadString();
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.Tracks = new Formats.Animation.AnimTrack[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.Tracks[i] = parser.ParseAnimTrack();
                }

                parser.Seek(previousPosition);
            }
            return(result);
        }
        public static Formats.Materials.MatlEntry ParseMatlEntry(this SsbhParser parser)
        {
            var result = new Formats.Materials.MatlEntry();

            result.MaterialLabel = parser.ReadOffsetReadString();
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.Attributes = new Formats.Materials.MatlAttribute[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.Attributes[i] = parser.ParseMatlAttribute();
                }

                parser.Seek(previousPosition);
            }
            result.ShaderLabel = parser.ReadOffsetReadString();
            return(result);
        }
        public static Formats.Hlpb ParseHlpb(this SsbhParser parser)
        {
            var result = new Formats.Hlpb();

            result.Magic        = parser.ReadUInt32();
            result.VersionMajor = parser.ReadUInt16();
            result.VersionMinor = parser.ReadUInt16();
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.AimEntries = new Formats.HlpbRotateAim[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.AimEntries[i] = parser.ParseHlpbRotateAim();
                }

                parser.Seek(previousPosition);
            }
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.InterpolationEntries = new Formats.HlpbRotateInterpolation[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.InterpolationEntries[i] = parser.ParseHlpbRotateInterpolation();
                }

                parser.Seek(previousPosition);
            }
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);

                result.List1 = parser.ReadStructs <System.Int32>((int)elementCount);

                parser.Seek(previousPosition);
            }
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);

                result.List2 = parser.ReadStructs <System.Int32>((int)elementCount);

                parser.Seek(previousPosition);
            }
            return(result);
        }
        public static Formats.Meshes.Mesh ParseMesh(this SsbhParser parser)
        {
            var result = new Formats.Meshes.Mesh();

            result.Magic                        = parser.ReadUInt32();
            result.VersionMajor                 = parser.ReadUInt16();
            result.VersionMinor                 = parser.ReadUInt16();
            result.ModelName                    = parser.ReadOffsetReadString();
            result.BoundingSphereCenter         = parser.ReadVector3();
            result.BoundingSphereRadius         = parser.ReadSingle();
            result.BoundingBoxMin               = parser.ReadVector3();
            result.BoundingBoxMax               = parser.ReadVector3();
            result.OrientedBoundingBoxCenter    = parser.ReadVector3();
            result.OrientedBoundingBoxTransform = parser.ReadMatrix3x3();
            result.OrientedBoundingBoxSize      = parser.ReadVector3();
            result.Unk1 = parser.ReadSingle();
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.Objects = new Formats.Meshes.MeshObject[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.Objects[i] = parser.ParseMeshObject();
                }

                parser.Seek(previousPosition);
            }
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);

                result.BufferSizes = parser.ReadStructs <System.Int32>((int)elementCount);

                parser.Seek(previousPosition);
            }
            result.PolygonIndexSize = parser.ReadInt64();
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.VertexBuffers = new Formats.Meshes.MeshBuffer[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.VertexBuffers[i] = parser.ParseMeshBuffer();
                }

                parser.Seek(previousPosition);
            }
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);

                result.PolygonBuffer = parser.ReadBytes((int)elementCount);

                parser.Seek(previousPosition);
            }
            {
                // TODO: Extract this code to a method?
                long absoluteOffset   = parser.ReadRelativeGetAbsoluteOffset();
                long elementCount     = parser.ReadInt64();
                long previousPosition = parser.Position;
                parser.Seek(absoluteOffset);


                result.RiggingBuffers = new Formats.Meshes.MeshRiggingGroup[elementCount];
                for (int i = 0; i < elementCount; i++)
                {
                    result.RiggingBuffers[i] = parser.ParseMeshRiggingGroup();
                }

                parser.Seek(previousPosition);
            }
            result.UnknownOffset = parser.ReadInt64();
            result.UnknownSize   = parser.ReadInt64();
            return(result);
        }