Exemple #1
0
        public string ShaderConfCatalog(byte[] data)
        {
            MaterialPieces materialPieces = new MaterialPieces();

            if (data.SequenceEqual(materialPieces.SHADER_DEFAULT))
            {
                return("DEFAULT");
            }
            if (data.SequenceEqual(materialPieces.SHADER_NOTFOUND))
            {
                return("ERROR");
            }
            if (data.SequenceEqual(materialPieces.SHADER_VAGUE))
            {
                return("VAGUE");
            }
            if (data.SequenceEqual(materialPieces.SHADER_VEGETATION_COLOR))
            {
                return("VEGETATION_COLOR");
            }
            if (data.SequenceEqual(materialPieces.SHADER_VEGETATION_COLOR2))
            {
                return("VEGETATION_COLOR_2");
            }
            if (data.SequenceEqual(materialPieces.SHADER_VEGETATION_NORMAL))
            {
                return("VEGETATION_NORMAL");
            }
            if (data.SequenceEqual(materialPieces.SHADER_VEGETATION_IMPOSTEUR))
            {
                return("VEGETATION_IMPOSTOR");
            }
            if (data.SequenceEqual(materialPieces.SHADER_VAGUE2))
            {
                return("VAGUE_2");
            }
            if (data.SequenceEqual(materialPieces.SHADER_VAGUE3))
            {
                return("VAGUE_3");
            }
            if (data.SequenceEqual(materialPieces.SHADER_LAC))
            {
                return("LAC");
            }
            if (data.SequenceEqual(materialPieces.SHADER_BORD_BLANC))
            {
                return("BORD_BLANC");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ECUME))
            {
                return("ECUME");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ECUME2))
            {
                return("ECUME_2");
            }
            if (data.SequenceEqual(materialPieces.SHADER_COLOR_BLEND2))
            {
                return("COLOR_BLEND_2");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ECUME3))
            {
                return("ECUME_3");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ECUME4))
            {
                return("ECUME_4");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ASPHALT_TUNNEL_ARROWS))
            {
                return("ASPHALT_TUNNEL_ARROWS");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ASPHALT))
            {
                return("ASPHALT");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ASPHALT2))
            {
                return("ASPHALT_2");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ASPHALT_ARROWS))
            {
                return("ASPHALT_ARROWS");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ASPHALT_ARROWS2))
            {
                return("ASPHALT_ARROWS_2");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ASPHALT_CROSSROAD))
            {
                return("ASPHALT_CROSSROAD");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ASPHALT_CROSSROAD2))
            {
                return("ASPHALT_CROSSROAD_2");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ASPHALT_COLORMAP3))
            {
                return("ASPHALT_COLORMAP_3");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ASPHALT_TUNNEL))
            {
                return("ASPHALT_TUNNEL");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_ALPHA))
            {
                return("COLORMAP_ALPHA");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_GLOSS))
            {
                return("COLORMAP_GLOSS");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_GLOSS2))
            {
                return("COLORMAP_GLOSS_2");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_GLOSS3))
            {
                return("COLORMAP_GLOSS_3");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_GLOSS4))
            {
                return("COLORMAP_GLOSS_4");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_GLOSS5))
            {
                return("COLORMAP_GLOSS_5");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_GLOSS6))
            {
                return("COLORMAP_GLOSS_6");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_GLOSS7))
            {
                return("COLORMAP_GLOSS_7");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_GLOSS8))
            {
                return("COLORMAP_GLOSS_8");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_GLOSS9))
            {
                return("COLORMAP_GLOSS_9");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_DETAIL))
            {
                return("COLORMAP_DETAIL");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_DETAIL2))
            {
                return("COLORMAP_DETAIL_2");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_DETAIL3))
            {
                return("COLORMAP_DETAIL_3");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_DETAIL4))
            {
                return("COLORMAP_DETAIL_4");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_DETAIL5))
            {
                return("COLORMAP_DETAIL_5");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_COLOR))
            {
                return("COLORMAP_COLOR");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_COLOR2))
            {
                return("COLORMAP_COLOR_2");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_DETAIL6))
            {
                return("COLORMAP_DETAIL_6");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ASPHALT_DECAL))
            {
                return("ASPHALT_DECAL");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ASPHALT_DECAL2))
            {
                return("ASPHALT_DECAL_2");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ASPHALT_DECAL3))
            {
                return("ASPHALT_DECAL_3");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_COLOR3))
            {
                return("COLORMAP_COLOR_3");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_COLOR5))
            {
                return("COLORMAP_COLOR_5");
            }
            if (data.SequenceEqual(materialPieces.SHADER_COLOR_BLEND))
            {
                return("COLOR_BLEND");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_SHADOW))
            {
                return("COLORMAP_SHADOW");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_ILLUMINATED))
            {
                return("COLORMAP_ILLUMINATED");
            }
            if (data.SequenceEqual(materialPieces.SHADER_OBJECT_COLORR))
            {
                return("COLORMAP_COLOR_R");
            }
            if (data.SequenceEqual(materialPieces.SHADER_ILLUMINATION))
            {
                return("ILLUMINATION");
            }
            if (data.SequenceEqual(materialPieces.SHADER_HEIGHTMAP_IMPOSTOR))
            {
                return("HMAP");
            }
            return("???");
        }
Exemple #2
0
        public byte[] getShaderData(ShaderEnum hashcode)
        {
            MaterialPieces materialPieces = new MaterialPieces();

            switch (hashcode)
            {
            case ShaderEnum.DEFAULT:
                return(materialPieces.SHADER_DEFAULT);

            case ShaderEnum.NONE:
                return(materialPieces.SHADER_NOTFOUND);

            case ShaderEnum.ILLUMINATION:
                return(materialPieces.SHADER_ILLUMINATION);

            case ShaderEnum.HEIGHTMAP:
                return(materialPieces.SHADER_HEIGHTMAP_IMPOSTOR);

            case ShaderEnum.VAGUE:
                return(materialPieces.SHADER_VAGUE);

            case ShaderEnum.VAGUE_2:
                return(materialPieces.SHADER_VAGUE2);

            case ShaderEnum.VAGUE_3:
                return(materialPieces.SHADER_VAGUE3);

            case ShaderEnum.BORD_BLANC:
                return(materialPieces.SHADER_BORD_BLANC);

            case ShaderEnum.LAC:
                return(materialPieces.SHADER_LAC);

            case ShaderEnum.ECUME:
                return(materialPieces.SHADER_ECUME);

            case ShaderEnum.ECUME_2:
                return(materialPieces.SHADER_ECUME2);

            case ShaderEnum.ECUME_3:
                return(materialPieces.SHADER_ECUME3);

            case ShaderEnum.ECUME_4:
                return(materialPieces.SHADER_ECUME4);

            case ShaderEnum.ASPHALT:
                return(materialPieces.SHADER_ASPHALT);

            case ShaderEnum.ASPHALT_2:
                return(materialPieces.SHADER_ASPHALT2);

            case ShaderEnum.ASPHALT_ARROWS:
                return(materialPieces.SHADER_ASPHALT_ARROWS);

            case ShaderEnum.ASPHALT_ARROWS_2:
                return(materialPieces.SHADER_ASPHALT_ARROWS2);

            case ShaderEnum.ASPHALT_COLORMAP:
                return(materialPieces.SHADER_ASPHALT_CROSSROAD);

            case ShaderEnum.ASPHALT_COLORMAP_2:
                return(materialPieces.SHADER_ASPHALT_CROSSROAD2);

            case ShaderEnum.ASPHALT_COLORMAP_3:
                return(materialPieces.SHADER_ASPHALT_COLORMAP3);

            case ShaderEnum.ASPHALT_DECAL:
                return(materialPieces.SHADER_ASPHALT_DECAL);

            case ShaderEnum.ASPHALT_DECAL_2:
                return(materialPieces.SHADER_ASPHALT_DECAL2);

            case ShaderEnum.ASPHALT_DECAL_3:
                return(materialPieces.SHADER_ASPHALT_DECAL3);

            case ShaderEnum.ASPHALT_TUNNEL:
                return(materialPieces.SHADER_ASPHALT_TUNNEL);

            case ShaderEnum.ASPHALT_TUNNEL_ARROWS:
                return(materialPieces.SHADER_ASPHALT_TUNNEL_ARROWS);

            case ShaderEnum.OBJECT_COLOR:
                return(materialPieces.SHADER_OBJECT_COLOR);

            case ShaderEnum.OBJECT_COLOR_2:
                return(materialPieces.SHADER_OBJECT_COLOR2);

            case ShaderEnum.OBJECT_COLOR_3:
                return(materialPieces.SHADER_OBJECT_COLOR3);

            case ShaderEnum.OBJECT_COLOR_5:
                return(materialPieces.SHADER_OBJECT_COLOR5);

            case ShaderEnum.OBJECT_COLOR_REFLECTIVE:
                return(materialPieces.SHADER_OBJECT_COLORR);

            case ShaderEnum.OBJECT_GLOSS:
                return(materialPieces.SHADER_OBJECT_GLOSS);

            case ShaderEnum.OBJECT_GLOSS_2:
                return(materialPieces.SHADER_OBJECT_GLOSS2);

            case ShaderEnum.OBJECT_GLOSS_3:
                return(materialPieces.SHADER_OBJECT_GLOSS3);

            case ShaderEnum.OBJECT_GLOSS_4:
                return(materialPieces.SHADER_OBJECT_GLOSS4);

            case ShaderEnum.OBJECT_GLOSS_5:
                return(materialPieces.SHADER_OBJECT_GLOSS5);

            case ShaderEnum.OBJECT_GLOSS_6:
                return(materialPieces.SHADER_OBJECT_GLOSS6);

            case ShaderEnum.OBJECT_GLOSS_7:
                return(materialPieces.SHADER_OBJECT_GLOSS7);

            case ShaderEnum.OBJECT_GLOSS_8:
                return(materialPieces.SHADER_OBJECT_GLOSS8);

            case ShaderEnum.OBJECT_GLOSS_9:
                return(materialPieces.SHADER_OBJECT_GLOSS9);

            case ShaderEnum.OBJECT_DETAIL:
                return(materialPieces.SHADER_OBJECT_DETAIL);

            case ShaderEnum.OBJECT_DETAIL_2:
                return(materialPieces.SHADER_OBJECT_DETAIL2);

            case ShaderEnum.OBJECT_DETAIL_3:
                return(materialPieces.SHADER_OBJECT_DETAIL3);

            case ShaderEnum.OBJECT_DETAIL_4:
                return(materialPieces.SHADER_OBJECT_DETAIL4);

            case ShaderEnum.OBJECT_DETAIL_5:
                return(materialPieces.SHADER_OBJECT_DETAIL5);

            case ShaderEnum.OBJECT_DETAIL_6:
                return(materialPieces.SHADER_OBJECT_DETAIL6);

            case ShaderEnum.OBJECT_ALPHA:
                return(materialPieces.SHADER_OBJECT_ALPHA);

            case ShaderEnum.OBJECT_SHADOW:
                return(materialPieces.SHADER_OBJECT_SHADOW);

            case ShaderEnum.OBJECT_ILLUMINATED:
                return(materialPieces.SHADER_OBJECT_ILLUMINATED);

            case ShaderEnum.COLOR_BLEND:
                return(materialPieces.SHADER_COLOR_BLEND);

            case ShaderEnum.COLOR_BLEND_2:
                return(materialPieces.SHADER_COLOR_BLEND2);

            case ShaderEnum.VEGETATION_COLOR:
                return(materialPieces.SHADER_VEGETATION_COLOR);

            case ShaderEnum.VEGETATION_COLOR_2:
                return(materialPieces.SHADER_VEGETATION_COLOR2);

            case ShaderEnum.VEGETATION_IMPOSTOR:
                return(materialPieces.SHADER_VEGETATION_IMPOSTEUR);

            case ShaderEnum.VEGETATION_NORMAL:
                return(materialPieces.SHADER_VEGETATION_NORMAL);

            default:
                return(materialPieces.SHADER_NOTFOUND);
            }
        }
Exemple #3
0
        public void Write2DM(string output, List <_2DM_Common.sMAT> materialList, string srcFolder)
        {
            //IL_008b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0090: Expected O, but got Unknown
            Utilitaires    utilitaires    = new Utilitaires();
            _2DM_Common    _2DM_Common    = new _2DM_Common();
            MaterialPieces materialPieces = new MaterialPieces();
            Form           activeForm     = Form.ActiveForm;

            _2DM_Common.DicoPop(Path.GetDirectoryName(srcFolder));
            List <int> list   = new List <int>();
            List <int> list2  = new List <int>();
            List <int> list3  = new List <int>();
            List <int> list4  = new List <int>();
            List <int> list5  = new List <int>();
            List <int> list6  = new List <int>();
            List <int> list7  = new List <int>();
            List <int> list8  = new List <int>();
            List <int> list9  = new List <int>();
            List <int> list10 = new List <int>();
            long       num    = 0L;

            if (File.Exists(output))
            {
                File.Copy(output, output + ".BAK", true);
            }
            using (BinaryWriter binaryWriter = new BinaryWriter((Stream)File.Open(output, 2, 3, 3)))
            {
                binaryWriter.Write(2L);
                num = binaryWriter.BaseStream.Position;
                binaryWriter.Write(0);
                binaryWriter.Write(1296314926);
                binaryWriter.Write(1096368460L);
                binaryWriter.Write(materialList.Count * 288 + 16);
                binaryWriter.Write(16);
                foreach (_2DM_Common.sMAT material in materialList)
                {
                    _2DM_Common.sMAT current = material;
                    list6.Add(Convert.ToInt32(binaryWriter.BaseStream.Position));
                    binaryWriter.Write(777601356L);
                    binaryWriter.Write(288);
                    binaryWriter.Write(288);
                    binaryWriter.Write(materialPieces.LAYBLANK);
                    binaryWriter.Write((short)current.layerList.Count);
                    binaryWriter.Write((ushort)52685);
                    foreach (_2DM_Common.sLAYER layer in current.layerList)
                    {
                        _2DM_Common.sLAYER current2 = layer;
                        binaryWriter.Write(utilitaires.hexify(current2.parameter));
                        binaryWriter.Write(utilitaires.hexify(current2.texture));
                        binaryWriter.Write(0L);
                        binaryWriter.Write((byte)1);
                        binaryWriter.Write((byte)2);
                        binaryWriter.Write((byte)1);
                        binaryWriter.Write((byte)0);
                        binaryWriter.Write(0);
                    }
                    for (int i = current.layerList.Count; i < 8; i++)
                    {
                        binaryWriter.Write(0L);
                        binaryWriter.Write(0L);
                        binaryWriter.Write(0L);
                        binaryWriter.Write(0L);
                    }
                }
                binaryWriter.Write(1095909712L);
                binaryWriter.Write(16 + 160 * materialList.Count);
                binaryWriter.Write(16);
                for (int j = 0; j < materialList.Count; j++)
                {
                    list7.Add(Convert.ToInt32(binaryWriter.BaseStream.Position));
                    binaryWriter.Write(777142608L);
                    binaryWriter.Write(160);
                    binaryWriter.Write(160);
                    binaryWriter.Write(_2DM_Common.getShaderData(_2DM_Common.ShaderEnum.DEFAULT));
                    binaryWriter.Write(0);
                    list4.Add(Convert.ToInt32(binaryWriter.BaseStream.Position));
                    binaryWriter.Write(list6[j]);
                    binaryWriter.Write(0L);
                }
                binaryWriter.Write(1096040781L);
                binaryWriter.Write(240 * materialList.Count() + 16 * materialList.Count() + 32);
                binaryWriter.Write(16);
                binaryWriter.Write(1213415752L);
                binaryWriter.Write(16 * materialList.Count() + 16);
                binaryWriter.Write(16 * materialList.Count() + 16);
                foreach (_2DM_Common.sMAT material2 in materialList)
                {
                    _2DM_Common.sMAT current3 = material2;
                    binaryWriter.Write(utilitaires.hexify(current3.hash));
                    list2.Add(Convert.ToInt32(binaryWriter.BaseStream.Position));
                    binaryWriter.Write(0L);
                }
                int num2 = -1;
                foreach (_2DM_Common.sMAT material3 in materialList)
                {
                    _2DM_Common.sMAT current4 = material3;
                    list8.Add(Convert.ToInt32(binaryWriter.BaseStream.Position));
                    binaryWriter.Write(777273677L);
                    binaryWriter.Write(240);
                    binaryWriter.Write(240);
                    binaryWriter.Write(materialPieces.MAT_ALPHA);
                    binaryWriter.Write(byte.MaxValue);
                    binaryWriter.Write(byte.MaxValue);
                    binaryWriter.Write(byte.MaxValue);
                    for (int k = 0; k < 118; k++)
                    {
                        binaryWriter.Write((byte)0);
                    }
                    if (current4.ambient != null)
                    {
                        binaryWriter.Write(current4.ambient[0]);
                        binaryWriter.Write(current4.ambient[1]);
                        binaryWriter.Write(current4.ambient[2]);
                        binaryWriter.Write(1f);
                        binaryWriter.Write(current4.diffuse[0]);
                        binaryWriter.Write(current4.diffuse[1]);
                        binaryWriter.Write(current4.diffuse[2]);
                        binaryWriter.Write(1f);
                        binaryWriter.Write(current4.specular[0]);
                        binaryWriter.Write(current4.specular[1]);
                        binaryWriter.Write(current4.specular[2]);
                        binaryWriter.Write(1f);
                    }
                    else
                    {
                        binaryWriter.Write(0f);
                        binaryWriter.Write(0f);
                        binaryWriter.Write(0f);
                        binaryWriter.Write(1f);
                        binaryWriter.Write(0f);
                        binaryWriter.Write(0f);
                        binaryWriter.Write(0f);
                        binaryWriter.Write(1f);
                        binaryWriter.Write(0f);
                        binaryWriter.Write(0f);
                        binaryWriter.Write(0f);
                        binaryWriter.Write(1f);
                    }
                    binaryWriter.Write(0f);
                    binaryWriter.Write(0f);
                    binaryWriter.Write(0f);
                    binaryWriter.Write(1f);
                    list5.Add(Convert.ToInt32(binaryWriter.BaseStream.Position));
                    binaryWriter.Write(list7[++num2]);
                    binaryWriter.Write(materialPieces.LAYBLANK);
                }
                long position = binaryWriter.BaseStream.Position;
                for (int l = 0; l < list2.Count; l++)
                {
                    binaryWriter.BaseStream.Seek(list2[l], SeekOrigin.Begin);
                    binaryWriter.Write(list8[l]);
                }
                binaryWriter.BaseStream.Seek(Convert.ToInt32(position), SeekOrigin.Begin);
                binaryWriter.Write(1095783501L);
                binaryWriter.Write(16);
                binaryWriter.Write(16);
                binaryWriter.Write(1094800981L);
                binaryWriter.Write(16);
                binaryWriter.Write(16);
                position = binaryWriter.BaseStream.Position;
                for (int m = 0; m < list3.Count; m++)
                {
                    binaryWriter.BaseStream.Seek(list3[m], SeekOrigin.Begin);
                    binaryWriter.Write(list10[m]);
                }
                int num3 = 16;
                for (num3 += 4 * materialList.Count() * 3; num3 % 16 != 0; num3++)
                {
                }
                binaryWriter.BaseStream.Seek(Convert.ToInt32(position), SeekOrigin.Begin);
                binaryWriter.Write(1279346002L);
                binaryWriter.Write(num3);
                binaryWriter.Write(num3);
                foreach (int item in list)
                {
                    binaryWriter.Write(item);
                }
                foreach (int item2 in list2)
                {
                    binaryWriter.Write(item2);
                }
                foreach (int item3 in list3)
                {
                    binaryWriter.Write(item3);
                }
                foreach (int item4 in list4)
                {
                    binaryWriter.Write(item4);
                }
                foreach (int item5 in list5)
                {
                    binaryWriter.Write(item5);
                }
                while (binaryWriter.BaseStream.Position % 16 != 0)
                {
                    binaryWriter.Write((byte)0);
                }
                for (int n = 0; n < list3.Count; n++)
                {
                    binaryWriter.BaseStream.Seek(list[n], SeekOrigin.Begin);
                    binaryWriter.Write(list9[n]);
                }
                int value = Convert.ToInt32(binaryWriter.BaseStream.Position);
                binaryWriter.BaseStream.Seek(num, SeekOrigin.Begin);
                binaryWriter.Write(value);
            }
        }