Beispiel #1
0
 /// <summary>
 /// Creates a new MSB3 with all sections empty.
 /// </summary>
 public MSB3()
 {
     Models     = new ModelSection();
     Events     = new EventSection();
     Regions    = new PointSection();
     Routes     = new RouteSection();
     Layers     = new LayerSection();
     Parts      = new PartsSection();
     PartsPoses = new PartsPoseSection();
     BoneNames  = new BoneNameSection();
 }
Beispiel #2
0
        internal override void Read(BinaryReaderEx br)
        {
            br.BigEndian = false;

            br.AssertASCII("MSB ");
            br.AssertInt32(1);
            // Header size/data start
            br.AssertInt32(0x10);

            // Probably bytes, just guessing
            br.AssertByte(0);
            br.AssertByte(0);
            br.AssertByte(1);
            br.AssertByte(0xFF);

            Entries entries = default;

            long nextSectionOffset = br.Position;

            while (nextSectionOffset != 0)
            {
                br.Position = nextSectionOffset;

                int    unk1       = br.ReadInt32();
                int    offsets    = br.ReadInt32() - 1;
                long   typeOffset = br.ReadInt64();
                string type       = br.GetUTF16(typeOffset);

                switch (type)
                {
                case "MODEL_PARAM_ST":
                    Models         = new ModelSection(br, unk1);
                    entries.Models = Models.Read(br, offsets);
                    break;

                case "EVENT_PARAM_ST":
                    Events         = new EventSection(br, unk1);
                    entries.Events = Events.Read(br, offsets);
                    break;

                case "POINT_PARAM_ST":
                    Regions         = new PointSection(br, unk1);
                    entries.Regions = Regions.Read(br, offsets);
                    break;

                case "ROUTE_PARAM_ST":
                    Routes         = new RouteSection(br, unk1);
                    entries.Routes = Routes.Read(br, offsets);
                    break;

                case "LAYER_PARAM_ST":
                    Layers         = new LayerSection(br, unk1);
                    entries.Layers = Layers.Read(br, offsets);
                    break;

                case "PARTS_PARAM_ST":
                    Parts         = new PartsSection(br, unk1);
                    entries.Parts = Parts.Read(br, offsets);
                    break;

                case "MAPSTUDIO_PARTS_POSE_ST":
                    PartsPoses = new PartsPoseSection(br, unk1, offsets);
                    break;

                case "MAPSTUDIO_BONE_NAME_STRING":
                    BoneNames         = new BoneNameSection(br, unk1);
                    entries.BoneNames = BoneNames.Read(br, offsets);
                    break;

                default:
                    throw new NotImplementedException($"Unimplemented section: {type}");
                }

                nextSectionOffset = br.ReadInt64();
            }

            DisambiguateNames(entries.Events);
            DisambiguateNames(entries.Models);
            DisambiguateNames(entries.Parts);
            DisambiguateNames(entries.Regions);

            Events.GetNames(this, entries);
            Parts.GetNames(this, entries);
            Regions.GetNames(this, entries);
        }