Example #1
0
        protected internal override void PostProcess(VoidPtr bresAddress, VoidPtr dataAddress, int dataLength, StringTable stringTable)
        {
            base.PostProcess(bresAddress, dataAddress, dataLength, stringTable);

            SCN0v4 *header = (SCN0v4 *)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;

            int[] indices = new int[] { -1, -1, -1, -1, -1 };
            foreach (SCN0GroupNode g in Children)
            {
                if (g._name == "LightSet(NW4R)")
                {
                    indices[0] = g.Index;
                }
                else if (g._name == "AmbLights(NW4R)")
                {
                    indices[1] = g.Index;
                }
                else if (g._name == "Lights(NW4R)")
                {
                    indices[2] = g.Index;
                }
                else if (g._name == "Fogs(NW4R)")
                {
                    indices[3] = g.Index;
                }
                else if (g._name == "Cameras(NW4R)")
                {
                    indices[4] = g.Index;
                }
            }

            for (int i = 0; i < 5; i++)
            {
                SCN0GroupNode n = indices[i] >= 0 ? Children[indices[i]] as SCN0GroupNode : null;
                if (n != null)
                {
                    dataAddress = (VoidPtr)group + (rEntry++)->_dataOffset;
                    ResourceEntry.Build(group, index++, dataAddress, (BRESString *)stringTable[n.Name]);
                    n.PostProcess(header, dataAddress, stringTable);
                }
            }

            if (_version == 5)
            {
                _userEntries.PostProcess(((SCN0v5 *)dataAddress)->UserData, stringTable);
            }
        }
Example #2
0
        protected internal override void PostProcess(VoidPtr bresAddress, VoidPtr dataAddress, int dataLength, StringTable stringTable)
        {
            base.PostProcess(bresAddress, dataAddress, dataLength, stringTable);

            ResourceGroup *group;

            if (_version == 5)
            {
                SCN0v5 *header = (SCN0v5 *)dataAddress;
                header->ResourceStringAddress = stringTable[Name] + 4;
                if (!String.IsNullOrEmpty(_originalPath))
                {
                    header->OrigPathAddress = stringTable[_originalPath] + 4;
                }
                group = header->Group;
            }
            else
            {
                SCN0v4 *header = (SCN0v4 *)dataAddress;
                header->ResourceStringAddress = stringTable[Name] + 4;
                if (!String.IsNullOrEmpty(_originalPath))
                {
                    header->OrigPathAddress = stringTable[_originalPath] + 4;
                }
                group = header->Group;
            }

            group->_first = new ResourceEntry(0xFFFF, 0, 0, 0, 0);
            ResourceEntry *rEntry = group->First;

            int index = 1;

            int[] indices = new int[] { -1, -1, -1, -1, -1 };
            foreach (SCN0GroupNode g in Children)
            {
                indices[(int)g._type] = g.Index;
            }

            VoidPtr addr = dataAddress;

            for (int i = 0; i < 5; i++)
            {
                SCN0GroupNode n = indices[i] >= 0 ? Children[indices[i]] as SCN0GroupNode : null;
                if (n != null)
                {
                    addr = (VoidPtr)group + (rEntry++)->_dataOffset;
                    ResourceEntry.Build(group, index++, addr, (BRESString *)stringTable[n.Name]);
                    n.PostProcess(dataAddress, addr, stringTable);
                }
            }

            if (_version == 5)
            {
                _userEntries.PostProcess(((SCN0v5 *)addr)->UserData, stringTable);
            }
        }