// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { loader.CheckSignature(_signature); if (loader.IsSwitch) { if (loader.ResFile.VersionMajor2 == 9) { _flags = loader.ReadUInt32(); } else { ((Switch.Core.ResFileSwitchLoader)loader).LoadHeaderBlock(); } long BoneDictOffset = loader.ReadOffset(); long BoneArrayOffset = loader.ReadOffset(); Bones = loader.LoadDictValues <Bone>(BoneDictOffset, BoneArrayOffset); uint MatrixToBoneListOffset = loader.ReadOffset(); uint InverseModelMatricesOffset = loader.ReadOffset(); if (loader.ResFile.VersionMajor2 == 8) { loader.Seek(16); } if (loader.ResFile.VersionMajor2 == 9) { loader.Seek(8); } long userPointer = loader.ReadInt64(); if (loader.ResFile.VersionMajor2 != 9) { _flags = loader.ReadUInt32(); } ushort numBone = loader.ReadUInt16(); ushort numSmoothMatrix = loader.ReadUInt16(); ushort numRigidMatrix = loader.ReadUInt16(); loader.Seek(6); MatrixToBoneList = loader.LoadCustom(() => loader.ReadUInt16s((numSmoothMatrix + numRigidMatrix)), MatrixToBoneListOffset); InverseModelMatrices = loader.LoadCustom(() => loader.ReadMatrix3x4s(numSmoothMatrix), InverseModelMatricesOffset)?.ToList(); } else { _flags = loader.ReadUInt32(); ushort numBone = loader.ReadUInt16(); ushort numSmoothMatrix = loader.ReadUInt16(); ushort numRigidMatrix = loader.ReadUInt16(); loader.Seek(2); Bones = loader.LoadDict <Bone>(); uint ofsBoneList = loader.ReadOffset(); // Only load dict. MatrixToBoneList = loader.LoadCustom(() => loader.ReadUInt16s((numSmoothMatrix + numRigidMatrix))); if (loader.ResFile.Version >= 0x03040000) { InverseModelMatrices = loader.LoadCustom(() => loader.ReadMatrix3x4s(numSmoothMatrix))?.ToList(); } uint userPointer = loader.ReadUInt32(); } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { if (loader.IsSwitch) { Name = loader.LoadString(); long DataOffset = loader.ReadOffset(); ushort count = loader.ReadUInt16(); Type = loader.ReadEnum <RenderInfoType>(true); loader.Seek(5); switch (Type) { case RenderInfoType.Int32: _value = loader.LoadCustom(() => loader.ReadInt32s(count), (uint)DataOffset); break; case RenderInfoType.Single: _value = loader.LoadCustom(() => loader.ReadSingles(count), (uint)DataOffset); break; case RenderInfoType.String: if (DataOffset == 0) //Some games have empty data offset and no strings { _value = new string[0]; } else { _value = loader.LoadCustom(() => loader.LoadStrings(count), (uint)DataOffset); } break; } } else { ushort count = loader.ReadUInt16(); Type = loader.ReadEnum <RenderInfoType>(true); loader.Seek(1); Name = loader.LoadString(); switch (Type) { case RenderInfoType.Int32: _value = loader.ReadInt32s(count); break; case RenderInfoType.Single: _value = loader.ReadSingles(count); break; case RenderInfoType.String: _value = loader.LoadStrings(count); break; } } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { Name = loader.LoadString(); ushort count = loader.ReadUInt16(); Type = loader.ReadEnum <UserDataType>(true); loader.Seek(1); switch (Type) { case UserDataType.Int32: _value = loader.ReadInt32s(count); break; case UserDataType.Single: _value = loader.ReadSingles(count); break; case UserDataType.String: _value = loader.LoadStrings(count, Encoding.ASCII); break; case UserDataType.WString: _value = loader.LoadStrings(count, Encoding.Unicode); break; case UserDataType.Byte: _value = loader.ReadBytes(count); break; } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { CurveIndex = loader.ReadSByte(); SubBindIndex = loader.ReadSByte(); loader.Seek(2); Name = loader.LoadString(); }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { Name = loader.LoadString(); BufferIndex = loader.ReadByte(); loader.Seek(1); Offset = loader.ReadUInt16(); Format = loader.ReadEnum <GX2AttribFormat>(true); }
void IResData.Load(ResFileLoader loader) { loader.CheckSignature(_signature); Flags = loader.ReadEnum <CameraAnimFlags>(true); loader.Seek(2); FrameCount = loader.ReadInt32(); byte numCurve = loader.ReadByte(); loader.Seek(1); ushort numUserData = loader.ReadUInt16(); BakedSize = loader.ReadUInt32(); Name = loader.LoadString(); Curves = loader.LoadList <AnimCurve>(numCurve); BaseData = loader.LoadCustom(() => new CameraAnimData(loader)); UserData = loader.LoadDict <UserData>(); }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { if (loader.IsSwitch) { Name = loader.LoadString(); CurveIndex = loader.ReadSByte(); SubBindIndex = loader.ReadSByte(); loader.Seek(6); } else { CurveIndex = loader.ReadSByte(); SubBindIndex = loader.ReadSByte(); loader.Seek(2); Name = loader.LoadString(); } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { if (loader.IsSwitch) { Name = loader.LoadString(); CurveIndex = loader.ReadInt16(); BeginConstant = loader.ReadUInt16(); SubBindIndex = loader.ReadSByte(); loader.Seek(3); //padding } else { CurveIndex = loader.ReadSByte(); SubBindIndex = loader.ReadSByte(); loader.Seek(2); Name = loader.LoadString(); } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { TexSampler = new TexSampler(loader.ReadUInt32s(3)); uint handle = loader.ReadUInt32(); Name = loader.LoadString(); byte idx = loader.ReadByte(); loader.Seek(3); }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { if (loader.IsSwitch) { Name = loader.LoadString(); loader.ByteOrder = ByteOrder.BigEndian; Format = ConvertToGX2(loader.ReadEnum <SwitchAttribFormat>(true)); loader.ByteOrder = ByteOrder.LittleEndian; loader.Seek(2); //padding Offset = loader.ReadUInt16(); BufferIndex = (byte)loader.ReadUInt16(); } else { Name = loader.LoadString(); BufferIndex = loader.ReadByte(); loader.Seek(1); Offset = loader.ReadUInt16(); Format = loader.ReadEnum <GX2AttribFormat>(true); } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { PrimitiveType = loader.ReadEnum <GX2PrimitiveType>(true); IndexFormat = loader.ReadEnum <GX2IndexFormat>(true); uint indexCount = loader.ReadUInt32(); ushort numSubMesh = loader.ReadUInt16(); loader.Seek(2); SubMeshes = loader.LoadList <SubMesh>(numSubMesh); IndexBuffer = loader.Load <Buffer>(); FirstVertex = loader.ReadUInt32(); }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { loader.CheckSignature(_signature); if (loader.IsSwitch) { Switch.CameraAnimParser.Read((Switch.Core.ResFileSwitchLoader)loader, this); } else { Flags = loader.ReadEnum <CameraAnimFlags>(false); loader.Seek(2); FrameCount = loader.ReadInt32(); byte numCurve = loader.ReadByte(); loader.Seek(1); ushort numUserData = loader.ReadUInt16(); BakedSize = loader.ReadUInt32(); Name = loader.LoadString(); Curves = loader.LoadList <AnimCurve>(numCurve); BaseData = loader.LoadCustom(() => new CameraAnimData(loader)); UserData = loader.LoadDict <UserData>(); } }
void IResData.Load(ResFileLoader loader) { WrapModeU = (TexClamp)loader.ReadByte(); WrapModeV = (TexClamp)loader.ReadByte(); WrapModeW = (TexClamp)loader.ReadByte(); CompareFunc = (CompareFunction)loader.ReadByte(); BorderColorType = (TexBorderType)loader.ReadByte(); Anisotropic = (MaxAnisotropic)loader.ReadByte(); _filterFlags = loader.ReadUInt16(); MinLOD = loader.ReadSingle(); MaxLOD = loader.ReadSingle(); LODBias = loader.ReadSingle(); loader.Seek(12); }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { _flags = loader.ReadUInt32(); Name = loader.LoadString(); BeginRotate = loader.ReadByte(); BeginTranslate = loader.ReadByte(); byte numCurve = loader.ReadByte(); BeginBaseTranslate = loader.ReadByte(); BeginCurve = loader.ReadByte(); loader.Seek(3); Curves = loader.LoadList <AnimCurve>(numCurve); BaseData = loader.LoadCustom(() => new BoneAnimData(loader, FlagsBase)); }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { ushort numAnimParam = loader.ReadUInt16(); ushort numCurve = loader.ReadUInt16(); ushort numConstant = loader.ReadUInt16(); loader.Seek(2); BeginCurve = loader.ReadInt32(); BeginParamAnim = loader.ReadInt32(); Name = loader.LoadString(); ParamAnimInfos = loader.LoadList <ParamAnimInfo>(numAnimParam); Curves = loader.LoadList <AnimCurve>(numCurve); Constants = loader.LoadCustom(() => loader.ReadAnimConstants(numConstant)); }
void IResData.Load(ResFileLoader loader) { loader.CheckSignature(_signature); byte numVertexAttrib = loader.ReadByte(); byte numBuffer = loader.ReadByte(); ushort idx = loader.ReadUInt16(); uint vertexCount = loader.ReadUInt32(); VertexSkinCount = loader.ReadByte(); loader.Seek(3); uint ofsVertexAttribList = loader.ReadOffset(); // Only load dict. Attributes = loader.LoadDict <VertexAttrib>(); Buffers = loader.LoadList <Buffer>(numBuffer); uint userPointer = loader.ReadUInt32(); }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { loader.CheckSignature(_signature); _flags = loader.ReadUInt32(); ushort numBone = loader.ReadUInt16(); ushort numSmoothMatrix = loader.ReadUInt16(); ushort numRigidMatrix = loader.ReadUInt16(); loader.Seek(2); Bones = loader.LoadDict <Bone>(); uint ofsBoneList = loader.ReadOffset(); // Only load dict. MatrixToBoneList = loader.LoadCustom(() => loader.ReadUInt16s((numSmoothMatrix + numRigidMatrix))); InverseModelMatrices = loader.LoadCustom(() => loader.ReadMatrix3x4s(numSmoothMatrix)); uint userPointer = loader.ReadUInt32(); }
void IResData.Load(ResFileLoader loader) { if (loader.IsSwitch) { sampler = new SamplerSwitch(); ((IResData)sampler).Load(loader); TexSampler = sampler.ToTexSampler(); } else { TexSampler = new TexSampler(loader.ReadUInt32s(3)); uint handle = loader.ReadUInt32(); Name = loader.LoadString(); byte idx = loader.ReadByte(); loader.Seek(3); } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { if (loader.ResFile.Version >= 0x02040000) { loader.CheckSignature(_signature); Name = loader.LoadString(); Path = loader.LoadString(); _flags = loader.ReadUInt32(); if (loader.ResFile.Version >= 0x03040000) { FrameCount = loader.ReadInt32(); numBoneAnim = loader.ReadUInt16(); ushort numUserData = loader.ReadUInt16(); int numCurve = loader.ReadInt32(); BakedSize = loader.ReadUInt32(); } else { FrameCount = loader.ReadUInt16(); numBoneAnim = loader.ReadUInt16(); ushort numUserData = loader.ReadUInt16(); ushort numCurve = loader.ReadUInt16(); BakedSize = loader.ReadUInt32(); loader.Seek(4); //padding } BoneAnims = loader.LoadList <BoneAnim>(numBoneAnim).ToList(); BindSkeleton = loader.Load <Skeleton>(); BindIndices = loader.LoadCustom(() => loader.ReadUInt16s(numBoneAnim)); UserData = loader.LoadDict <UserData>(); } else { _flags = loader.ReadUInt32(); FrameCount = loader.ReadUInt16(); numBoneAnim = loader.ReadUInt16(); ushort numUserData = loader.ReadUInt16(); ushort numCurve = loader.ReadUInt16(); Name = loader.LoadString(); Path = loader.LoadString(); BoneAnims = loader.LoadList <BoneAnim>(numBoneAnim).ToList(); BindSkeleton = loader.Load <Skeleton>(); BindIndices = loader.LoadCustom(() => loader.ReadUInt16s(numBoneAnim)); } }
void IResData.Load(ResFileLoader loader) { Strings.Clear(); if (loader.IsSwitch) { loader.Seek(-0x14, System.IO.SeekOrigin.Current); uint Signature = loader.ReadUInt32(); uint blockOffset = loader.ReadUInt32(); long BlockSize = loader.ReadInt64(); uint StringCount = loader.ReadUInt32(); for (int i = 0; i < StringCount + 1; i++) { ushort size = loader.ReadUInt16(); Strings.Add(loader.ReadString(BinaryStringFormat.ZeroTerminated)); loader.Align(2); } } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { loader.CheckSignature(_signature); if (loader.IsSwitch) { Switch.ShapeAnimParser.Read((Switch.Core.ResFileSwitchLoader)loader, this); } else { Name = loader.LoadString(); Path = loader.LoadString(); Flags = loader.ReadEnum <ShapeAnimFlags>(true); ushort numUserData; ushort numVertexShapeAnim; ushort numKeyShapeAnim; ushort numCurve; if (loader.ResFile.Version >= 0x03040000) { numUserData = loader.ReadUInt16(); FrameCount = loader.ReadInt32(); numVertexShapeAnim = loader.ReadUInt16(); numKeyShapeAnim = loader.ReadUInt16(); numCurve = loader.ReadUInt16(); loader.Seek(2); BakedSize = loader.ReadUInt32(); } else { FrameCount = loader.ReadUInt16(); numVertexShapeAnim = loader.ReadUInt16(); numKeyShapeAnim = loader.ReadUInt16(); numUserData = loader.ReadUInt16(); numCurve = loader.ReadUInt16(); BakedSize = loader.ReadUInt32(); } BindModel = loader.Load <Model>(); BindIndices = loader.LoadCustom(() => loader.ReadUInt16s(numVertexShapeAnim)); VertexShapeAnims = loader.LoadList <VertexShapeAnim>(numVertexShapeAnim); UserData = loader.LoadDict <UserData>(); } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { if (loader.IsSwitch) { Name = loader.LoadString(); UserData = loader.LoadDictValues <UserData>(); if (loader.ResFile.VersionMajor2 == 8 || loader.ResFile.VersionMajor2 == 9) { loader.Seek(16); } ushort idx = loader.ReadUInt16(); ParentIndex = loader.ReadInt16(); SmoothMatrixIndex = loader.ReadInt16(); RigidMatrixIndex = loader.ReadInt16(); BillboardIndex = loader.ReadInt16(); ushort numUserData = loader.ReadUInt16(); _flags = loader.ReadUInt32(); Scale = loader.ReadVector3F(); Rotation = loader.ReadVector4F(); Position = loader.ReadVector3F(); } else { Name = loader.LoadString(); ushort idx = loader.ReadUInt16(); ParentIndex = loader.ReadInt16(); SmoothMatrixIndex = loader.ReadInt16(); RigidMatrixIndex = loader.ReadInt16(); BillboardIndex = loader.ReadInt16(); ushort numUserData = loader.ReadUInt16(); _flags = loader.ReadUInt32(); Scale = loader.ReadVector3F(); Rotation = loader.ReadVector4F(); Position = loader.ReadVector3F(); UserData = loader.LoadDict <UserData>(); if (loader.ResFile.Version < 0x03040000) { InverseMatrix = loader.ReadMatrix3x4(); } } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { loader.CheckSignature(_signature); Dim = loader.ReadEnum <GX2SurfaceDim>(true); Width = loader.ReadUInt32(); Height = loader.ReadUInt32(); Depth = loader.ReadUInt32(); MipCount = loader.ReadUInt32(); Format = loader.ReadEnum <GX2SurfaceFormat>(true); AAMode = loader.ReadEnum <GX2AAMode>(true); Use = loader.ReadEnum <GX2SurfaceUse>(true); uint sizData = loader.ReadUInt32(); uint imagePointer = loader.ReadUInt32(); uint sizMipData = loader.ReadUInt32(); uint mipPointer = loader.ReadUInt32(); TileMode = loader.ReadEnum <GX2TileMode>(true); Swizzle = loader.ReadUInt32(); Alignment = loader.ReadUInt32(); Pitch = loader.ReadUInt32(); MipOffsets = loader.ReadUInt32s(13); ViewMipFirst = loader.ReadUInt32(); ViewMipCount = loader.ReadUInt32(); ViewSliceFirst = loader.ReadUInt32(); ViewSliceCount = loader.ReadUInt32(); CompSelR = loader.ReadEnum <GX2CompSel>(true); CompSelG = loader.ReadEnum <GX2CompSel>(true); CompSelB = loader.ReadEnum <GX2CompSel>(true); CompSelA = loader.ReadEnum <GX2CompSel>(true); Regs = loader.ReadUInt32s(5); uint handle = loader.ReadUInt32(); ArrayLength = loader.ReadUInt32(); // Possibly just a byte. Name = loader.LoadString(); Path = loader.LoadString(); Data = loader.LoadCustom(() => loader.ReadBytes((int)sizData)); MipData = loader.LoadCustom(() => loader.ReadBytes((int)sizMipData)); UserData = loader.LoadDict <UserData>(); ushort numUserData = loader.ReadUInt16(); loader.Seek(2); }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { if (loader.IsSwitch) { Name = loader.LoadString(); uint CurveOffset = loader.ReadOffset(); uint BaseDataOffset = loader.ReadOffset(); uint KeyShapeAnimInfosOffset = loader.ReadOffset(); ushort numCurve = loader.ReadUInt16(); ushort numKeyShapeAnim = loader.ReadUInt16(); BeginCurve = loader.ReadInt32(); BeginKeyShapeAnim = loader.ReadInt32(); loader.Seek(4); //Padding KeyShapeAnimInfos = loader.LoadList <KeyShapeAnimInfo>(numKeyShapeAnim, KeyShapeAnimInfosOffset); Curves = loader.LoadList <AnimCurve>(numCurve, CurveOffset); BaseDataList = loader.LoadCustom(() => loader.ReadSingles(numKeyShapeAnim - 1), BaseDataOffset); // Without base shape. } else { ushort numCurve; ushort numKeyShapeAnim; if (loader.ResFile.Version >= 0x03040000) { numCurve = loader.ReadUInt16(); numKeyShapeAnim = loader.ReadUInt16(); } else { numCurve = loader.ReadByte(); numKeyShapeAnim = loader.ReadByte(); unk = loader.ReadUInt16(); } BeginCurve = loader.ReadInt32(); BeginKeyShapeAnim = loader.ReadInt32(); Name = loader.LoadString(); KeyShapeAnimInfos = loader.LoadList <KeyShapeAnimInfo>(numKeyShapeAnim); Curves = loader.LoadList <AnimCurve>(numCurve); BaseDataList = loader.LoadCustom(() => loader.ReadSingles(numKeyShapeAnim - 1)); // Without base shape. } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { loader.CheckSignature(_signature); Name = loader.LoadString(); Path = loader.LoadString(); Flags = loader.ReadEnum <ShapeAnimFlags>(true); ushort numUserData = loader.ReadUInt16(); FrameCount = loader.ReadInt32(); ushort numVertexShapeAnim = loader.ReadUInt16(); ushort numKeyShapeAnim = loader.ReadUInt16(); ushort numCurve = loader.ReadUInt16(); loader.Seek(2); BakedSize = loader.ReadUInt32(); BindModel = loader.Load <Model>(); BindIndices = loader.LoadCustom(() => loader.ReadUInt16s(numVertexShapeAnim)); VertexShapeAnims = loader.LoadList <VertexShapeAnim>(numVertexShapeAnim); UserData = loader.LoadDict <UserData>(); }
void IResData.Load(ResFileLoader loader) { loader.CheckSignature(_signature); if (loader.IsSwitch) { Switch.VertexBufferParser.Load((Switch.Core.ResFileSwitchLoader)loader, this); } else { byte numVertexAttrib = loader.ReadByte(); byte numBuffer = loader.ReadByte(); ushort idx = loader.ReadUInt16(); uint vertexCount = loader.ReadUInt32(); VertexSkinCount = loader.ReadByte(); loader.Seek(3); uint ofsVertexAttribList = loader.ReadOffset(); // Only load dict. Attributes = loader.LoadDict <VertexAttrib>(); Buffers = loader.LoadList <Buffer>(numBuffer); uint userPointer = loader.ReadUInt32(); } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { ushort count = loader.ReadUInt16(); Type = loader.ReadEnum <RenderInfoType>(true); loader.Seek(1); Name = loader.LoadString(); switch (Type) { case RenderInfoType.Int32: _value = loader.ReadInt32s(count); break; case RenderInfoType.Single: _value = loader.ReadSingles(count); break; case RenderInfoType.String: _value = loader.LoadStrings(count); break; } }
// TODO: Methods to retrieve the strongly-typed shader param value. // ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { Type = loader.ReadEnum <ShaderParamType>(true); if (loader.ResFile.Version >= 0x03030000) { byte sizData = loader.ReadByte(); DataOffset = loader.ReadUInt16(); int offset = loader.ReadInt32(); // Uniform variable offset. uint callbackPointer = loader.ReadUInt32(); DependedIndex = loader.ReadUInt16(); DependIndex = loader.ReadUInt16(); Name = loader.LoadString(); } else { // GUESS loader.Seek(1); DataOffset = loader.ReadUInt16(); int offset = loader.ReadInt32(); // Uniform variable offset. Name = loader.LoadString(); } }
void IResData.Load(ResFileLoader loader) { if (loader.IsSwitch) { Name = loader.LoadString(); uint CurveOffset = loader.ReadOffset(); uint BaseDataOffset = loader.ReadOffset(); if (loader.ResFile.VersionMajor2 == 9) { long unk1 = loader.ReadInt64(); long unk2 = loader.ReadInt64(); } _flags = loader.ReadUInt32(); BeginRotate = loader.ReadByte(); BeginTranslate = loader.ReadByte(); byte numCurve = loader.ReadByte(); BeginBaseTranslate = loader.ReadByte(); BeginCurve = loader.ReadInt32(); int padding = loader.ReadInt32(); BaseData = loader.LoadCustom(() => new BoneAnimData(loader, FlagsBase), BaseDataOffset); Curves = loader.LoadList <AnimCurve>(numCurve, CurveOffset); } else { _flags = loader.ReadUInt32(); Name = loader.LoadString(); BeginRotate = loader.ReadByte(); BeginTranslate = loader.ReadByte(); byte numCurve = loader.ReadByte(); BeginBaseTranslate = loader.ReadByte(); BeginCurve = loader.ReadByte(); loader.Seek(3); Curves = loader.LoadList <AnimCurve>(numCurve); BaseData = loader.LoadCustom(() => new BoneAnimData(loader, FlagsBase)); } }
// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(ResFileLoader loader) { if (loader.IsSwitch) { uint SubMeshArrayOffset = loader.ReadOffset(); MemoryPool = loader.Load <MemoryPool>(); long Buffer = loader.ReadOffset(); var bufferSize = loader.Load <BufferSize>(); uint FaceBufferOffset = loader.ReadUInt32(); PrimitiveType = PrimitiveTypeList[loader.ReadEnum <SwitchPrimitiveType>(true)]; IndexFormat = IndexList[loader.ReadEnum <SwitchIndexFormat>(true)]; uint indexCount = loader.ReadUInt32(); FirstVertex = loader.ReadUInt32(); ushort numSubMesh = loader.ReadUInt16(); ushort padding = loader.ReadUInt16(); SubMeshes = loader.LoadList <SubMesh>(numSubMesh, SubMeshArrayOffset).ToList(); uint DataOffset = (uint)BufferInfo.BufferOffset + FaceBufferOffset; //Load buffer data from mem block IndexBuffer = new Buffer(); IndexBuffer.Flags = bufferSize.Flag; IndexBuffer.Data = new byte[1][]; IndexBuffer.Data[0] = loader.LoadCustom(() => loader.ReadBytes((int)bufferSize.Size), DataOffset); } else { PrimitiveType = loader.ReadEnum <GX2PrimitiveType>(true); IndexFormat = loader.ReadEnum <GX2IndexFormat>(true); uint indexCount = loader.ReadUInt32(); ushort numSubMesh = loader.ReadUInt16(); loader.Seek(2); SubMeshes = loader.LoadList <SubMesh>(numSubMesh).ToList(); IndexBuffer = loader.Load <Buffer>(); FirstVertex = loader.ReadUInt32(); } }