void IResData.Save(ResFileSaver saver) { saver.WriteSignature(_signature); saver.SaveString(Name); saver.SaveString(Path); saver.Write(_flags); if (saver.ResFile.Version >= 0x03040000) { saver.Write(FrameCount); saver.Write((ushort)BoneAnims.Count); saver.Write((ushort)UserData.Count); saver.Write(BoneAnims.Sum((x) => x.Curves.Count)); saver.Write(BakedSize); } else { saver.Write((ushort)FrameCount); saver.Write((ushort)BoneAnims.Count); saver.Write((ushort)UserData.Count); saver.Write((ushort)BoneAnims.Sum((x) => x.Curves.Count)); saver.Write(BakedSize); saver.Seek(4); } PosBoneAnimsOffset = saver.SaveOffsetPos(); PosBindModelOffset = saver.SaveOffsetPos(); PosBindIndicesOffset = saver.SaveOffsetPos(); PosUserDataOffset = saver.SaveOffsetPos(); }
void IResData.Save(ResFileSaver saver) { saver.WriteSignature(_signature); saver.SaveString(Name); saver.SaveString(Path); saver.Write(_flags); saver.Write(FrameCount); saver.Write((ushort)BoneAnims.Count); saver.Write((ushort)UserData.Count); saver.Write(BoneAnims.Sum((x) => x.Curves.Count)); saver.Write(BakedSize); saver.SaveList(BoneAnims); saver.Save(BindSkeleton); saver.SaveCustom(BindIndices, () => saver.Write(BindIndices)); saver.SaveDict(UserData); }
void IResData.Save(ResFileSaver saver) { if (BindIndices == null) { BindIndices = new ushort[0]; } saver.WriteSignature(_signature); if (saver.IsSwitch) { if (saver.ResFile.VersionMajor2 == 9) { saver.Write(_flags); } else { ((Switch.Core.ResFileSwitchSaver)saver).SaveHeaderBlock(); } saver.SaveString(Name); saver.SaveString(Path); saver.Write(0L); PosBindIndicesOffset = saver.SaveOffset(); PosBoneAnimsOffset = saver.SaveOffset(); PosUserDataOffset = saver.SaveOffset(); PosUserDataDictOffset = saver.SaveOffset(); if (saver.ResFile.VersionMajor2 != 9) { saver.Write(_flags); } saver.Write(FrameCount); saver.Write(BoneAnims.Sum((x) => x.Curves.Count)); saver.Write(BakedSize); saver.Write((ushort)BoneAnims.Count); saver.Write((ushort)UserData.Count); if (saver.ResFile.VersionMajor2 != 9) { saver.Write(0); //padding } } else { saver.SaveString(Name); saver.SaveString(Path); saver.Write(_flags); if (saver.ResFile.Version >= 0x03040000) { saver.Write(FrameCount); saver.Write((ushort)BoneAnims.Count); saver.Write((ushort)UserData.Count); saver.Write(BoneAnims.Sum((x) => x.Curves.Count)); saver.Write(BakedSize); } else { saver.Write((ushort)FrameCount); saver.Write((ushort)BoneAnims.Count); saver.Write((ushort)UserData.Count); saver.Write((ushort)BoneAnims.Sum((x) => x.Curves.Count)); saver.Write(BakedSize); saver.Seek(4); } PosBoneAnimsOffset = saver.SaveOffsetPos(); PosBindModelOffset = saver.SaveOffsetPos(); PosBindIndicesOffset = saver.SaveOffsetPos(); PosUserDataOffset = saver.SaveOffsetPos(); } }