예제 #1
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;
                }
            }
        }
예제 #2
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);
        }