예제 #1
0
        public override void OnPopulate()
        {
            int count = 0, index = 0;

            foreach (PAT0Flags p in texFlags)
            {
                if (p.HasFlag(PAT0Flags.Enabled))
                {
                    if (!p.HasFlag(PAT0Flags.FixedTexture))
                    {
                        new PAT0TextureNode(p, index).Initialize(this, new DataSource(Header->GetTexTable(count), PAT0Texture.Size));
                    }
                    else
                    {
                        PAT0TextureNode t = new PAT0TextureNode(p, index)
                        {
                            textureCount = 1
                        };
                        t._parent = this;
                        _children.Add(t);
                        PAT0TextureEntryNode entry = new PAT0TextureEntryNode();
                        entry._frame        = 0;
                        entry._texFileIndex = Header->GetIndex(count, false);
                        entry._pltFileIndex = Header->GetIndex(count, true);
                        entry._parent       = t;
                        t._children.Add(entry);
                        entry.GetStrings();
                    }
                    count++;
                }
                index++;
            }
        }
예제 #2
0
        public string GetPalette(int index, out bool kf)
        {
            PAT0TextureEntryNode prev = null;

            if (Children.Count == 0)
            {
                kf = false;
                return(null);
            }
            foreach (PAT0TextureEntryNode next in Children)
            {
                if (next.Index == 0)
                {
                    prev = next;
                    continue;
                }
                if (prev.key <= index && next.key > index)
                {
                    break;
                }
                prev = next;
            }
            if ((int)prev.key == index)
            {
                kf = true;
            }
            else
            {
                kf = false;
            }
            return(prev.Palette);
        }
예제 #3
0
        public PAT0TextureEntryNode GetTextureEntryExplicit(int index)
        {
            PAT0TextureEntryNode prev = null;

            if (Children.Count == 0)
            {
                return(null);
            }
            foreach (PAT0TextureEntryNode next in Children)
            {
                if (next.Index == 0)
                {
                    prev = next;
                    continue;
                }
                if (prev.key <= index && next.key > index)
                {
                    break;
                }
                prev = next;
            }
            if ((int)prev.key == index)
            {
                return(prev);
            }
            else
            {
                return(null);
            }
        }
예제 #4
0
        /// <summary>
        /// Gets the applied texture at the index and outputs if the value is a keyframe.
        /// </summary>
        public string GetTexture(float index, out bool kf)
        {
            PAT0TextureEntryNode prev = null;

            if (Children.Count == 0)
            {
                kf = false;
                return(null);
            }
            foreach (PAT0TextureEntryNode next in Children)
            {
                if (next.Index == 0)
                {
                    prev = next;
                    continue;
                }
                if (prev._frame <= index && next._frame > index)
                {
                    break;
                }
                prev = next;
            }
            if ((int)prev._frame == index)
            {
                kf = true;
            }
            else
            {
                kf = false;
            }
            return(prev.Texture);
        }
예제 #5
0
        /// <summary>
        /// Gets the texture entry at the index, if there is one.
        /// </summary>
        public PAT0TextureEntryNode GetEntry(float index)
        {
            PAT0TextureEntryNode prev = null;

            if (Children.Count == 0)
            {
                return(null);
            }
            foreach (PAT0TextureEntryNode next in Children)
            {
                if (next.Index == 0)
                {
                    prev = next;
                    continue;
                }
                if (prev._frame <= index && next._frame > index)
                {
                    break;
                }
                prev = next;
            }
            if ((int)prev._frame == index)
            {
                return(prev);
            }
            else
            {
                return(null);
            }
        }
예제 #6
0
        public int GetImageIndexAtFrame(int frame)
        {
            PAT0TextureEntryNode node = GetPrevious(frame);

            if (node != null)
            {
                return(node.Index);
            }
            return(0);
        }
예제 #7
0
        public void CreateEntry()
        {
            float value = Children.Count > 0 ? ((PAT0TextureEntryNode)Children[Children.Count - 1])._frame + 1 : 0;
            PAT0TextureEntryNode node = new PAT0TextureEntryNode()
            {
                _frame = value
            };

            AddChild(node);
            node.Texture = "NewTexture";
        }
예제 #8
0
        /// <summary>
        /// Adds an animation to the end of this one
        /// </summary>
        public void Append(PAT0Node external)
        {
            int origIntCount = FrameCount;

            FrameCount += external.FrameCount;

            foreach (PAT0EntryNode w in external.Children)
            {
                foreach (PAT0TextureNode _extEntry in w.Children)
                {
                    PAT0TextureNode _intEntry = null;
                    if ((_intEntry = (PAT0TextureNode)FindChild(w.Name + "/" + _extEntry.Name, false)) == null)
                    {
                        PAT0EntryNode wi = null;
                        if ((wi = (PAT0EntryNode)FindChild(w.Name, false)) == null)
                        {
                            AddChild(wi = new PAT0EntryNode()
                            {
                                Name = FindName(null)
                            });
                        }

                        PAT0TextureNode newIntEntry = new PAT0TextureNode(_extEntry._texFlags, _extEntry.TextureIndex);

                        wi.AddChild(newIntEntry);
                        foreach (PAT0TextureEntryNode e in _extEntry.Children)
                        {
                            PAT0TextureEntryNode q = new PAT0TextureEntryNode()
                            {
                                _frame = e._frame + origIntCount
                            };
                            newIntEntry.AddChild(q);

                            q.Texture = e.Texture;
                            q.Palette = e.Palette;
                        }
                    }
                    else
                    {
                        foreach (PAT0TextureEntryNode e in _extEntry.Children)
                        {
                            PAT0TextureEntryNode q = new PAT0TextureEntryNode()
                            {
                                _frame = e._frame + origIntCount
                            };
                            _intEntry.AddChild(q);

                            q.Texture = e.Texture;
                            q.Palette = e.Palette;
                        }
                    }
                }
            }
        }
예제 #9
0
        /// <summary>
        /// Sorts the order of texture entries by their frame index.
        /// </summary>
        public void SortChildren()
        {
Top:
            for (int i = 0; i < Children.Count; i++)
            {
                PAT0TextureEntryNode t = Children[i] as PAT0TextureEntryNode;
                int x = t.Index;
                t.CheckNext();
                t.CheckPrev();
                if (t.Index != x)
                {
                    goto Top;
                }
            }
        }
예제 #10
0
        /// <summary>
        /// Gets the last applied texture entry before or at the index.
        /// </summary>
        public PAT0TextureEntryNode GetPrevious(float index)
        {
            PAT0TextureEntryNode prev = null;

            foreach (PAT0TextureEntryNode next in Children)
            {
                if (next.Index == 0)
                {
                    prev = next;
                    continue;
                }
                if (prev._frame <= index && next._frame > index)
                {
                    break;
                }
                prev = next;
            }
            return(prev);
        }
예제 #11
0
        public PAT0TextureEntryNode GetTextureEntry(int index)
        {
            PAT0TextureEntryNode prev = null;

            foreach (PAT0TextureEntryNode next in Children)
            {
                if (next.Index == 0)
                {
                    prev = next;
                    continue;
                }
                if (prev.key <= index && next.key > index)
                {
                    break;
                }
                prev = next;
            }
            return(prev);
        }
예제 #12
0
        internal void ApplyPAT0Texture(PAT0TextureNode node, int index)
        {
            PAT0TextureEntryNode prev = null;

            if (node != null && index != 0 && node.Children.Count > 0)
            {
                foreach (PAT0TextureEntryNode next in node.Children)
                {
                    if (next.Index == 0)
                    {
                        prev = next;
                        continue;
                    }
                    if (prev.key <= index - 1 && next.key > index - 1)
                    {
                        break;
                    }
                    prev = next;
                }

                PAT0Texture = prev.Texture;
                PAT0Palette = prev.Palette;
                if (!PAT0Textures.ContainsKey(PAT0Texture))
                {
                    TEX0Node texture = RootNode.FindChildByType(PAT0Texture, true, ResourceNodes.ResourceType.TEX0) as TEX0Node;
                    if (texture != null)
                    {
                        PAT0Textures[PAT0Texture] = new MDL0TextureNode(texture.Name)
                        {
                            Source = texture, palette = PAT0Palette != null?RootNode.FindChildByType(PAT0Palette, true, ResourceNodes.ResourceType.PLT0) as PLT0Node : null
                        }
                    }
                    ;
                }
                return;
            }
            else
            {
                PAT0Texture = PAT0Palette = null;
            }
        }
예제 #13
0
        internal void CompareToAll()
        {
            _rebuild = true;
            foreach (PAT0EntryNode e in Parent.Parent.Children)
            {
                foreach (PAT0TextureNode table in e.Children)
                {
                    if (table == this)
                    {
                        return;
                    }

                    if (table != this && table.Children.Count == Children.Count)
                    {
                        bool same = true;
                        for (int l = 0; l < Children.Count; l++)
                        {
                            PAT0TextureEntryNode exte = (PAT0TextureEntryNode)table.Children[l];
                            PAT0TextureEntryNode inte = (PAT0TextureEntryNode)Children[l];

                            if (exte._frame != inte._frame || exte.Texture != inte.Texture || exte.Palette != inte.Palette)
                            {
                                same = false;
                                break;
                            }
                        }
                        if (same)
                        {
                            _rebuild  = false;
                            _matIndex = e.Index;
                            _texIndex = table.Index;
                            ((PAT0EntryNode)Parent)._dataLens[Index] = -1;
                            return;
                        }
                    }
                }
            }
        }
예제 #14
0
        public override void OnRebuild(VoidPtr address, int length, bool force)
        {
            PAT0Pattern *header = (PAT0Pattern *)address;

            int x = 0;

            foreach (int i in _dataLens)
            {
                if (i == -1)
                {
                    _dataAddrs[x] = ((PAT0EntryNode)Parent.Children[((PAT0TextureNode)Children[x])._matIndex])._dataAddrs[((PAT0TextureNode)Children[x])._texIndex];
                }
                x++;
            }
            uint flags = 0;

            foreach (PAT0TextureNode table in Children)
            {
                table._texFlags |= PAT0Flags.Enabled;
                if (table.Children.Count > 1)
                {
                    table._texFlags &= ~PAT0Flags.FixedTexture;
                }
                else
                {
                    table._texFlags |= PAT0Flags.FixedTexture;
                }

                bool hasTex = false, hasPlt = false;

                //foreach (PAT0TextureEntryNode e in table.Children)
                //{
                //    if (e.Texture != null)
                //        hasTex = true;
                //    if (e.Palette != null)
                //        hasPlt = true;
                //}

                hasTex = table._hasTex;
                hasPlt = table._hasPlt;

                if (!hasTex)
                {
                    table._texFlags &= ~PAT0Flags.HasTexture;
                }
                else
                {
                    table._texFlags |= PAT0Flags.HasTexture;
                }
                if (!hasPlt)
                {
                    table._texFlags &= ~PAT0Flags.HasPalette;
                }
                else
                {
                    table._texFlags |= PAT0Flags.HasPalette;
                }

                if (table.Children.Count > 1)
                {
                    header->SetTexTableOffset(table.Index, _dataAddrs[table.Index]);
                    if (table._rebuild)
                    {
                        table.Rebuild(_dataAddrs[table.Index], PAT0TextureTable.Size + PAT0Texture.Size * table.Children.Count, true);
                    }
                }
                else
                {
                    PAT0TextureEntryNode entry = (PAT0TextureEntryNode)table.Children[0];
                    PAT0Node             node  = (PAT0Node)Parent;

                    short i = 0;
                    if (table._hasTex && !String.IsNullOrEmpty(entry.Texture))
                    {
                        i = (short)node._textureFiles.IndexOf(entry.Texture);
                    }

                    if (i < 0)
                    {
                        entry._texFileIndex = 0;
                    }
                    else
                    {
                        entry._texFileIndex = (ushort)i;
                    }

                    i = 0;
                    if (table._hasPlt && !String.IsNullOrEmpty(entry.Palette))
                    {
                        i = (short)node._paletteFiles.IndexOf(entry.Palette);
                    }

                    if (i < 0)
                    {
                        entry._pltFileIndex = 0;
                    }
                    else
                    {
                        entry._pltFileIndex = (ushort)i;
                    }

                    header->SetIndex(table.Index, entry._texFileIndex, false);
                    header->SetIndex(table.Index, entry._pltFileIndex, true);
                }

                flags = flags & ~((uint)0xF << (table._textureIndex * 4)) | ((uint)table._texFlags << (table._textureIndex * 4));
            }

            header->_flags = flags;
        }
예제 #15
0
        internal unsafe void TexChanged(object sender, EventArgs e)
        {
            MDL0MaterialRefNode mr = TargetTexRef;
            PAT0TextureNode node;

            if (mr == null || _updating)
                return;

            if (SelectedAnimation != null && CurrentFrame > 0)
            {
                node = SelectedAnimation.FindChild(mr._parent.Name + "/Texture" + mr.Index, true) as PAT0TextureNode;

                if (node != null)
                {
                    PAT0TextureEntryNode tex = node.GetEntry(CurrentFrame - 1);
                    if (tex == null)
                    {
                        if (!String.IsNullOrEmpty(texBox.Text) || !String.IsNullOrEmpty(pltBox.Text))
                        {
                            tex = new PAT0TextureEntryNode();
                            tex._frame = CurrentFrame - 1;
                            if (node.Children.Count > 0)
                                node.InsertChild(tex, true, node.GetPrevious(CurrentFrame - 1).Index + 1);
                            else
                                node.AddChild(tex, true);
                            tex.Texture = texBox.Text;
                            tex.Palette = pltBox.Text;
                        }
                    }
                    else
                    {
                        if (!String.IsNullOrEmpty(texBox.Text) || !String.IsNullOrEmpty(pltBox.Text))
                        {
                            tex.Texture = texBox.Text;
                            tex.Palette = pltBox.Text;
                        }
                        else
                            tex.Remove();
                    }
                }
            }

            TargetModel.ApplyPAT(SelectedAnimation, CurrentFrame);
            ResetTexture();
            ResetPalette();
            _mainWindow.ModelPanel.Invalidate();
        }
예제 #16
0
 public void CreateEntry()
 {
     float value = Children.Count > 0 ? ((PAT0TextureEntryNode)Children[Children.Count - 1])._frame + 1 : 0;
     PAT0TextureEntryNode node = new PAT0TextureEntryNode() { _frame = value };
     AddChild(node);
     node.Texture = "NewTexture";
 }
예제 #17
0
        /// <summary>
        /// Adds an animation to the end of this one
        /// </summary>
        public void Append(PAT0Node external)
        {
            int origIntCount = FrameCount;
            FrameCount += external.FrameCount;

            foreach (PAT0EntryNode w in external.Children)
                foreach (PAT0TextureNode _extEntry in w.Children)
                {
                    PAT0TextureNode _intEntry = null;
                    if ((_intEntry = (PAT0TextureNode)FindChild(w.Name + "/" + _extEntry.Name, false)) == null)
                    {
                        PAT0EntryNode wi = null;
                        if ((wi = (PAT0EntryNode)FindChild(w.Name, false)) == null)
                            AddChild(wi = new PAT0EntryNode() { Name = FindName(null) });

                        PAT0TextureNode newIntEntry = new PAT0TextureNode(_extEntry._texFlags, _extEntry.TextureIndex);

                        wi.AddChild(newIntEntry);
                        foreach (PAT0TextureEntryNode e in _extEntry.Children)
                        {
                            PAT0TextureEntryNode q = new PAT0TextureEntryNode() { _frame = e._frame + origIntCount };
                            newIntEntry.AddChild(q);

                            q.Texture = e.Texture;
                            q.Palette = e.Palette;
                        }
                    }
                    else
                    {
                        foreach (PAT0TextureEntryNode e in _extEntry.Children)
                        {
                            PAT0TextureEntryNode q = new PAT0TextureEntryNode() { _frame = e._frame + origIntCount };
                            _intEntry.AddChild(q);

                            q.Texture = e.Texture;
                            q.Palette = e.Palette;
                        }
                    }
                }
        }
예제 #18
0
 public override void OnPopulate()
 {
     int count = 0, index = 0;
     foreach (PAT0Flags p in texFlags)
     {
         if (p.HasFlag(PAT0Flags.Enabled))
         {
             if (!p.HasFlag(PAT0Flags.FixedTexture))
                 new PAT0TextureNode(p, index).Initialize(this, new DataSource(Header->GetTexTable(count), PAT0Texture.Size));
             else
             {
                 PAT0TextureNode t = new PAT0TextureNode(p, index) { textureCount = 1 };
                 t._parent = this;
                 _children.Add(t);
                 PAT0TextureEntryNode entry = new PAT0TextureEntryNode();
                 entry._frame = 0;
                 entry._texFileIndex = Header->GetIndex(count, false);
                 entry._pltFileIndex = Header->GetIndex(count, true);
                 entry._parent = t;
                 t._children.Add(entry);
                 entry.GetStrings();
             }
             count++;
         }
         index++;
     }
 }
예제 #19
0
        public void ImportGIF(string file)
        {
            Action <object, DoWorkEventArgs> work = (object sender, DoWorkEventArgs e) =>
            {
                GifDecoder decoder = new GifDecoder();
                decoder.Read(file, null);
                e.Result = decoder;
            };
            Action <object, RunWorkerCompletedEventArgs> completed = (object sender, RunWorkerCompletedEventArgs e) =>
            {
                GifDecoder decoder = e.Result as GifDecoder;
                string     s       = Path.GetFileNameWithoutExtension(file);
                PAT0Node   p       = CreateResource <PAT0Node>(s);
                p._loop = true;
                p.CreateEntry();

                PAT0TextureNode      textureNode = p.Children[0].Children[0] as PAT0TextureNode;
                PAT0TextureEntryNode entry       = textureNode.Children[0] as PAT0TextureEntryNode;

                //Get the number of images in the file
                int frames = decoder.GetFrameCount();

                //The framecount will be created by adding up each image delay.
                float frameCount = 0;

                bool resized = false;
                int  w = 0, h = 0;
                Action <int, int> onResized = (newW, newH) =>
                {
                    if (resized != true)
                    {
                        w       = newW;
                        h       = newH;
                        resized = true;
                    }
                };

                using (TextureConverterDialog dlg = new TextureConverterDialog())
                {
                    using (ProgressWindow progress = new ProgressWindow(RootNode._mainForm, "GIF to PAT0 converter",
                                                                        "Converting, please wait...", true))
                    {
                        Bitmap prev = null;

                        progress.Begin(0, frames, 0);
                        for (int i = 0; i < frames; i++, entry = new PAT0TextureEntryNode())
                        {
                            if (progress.Cancelled)
                            {
                                break;
                            }

                            string name = s + "." + i;

                            dlg.ImageSource = name + ".";

                            using (Bitmap img = (Bitmap)decoder.GetFrame(i))
                            {
                                if (i == 0)
                                {
                                    dlg.LoadImages(img.Copy());
                                    dlg.Resized += onResized;
                                    if (dlg.ShowDialog(null, this) != DialogResult.OK)
                                    {
                                        return;
                                    }

                                    textureNode._hasTex = dlg.TextureData != null;
                                    textureNode._hasPlt = dlg.PaletteData != null;

                                    prev = img.Copy();
                                }
                                else
                                {
                                    //Draw the current image over the previous
                                    //This is because some GIFs use pixels of the previous frame
                                    //in order to compress the overall image data
                                    using (Graphics graphics = Graphics.FromImage(prev))
                                    {
                                        graphics.InterpolationMode  = InterpolationMode.HighQualityBicubic;
                                        graphics.CompositingQuality = CompositingQuality.HighQuality;
                                        graphics.CompositingMode    = CompositingMode.SourceOver;
                                        graphics.SmoothingMode      = SmoothingMode.HighQuality;
                                        graphics.DrawImage(img, 0, 0, prev.Width, prev.Height);
                                    }

                                    dlg.LoadImages(prev.Copy());
                                    if (resized)
                                    {
                                        dlg.ResizeImage(w, h);
                                    }
                                    else
                                    {
                                        dlg.UpdatePreview();
                                    }

                                    dlg.EncodeSource();

                                    textureNode.AddChild(entry);
                                }
                            }

                            entry._frame = (float)Math.Round(frameCount, 2);
                            frameCount  += decoder.GetDelay(i) / 1000.0f * 60.0f;

                            if (textureNode._hasTex)
                            {
                                entry.Texture = name;
                            }

                            if (textureNode._hasPlt)
                            {
                                entry.Palette = name;
                            }

                            progress.Update(progress.CurrentValue + 1);
                        }

                        progress.Finish();
                        if (prev != null)
                        {
                            prev.Dispose();
                        }
                    }
                }

                p._numFrames = (ushort)(frameCount + 0.5f);
            };

            using (BackgroundWorker b = new BackgroundWorker())
            {
                b.DoWork             += new DoWorkEventHandler(work);
                b.RunWorkerCompleted += new RunWorkerCompletedEventHandler(completed);
                b.RunWorkerAsync();
            }
        }
예제 #20
0
        /// <summary>
        /// Adds PAT0 entries for each stage to the given PAT0TextureNode.
        /// </summary>
        /// <param name="pathToPAT0TextureNode">Path relative to sc_selmap_en</param>
        /// <param name="defaultName">The texture name to be used for new PAT0 entries. If null, the name will be taken from the first entry, with the number at the end replaced with the icon number.</param>
        public void AddPAT0(string pathToPAT0TextureNode, string defaultName = null)
        {
            var look = sc_selmap.FindChild(pathToPAT0TextureNode, false).Children[0];
            if (!(look is PAT0TextureNode)) {
                throw new FormatException(look.Name);
            }

            bool icon = look.Parent.Name == "iconM";

            PAT0TextureNode tn = look as PAT0TextureNode;

            List<PAT0TextureEntryNode> childrenList = (from c in tn.Children
                                                       where c is PAT0TextureEntryNode
                                                       select (PAT0TextureEntryNode)c).ToList();
            if ((from c in childrenList where c.FrameIndex >= 40 && c.FrameIndex < 50 select c).Count() >= 10) {
                MessageBox.Show("Skipping " + pathToPAT0TextureNode.Substring(pathToPAT0TextureNode.LastIndexOf('/') + 1) +
                    " - mappings for icon numbers 40-49 already exist.");
                return;
            }

            string texToCopyName = null;
            List<Tuple<string, float>> entries = new List<Tuple<string, float>>();
            foreach (var entry in childrenList) {
                if (entry.Texture == null) {
                    MessageBox.Show("BrawlLib cannot read PAT0 texture name(s) from " + pathToPAT0TextureNode);
                    return;
                }
                entries.Add(new Tuple<string, float>(entry.Texture, entry.FrameIndex));
                if (entry.FrameIndex == 1) texToCopyName = entry.Texture;
                if (entry.FrameIndex != 0) tn.RemoveChild(entry);
            }

            string basename = (from e in entries
                               where e.Item1.Contains('.')
                               select e.Item1).First();
            basename = basename.Substring(0, basename.LastIndexOf('.'));

            Func<int, string> getTexStringByIconNumber = iconNum => {
                if (iconNum < 32 || (iconNum >= 50 && iconNum < 60) || iconNum == 80) {
                    string previousTexture = null;
                    foreach (var entry in entries) {
                        if (entry.Item2 > iconNum) break;
                        previousTexture = entry.Item1;
                    }
                    return previousTexture;
                } else {
                    return defaultName ?? basename + "." + iconNum.ToString("D2");
                }
            };

            for (int i = 1; i <= 80; i++) {
                string texname = getTexStringByIconNumber(i);
                var entry = new PAT0TextureEntryNode();
                tn.AddChild(entry);
                entry.FrameIndex = i;
                entry.Texture = texname;
                if (icon) {
                    entry.Palette = entry.Texture;
                }
            }

            var moreThan79query = from e in entries
                                  where e.Item2 > 80
                                  orderby e.Item2 ascending
                                  select e;
            foreach (var tuple in moreThan79query) {
                var entry = new PAT0TextureEntryNode();
                tn.AddChild(entry);
                entry.FrameIndex = tuple.Item2;
                entry.Texture = tuple.Item1;
                if (icon) {
                    entry.Palette = entry.Texture;
                }
            }

            ResourceNode brres = tn;
            while (brres != null && !(brres is BRRESNode)) {
                brres = brres.Parent;
            }

            if (brres != null) {
                var folder = brres.FindChild("Textures(NW4R)", false);
                TEX0Node texToCopy = texToCopyName == null
                    ? null
                    : folder.FindChild(texToCopyName, false) as TEX0Node;
                PLT0Node pltToCopy = texToCopyName == null
                    ? null
                    : brres.FindChild("Palettes(NW4R)", false).FindChild(texToCopyName, false) as PLT0Node;

                foreach (ResourceNode c in tn.Children) {
                    PAT0TextureEntryNode p = c as PAT0TextureEntryNode;
                    if (p == null) continue;

                    var texture = folder.FindChild(p.Texture, false);
                    if (texture == null) {
                        if (texToCopy != null) {
                            TEX0Node tex0 = ((BRRESNode)brres).CreateResource<TEX0Node>(p.Texture);
                            tex0.ReplaceRaw(texToCopy.WorkingUncompressed.Address, texToCopy.WorkingUncompressed.Length);
                        }
                        if (pltToCopy != null) {
                            PLT0Node plt0 = ((BRRESNode)brres).CreateResource<PLT0Node>(p.Texture);
                            plt0.ReplaceRaw(pltToCopy.WorkingUncompressed.Address, pltToCopy.WorkingUncompressed.Length);
                        }
                    } else if (texture.Index == 1) {
                        texToCopy = texture as TEX0Node;
                    }
                }
            }
        }