Beispiel #1
0
 private M4 Parse4_02(TreeNode tn, int xoff, ReadBar.Barent ent)
 {
     MemoryStream memoryStream = new MemoryStream(ent.bin, false);
     BinaryReader binaryReader = new BinaryReader(memoryStream);
     memoryStream.Position = 144L;
     int num = binaryReader.ReadInt32();
     if (num != 2)
     {
         throw new NotSupportedException("@90 != 2");
     }
     memoryStream.Position = 160L;
     int num2 = binaryReader.ReadInt32();
     binaryReader.ReadUInt16();
     int num3 = (int)binaryReader.ReadUInt16();
     int num4 = binaryReader.ReadInt32();
     int num5 = binaryReader.ReadInt32();
     List<int[]> list = new List<int[]>();
     for (int i = 0; i < num3; i++)
     {
         memoryStream.Position = (long)(144 + num4 + 4 * i);
         int num6 = binaryReader.ReadInt32();
         memoryStream.Position = (long)(144 + num6);
         List<int> list2 = new List<int>();
         while (true)
         {
             int num7 = (int)binaryReader.ReadUInt16();
             if (num7 == 65535)
             {
                 break;
             }
             list2.Add(num7);
         }
         list.Add(list2.ToArray());
     }
     List<int> list3 = new List<int>();
     memoryStream.Position = (long)(144 + num5);
     for (int j = 0; j < 1; j++)
     {
         int num8 = binaryReader.ReadInt32();
         memoryStream.Position = (long)(144 + num8);
         for (int k = 0; k < num2; k++)
         {
             list3.Add((int)binaryReader.ReadUInt16());
         }
     }
     List<Vifpli> list4 = new List<Vifpli>();
     for (int l = 0; l < num2; l++)
     {
         memoryStream.Position = (long)(176 + 16 * l);
         int num9 = binaryReader.ReadInt32();
         int num10 = binaryReader.ReadInt32();
         MemoryStream memoryStream2 = new MemoryStream();
         while (true)
         {
             memoryStream.Position = (long)(144 + num9);
             int num11 = binaryReader.ReadInt32();
             int num12 = num11 & 65535;
             binaryReader.ReadInt32();
             byte[] array = binaryReader.ReadBytes(8 + 16 * num12);
             memoryStream2.Write(array, 0, array.Length);
             if (num11 >> 28 == 6)
             {
                 break;
             }
             num9 += 16 + 16 * num12;
         }
         byte[] vifpkt = memoryStream2.ToArray();
         list4.Add(new Vifpli(vifpkt, num10));
         TreeNode treeNode = tn.Nodes.Add(string.Format("vifpkt{0} ({1})", l, num10));
         RDForm.MI mI = new RDForm.MI();
         mI.Add("vifpkt", xoff + 144 + num9);
         treeNode.Tag = new RDForm.Vifi(xoff + 144 + num9, mI, vifpkt);
     }
     return new M4
     {
         alb1t2 = list3,
         alb2 = list,
         alvifpkt = list4
     };
 }
Beispiel #2
0
 private void Parse24(TreeNode tn, int xoff, ReadBar.Barent ent)
 {
     if (ent.id == "evt")
     {
         int num = ent.bin.Length / 256;
         Bitmap bitmap = new Bitmap(256, 2 * num);
         byte[] bin = ent.bin;
         for (int i = 0; i < num; i++)
         {
             int y = (i & 511) + 2 * (i & -512);
             for (int j = 0; j < 256; j++)
             {
                 int num2 = (int)bin[j + 256 * i];
                 num2 = ((num2 & 48) << 2 | (num2 & 3) << 4);
                 bitmap.SetPixel(j, y, Color.FromArgb(num2, num2, num2));
             }
         }
         for (int k = 0; k < num; k++)
         {
             int y2 = (k & 511) + 2 * (k & -512) + 512;
             for (int l = 0; l < 256; l++)
             {
                 int num3 = (int)bin[l + 256 * k];
                 num3 = ((num3 & 192) | (num3 & 12) << 2);
                 bitmap.SetPixel(l, y2, Color.FromArgb(num3, num3, num3));
             }
         }
         TreeNode treeNode = tn.Nodes.Add("font");
         treeNode.Tag = new RDForm.IMGDi(xoff, bitmap);
         return;
     }
     if (ent.id == "sys")
     {
         int num4 = ent.bin.Length / 256;
         Bitmap bitmap2 = new Bitmap(256, 2 * num4);
         byte[] bin2 = ent.bin;
         for (int m = 0; m < num4; m++)
         {
             int y3 = m;
             for (int n = 0; n < 256; n++)
             {
                 int num5 = (int)bin2[n + 256 * m];
                 num5 = ((num5 & 48) << 2 | (num5 & 3) << 4);
                 bitmap2.SetPixel(n, y3, Color.FromArgb(num5, num5, num5));
             }
         }
         for (int num6 = 0; num6 < num4; num6++)
         {
             int y4 = num6 + num4;
             for (int num7 = 0; num7 < 256; num7++)
             {
                 int num8 = (int)bin2[num7 + 256 * num6];
                 num8 = ((num8 & 192) | (num8 & 12) << 2);
                 bitmap2.SetPixel(num7, y4, Color.FromArgb(num8, num8, num8));
             }
         }
         TreeNode treeNode2 = tn.Nodes.Add("font");
         treeNode2.Tag = new RDForm.IMGDi(xoff, bitmap2);
         return;
     }
     if (ent.id == "icon")
     {
         Bitmap bitmap3 = new Bitmap(256, 160, PixelFormat.Format8bppIndexed);
         byte[] bin3 = ent.bin;
         BitmapData bitmapData = bitmap3.LockBits(new Rectangle(0, 0, bitmap3.Width, bitmap3.Height), ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);
         try
         {
             Marshal.Copy(bin3, 0, bitmapData.Scan0, 40960);
         }
         finally
         {
             bitmap3.UnlockBits(bitmapData);
         }
         ColorPalette palette = bitmap3.Palette;
         byte[] array = new byte[8192];
         Buffer.BlockCopy(bin3, 40960, array, 0, 1024);
         Color[] entries = palette.Entries;
         for (int num9 = 0; num9 < 256; num9++)
         {
             int num10 = num9;
             int num11 = num9;
             int num12 = 4 * num10;
             entries[num11] = Color.FromArgb(Math.Min(255, (int)(array[num12 + 3] * 2)), (int)array[num12], (int)array[num12 + 1], (int)array[num12 + 2]);
         }
         bitmap3.Palette = palette;
         TreeNode treeNode3 = tn.Nodes.Add("font");
         treeNode3.Tag = new RDForm.IMGDi(xoff, bitmap3);
     }
 }
Beispiel #3
0
 private void Parse4(TreeNode tn, int xoff, ReadBar.Barent ent, DC curdc)
 {
     MemoryStream memoryStream = new MemoryStream(ent.bin, false);
     BinaryReader binaryReader = new BinaryReader(memoryStream);
     memoryStream.Position = 144L;
     int num = binaryReader.ReadInt32();
     if (num == 2)
     {
         curdc.o4Map = this.Parse4_02(tn, xoff, ent);
         return;
     }
     if (num == 3)
     {
         curdc.o4Mdlx = this.Parse4_03(tn, xoff, ent);
         return;
     }
     throw new NotSupportedException("Unknown @90 .. " + num);
 }
Beispiel #4
0
 private void Parse1D(TreeNode tn, int xoff, ReadBar.Barent ent)
 {
     MemoryStream memoryStream = new MemoryStream(ent.bin, false);
     BinaryReader binaryReader = new BinaryReader(memoryStream);
     memoryStream.Position = 12L;
     int num = binaryReader.ReadInt32();
     for (int i = 0; i < num; i++)
     {
         int index = binaryReader.ReadInt32();
         int count = binaryReader.ReadInt32();
         MemoryStream si = new MemoryStream(ent.bin, index, count, false);
         PicIMGD picIMGD = ParseIMGD.TakeIMGD(si);
         TreeNode treeNode = tn.Nodes.Add("IMGD." + RDForm.PalC2s.Guess(picIMGD));
         treeNode.Tag = new RDForm.IMGDi(ent.off, picIMGD.pic);
     }
 }
Beispiel #5
0
 private void Parse22(TreeNode tn, int xoff, ReadBar.Barent ent)
 {
     MemoryStream memoryStream = new MemoryStream(ent.bin, false);
     new BinaryReader(memoryStream);
     Wavo[] array = ParseSD.ReadIV(memoryStream);
     Wavo[] array2 = array;
     for (int i = 0; i < array2.Length; i++)
     {
         Wavo wavo = array2[i];
         TreeNode treeNode = tn.Nodes.Add(wavo.fn);
         treeNode.Tag = new RDForm.WAVi(ent.off, wavo);
         this.setWAVi(treeNode);
     }
 }
Beispiel #6
0
 private void Parse12(TreeNode tn, int xoff, ReadBar.Barent ent)
 {
     MemoryStream memoryStream = new MemoryStream(ent.bin, false);
     new BinaryReader(memoryStream);
     PicPAX picPAX = ParsePAX.ReadPAX(memoryStream);
     int num = 0;
     foreach (R current in picPAX.alr)
     {
         num++;
         int num2 = 0;
         foreach (Bitmap current2 in current.pics)
         {
             num2++;
             TreeNode treeNode = tn.Nodes.Add(string.Concat(new object[]
             {
                 num,
                 ".",
                 num2,
                 ".p.",
                 RDForm.PalC2s.Guess(current2)
             }));
             treeNode.Tag = new RDForm.IMGDi(ent.off, current2);
         }
     }
 }
Beispiel #7
0
 private void Parse18(TreeNode tn, int xoff, ReadBar.Barent ent)
 {
     MemoryStream memoryStream = new MemoryStream(ent.bin, false);
     new BinaryReader(memoryStream);
     PicIMGD picIMGD = ParseIMGD.TakeIMGD(memoryStream);
     TreeNode treeNode = tn.Nodes.Add("IMGD." + RDForm.PalC2s.Guess(picIMGD));
     treeNode.Tag = new RDForm.IMGDi(ent.off, picIMGD.pic);
 }
Beispiel #8
0
 private void Parse0a(TreeNode tn, int xoff, ReadBar.Barent ent)
 {
     MemoryStream si = new MemoryStream(ent.bin, false);
     ParseRADA parseRADA = new ParseRADA(si);
     parseRADA.Parse();
     TreeNode treeNode = tn.Nodes.Add("radar");
     RDForm.IMGDi tag = new RDForm.IMGDi(xoff, parseRADA.pic);
     treeNode.Tag = tag;
 }
Beispiel #9
0
 private void Parse0c(TreeNode tn, int xoff, ReadBar.Barent ent)
 {
     MemoryStream memoryStream = new MemoryStream(ent.bin, false);
     BinaryReader binaryReader = new BinaryReader(memoryStream);
     try
     {
         memoryStream.Position = 12L;
         int num = (int)binaryReader.ReadUInt16();
         int num2 = (int)binaryReader.ReadUInt16();
         int num3 = 52;
         StringWriter stringWriter = new StringWriter();
         for (int i = 0; i < num; i++)
         {
             memoryStream.Position = (long)(num3 + 64 * i);
             int num4 = binaryReader.ReadInt32();
             float num5 = binaryReader.ReadSingle();
             float num6 = binaryReader.ReadSingle();
             float num7 = binaryReader.ReadSingle();
             float num8 = binaryReader.ReadSingle();
             stringWriter.WriteLine("a.{0} {1:X4} ({2}, {3}, {4}, {5}) ; {6}", new object[]
             {
                 i,
                 num4,
                 num5,
                 num6,
                 num7,
                 num8,
                 this.GetObjName(num4) ?? "?"
             });
         }
         num3 += 64 * num;
         stringWriter.WriteLine();
         for (int j = 0; j < num2; j++)
         {
             memoryStream.Position = (long)(num3 + 64 * j);
             int num9 = (int)binaryReader.ReadUInt16();
             int num10 = (int)binaryReader.ReadUInt16();
             float num11 = binaryReader.ReadSingle();
             float num12 = binaryReader.ReadSingle();
             float num13 = binaryReader.ReadSingle();
             float num14 = binaryReader.ReadSingle();
             float num15 = binaryReader.ReadSingle();
             float num16 = binaryReader.ReadSingle();
             float num17 = binaryReader.ReadSingle();
             float num18 = binaryReader.ReadSingle();
             stringWriter.WriteLine("b.{0} {1:X4} {10:X} ({2}, {3}, {4}, {5}) ({6}, {7}, {8}, {9})", new object[]
             {
                 j,
                 num9,
                 num11,
                 num12,
                 num13,
                 num14,
                 num15,
                 num16,
                 num17,
                 num18,
                 num10
             });
         }
         num3 += 64 * num2;
         TreeNode treeNode = tn.Nodes.Add("appear");
         treeNode.Tag = new RDForm.Strif(xoff, stringWriter.ToString());
     }
     catch (EndOfStreamException innerException)
     {
         throw new NotSupportedException("EOF", innerException);
     }
 }
Beispiel #10
0
 private void Parse03(TreeNode tn, int xoff, ReadBar.Barent ent)
 {
     try
     {
         StringWriter stringWriter = new StringWriter();
         new Parse03(stringWriter).Run(ent.bin);
         TreeNode treeNode = tn.Nodes.Add("A.I. code");
         treeNode.Tag = new RDForm.Strif(xoff, stringWriter.ToString());
     }
     catch (Exception innerException)
     {
         throw new NotSupportedException("Parser error.", innerException);
     }
 }
Beispiel #11
0
 private void Parse02(TreeNode tn, int xoff, ReadBar.Barent ent)
 {
     try
     {
         MemoryStream memoryStream = new MemoryStream(ent.bin, false);
         BinaryReader binaryReader = new BinaryReader(memoryStream);
         byte[] bin = ent.bin;
         int num = binaryReader.ReadInt32();
         if (num != 1)
         {
             throw new InvalidDataException("w0 != 1");
         }
         StringWriter stringWriter = new StringWriter();
         int num2 = binaryReader.ReadInt32();
         StrDec strDec = new StrDec();
         for (int i = 0; i < num2; i++)
         {
             memoryStream.Position = (long)(8 + 8 * i);
             int num3 = binaryReader.ReadInt32();
             int num4 = binaryReader.ReadInt32();
             memoryStream.Position = (long)num4;
             stringWriter.WriteLine("{0:x8} {1} --", num3, num4);
             foreach (StrCode current in strDec.DecodeEvt(bin, num4))
             {
                 byte[] bin2 = current.bin;
                 for (int j = 0; j < bin2.Length; j++)
                 {
                     byte b = bin2[j];
                     stringWriter.Write("{0:x2} ", b);
                 }
             }
             stringWriter.WriteLine();
             stringWriter.WriteLine(strDec.DecodeEvt(bin, num4));
             stringWriter.WriteLine();
         }
         TreeNode treeNode = tn.Nodes.Add("String table");
         treeNode.Tag = new RDForm.Strif(xoff, stringWriter.ToString());
     }
     catch (Exception innerException)
     {
         throw new NotSupportedException("Parser error.", innerException);
     }
 }
Beispiel #12
0
 private MTex ParseTex(TreeNode tn, int xoff, ReadBar.Barent ent)
 {
     MemoryStream memoryStream = new MemoryStream(ent.bin, false);
     BinaryReader binaryReader = new BinaryReader(memoryStream);
     int num = binaryReader.ReadInt32();
     if (num == 0)
     {
         memoryStream.Position = 0L;
         return this.ParseTex_TIMf(tn, xoff, memoryStream, binaryReader);
     }
     if (num != -1)
     {
         throw new NotSupportedException("Unknown v00 .. " + num);
     }
     int num2 = binaryReader.ReadInt32();
     List<int> list = new List<int>();
     for (int i = 0; i < num2; i++)
     {
         list.Add(binaryReader.ReadInt32());
     }
     list.Add(ent.bin.Length);
     List<MTex> list2 = new List<MTex>();
     for (int j = 0; j < num2; j++)
     {
         memoryStream.Position = (long)list[j];
         byte[] buffer = binaryReader.ReadBytes(list[j + 1] - list[j]);
         TreeNode tn2 = tn.Nodes.Add("TIMc" + j);
         MemoryStream memoryStream2 = new MemoryStream(buffer, false);
         BinaryReader br = new BinaryReader(memoryStream2);
         list2.Add(this.ParseTex_TIMf(tn2, ent.off + list[j], memoryStream2, br));
     }
     if (list2.Count == 0)
     {
         return null;
     }
     return list2[0];
 }
Beispiel #13
0
 private CollReader Parse6(TreeNode tn, int xoff, ReadBar.Barent ent)
 {
     MemoryStream memoryStream = new MemoryStream(ent.bin, false);
     new BinaryReader(memoryStream);
     CollReader collReader = new CollReader();
     collReader.Read(memoryStream);
     StringWriter stringWriter = new StringWriter();
     int num = 0;
     foreach (Co1 current in collReader.alCo1)
     {
         stringWriter.WriteLine("Co1[{0,2}] {1}", num, current);
         num++;
     }
     stringWriter.WriteLine("--");
     int num2 = 0;
     foreach (Co2 current2 in collReader.alCo2)
     {
         stringWriter.WriteLine("Co2[{0,3}] {1}", num2, current2);
         num2++;
     }
     stringWriter.WriteLine("--");
     int num3 = 0;
     foreach (Co3 current3 in collReader.alCo3)
     {
         stringWriter.WriteLine("Co3[{0,3}] {1}", num3, current3);
         num3++;
     }
     stringWriter.WriteLine("--");
     int num4 = 0;
     foreach (Vector4 current4 in collReader.alCo4)
     {
         stringWriter.WriteLine("Co4[{0,3}] {1}", num4, current4);
         num4++;
     }
     stringWriter.WriteLine("--");
     int num5 = 0;
     foreach (Plane current5 in collReader.alCo5)
     {
         stringWriter.WriteLine("Co5[{0,3}] {1}", num5, current5);
         num5++;
     }
     stringWriter.WriteLine("--");
     TreeNode treeNode = tn.Nodes.Add("collision");
     treeNode.Tag = new RDForm.Strif(xoff, stringWriter.ToString());
     return collReader;
 }
Beispiel #14
0
 private Parse4Mdlx Parse4_03(TreeNode tn, int xoff, ReadBar.Barent ent)
 {
     Parse4Mdlx parse4Mdlx = new Parse4Mdlx(ent.bin);
     foreach (T31 current in parse4Mdlx.mdlx.alt31)
     {
         TreeNode treeNode = tn.Nodes.Add("Mdlx.T31");
         treeNode.Tag = new RDForm.Hexi(xoff + current.off, current.len);
         if (current.t21 != null)
         {
             TreeNode treeNode2 = treeNode.Nodes.Add("T21.alaxb");
             StringWriter stringWriter = new StringWriter();
             stringWriter.WriteLine("alaxb = Array of joints");
             stringWriter.WriteLine();
             stringWriter.WriteLine("current-joint-index,parent-joint-index");
             stringWriter.WriteLine(" scale x,y,z,w");
             stringWriter.WriteLine(" rotate x,y,z,w");
             stringWriter.WriteLine(" translate x,y,z,w");
             stringWriter.WriteLine();
             foreach (AxBone current2 in current.t21.alaxb)
             {
                 stringWriter.WriteLine("{0},{1}", current2.cur, current2.parent);
                 stringWriter.WriteLine(" {0},{1},{2},{3}", new object[]
                 {
                     current2.x1,
                     current2.y1,
                     current2.z1,
                     current2.w1
                 });
                 stringWriter.WriteLine(" {0},{1},{2},{3}", new object[]
                 {
                     current2.x2,
                     current2.y2,
                     current2.z2,
                     current2.w2
                 });
                 stringWriter.WriteLine(" {0},{1},{2},{3}", new object[]
                 {
                     current2.x3,
                     current2.y3,
                     current2.z3,
                     current2.w3
                 });
             }
             treeNode2.Tag = new RDForm.Strif(xoff + current.t21.off, stringWriter.ToString());
         }
         int num = 0;
         foreach (T13vif current3 in current.al13)
         {
             TreeNode treeNode3 = treeNode.Nodes.Add(string.Format("vifpkt{0} ({1})", num++, current3.texi));
             treeNode3.Tag = new RDForm.Vifi(xoff + current3.off, current3.bin);
         }
     }
     return parse4Mdlx;
 }