Exemple #1
0
        public int GetLength()
        {
            int length = 5;

            if (SettingsObject != null)
            {
                length += SettingsObject.GetLength();
            }
            else if (SoundSFXObject != null)
            {
                length += SoundSFXObject.GetLength();
            }
            else if (EventAction != null)
            {
                length += EventAction.GetLength();
            }
            else if (Event != null)
            {
                length += Event.GetLength();
            }
            else if (RandomContainer != null)
            {
                length += RandomContainer.GetLength();
            }
            else if (SwitchContainer != null)
            {
                length += SwitchContainer.GetLength();
            }
            else if (ActorMixer != null)
            {
                length += ActorMixer.GetLength();
            }
            else if (AudioBus != null)
            {
                length += AudioBus.GetLength();
            }
            else if (BlendContainer != null)
            {
                length += BlendContainer.GetLength();
            }
            else if (MusicSegment != null)
            {
                length += MusicSegment.GetLength();
            }
            else if (MusicTrack != null)
            {
                length += MusicTrack.GetLength();
            }
            else if (MusicSwitchContainer != null)
            {
                length += MusicSwitchContainer.GetLength();
            }
            else if (MusicSequence != null)
            {
                length += MusicSequence.GetLength();
            }
            else if (Attenuation != null)
            {
                length += Attenuation.GetLength();
            }
            else if (FeedbackNode != null)
            {
                length += FeedbackNode.GetLength();
            }
            else if (FxShareSet != null)
            {
                length += FxShareSet.GetLength();
            }
            else if (FxCustom != null)
            {
                length += FxCustom.GetLength();
            }
            else if (AuxiliaryBus != null)
            {
                length += AuxiliaryBus.GetLength();
            }
            else if (LFO != null)
            {
                length += LFO.GetLength();
            }
            else if (Envelope != null)
            {
                length += Envelope.GetLength();
            }
            else if (FeedbackBus != null)
            {
                length += FeedbackBus.GetLength();
            }
            else
            {
                if (Data != null)
                {
                    length += Data.Length;
                }
                else
                {
                    length = -1;
                }
            }

            return(length);
        }
Exemple #2
0
        public HIRCObject(BNK mainBnk, BinaryReader br)
        {
            Bnk = mainBnk;
            if (!hircError.errorOccured)
            {
                int type = br.ReadByte();
                LastPos = br.BaseStream.Position;
                switch (type)
                {
                case 1:
                    SettingsObject = new Settings(br, type);
                    break;

                case 2:
                    SoundSFXObject = new SoundSFX(this, br, type);
                    break;

                case 3:
                    EventAction = new EventAction(this, br, type);
                    break;

                case 4:
                    Event = new Event(this, br, type);
                    break;

                case 5:
                    RandomContainer = new RandomContainer(this, br, type);
                    break;

                case 6:
                    SwitchContainer = new SwitchContainer(this, br, type);
                    break;

                case 7:
                    ActorMixer = new ActorMixer(this, br, type);
                    break;

                case 8:
                    AudioBus = new AudioBus(this, br, type);
                    break;

                case 9:
                    BlendContainer = new BlendContainer(this, br, type);
                    break;

                case 10:
                    MusicSegment = new MusicSegment(this, br, type);
                    break;

                case 11:
                    MusicTrack = new MusicTrack(this, br, type);
                    break;

                case 12:
                    MusicSwitchContainer = new MusicSwitchContainer(this, br, type);
                    break;

                case 13:
                    MusicSequence = new MusicSequence(this, br, type);
                    break;

                case 14:
                    Attenuation = new Attenuation(br, type);
                    break;

                case 16:
                    FeedbackBus = new FeedbackBus(this, br, type);
                    break;

                case 17:
                    FeedbackNode = new FeedbackNode(this, br, type);
                    break;

                case 18:
                    FxShareSet = new FxShareSet(this, br, type);
                    break;

                case 19:
                    FxCustom = new FxCustom(this, br, type);
                    break;

                case 20:
                    AuxiliaryBus = new AuxiliaryBus(this, br, type);
                    break;

                case 21:
                    LFO = new LFO(br, type);
                    break;

                case 22:
                    Envelope = new Envelope(br, type);
                    break;

                default:
                    int length = br.ReadInt32();
                    br.BaseStream.Position -= 5;
                    Data = br.ReadBytes(length + 5);
                    System.Windows.MessageBox.Show("Detected unkown HIRC Object type at: " + (LastPos - 1).ToString("X"), "Toolkit");
                    break;
                }
            }
        }
Exemple #3
0
        public static BlendContainer ParseBlendContainer(byte[] data)
        {
            using (var reader = new BinaryReader(new MemoryStream(data)))
            {
                var blendContainer = new BlendContainer(data.Length);
                blendContainer.Id         = reader.ReadUInt32();
                blendContainer.Properties = reader.ReadAudioProperties();
                blendContainer.ChildCount = reader.ReadUInt32();
                blendContainer.ChildIds   = new uint[blendContainer.ChildCount];
                for (var i = 0; i < blendContainer.ChildCount; i++)
                {
                    blendContainer.ChildIds[i] = reader.ReadUInt32();
                }
                blendContainer.BlendTrackCount = reader.ReadUInt32();
                blendContainer.BlendTracks     = new BlendTrack[blendContainer.BlendTrackCount];
                for (var i = 0; i < blendContainer.BlendTrackCount; i++)
                {
                    BlendTrack blendTrack = default;
                    blendTrack.Id        = reader.ReadUInt32();
                    blendTrack.RuleCount = reader.ReadUInt16();
                    blendTrack.Rules     = new BlendRule[blendTrack.RuleCount];
                    for (var j = 0; j < blendTrack.RuleCount; j++)
                    {
                        BlendRule blendRule = default;
                        blendRule.X          = reader.ReadUInt32();
                        blendRule.XType      = (BlendTrackXAxisType)reader.ReadByte();
                        blendRule.Unknown_05 = reader.ReadByte();
                        blendRule.YType      = (BlendTrackYAxisType)reader.ReadByte();
                        blendRule.UnknownId  = reader.ReadUInt32();
                        blendRule.Unknown_0B = reader.ReadByte();
                        blendRule.PointCount = reader.ReadUInt16();
                        blendRule.Points     = new Point[blendRule.PointCount];
                        for (var k = 0; k < blendRule.PointCount; k++)
                        {
                            Point point = default;
                            point.X = reader.ReadSingle();
                            point.Y = reader.ReadSingle();
                            point.FollowingCurveShape = (BlendCurveShape)reader.ReadUInt32();
                            blendRule.Points[k]       = point;
                        }
                        blendTrack.Rules[j] = blendRule;
                    }
                    blendTrack.CrossfadeId = reader.ReadUInt32();
                    blendTrack.Unknown     = reader.ReadByte();
                    blendTrack.ChildCount  = reader.ReadUInt32();
                    blendTrack.Children    = new BlendTrackChild[blendTrack.ChildCount];
                    for (var j = 0; j < blendTrack.ChildCount; j++)
                    {
                        BlendTrackChild blendTrackChild = default;
                        blendTrackChild.Id = reader.ReadUInt32();
                        blendTrackChild.CrossfadePointCount = reader.ReadUInt32();
                        blendTrackChild.CrossfadePoints     = new CrossfadePoint[blendTrackChild.CrossfadePointCount];
                        for (var k = 0; k < blendTrackChild.CrossfadePointCount; k++)
                        {
                            CrossfadePoint crossfadePoint = default;
                            crossfadePoint.X = reader.ReadSingle();
                            crossfadePoint.Y = reader.ReadSingle();
                            crossfadePoint.FollowingCurveShape = (BlendCurveShape)reader.ReadUInt32();
                            blendTrackChild.CrossfadePoints[k] = crossfadePoint;
                        }
                        blendTrack.Children[j] = blendTrackChild;
                    }
                    blendContainer.BlendTracks[i] = blendTrack;
                }

                return(blendContainer);
            }
        }