Beispiel #1
0
        public override void OnRebuild(VoidPtr address, int length, bool force)
        {
            RSTC *hdr = (RSTC *)address;

            *hdr = new RSTC();
            hdr->_tag         = _tag;
            hdr->_size        = _size;
            hdr->_version     = _version;
            hdr->_unknown0x0C = _unknown0x0C;
            hdr->_charNum     = (byte)cssList.Children.Count;
            hdr->_unknown0x0E = _unknown0x0E;
            hdr->_randNum     = (byte)randList.Children.Count;
            uint offset = 0x10;

            // Ensures no junk data got saved to the character list
            for (int i = 0; i < _charList.Length; i++)
            {
                hdr->_charList[i] = 0x00;
            }

            for (int i = 0; i < cssList.Children.Count; i++)
            {
                ResourceNode r = cssList.Children[i];
                *(buint *)((byte *)address + 0x10 + i) = offset;
                r.Rebuild(address + offset, 0x01, true);
                offset += 0x01;
            }

            offset = 0x10 + 104;
            // Ensures no junk data got saved to the random list
            for (int i = 0; i < _randList.Length; i++)
            {
                hdr->_randList[i] = 0x00;
            }

            for (int i = 0; i < randList.Children.Count; i++)
            {
                ResourceNode r = randList.Children[i];
                *(buint *)((byte *)address + 0x10 + (i + 104)) = offset;
                r.Rebuild(address + offset, 0x01, true);
                offset += 0x01;
            }

            // Clear all junk data from the end of the lists
            for (int i = cssList.Children.Count; i < _charList.Length; i++)
            {
                hdr->_charList[i] = 0x00;
            }

            for (int i = randList.Children.Count; i < _randList.Length; i++)
            {
                hdr->_randList[i] = 0x00;
            }
        }
Beispiel #2
0
        public override void OnRebuild(VoidPtr address, int length, bool force)
        {
            RSTC *hdr = (RSTC *)address;

            *hdr = new RSTC();
            hdr->_tag         = _tag;
            hdr->_size        = (uint)length;
            hdr->_version     = _version;
            hdr->_unknown0x0C = _unknown0x0C;
            hdr->_charNum     = (byte)Math.Min(cssList.Children.Count, (length - RSTC.Size) / 2);
            hdr->_unknown0x0E = _unknown0x0E;
            hdr->_randNum     = (byte)Math.Min(randList.Children.Count, (length - RSTC.Size) / 2);
            int entrySize = (length - 0x10) / 2;

            cssList.Rebuild(address + 0x10, entrySize, force);
            randList.Rebuild(address + 0x10 + entrySize, entrySize, force);
        }