Example #1
0
 public DZB(RARC.FileEntry FE, TreeNode TN)
 {
     Root       = TN;
     Name       = FE.FileName;
     ParentFile = FE;
     Load(FE.GetFileData());
 }
Example #2
0
        public RPPN(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, System.Drawing.Color Color = default(System.Drawing.Color), ZeldaArc ParentZA = null)
        {
            ParentFile = FE;

            byte[] SrcData = ParentFile.GetFileData();

            Offset = SrcOffset;

            _Unknown  = Helpers.Read32(SrcData, SrcOffset);
            _Position = new Vector3(
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x04)),
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x08)),
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x0C)));

            SrcOffset += 0x10;

            RenderColor = Color;

            Node = Helpers.CreateTreeNode(string.Format("{0}", _Position), this);
            ParentNode.BackColor = RenderColor;
            ParentNode.Nodes.Add(Node);

            ZA = ParentZA;

            GLID = GL.GenLists(1);
            GL.NewList(GLID, ListMode.Compile);
            Helpers.DrawFramedSphere(new Vector3d(0, 0, 0), 25.0f, 10);
            GL.EndList();
        }
Example #3
0
        public MULT(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, System.Drawing.Color Color = default(System.Drawing.Color))
        {
            ParentFile = FE;

            byte[] SrcData = ParentFile.GetFileData();

            Offset = SrcOffset;

            _Translation = new Vector2(
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset)),
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x04)));
            _Rotation   = ((short)(Helpers.Read16(SrcData, SrcOffset + 0x08)) / 182.04444444444444f).Clamp(-180, 179);
            _RoomNumber = SrcData[SrcOffset + 0x0A];
            _Unknown2   = SrcData[SrcOffset + 0x0B];

            SrcOffset += 0x0C;

            RenderColor = Color;

            Node = Helpers.CreateTreeNode(string.Format("{0:X6}: {1}", Offset, new Vector2(_Translation.X / 100000, _Translation.Y / 100000)), this, string.Format("{0}", _Translation));
            ParentNode.BackColor = RenderColor;
            ParentNode.Nodes.Add(Node);

            GLID = GL.GenLists(1);
            GL.NewList(GLID, ListMode.Compile);
            Helpers.DrawFramedCube(new Vector3d(15, 15, 15));
            GL.EndList();
        }
Example #4
0
        public Generic(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode)
        {
            ParentFile = FE;
            Node       = ParentNode;

            Offset = SrcOffset;
        }
Example #5
0
        public LGTV(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, System.Drawing.Color Color = default(System.Drawing.Color), ZeldaArc ParentZA = null)
        {
            ParentFile = FE;

            byte[] SrcData = ParentFile.GetFileData();

            Offset = SrcOffset;

            _Unknown1 = new Vector3(
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset)),
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x04)),
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x08)));
            _Unknown2 = new Vector3(
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x0C)),
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x10)),
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x14)));
            _Unknown3 = Helpers.Read32(SrcData, SrcOffset + 0x18);

            SrcOffset += 0x1C;

            RenderColor = Color;

            Node = Helpers.CreateTreeNode(string.Format("{0:X6}", Offset), this, string.Format("{0}\n{1}\n0x{2:X8}", _Unknown1, _Unknown2, _Unknown3));
            ParentNode.BackColor = RenderColor;
            ParentNode.Nodes.Add(Node);
        }
Example #6
0
 public DZx(RARC.FileEntry FE, TreeNode TN, ZeldaArc PZA = null)
 {
     Root      = TN;
     FileEntry = FE;
     ParentZA  = PZA;
     Load();
 }
Example #7
0
            public FileChunk(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, ZeldaArc ParentZA)
            {
                byte[] SrcData = FE.GetFileData();

                Tag      = Helpers.ReadString(SrcData, SrcOffset, 4);
                Elements = Helpers.Read32(SrcData, SrcOffset + 4);
                Offset   = Helpers.Read32(SrcData, SrcOffset + 8);

                Data = new object[Elements];

                TreeNode NewNode = Helpers.CreateTreeNode(Tag, this, string.Format("Offset: {0:X6}\n{1} elements", Offset, Elements));

                int ReadOffset = (int)Offset;

                for (int i = 0; i < Elements; i++)
                {
                    switch (Tag)
                    {
                    /* Typically in DZR */
                    case "ACTR": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.GreenYellow, ParentZA); continue;

                    case "TGOB": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.GreenYellow, ParentZA); continue;

                    case "PLYR": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.Orange, ParentZA); continue;

                    case "PPNT":        /* Found in DmSpot0's Stage DZS for some reason... */
                    case "RPPN": Data[i] = new RPPN(FE, ref ReadOffset, NewNode, System.Drawing.Color.LightSkyBlue, ParentZA); continue;

                    case "SHIP": Data[i] = new SHIP(FE, ref ReadOffset, NewNode, System.Drawing.Color.BlueViolet, ParentZA); continue;

                    case "TGDR":
                    case "DOOR":
                    case "Door": Data[i] = new TGDR(FE, ref ReadOffset, NewNode, System.Drawing.Color.HotPink, ParentZA); continue;

                    case "LGTV": Data[i] = new LGTV(FE, ref ReadOffset, NewNode, System.Drawing.Color.DarkGray, ParentZA); continue;      /* ????? */

                    /* Typically in DZS */
                    case "MULT": Data[i] = new MULT(FE, ref ReadOffset, NewNode, System.Drawing.Color.LightGray, ParentZA); continue;

                    case "TRES": Data[i] = new TRES(FE, ref ReadOffset, NewNode, System.Drawing.Color.SaddleBrown, ParentZA); continue;
                    }

                    switch (Tag.Substring(0, 3))
                    {
                    case "ACT": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.GreenYellow, ParentZA); break;

                    case "PLY": Data[i] = new ACTR(FE, ref ReadOffset, NewNode, System.Drawing.Color.Orange, ParentZA); break;

                    case "SCO": Data[i] = new TGDR(FE, ref ReadOffset, NewNode, System.Drawing.Color.Yellow, ParentZA); break;

                    case "TRE": Data[i] = new TRES(FE, ref ReadOffset, NewNode, System.Drawing.Color.SaddleBrown, ParentZA); break;

                    default: Data[i] = new Generic(FE, ref ReadOffset, NewNode); NewNode.Tag = Data[i]; break;
                    }
                }

                ParentNode.Nodes.Add(NewNode);

                SrcOffset += 12;
            }
Example #8
0
 public Vertex(byte[] Data, ref UInt32 Offset, RARC.FileEntry FE)
 {
     ParentFile = FE;
     ThisOffset = (int)Offset;
     _Position  = new Vector3(
         Helpers.ConvertIEEE754Float(Helpers.Read32(Data, (int)Offset)),
         Helpers.ConvertIEEE754Float(Helpers.Read32(Data, (int)Offset + 4)),
         Helpers.ConvertIEEE754Float(Helpers.Read32(Data, (int)Offset + 8)));
     Offset += Size;
 }
Example #9
0
        public TGDR(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, System.Drawing.Color Color = default(System.Drawing.Color), ZeldaArc ParentZA = null)
        {
            ParentFile = FE;

            byte[] SrcData = ParentFile.GetFileData();

            Offset = SrcOffset;

            _Name       = Helpers.ReadString(SrcData, SrcOffset, 8);
            _Parameters = Helpers.Read32(SrcData, SrcOffset + 8);
            _Position   = new Vector3(
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x0C)),
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x10)),
                Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x14)));

            _Unknown1  = Helpers.Read16(SrcData, SrcOffset + 0x18);
            _RotationY = ((short)Helpers.Read16(SrcData, SrcOffset + 0x1A) / 182.04444444444444).Clamp(-180, 179);
            _Unknown2  = Helpers.Read16(SrcData, SrcOffset + 0x1C);

            _Unknown3 = Helpers.Read16(SrcData, SrcOffset + 0x1E);
            _Unknown4 = Helpers.Read32(SrcData, SrcOffset + 0x20);

            SrcOffset += 0x24;

            RenderColor = Color;

            Node = Helpers.CreateTreeNode(string.Format("{0:X6}: {1}", Offset, _Name), this);
            ParentNode.BackColor = RenderColor;
            ParentNode.Nodes.Add(Node);

            GLID = GL.GenLists(1);
            GL.NewList(GLID, ListMode.Compile);

            if (ParentZA != null)
            {
                MatchedModel     = ParentZA.J3Dxs.Find(x => x.FileEntry.FileName.StartsWith(_Name));
                MatchedCollision = ParentZA.DZBs.Find(x => x.Name.StartsWith(_Name));
            }

            Helpers.DrawFramedCube(new Vector3d(15, 15, 15));
            GL.EndList();
        }
        private void OpenFile()
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                IsBMGLoaded = false;

                IsBMCLoaded = false;

                if (Yaz0.IsYaz0Compressed(openFileDialog1.FileName))
                {
                    MessageBox.Show("Archive is compressed. Please decompress it.");

                    return;
                }

                RARC archive = new RARC(openFileDialog1.FileName);

                int numRARCNodes = archive.Nodes.Count();

                if (numRARCNodes < 0)
                    return;

                foreach (RARC.FileEntry entry in archive.Nodes[0].Entries)
                {
                    if (entry.Name.EndsWith(".bmg"))
                    {
                        TextBankBMG = entry;

                        TextBankClass = new BMG_New(new EndianBinaryReader(entry.Data, Endian.Big));

                        if (TextBankClass.IsWindWaker == false)
                        {
                            MessageBox.Show("The BMG file in this archive is not from The Wind Waker. BMG files from other games are not supported at this time.");

                            return;
                        }

                        ArcFilePath = openFileDialog1.FileName;

                        saveFileDialog1.InitialDirectory = ArcFilePath;

                        IsBMGLoaded = true;

                        MessageList = TextBankClass.GetMessageList();

                        saveToolStripMenuItem.Enabled = true;
                        AddToolStrip.Enabled = true;
                        deleteToolStripMenuItem.Enabled = true;
                        proofreadToolStripMenuItem.Enabled = true;
                        searchBoxBackPanel.Controls[0].Enabled = true;
                        SearchButton.Enabled = true;
                        textOpt.Enabled = true;
                        idOpt.Enabled = true;

                        LoadMainUI();
                    }

                    if (entry.Name.EndsWith(".bmc"))
                    {
                        TextColorBMC = entry;
                        IsBMCLoaded = true;
                        textColorsToolStripMenuItem.Enabled = true;

                        ColorClass = new BMCParser(new EndianBinaryReader(entry.Data, Endian.Big));

                        ColorList = ColorClass.GetColorList();
                    }
                }

                if (!IsBMGLoaded && IsBMCLoaded)
                    MessageBox.Show("Archive does not contain a text bank (.bmg).");

                if (IsBMGLoaded && !IsBMCLoaded)
                    MessageBox.Show("Archive does not contain a text color file (.bmc).");

                if (!IsBMGLoaded && !IsBMCLoaded)
                    MessageBox.Show("Archive does not contain a text bank (.bmg) or a text color file (.bmc).");
            }

            return;
        }