protected override void OnPopulate() { int count; if (_index == 0) { RBNK_DATAHeader *header = Header; VoidPtr offset = &header->_list; count = header->_list._numEntries; LabelItem[] list = ((RBNKNode)_parent)._labels; //Get labels from parent ((RBNKNode)_parent)._labels = null; //Clear labels, no more use for them! for (int i = 0; i < count; i++) { RBNKDataNode node = new RBNKDataNode(); node._offset = offset; if (list != null) { node._soundIndex = list[i].Tag; node._name = list[i].String; } node.Initialize(this, header->_list.Get(offset, i), 0); } } else { //Uses same format as RWSD //RWSD_WAVEHeader* header = (RWSD_WAVEHeader*)Header; //count = header->_entries; //for (int i = 0; i < count; i++) // new RWSDSoundNode().Initialize(this, header->GetEntry(i), 0); } }
protected override void OnPopulate() { RSARNode rsar = RSARNode; SYMBHeader *symb = null; RuintList * bankList = null; //INFOBankEntry** soundIndices = null; VoidPtr soundOffset = null; //INFOBankEntry* sEntry; RBNKGroupNode g; RBNKHeader * rwsd = Header; RBNK_DATAHeader *data = rwsd->Data; //RWSD_WAVEHeader* wave = rwsd->Wave; RuintList *list = &data->_list; //RuintList* waveList = &wave->_list; int count = list->_numEntries; //Get sound info from RSAR (mainly for names) if (rsar != null) { symb = rsar.Header->SYMBBlock; soundOffset = &rsar.Header->INFOBlock->_collection; bankList = rsar.Header->INFOBlock->Banks; //soundIndices = (INFOBankEntry**)Marshal.AllocHGlobal(count * 4); //int sIndex = 0; //int soundCount = soundList->_numEntries; //for (int i = 0; i < soundCount; i++) // if ((sEntry = (INFOBankEntry*)soundList->Get(soundOffset, i))->_fileId == _fileIndex) // soundIndices[((INFOSoundPart2*)sEntry->GetPart2(soundOffset))->_soundIndex] = sEntry; } (g = new RBNKGroupNode()).Initialize(this, Header->Data, Header->_dataLength); for (int i = 0; i < count; i++) { RBNK_DATAEntry *entry = (RBNK_DATAEntry *)list->Get(list, i); RBNKDataNode node = new RBNKDataNode(); node._offset = list; node.Initialize(g, entry, 0); //Attach from INFO block //if (soundIndices != null) //{ // sEntry = soundIndices[i]; // node._name = symb->GetStringEntry(sEntry->_stringId); //} } //if (soundIndices != null) // Marshal.FreeHGlobal((IntPtr)soundIndices); //Get labels RSARNode parent; int count2 = Header->Data->_list._numEntries; if ((_labels == null) && ((parent = RSARNode) != null)) { _labels = new LabelItem[count2];// new string[count]; //Get them from RSAR SYMBHeader *symb2 = parent.Header->SYMBBlock; INFOHeader *info = parent.Header->INFOBlock; VoidPtr offset = &info->_collection; RuintList *bankList2 = info->Banks; count2 = bankList2->_numEntries; //INFOBankEntry* entry; //for (int i = 0; i < count2; i++) // if ((entry = (INFOBankEntry*)soundList2->Get(offset, i))->_fileId == _fileIndex) // _labels[((INFOSoundPart2*)entry->GetPart2(offset))->_soundIndex] = new LabelItem() { Tag = i, String = symb2->GetStringEntry(entry->_stringId) }; } new RBNKGroupNode().Initialize(this, Header->Wave, Header->_waveLength); }