public override void OnRebuild(VoidPtr address, int length, bool force) { VoidPtr addr = address + 0x20; RWSDHeader *header = (RWSDHeader *)address; header->_header._length = _headerLen; header->_header._tag = RWSDHeader.Tag; header->_header._numEntries = (ushort)(VersionMinor >= 3 ? 1 : 2); header->_header._firstOffset = 0x20; header->_header.Endian = Endian.Big; header->_header._version = (ushort)(0x100 + VersionMinor); header->_dataOffset = 0x20; header->_dataLength = Children[0]._calcSize; header->_waveOffset = 0x20 + Children[0]._calcSize; header->_waveLength = Children[1]._calcSize; Children[0].Rebuild(addr, Children[0]._calcSize, true); addr += Children[0]._calcSize; SetSizeInternal(_headerLen); if (VersionMinor <= 2) { header->_waveOffset = 0x20 + Children[0]._calcSize; header->_waveLength = Children[1]._calcSize; VoidPtr audio = addr; if (RSARNode == null) { audio += Children[1]._calcSize; } else { audio = _rebuildAudioAddr; } (Children[1] as RWSDSoundGroupNode)._audioAddr = audio; _audioSource = new DataSource(audio, _audioLen); Children[1].Rebuild(addr, Children[1]._calcSize, true); addr += Children[1]._calcSize; } else { header->_waveOffset = 0; header->_waveLength = 0; VoidPtr audio = addr; if (RSARNode != null) { audio = _rebuildAudioAddr; } _audioSource = new DataSource(audio, _audioLen); Children[1].Rebuild(audio, Children[1]._calcSize, true); } }
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" } }
//Finds labels using LABL block between header and footer, also initializes array protected bool GetLabels(int count) { RWSDHeader *header = (RWSDHeader *)WorkingUncompressed.Address; int len = header->_header._length; LABLHeader *labl = (LABLHeader *)((int)header + len); if ((WorkingUncompressed.Length > len) && (labl->_tag == LABLHeader.Tag)) { _labels = new LabelItem[count]; count = labl->_numEntries; for (int i = 0; i < count; i++) { LABLEntry *entry = labl->Get(i); _labels[i] = new LabelItem() { String = entry->Name, Tag = entry->_id }; } return(true); } return(false); }
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); } }