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); }
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(); }
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(); }