protected override void OnPopulate() { int count; if (_index == 0) { RWSD_DATAHeader *header = Header; VoidPtr offset = &header->_list; count = header->_list._numEntries; LabelItem[] list = ((RWSDNode)_parent)._labels; //Get labels from parent ((RWSDNode)_parent)._labels = null; //Clear labels, no more use for them! for (int i = 0; i < count; i++) { RWSDDataNode node = new RWSDDataNode(); 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 { RWSD_WAVEHeader *header = (RWSD_WAVEHeader *)Header; count = header->_entries; for (int i = 0; i < count; i++) { new RWSDSoundNode().Initialize(this, header->GetEntry(i), 0); } } }
public override void OnRebuild(VoidPtr address, int length, bool force) { RWSD_DATAHeader *header = (RWSD_DATAHeader *)address; header->_tag = RWSD_DATAHeader.Tag; header->_length = length; header->_list._numEntries = Children.Count; VoidPtr addr = address + 12 + Children.Count * 8; foreach (RWSDDataNode d in Children) { d._baseAddr = header->_list.Address; header->_list[d.Index] = addr - header->_list.Address; d.Rebuild(addr, d._calcSize, force); addr += d._calcSize; } }
public override void OnPopulate() { RWSDHeader * rwsd = Header; RWSD_DATAHeader *data = rwsd->Data; RuintList * list = &data->_list; int count = list->_numEntries; new RWSDDataGroupNode().Initialize(this, Header->Data, Header->_dataLength); if (Header->_waveOffset > 0 && VersionMinor < 3) { new RWSDSoundGroupNode().Initialize(this, Header->Wave, Header->_waveLength); } else if (VersionMinor >= 3) { new RWARNode() { _name = "Audio" } }
protected override void OnPopulate() { RSARNode rsar = RSARNode; SYMBHeader * symb = null; RuintList * soundList = null; INFOSoundEntry **soundIndices = null; VoidPtr soundOffset = null; INFOSoundEntry * sEntry; RWSDGroupNode g; RWSDHeader * rwsd = Header; RWSD_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; soundList = rsar.Header->INFOBlock->Sounds; soundIndices = (INFOSoundEntry **)Marshal.AllocHGlobal(count * 4); //int sIndex = 0; int soundCount = soundList->_numEntries; for (int i = 0; i < soundCount; i++) { if ((sEntry = (INFOSoundEntry *)soundList->Get(soundOffset, i))->_fileId == _fileIndex) { soundIndices[((INFOSoundPart2 *)sEntry->GetPart2(soundOffset))->_soundIndex] = sEntry; } } } (g = new RWSDGroupNode()).Initialize(this, Header->Data, Header->_dataLength); for (int i = 0; i < count; i++) { RWSD_DATAEntry *entry = (RWSD_DATAEntry *)list->Get(list, i); RWSDDataNode node = new RWSDDataNode(); 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 *soundList2 = info->Sounds; count2 = soundList2->_numEntries; INFOSoundEntry *entry; for (int i = 0; i < count2; i++) { if ((entry = (INFOSoundEntry *)soundList2->Get(offset, i))->_fileId == _fileIndex) { _labels[((INFOSoundPart2 *)entry->GetPart2(offset))->_soundIndex] = new LabelItem() { Tag = i, String = symb2->GetStringEntry(entry->_stringId) } } } ; } new RWSDGroupNode().Initialize(this, Header->Wave, Header->_waveLength); }
public override void OnPopulate() { RWSDHeader * rwsd = Header; RWSD_DATAHeader *data = rwsd->Data; RuintList * list = &data->_list; int count = list->_numEntries; new RWSDDataGroupNode().Initialize(this, Header->Data, Header->_dataLength); if (Header->_waveOffset > 0 && VersionMinor < 3) { new RWSDSoundGroupNode().Initialize(this, Header->Wave, Header->_waveLength); } else if (VersionMinor >= 3) { new RWARNode { _name = "Audio" }.Initialize(this, _audioSource.Address, _audioSource.Length); } //Get labels RSARNode parent; if (_labels == null && (parent = RSARNode) != null) { //Get them from RSAR SYMBHeader *symb2 = parent.Header->SYMBBlock; INFOHeader *info = parent.Header->INFOBlock; VoidPtr offset = &info->_collection; RuintList *soundList = info->Sounds; int count2 = soundList->_numEntries; _labels = new LabelItem[count2]; INFOSoundEntry *entry; for (uint i = 0; i < count2; i++) { if ((entry = (INFOSoundEntry *)soundList->Get(offset, (int)i))->_fileId == _fileIndex) { int x = ((WaveSoundInfo *)entry->GetSoundInfoRef(offset))->_soundIndex; if (x >= 0 && x < count2) { _labels[x] = new LabelItem { Tag = i, String = symb2->GetStringEntry(entry->_stringId) }; } } } } for (int i = 0; i < count; i++) { string name = "Entry" + i; if (_labels != null && i < _labels.Length) { name = _labels[i].String; } RWSD_DATAEntry *entry = (RWSD_DATAEntry *)list->Get(list, i); RWSDDataNode node = new RWSDDataNode { _name = name }; node._offset = list; node.Initialize(Children[0], entry, 0); } }