/// <summary> /// Deserializes file data from a stream. /// </summary> protected override void Read(BinaryReaderEx br) { br.BigEndian = false; MSB.AssertHeader(br); 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); Parts = new PartsParam(); entries.Parts = Parts.Read(br); if (br.Position != 0) { throw new InvalidDataException($"The next param offset of the final param should be 0, but it was 0x{br.Position:X}."); } MSB.DisambiguateNames(entries.Models); MSB.DisambiguateNames(entries.Regions); MSB.DisambiguateNames(entries.Parts); foreach (Event evt in entries.Events) { evt.GetNames(this, entries); } foreach (Part part in entries.Parts) { part.GetNames(this, entries); } }
/// <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); } }
/// <summary> /// Deserializes file data from a stream. /// </summary> protected override void Read(BinaryReaderEx br) { br.BigEndian = false; br.VarintLong = false; if (br.GetASCII(0, 4) == "MSB ") { Format = MSBFormat.DarkSouls2Scholar; br.VarintLong = true; MSB.AssertHeader(br); } else if (br.GetUInt32(0) == 5) { Format = MSBFormat.DarkSouls2LE; } else { Format = MSBFormat.DarkSouls2BE; br.BigEndian = true; } 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); new RouteParam().Read(br); new LayerParam().Read(br); Parts = new PartsParam(); entries.Parts = Parts.Read(br); PartPoses = new MapstudioPartsPose().Read(br); entries.BoneNames = new MapstudioBoneName().Read(br); if (br.Position != 0) { throw new InvalidDataException($"The next param offset of the final param should be 0, but it was 0x{br.Position:X}."); } MSB.DisambiguateNames(entries.Models); MSB.DisambiguateNames(entries.Parts); MSB.DisambiguateNames(entries.BoneNames); foreach (Part part in entries.Parts) { part.GetNames(this, entries); } foreach (PartPose pose in PartPoses) { pose.GetNames(entries); } }
/// <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 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.AssertSByte(-1); // 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); new RouteParam().Read(br); new LayerParam().Read(br); Parts = new PartsParam(); entries.Parts = Parts.Read(br); PartPoses = new MapstudioPartsPose().Read(br); entries.BoneNames = new MapstudioBoneName().Read(br); if (br.Position != 0) { throw new InvalidDataException($"The next param offset of the final param should be 0, but it was 0x{br.Position:X}."); } DisambiguateNames(entries.Models); DisambiguateNames(entries.Parts); DisambiguateNames(entries.BoneNames); foreach (Part part in entries.Parts) { part.GetNames(this, entries); } foreach (PartPose pose in PartPoses) { pose.GetNames(entries); } }