internal RagdollBoneEntry(BinaryReaderEx br, GameType game) { if (game == GameType.BB) { RagdollParamID = br.ReadInt32(); DamageAnimID = br.ReadInt16(); NPCPartGroupIndex = br.ReadByte(); Unknown = br.ReadByte(); UnknownBB = br.ReadSByte(); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0); br.AssertInt32(0); } else { RagdollParamID = br.ReadInt16(); DamageAnimID = br.ReadInt16(); NPCPartGroupIndex = br.ReadByte(); Unknown = br.ReadByte(); br.AssertByte(0); br.AssertByte(0); if (game == GameType.DS3) { br.AssertInt64(0); } } }
internal Section3(BinaryReaderEx br) { br.AssertInt16(11); br.AssertByte(0); br.AssertByte(1); br.AssertInt32(0); Unk08 = br.ReadInt32(); br.AssertInt32(0); Unk10 = br.AssertInt32(0x100FFFC, 0x100FFFD); br.AssertInt32(0); br.AssertInt32(1); br.AssertInt32(0); int section11Offset1 = br.ReadInt32(); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); Unk38 = br.AssertInt32(0x100FFFC, 0x100FFFD); br.AssertInt32(0); br.AssertInt32(1); br.AssertInt32(0); int section11Offset2 = br.ReadInt32(); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); Section11Data1 = br.GetInt32(section11Offset1); Section11Data2 = br.GetInt32(section11Offset2); }
internal Mesh(BinaryReaderEx br, FLVERHeader header) { Dynamic = br.ReadBoolean(); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0); MaterialIndex = br.ReadInt32(); br.AssertInt32(0); br.AssertInt32(0); DefaultBoneIndex = br.ReadInt32(); int boneCount = br.ReadInt32(); int boundingBoxOffset = br.ReadInt32(); int boneOffset = br.ReadInt32(); int faceSetCount = br.ReadInt32(); int faceSetOffset = br.ReadInt32(); int vertexBufferCount = br.AssertInt32(1, 2, 3); int vertexBufferOffset = br.ReadInt32(); if (boundingBoxOffset != 0) { br.StepIn(boundingBoxOffset); { BoundingBox = new BoundingBoxes(br, header); } br.StepOut(); } BoneIndices = new List <int>(br.GetInt32s(boneOffset, boneCount)); faceSetIndices = br.GetInt32s(faceSetOffset, faceSetCount); vertexBufferIndices = br.GetInt32s(vertexBufferOffset, vertexBufferCount); }
private protected Event(BinaryReaderEx br) { long start = br.Position; long nameOffset = br.ReadVarint(); EventID = br.ReadInt32(); br.AssertByte((byte)Type); br.AssertByte(0); br.ReadInt16(); // ID long typeDataOffset = br.ReadVarint(); if (!br.VarintLong) { br.AssertInt32(0); br.AssertInt32(0); } if (nameOffset == 0) { throw new InvalidDataException($"{nameof(nameOffset)} must not be 0 in type {GetType()}."); } if (typeDataOffset == 0) { throw new InvalidDataException($"{nameof(typeDataOffset)} must not be 0 in type {GetType()}."); } br.Position = start + nameOffset; Name = br.ReadUTF16(); br.Position = start + typeDataOffset; ReadTypeData(br); }
private protected Model(BinaryReaderEx br) { long start = br.Position; long nameOffset = br.ReadVarint(); br.AssertByte((byte)Type); br.AssertByte(0); br.ReadInt16(); // ID if (br.VarintLong) { br.AssertInt32(0); } long typeDataOffset = br.ReadVarint(); br.AssertVarint(0); if (nameOffset == 0) { throw new InvalidDataException($"{nameof(nameOffset)} must not be 0 in type {GetType()}."); } if (HasTypeData ^ typeDataOffset != 0) { throw new InvalidDataException($"Unexpected {nameof(typeDataOffset)} 0x{typeDataOffset:X} in type {GetType()}."); } br.Position = start + nameOffset; Name = br.ReadUTF16(); if (HasTypeData) { br.Position = start + typeDataOffset; ReadTypeData(br); } }
internal Section5(BinaryReaderEx br) { Unk00 = br.ReadInt16(); br.AssertByte(0); br.AssertByte(1); br.AssertInt32(0); br.AssertInt32(0); int section6Count = br.ReadInt32(); br.AssertInt32(0); br.AssertInt32(0); int section6Offset = br.ReadInt32(); br.AssertInt32(0); br.StepIn(section6Offset); { Section6s = new List <FFXDrawEntityHost>(section6Count); for (int i = 0; i < section6Count; i++) { Section6s.Add(new FFXDrawEntityHost(br)); } } br.StepOut(); }
internal override void Read(BinaryReaderEx br) { br.AssertInt32(0); br.AssertInt32(0); partIndex2 = br.ReadInt32(); br.AssertInt32(0); ItemLot1 = br.ReadInt32(); ItemLot2 = br.ReadInt32(); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); PickupAnimID = br.ReadInt32(); IsChest = br.ReadBoolean(); IsYoelUnknown = br.ReadBoolean(); br.AssertByte(0); br.AssertByte(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); }
protected override void Read(BinaryReaderEx br) { br.AssertASCII("FLVER\0"); BigEndian = br.AssertASCII("L\0", "B\0") == "B\0"; br.BigEndian = BigEndian; // 10002, 10003 - Another Century's Episode R Version = br.AssertInt32(0x0E, 0x0F, 0x10, 0x12, 0x13, 0x14, 0x15, 0x10002, 0x10003); int dataOffset = br.ReadInt32(); br.ReadInt32(); // Data length int dummyCount = br.ReadInt32(); int materialCount = br.ReadInt32(); int boneCount = br.ReadInt32(); int meshCount = br.ReadInt32(); br.ReadInt32(); // Vertex buffer count BoundingBoxMin = br.ReadVector3(); BoundingBoxMax = br.ReadVector3(); br.ReadInt32(); // Face count not including motion blur meshes or degenerate faces br.ReadInt32(); // Total face count VertexIndexSize = br.AssertByte(16, 32); Unicode = br.ReadBoolean(); Unk4A = br.ReadByte(); Unk4B = br.ReadByte(); Unk4C = br.ReadInt32(); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); Unk5C = br.ReadByte(); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0); br.AssertPattern(0x20, 0x00); Dummies = new List <FLVER.Dummy>(dummyCount); for (int i = 0; i < dummyCount; i++) { Dummies.Add(new FLVER.Dummy(br, Version)); } Materials = new List <Material>(materialCount); for (int i = 0; i < materialCount; i++) { Materials.Add(new Material(br, this)); } Bones = new List <FLVER.Bone>(boneCount); for (int i = 0; i < boneCount; i++) { Bones.Add(new FLVER.Bone(br, Unicode)); } Meshes = new List <Mesh>(meshCount); for (int i = 0; i < meshCount; i++) { Meshes.Add(new Mesh(br, this, dataOffset)); } }
/// <summary> /// Reads BND3 data from a BinaryReaderEx. /// </summary> internal override void Read(BinaryReaderEx br) { br.BigEndian = false; br.AssertASCII("BND3"); Timestamp = br.ReadFixStr(8); Format = br.AssertByte(0x0E, 0x2E, 0x40, 0x54, 0x60, 0x64, 0x70, 0x74, 0xE0, 0xF0); BigEndian = br.ReadBoolean(); Unk1 = br.ReadBoolean(); br.AssertByte(0); br.BigEndian = BigEndian || Format == 0xE0 || Format == 0xF0; int fileCount = br.ReadInt32(); // File headers end; sometimes 0, but it's redundant anyways br.ReadInt32(); Unk2 = br.ReadInt32(); br.AssertInt32(0); Files = new List <File>(fileCount); for (int i = 0; i < fileCount; i++) { Files.Add(new File(br, Format)); } }
internal FFXProperty(BinaryReaderEx br) { Unk00 = br.ReadInt16(); br.AssertByte(0); br.AssertByte(1); Unk04 = br.ReadInt32(); int section11Count = br.ReadInt32(); br.AssertInt32(0); int section11Offset = br.ReadInt32(); br.AssertInt32(0); int section8Offset = br.ReadInt32(); br.AssertInt32(0); int section8Count = br.ReadInt32(); br.AssertInt32(0); br.StepIn(section8Offset); { Section8s = new List <Section8>(section8Count); for (int i = 0; i < section8Count; i++) { Section8s.Add(new Section8(br)); } } br.StepOut(); Section11s = new List <int>(br.GetInt32s(section11Offset, section11Count)); }
private BHD5(BinaryReaderEx br, Game game) { br.AssertASCII("BHD5"); br.BigEndian = br.AssertSByte(0, -1) == 0; br.AssertByte(0, 1); br.AssertByte(0); br.AssertByte(0); br.AssertInt32(1); int fileSize = br.ReadInt32(); int bucketCount = br.ReadInt32(); int bucketsOffset = br.ReadInt32(); Salt = null; if (game == Game.DarkSouls2 || game == Game.DarkSouls3 || game == Game.Sekiro) { int saltLength = br.ReadInt32(); Salt = br.ReadASCII(saltLength); } Buckets = new List <Bucket>(bucketCount); for (int i = 0; i < bucketCount; i++) { Buckets.Add(new Bucket(br, game)); } }
/// <summary> /// Deserializes file data from a stream. /// </summary> protected override void Read(BinaryReaderEx br) { br.BigEndian = br.GetBoolean(0x10); br.AssertInt32(1); br.AssertInt32(0); int entryCount = br.ReadInt32(); int stringsLength = br.ReadInt32(); BigEndian = br.ReadBoolean(); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0); br.VarintLong = LongFormat = br.AssertInt32(0x1C, 0x28) == 0x28; // Entry size br.AssertPattern(0x24, 0x00); long stringsStart = br.Position; br.Skip(stringsLength); Entries = new List <Entry>(entryCount); for (int i = 0; i < entryCount; i++) { Entries.Add(new Entry(br, stringsStart)); } }
private BHD5(BinaryReaderEx br, Game game) { Format = game; br.AssertASCII("BHD5"); BigEndian = br.AssertSByte(0, -1) == 0; br.BigEndian = BigEndian; Unk05 = br.ReadBoolean(); br.AssertByte(0); br.AssertByte(0); br.AssertInt32(1); br.ReadInt32(); // File size int bucketCount = br.ReadInt32(); int bucketsOffset = br.ReadInt32(); if (game >= Game.DarkSouls2) { int saltLength = br.ReadInt32(); Salt = br.ReadASCII(saltLength); // No padding } br.Position = bucketsOffset; Buckets = new List <Bucket>(bucketCount); for (int i = 0; i < bucketCount; i++) { Buckets.Add(new Bucket(br, game)); } }
internal override void Read(BinaryReaderEx br) { br.AssertInt32(0); br.AssertInt32(0); partIndex2 = br.ReadInt32(); br.AssertInt32(0); ItemLot1 = br.ReadInt32(); ItemLot2 = br.ReadInt32(); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); ActionButtonParamID = br.ReadInt32(); PickupAnimID = br.ReadInt32(); InChest = br.ReadBoolean(); StartDisabled = br.ReadBoolean(); br.AssertByte(0); br.AssertByte(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); }
internal Texture(BinaryReaderEx br, FLVERHeader header) { int pathOffset = br.ReadInt32(); int typeOffset = br.ReadInt32(); Scale = br.ReadVector2(); Unk10 = br.AssertByte(0, 1, 2); Unk11 = br.ReadBoolean(); br.AssertByte(0); br.AssertByte(0); Unk14 = br.ReadSingle(); Unk18 = br.ReadSingle(); Unk1C = br.ReadSingle(); if (header.Unicode) { Type = br.GetUTF16(typeOffset); Path = br.GetUTF16(pathOffset); } else { Type = br.GetShiftJIS(typeOffset); Path = br.GetShiftJIS(pathOffset); } }
private protected override void ReadTypeData(BinaryReaderEx br) { MaxNum = br.ReadByte(); GenType = br.ReadSByte(); LimitNum = br.ReadInt16(); MinGenNum = br.ReadInt16(); MaxGenNum = br.ReadInt16(); MinInterval = br.ReadSingle(); MaxInterval = br.ReadSingle(); InitialSpawnCount = br.ReadByte(); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0); UnkT14 = br.ReadSingle(); UnkT18 = br.ReadSingle(); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); SpawnPointIndices = br.ReadInt32s(8); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); SpawnPartIndices = br.ReadInt32s(32); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); }
private protected override void ReadTypeData(BinaryReaderEx br) { br.AssertInt32(0); br.AssertInt32(0); TreasurePartIndex = br.ReadInt32(); br.AssertInt32(0); ItemLot1 = br.ReadInt32(); ItemLot2 = br.ReadInt32(); UnkT18 = br.ReadInt32(); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); br.AssertInt32(-1); ActionButtonParamID = br.ReadInt32(); PickupAnimID = br.ReadInt32(); InChest = br.ReadBoolean(); StartDisabled = br.ReadBoolean(); br.AssertByte(0); br.AssertByte(0); br.AssertInt32(0); br.AssertInt32(0); br.AssertInt32(0); }
internal Texture(BinaryReaderEx br, TPFPlatform platform, byte encoding) { int fileOffset = br.ReadInt32(); int fileSize = br.ReadInt32(); Format = br.ReadByte(); Cubemap = br.ReadBoolean(); Mipmaps = br.ReadByte(); Flags1 = br.AssertByte(0, 1, 2, 3); int nameOffset = 0; if (platform == TPFPlatform.PC) { Header = null; nameOffset = br.ReadInt32(); Flags2 = br.AssertInt32(0, 1); } else if (platform == TPFPlatform.PS3) { Header = new TexHeader(); Header.Width = br.ReadInt16(); Header.Height = br.ReadInt16(); Header.Unk1 = br.ReadInt32(); Header.Unk2 = br.AssertInt32(0, 0xAAE4); nameOffset = br.ReadInt32(); Flags2 = br.AssertInt32(0, 1); } else if (platform == TPFPlatform.PS4 || platform == TPFPlatform.Xbone) { Header = new TexHeader(); Header.Width = br.ReadInt16(); Header.Height = br.ReadInt16(); Header.TextureCount = br.AssertByte(1, 6); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0); Header.Unk2 = br.AssertInt32(0xD); nameOffset = br.ReadInt32(); Flags2 = br.AssertInt32(0, 1); Header.DXGIFormat = br.ReadInt32(); } Bytes = br.GetBytes(fileOffset, fileSize); if (Flags1 == 2 || Flags1 == 3) { Bytes = DCX.Decompress(Bytes); } if (encoding == 1) { Name = br.GetUTF16(nameOffset); } else if (encoding == 0 || encoding == 2) { Name = br.GetShiftJIS(nameOffset); } }
internal Mesh(BinaryReaderEx br, NGPVersion version) { Unk00 = br.ReadInt32(); br.ReadInt32(); // Length of this mesh (including child structs) Unk08 = br.ReadInt32(); if (version == NGPVersion.Scholar) { br.AssertInt32(0); } BoundingBoxMin = br.ReadVector3(); BoundingBoxMax = br.ReadVector3(); int vertexCount = br.ReadInt32(); short faceCount = br.ReadInt16(); short count30 = br.ReadInt16(); Unk30 = br.ReadInt16(); Unk32 = br.ReadInt16(); br.AssertByte(1); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0); if (version == NGPVersion.Scholar) { br.AssertInt64(0); } long verticesOffset = br.ReadVarint(); long offset48 = br.ReadVarint(); long facesOffset = br.ReadVarint(); long offset58 = br.ReadVarint(); long offset60 = br.ReadVarint(); long offset68 = br.ReadVarint(); br.Position = verticesOffset; Vertices = new List <Vector3>(vertexCount); for (int i = 0; i < vertexCount; i++) { Vertices.Add(br.ReadVector3()); } br.Position = offset48; Struct2s = new List <int>(br.ReadInt32s(faceCount)); br.Position = facesOffset; Faces = new List <Face>(faceCount); for (int i = 0; i < faceCount; i++) { Faces.Add(new Face(br)); } br.Position = offset58; Struct4s = new List <Struct4>(count30); for (int i = 0; i < count30; i++) { Struct4s.Add(new Struct4(br)); } br.Position = offset60; Struct5Root = new Struct5(br, offset60, offset68); }
private protected override void ReadTypeData(BinaryReaderEx br) { UnkT00 = br.ReadByte(); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0); Position = br.ReadVector3(); }
internal override void Read(BinaryReaderEx br) { br.BigEndian = false; br.AssertASCII("TAE "); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0xFF); int version = br.AssertInt32(0x1000C); int fileSize = br.ReadInt32(); br.AssertInt64(0x40); br.AssertInt64(1); br.AssertInt64(0x50); br.AssertInt64(0x80); Unk30 = br.ReadInt64(); br.AssertInt64(0); Flags = br.ReadBytes(8); br.AssertInt64(1); ID = br.ReadInt32(); int animCount = br.ReadInt32(); long animsOffset = br.ReadInt64(); long animGroupsOffset = br.ReadInt64(); br.AssertInt64(0xA0); br.AssertInt64(animCount); long firstAnimOffset = br.ReadInt64(); br.AssertInt64(1); br.AssertInt64(0x90); br.AssertInt32(ID); br.AssertInt32(ID); br.AssertInt64(0x50); br.AssertInt64(0); br.AssertInt64(0xB0); long skeletonNameOffset = br.ReadInt64(); long sibNameOffset = br.ReadInt64(); br.AssertInt64(0); br.AssertInt64(0); SkeletonName = br.GetUTF16(skeletonNameOffset); SibName = br.GetUTF16(sibNameOffset); br.StepIn(animsOffset); { Animations = new List <Animation>(animCount); for (int i = 0; i < animCount; i++) { Animations.Add(new Animation(br)); } } br.StepOut(); // Don't bother reading anim groups. }
/// <summary> /// Deserializes file data from a stream. /// </summary> protected override void Read(BinaryReaderEx br) { br.BigEndian = false; br.AssertASCII("MSB "); br.AssertInt32(1); br.AssertInt32(0x10); br.AssertBoolean(false); // isBigEndian br.AssertBoolean(false); // isBitBigEndian br.AssertByte(1); // textEncoding br.AssertByte(0xFF); // is64BitOffset Entries entries = default; Models = new ModelParam(); entries.Models = Models.Read(br); Events = new EventParam(); entries.Events = Events.Read(br); Regions = new PointParam(); entries.Regions = Regions.Read(br); Routes = new RouteParam(); entries.Routes = Routes.Read(br); Layers = new LayerParam(); entries.Layers = Layers.Read(br); Parts = new PartsParam(); entries.Parts = Parts.Read(br); PartsPoses = new MapstudioPartsPose(); entries.PartsPoses = PartsPoses.Read(br); BoneNames = new MapstudioBoneName(); entries.BoneNames = BoneNames.Read(br); if (br.Position != 0) { throw new InvalidDataException("The next param offset of the final param should be 0, but it wasn't."); } MSB.DisambiguateNames(entries.Models); MSB.DisambiguateNames(entries.Parts); MSB.DisambiguateNames(entries.Regions); foreach (Event evt in entries.Events) { evt.GetNames(this, entries); } foreach (Region region in entries.Regions) { region.GetNames(this, entries); } foreach (Part part in entries.Parts) { part.GetNames(this, entries); } foreach (PartsPose pose in entries.PartsPoses) { pose.GetNames(this, entries); } }
internal CommandDesc(BinaryReaderEx br, List <string> strings) { short nameIndex = br.ReadInt16(); br.AssertByte(1); br.AssertByte(0xFF); Name = strings[nameIndex]; }
public static void Assert(BinaryReaderEx br) { br.ReadInt64(); // Hashes offset br.ReadInt32(); // Bucket count br.AssertByte(0x10); // Hash table header size? br.AssertByte(8); // Bucket size? br.AssertByte(8); // Hash size? br.AssertByte(0); // Don't actually care about the hashes, I just like asserting }
private protected override void ReadTypeData(BinaryReaderEx br) { CollisionIndex = br.ReadInt32(); MapID = br.ReadBytes(4); UnkT08 = br.ReadInt32(); UnkT0C = br.ReadByte(); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0); }
internal AnimBoneEntry(BinaryReaderEx br) { SkeletonParamID = br.ReadInt16(); Unk2 = br.ReadByte(); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0); }
internal static void AssertHeader(BinaryReaderEx br) { br.AssertASCII("MSB "); br.AssertInt32(1); br.AssertInt32(0x10); br.AssertBoolean(false); // isBigEndian br.AssertBoolean(false); // isBitBigEndian br.AssertByte(1); // textEncoding br.AssertByte(0xFF); // is64BitOffset }
internal override void Read(BinaryReaderEx br) { br.AssertASCII("ELD\0"); bool bigEndian = br.ReadBoolean(); bool is64Bit = br.AssertSByte(0, -1) == -1; br.AssertByte(0); br.AssertByte(0); br.BigEndian = bigEndian; br.VarintLong = is64Bit; br.AssertInt16(0x65); br.AssertInt16(0xCC); br.ReadInt32(); // File size if (!bigEndian && !is64Bit) { Format = EMEVD.Game.DarkSouls1; } else if (bigEndian && !is64Bit) { Format = EMEVD.Game.DarkSouls1BE; } else if (!bigEndian && is64Bit) { Format = EMEVD.Game.Bloodborne; } else { throw new NotSupportedException($"Unknown EMELD format: BigEndian={bigEndian} Is64Bit={is64Bit}"); } long eventCount = br.ReadVarint(); long eventsOffset = br.ReadVarint(); br.AssertVarint(0); // Unused count 2 br.ReadVarint(); // Unused offset 2 br.AssertVarint(0); // Unused count 3 br.ReadVarint(); // Unused offset 3 br.ReadVarint(); // Strings length long stringsOffset = br.ReadVarint(); if (!is64Bit) { br.AssertInt32(0); br.AssertInt32(0); } br.Position = eventsOffset; Events = new List <Event>((int)eventCount); for (int i = 0; i < eventCount; i++) { Events.Add(new Event(br, Format, stringsOffset)); } }
/// <summary> /// Deserializes file data from a stream. /// </summary> protected override void Read(BinaryReaderEx br) { br.BigEndian = false; br.AssertASCII("MSB "); br.AssertInt32(1); br.AssertInt32(0x10); br.AssertBoolean(false); // isBigEndian br.AssertBoolean(false); // isBitBigEndian br.AssertByte(1); // textEncoding br.AssertByte(0xFF); // is64BitOffset Entries entries; Models = new ModelParam(); entries.Models = Models.Read(br); Events = new EventParam(); entries.Events = Events.Read(br); Regions = new PointParam(); entries.Regions = Regions.Read(br); Routes = new RouteParam(); entries.Routes = Routes.Read(br); Layers = new EmptyParam(0x23, "LAYER_PARAM_ST"); Layers.Read(br); Parts = new PartsParam(); entries.Parts = Parts.Read(br); PartsPoses = new EmptyParam(0, "MAPSTUDIO_PARTS_POSE_ST"); PartsPoses.Read(br); BoneNames = new EmptyParam(0, "MAPSTUDIO_BONE_NAME_STRING"); BoneNames.Read(br); if (br.Position != 0) { throw new InvalidDataException("The next param offset of the final param should be 0, but it wasn't."); } MSB.DisambiguateNames(entries.Models); MSB.DisambiguateNames(entries.Regions); MSB.DisambiguateNames(entries.Parts); foreach (Event evt in entries.Events) { evt.GetNames(this, entries); } foreach (Region region in entries.Regions) { region.GetNames(entries); } foreach (Part part in entries.Parts) { part.GetNames(this, entries); } }
internal static BinderFileHeader ReadBinder4FileHeader(BinaryReaderEx br, Format format, bool bitBigEndian, bool unicode) { FileFlags flags = ReadFileFlags(br, bitBigEndian, format); br.AssertByte(0); br.AssertByte(0); br.AssertByte(0); br.AssertInt32(-1); long compressedSize = br.ReadInt64(); long uncompressedSize = -1; if (HasCompression(format)) { uncompressedSize = br.ReadInt64(); } long dataOffset; if (HasLongOffsets(format)) { dataOffset = br.ReadInt64(); } else { dataOffset = br.ReadUInt32(); } int id = -1; if (HasIDs(format)) { id = br.ReadInt32(); } string name = null; if (HasNames(format)) { uint nameOffset = br.ReadUInt32(); if (unicode) { name = br.GetUTF16(nameOffset); } else { name = br.GetShiftJIS(nameOffset); } } return(new BinderFileHeader(flags, id, name, compressedSize, uncompressedSize, dataOffset)); }