Пример #1
0
 public HRegular(HueData hd, int HueID)
 {
     this.hue = HueID;
     this.m_Data = hd;
 }
Пример #2
0
 static unsafe Hues()
 {
     Debug.TimeBlock("Initializing Hues");
     m_Default = new HDefault();
     m_HueData = new HueData[0xbb8];
     m_Partial = new HPartial[0xbb8];
     m_Regular = new HRegular[0xbb8];
     string path = "Data/QuickLoad/Hues.mul";
     string str2 = Engine.FileManager.BasePath(path);
     FileInfo info = new FileInfo(Engine.FileManager.ResolveMUL(Files.Hues));
     FileInfo info2 = new FileInfo(Engine.FileManager.ResolveMUL(Files.Verdata));
     if (File.Exists(str2))
     {
         BinaryReader reader = new BinaryReader(Engine.FileManager.OpenBaseMUL(path));
         DateTime time = DateTime.FromFileTime(reader.ReadInt64());
         DateTime time2 = DateTime.FromFileTime(reader.ReadInt64());
         if ((info.LastWriteTime == time) && (info2.LastWriteTime == time2))
         {
             int num = 0xbb8;
             int num2 = 0;
             byte[] src = reader.ReadBytes(num * 0x44);
             int srcOffset = 0;
             while (num2 < num)
             {
                 HueData data = new HueData {
                     colors = new ushort[0x40]
                 };
                 Buffer.BlockCopy(src, srcOffset, data.colors, 0x40, 0x40);
                 srcOffset += 0x44;
                 m_HueData[num2++] = data;
             }
             reader.Close();
             Patch();
             Debug.EndBlock();
             return;
         }
         reader.Close();
     }
     int count = 0x40d1c;
     byte[] buffer2 = new byte[count];
     Stream stream = Engine.FileManager.OpenMUL(Files.Hues);
     stream.Read(buffer2, 0, count);
     stream.Close();
     fixed (byte* numRef = buffer2)
     {
         int num5 = 0;
         int num6 = 0;
         short* numPtr = (short*) numRef;
         do
         {
             numPtr += 2;
             int num7 = 0;
             do
             {
                 HueData data2 = new HueData {
                     colors = new ushort[0x40]
                 };
                 for (int j = 0; j < 0x20; j++)
                 {
                     numPtr++;
                     data2.colors[0x20 + j] = (ushort) numPtr[0];
                 }
                 numPtr++;
                 data2.tableStart = numPtr[0];
                 numPtr++;
                 data2.tableEnd = numPtr[0];
                 m_HueData[num5++] = data2;
                 numPtr += 10;
             }
             while (++num7 < 8);
         }
         while (++num6 < 0x177);
     }
     Stream stream2 = Engine.FileManager.OpenMUL(Files.Verdata);
     buffer2 = new byte[stream2.Length];
     stream2.Read(buffer2, 0, buffer2.Length);
     stream2.Close();
     fixed (byte* numRef2 = buffer2)
     {
         int* numPtr2 = (int*) numRef2;
         numPtr2++;
         int num9 = numPtr2[0];
         int num10 = 0;
         while (num10++ < num9)
         {
             numPtr2++;
             int num11 = numPtr2[0];
             if (num11 == 0x20)
             {
                 numPtr2++;
                 int num12 = numPtr2[0];
                 numPtr2++;
                 int num13 = numPtr2[0];
                 numPtr2++;
                 int num14 = numPtr2[0];
                 numPtr2++;
                 int num15 = numPtr2[0];
                 short* numPtr3 = (short*) ((numRef2 + num13) + 4);
                 for (int k = 0; k < 8; k++)
                 {
                     HueData data3 = new HueData {
                         colors = new ushort[0x40]
                     };
                     for (int m = 0; m < 0x20; m++)
                     {
                         numPtr3++;
                         data3.colors[0x20 + m] = (ushort) numPtr3[0];
                     }
                     numPtr3++;
                     data3.tableStart = numPtr3[0];
                     numPtr3++;
                     data3.tableEnd = numPtr3[0];
                     m_HueData[(num12 << 3) + k] = data3;
                     numPtr3 += 10;
                 }
             }
             else
             {
                 numPtr2 += 4;
             }
         }
     }
     BinaryWriter writer = new BinaryWriter(Engine.FileManager.CreateBaseMUL(str2));
     writer.Write(info.LastWriteTime.ToFileTime());
     writer.Write(info2.LastWriteTime.ToFileTime());
     int num18 = 0xbb8;
     for (int i = 0; i < num18; i++)
     {
         HueData data4 = m_HueData[i];
         for (int n = 0; n < 0x20; n++)
         {
             ushort[] numArray;
             IntPtr ptr;
             (numArray = data4.colors)[(int) (ptr = (IntPtr) (0x20 + n))] = (ushort) (numArray[(int) ptr] | 0x8000);
             writer.Write(data4.colors[0x20 + n]);
         }
         writer.Write(data4.tableStart);
         writer.Write(data4.tableEnd);
     }
     writer.Flush();
     writer.Close();
     Patch();
     Debug.EndBlock();
 }
Пример #3
0
 public HPartial(HueData hd, int HueID)
 {
     this.hue = HueID;
     this.m_Data = hd;
 }