protected internal override void OnRebuild(VoidPtr address, int length, bool force) { int count = Children.Count; int stride = (_numFrames + 1) * 4 * count; //int data; CLR0Entry *pEntry = (CLR0Entry *)(address + 0x3C + (count * 0x10)); ABGRPixel *pData = (ABGRPixel *)(((int)pEntry + count * 0x10)); CLR0 *header = (CLR0 *)address; *header = new CLR0(length, _unk1, _numFrames, count, _unk2); ResourceGroup *group = header->Group; *group = new ResourceGroup(count); ResourceEntry *entry = group->First; foreach (CLR0EntryNode n in Children) { entry->_dataOffset = (int)pEntry - (int)group; if (n._numEntries == 0) { *pEntry = new CLR0Entry(n._flags, (ABGRPixel)n._colorMask, (ABGRPixel)n._solidColor); } //*(RGBAPixel*)&data = (RGBAPixel)n._solidColor; else { *pEntry = new CLR0Entry(n._flags, (ABGRPixel)n._colorMask, (int)pData - ((int)pEntry + 12)); } //data = (int)pData - ((int)pEntry + 12); entry++; pEntry++; foreach (ARGBPixel p in n._colors) { *pData++ = (ABGRPixel)p; } n._changed = false; } }
protected internal override void PostProcess(VoidPtr bresAddress, VoidPtr dataAddress, int dataLength, StringTable stringTable) { base.PostProcess(bresAddress, dataAddress, dataLength, stringTable); CLR0 *header = (CLR0 *)dataAddress; header->ResourceStringAddress = stringTable[Name] + 4; ResourceGroup *group = header->Group; group->_first = new ResourceEntry(0xFFFF, 0, 0, 0, 0); ResourceEntry *rEntry = group->First; int index = 1; foreach (CLR0EntryNode n in Children) { dataAddress = (VoidPtr)group + (rEntry++)->_dataOffset; ResourceEntry.Build(group, index++, dataAddress, (BRESString *)stringTable[n.Name]); n.PostProcess(dataAddress, stringTable); } }