public override bool OnInitialize()
        {
            base.OnInitialize();

            _fileId         = Header->_fileId;
            _playerId       = Header->_playerId;
            _volume         = Header->_volume;
            _playerPriority = Header->_playerPriority;
            _soundType      = Header->_soundType;
            _remoteFilter   = Header->_remoteFilter;
            _panMode        = Header->_panMode;
            _panCurve       = Header->_panCurve;
            _actorPlayerId  = Header->_actorPlayerId;
            _p1             = Header->_userParam1;
            _p2             = Header->_userParam2;

            INFOHeader *info = RSARNode.Header->INFOBlock;

            _sound3dParam = *Header->GetParam3dRef(&info->_collection);

            VoidPtr addr = Header->GetSoundInfoRef(&info->_collection);

            switch (Header->_soundInfoRef._dataType)
            {
            case 1: _seqInfo = *(SeqSoundInfo *)addr; break;

            case 2: _strmInfo = *(StrmSoundInfo *)addr; break;

            case 3: _waveInfo = *(WaveSoundInfo *)addr; break;
            }

            _soundFileNode = RSARNode.Files[_fileId];
            _soundFileNode.AddSoundRef(this);

            if (_soundFileNode is RSEQNode)
            {
                foreach (RSEQLabelNode r in _soundFileNode.Children)
                {
                    if (_seqInfo._dataID == r.Id)
                    {
                        _seqLabl = r;
                        break;
                    }
                }
            }

            if (_waveInfo._soundIndex >= 0 &&
                _soundFileNode is RWSDNode &&
                _soundFileNode.Children.Count > 0 &&
                _soundFileNode.Children[0].Children.Count > _waveInfo._soundIndex)
            {
                _waveDataNode = _soundFileNode.Children[0].Children[_waveInfo._soundIndex] as RWSDDataNode;
                if (_waveDataNode != null)
                {
                    _waveDataNode._refs.Add(this);
                }
            }

            return(false);
        }
Example #2
0
        private void GetFiles()
        {
            RSARHeader *rsar = Header;
            //SYMBHeader* symb = rsar->SYMBBlock;
            //sbyte* offset = (sbyte*)symb + 8;
            //buint* stringOffsets = symb->StringOffsets;

            VoidPtr gOffset = (VoidPtr)rsar->INFOBlock + 8;
            ruint * groups  = (ruint *)gOffset;

            ruint *list  = (ruint *)((uint)groups + groups[3] + 4);
            int    count = *((bint *)list - 1);


            //Get files
            INFOFileHeader * fileHeader;
            INFOFileEntry *  fileEntry;
            RuintList *      entryList;
            INFOGroupHeader *group;
            INFOGroupEntry * gEntry;
            RuintList *      groupList = rsar->INFOBlock->Groups;
            RSARFileNode     n;
            DataSource       source;

            for (int x = 0; x < count; x++)
            {
                fileHeader = (INFOFileHeader *)(gOffset + list[x]);
                entryList  = fileHeader->GetList(gOffset);
                if (entryList->_numEntries == 0)
                {
                    //Must be external file.
                    n      = new RSARExtFileNode();
                    source = new DataSource(fileHeader, 0);
                }
                else
                {
                    //use first entry
                    fileEntry = (INFOFileEntry *)entryList->Get(gOffset, 0);
                    //Find group with matching ID
                    group = (INFOGroupHeader *)groupList->Get(gOffset, fileEntry->_groupId);
                    //Find group entry with matching index
                    gEntry = (INFOGroupEntry *)group->GetCollection(gOffset)->Get(gOffset, fileEntry->_index);

                    //Create node and parse
                    source = new DataSource((int)rsar + group->_headerOffset + gEntry->_headerOffset, gEntry->_headerLength);
                    if ((n = NodeFactory.GetRaw(source) as RSARFileNode) == null)
                    {
                        n = new RSARFileNode();
                    }
                    n._audioSource = new DataSource((int)rsar + group->_dataOffset + gEntry->_dataOffset, gEntry->_dataLength);
                }
                n._fileIndex = x;
                n._parent    = this; //This is so that the node won't add itself to the child list.
                n.Initialize(this, source);
                _files.Add(n);
            }
        }
        public override bool OnInitialize()
        {
            base.OnInitialize();

            _fileId = Header->_fileId;

            if (_fileId >= 0 && _fileId < RSARNode.Files.Count)
            {
                _rbnk = RSARNode.Files[_fileId];
                if (_rbnk is RSARExtFileNode)
                {
                    RSARExtFileNode ext = _rbnk as RSARExtFileNode;
                    ext.AddBankRef(this);
                }
                else if (_rbnk is RBNKNode)
                {
                    RBNKNode ext = _rbnk as RBNKNode;
                    ext.AddBankRef(this);
                }
            }

            return(false);
        }
Example #4
0
        private void GetFiles()
        {
            INFOFileHeader * fileHeader;
            INFOFileEntry *  fileEntry;
            RuintList *      entryList;
            INFOGroupHeader *group;
            INFOGroupEntry * gEntry;
            RSARFileNode     n;
            DataSource       source;
            RSARHeader *     rsar = Header;

            //SYMBHeader* symb = rsar->SYMBBlock;
            //sbyte* offset = (sbyte*)symb + 8;
            //buint* stringOffsets = symb->StringOffsets;

            //Get ruint collection from info header
            VoidPtr infoCollection = rsar->INFOBlock->_collection.Address;

            //Info has 5 groups:
            //Sounds 0
            //Banks 1
            //Types 2
            //Files 3
            //Groups 4

            //Convert to ruint buffer
            ruint *groups = (ruint *)infoCollection;

            //Get file ruint list at file offset (groups[3])
            RuintList *fileList = (RuintList *)((uint)groups + groups[3]);

            //Get the info list
            RuintList *groupList = rsar->INFOBlock->Groups;

            //Loop through the ruint offsets to get all files
            for (int x = 0; x < fileList->_numEntries; x++)
            {
                //Get the file header for the file info
                fileHeader = (INFOFileHeader *)(infoCollection + fileList->Entries[x]);
                entryList  = fileHeader->GetList(infoCollection);
                if (entryList->_numEntries == 0)
                {
                    //Must be external file.
                    n      = new RSARExtFileNode();
                    source = new DataSource(fileHeader, 0);
                }
                else
                {
                    //Use first entry
                    fileEntry = (INFOFileEntry *)entryList->Get(infoCollection, 0);
                    //Find group with matching ID
                    group = (INFOGroupHeader *)groupList->Get(infoCollection, fileEntry->_groupId);
                    //Find group entry with matching index
                    gEntry = (INFOGroupEntry *)group->GetCollection(infoCollection)->Get(infoCollection, fileEntry->_index);

                    //Create node and parse
                    source = new DataSource((int)rsar + group->_headerOffset + gEntry->_headerOffset, gEntry->_headerLength);
                    if ((n = NodeFactory.GetRaw(source) as RSARFileNode) == null)
                    {
                        n = new RSARFileNode();
                    }
                    n._audioSource = new DataSource((int)rsar + group->_waveDataOffset + gEntry->_dataOffset, gEntry->_dataLength);
                    n._infoHdr     = fileHeader;
                }
                n._fileIndex = x;
                n._parent    = this; //This is so that the node won't add itself to the child list.
                n.Initialize(this, source);
                _files.Add(n);
            }

            //foreach (ResourceNode r in _files)
            //    r.Populate();
        }
        private void GetFiles()
        {
            INFOFileHeader* fileHeader;
            INFOFileEntry* fileEntry;
            RuintList* entryList;
            INFOGroupHeader* group;
            INFOGroupEntry* gEntry;
            RSARFileNode n;
            DataSource source;
            RSARHeader* rsar = Header;

            //SYMBHeader* symb = rsar->SYMBBlock;
            //sbyte* offset = (sbyte*)symb + 8;
            //buint* stringOffsets = symb->StringOffsets;

            //Get ruint collection from info header
            VoidPtr infoCollection = rsar->INFOBlock->_collection.Address;

            //Info has 5 groups:
            //Sounds 0
            //Banks 1
            //Types 2
            //Files 3
            //Groups 4

            //Convert to ruint buffer
            ruint* groups = (ruint*)infoCollection;

            //Get file ruint list at file offset (groups[3])
            RuintList* fileList = (RuintList*)((uint)groups + groups[3]);

            //Get the info list
            RuintList* groupList = rsar->INFOBlock->Groups;

            //Loop through the ruint offsets to get all files
            for (int x = 0; x < fileList->_numEntries; x++)
            {
                //Get the file header for the file info
                fileHeader = (INFOFileHeader*)(infoCollection + fileList->Entries[x]);
                entryList = fileHeader->GetList(infoCollection);
                if (entryList->_numEntries == 0)
                {
                    //Must be external file.
                    n = new RSARExtFileNode();
                    source = new DataSource(fileHeader, 0);
                }
                else
                {
                    //Use first entry
                    fileEntry = (INFOFileEntry*)entryList->Get(infoCollection, 0);
                    //Find group with matching ID
                    group = (INFOGroupHeader*)groupList->Get(infoCollection, fileEntry->_groupId);
                    //Find group entry with matching index
                    gEntry = (INFOGroupEntry*)group->GetCollection(infoCollection)->Get(infoCollection, fileEntry->_index);

                    //Create node and parse
                    source = new DataSource((int)rsar + group->_headerOffset + gEntry->_headerOffset, gEntry->_headerLength);
                    if ((n = NodeFactory.GetRaw(source) as RSARFileNode) == null)
                        n = new RSARFileNode();
                    n._audioSource = new DataSource((int)rsar + group->_waveDataOffset + gEntry->_dataOffset, gEntry->_dataLength);
                    n._infoHdr = fileHeader;
                }
                n._fileIndex = x;
                n._parent = this; //This is so that the node won't add itself to the child list.
                n.Initialize(this, source);
                _files.Add(n);
            }

            //foreach (ResourceNode r in _files)
            //    r.Populate();
        }
        public SoundPackItem(RSARFileNode file)
        {
            ImageIndex = (byte)file.ResourceType;

            Text = file.FileNodeIndex.ToString();

            _node = file;

            string s = file.ResourceType.ToString();
            if (s == "Unknown") s = "External";
            SubItems.Add(s);
            int i = Helpers.FindFirst(file.Name, 0, ']');
            SubItems.Add(file.Name.Substring(i + 1));
            //SubItems.Add(file.ExtPath);
            SubItems.Add("0x" + file.DataOffset);
            SubItems.Add("0x" + file.AudioOffset);
            SubItems.Add("0x" + file.InfoHeaderOffset);
        }
Example #7
0
        protected override void OnPopulate()
        {
            RSARHeader *rsar   = Header;
            INFOHeader *info   = Header->INFOBlock;
            VoidPtr     offset = &info->_collection;
            RuintList * list   = (RuintList *)info->_collection[_listIndex];
            int         count  = list->_numEntries;

            Type t;

            switch (_listIndex)
            {
            case 2:
                t = typeof(RSARTypeNode);
                break;  //Types

            case 3:     //Files
                INFOFileHeader * fileHeader;
                INFOFileEntry *  fileEntry;
                RuintList *      entryList;
                INFOGroupHeader *group;
                INFOGroupEntry * gEntry;
                RuintList *      groupList = info->Groups;
                RSARFileNode     n;
                DataSource       source;

                for (int i = 0; i < count; i++)
                {
                    fileHeader = (INFOFileHeader *)list->Get(offset, i);
                    entryList  = fileHeader->GetList(offset);
                    if (entryList->_numEntries == 0)
                    {
                        //Must be external file.
                        n            = new RSARExtFileNode();
                        n._fileIndex = i;
                        n.Initialize(this, fileHeader, 0);
                    }
                    else
                    {
                        //use first entry
                        fileEntry = (INFOFileEntry *)entryList->Get(offset, 0);
                        //Find group with matching ID
                        group = (INFOGroupHeader *)groupList->Get(offset, fileEntry->_groupId);
                        //Find group entry with matching index
                        gEntry = (INFOGroupEntry *)group->GetCollection(offset)->Get(offset, fileEntry->_index);

                        //Create node and parse
                        source = new DataSource((int)rsar + group->_headerOffset + gEntry->_headerOffset, gEntry->_headerLength);
                        if ((n = NodeFactory.GetRaw(source) as RSARFileNode) == null)
                        {
                            n = new RSARFileNode();
                        }

                        n._audioSource = new DataSource((int)rsar + group->_dataOffset + gEntry->_dataOffset, gEntry->_dataLength);
                        n._fileIndex   = i;
                        n.Initialize(this, source);
                    }
                }

                return;

            case 4:
                t = typeof(RSARGroupNode);
                break;     //Groups

            default:
                return;
            }


            for (int i = 0; i < count; i++)
            {
                ResourceNode node = Activator.CreateInstance(t) as ResourceNode;
                node.Initialize(this, list->Get(offset, i), 0);
            }

            base.OnPopulate();
        }