internal int EncodeSYMBBlock(SYMBHeader *header, RSAREntryList entries, RSARNode node) { int len = 0; int count = entries._strings.Count; VoidPtr baseAddr = (VoidPtr)header + 8, dataAddr; bint * strEntry = (bint *)(baseAddr + 0x18); PString pStr = (byte *)strEntry + (count << 2); //Strings header->_stringOffset = 0x14; strEntry[-1] = entries._strings.Count; foreach (string s in entries._strings) { *strEntry++ = (int)(pStr - baseAddr); pStr.Write(s, 0, s.Length + 1); pStr += s.Length + 1; } dataAddr = pStr; //Sounds header->_maskOffset1 = (int)(dataAddr - baseAddr); dataAddr += EncodeMaskGroup(header, (SYMBMaskHeader *)dataAddr, entries._sounds, node, 0); //Player Info header->_maskOffset2 = (int)(dataAddr - baseAddr); dataAddr += EncodeMaskGroup(header, (SYMBMaskHeader *)dataAddr, entries._playerInfo, node, 1); //Groups header->_maskOffset3 = (int)(dataAddr - baseAddr); dataAddr += EncodeMaskGroup(header, (SYMBMaskHeader *)dataAddr, entries._groups, node, 2); //Banks header->_maskOffset4 = (int)(dataAddr - baseAddr); dataAddr += EncodeMaskGroup(header, (SYMBMaskHeader *)dataAddr, entries._banks, node, 3); int temp = (int)dataAddr - (int)header; len = temp.Align(0x20); //Fill padding byte *p = (byte *)dataAddr; for (int i = temp; i < len; i++) { *p++ = 0; } //Set header header->_header._tag = SYMBHeader.Tag; header->_header._length = len; return(len); }
internal static int EncodeSYMBBlock(SYMBHeader *header, RSAREntryList entries) { int count = entries._count; VoidPtr baseAddr = (VoidPtr)header + 8, dataAddr; int len; bint * strEntry = (bint *)(baseAddr + 0x18); PString pStr = (byte *)strEntry + (count << 2); //Strings header->_stringOffset = 0x14; strEntry[-1] = entries._strings.Count; foreach (string s in entries._strings) { *strEntry++ = (int)(pStr - baseAddr); pStr.Write(s, 0, s.Length + 1); pStr += s.Length + 1; } dataAddr = pStr; //Sounds header->_maskOffset1 = (int)(dataAddr - baseAddr); dataAddr += EncodeMaskGroup((SYMBMaskHeader *)dataAddr, entries._sounds); //Types header->_maskOffset2 = (int)(dataAddr - baseAddr); dataAddr += EncodeMaskGroup((SYMBMaskHeader *)dataAddr, entries._types); //Groups header->_maskOffset3 = (int)(dataAddr - baseAddr); dataAddr += EncodeMaskGroup((SYMBMaskHeader *)dataAddr, entries._groups); //Banks header->_maskOffset4 = (int)(dataAddr - baseAddr); dataAddr += EncodeMaskGroup((SYMBMaskHeader *)dataAddr, entries._banks); len = ((int)baseAddr).Align(0x20); //Fill padding byte *p = (byte *)dataAddr; for (int i = dataAddr - header; i < len; i++) { *p++ = 0; } //Set header header->_tag = SYMBHeader.Tag; header->_length = len; return(len); }