Beispiel #1
0
        private void textureEdit()
        {
            this.Text      = "Texture" + this.Text;
            panel1.Visible = true;
            TexLUT texlut = LUTUtil.getTexLUTFromName(name, luts.texLUT);

            textBox1.Text     = texlut.incbinFile;
            textBox2.Text     = texlut.texFileName;
            textBox3.Text     = texlut.texSubData.label.labelName;
            textBox4.Text     = texlut.texSubData.label.labelLine.ToString();
            textBox5.Text     = texlut.texSubData.label.isGlobal ? "True" : "False";
            pictureBox1.Image = texlut.tex;
        }
Beispiel #2
0
        public void initF3D()
        {
            int n = -1;

            foreach (string line in dldata)
            {
                n++;
                if (!(line.Contains("gsSP") || line.Contains("gsDP")))
                {
                    continue;
                }
                vals = MISCUtils.ParseAsmbd(line);
                if (vals[0] == "gsSPVertex")
                {
                    List <Vtx> verteces = new List <Vtx>();
                    Vtx        twvtx    = new Vtx();
                    VtxLUT     vl       = new VtxLUT();
                    int[]      vert     = new int[9];
                    string[]   cs       = new string[0];
                    vl.vtxSubData.label       = LakiTool.LUT.Utils.LabelUtil.findLabelFromName(vals[1], curFile);
                    vl.vtxSubData.gData.GFile = curFile;
                    vl.vtxSubData.gData.GLine = (uint)n + 1;
                    uint l = vl.vtxSubData.label.labelLine;
                    while (true)
                    {
                        if (dldata[l].Length < 6 || dldata[l][0] != 'v')
                        {
                            break;
                        }
                        l++;
                        cs = MISCUtils.ParseAsmbd(dldata[l - 1]);
                        for (int v = 0; v < vert.Length; v++)
                        {
                            string c = cs[v + 1];
                            vert[v] = MISCUtils.ParseInt(c);
                        }
                        twvtx.X = (short)vert[0];
                        twvtx.Y = (short)vert[1];
                        twvtx.Z = (short)vert[2];
                        twvtx.S = (short)vert[3];
                        twvtx.T = (short)vert[4];
                        twvtx.R = (byte)vert[5];
                        twvtx.G = (byte)vert[6];
                        twvtx.B = (byte)vert[7];
                        twvtx.A = (byte)vert[8];
                        verteces.Add(twvtx);
                    }
                    vl.vtces = verteces;
                    luts.vtxLUT.Add(vl);
                }
                if (vals[0] == "gsSPLight")
                {
                    LightLUT ll = new LightLUT();
                    ll.lightSubData.label       = LakiTool.LUT.Utils.LabelUtil.findLabelFromName(vals[1], curFile);
                    ll.lightSubData.gData.GFile = curFile;
                    ll.lightSubData.gData.GLine = (uint)n + 1;
                    float[] light = new float[4];
                    for (int v = 0; v < light.Length; v++)
                    {
                        string c = MISCUtils.ParseAsmbd(dldata[ll.lightSubData.label.labelLine])[v + 1];
                        light[v] = (float)MISCUtils.ParseInt(c) / 255f;
                    }
                    ll.col          = light;
                    ll.type         = (uint)MISCUtils.ParseInt(vals[2]);
                    ll.rawLightData = dldata[ll.lightSubData.label.labelLine];
                    luts.lightLUT.Add(ll);
                }
                if (vals[0] == "gsDPSetTextureImage")
                {
                    TexLUT tl = new TexLUT();
                    tl.texSubData.label       = LakiTool.LUT.Utils.LabelUtil.findLabelFromName(vals[4], curFile, fbpath, true);
                    tl.texSubData.gData.GFile = curFile;
                    tl.texSubData.gData.GLine = (uint)n + 1;
                    tl.incbinFile             = MISCUtils.ParseAsmbd(File.ReadAllLines(tl.texSubData.label.labelFile)[tl.texSubData.label.labelLine])[1].Replace("\"", "");
                    if (tl.texSubData.label.labelFound)
                    {
                        string tp = fbpath + "/" + tl.incbinFile;
                        if (File.Exists(tp + ".png"))
                        {
                            tl.texFileName = tp + ".png";
                        }
                        else if (File.Exists(fbpath + "/" + "textures" + tl.incbinFile.Substring(3) + ".png"))
                        {
                            tl.texFileName = fbpath + "/" + "textures" + tl.incbinFile.Substring(3) + ".png";
                        }
                    }
                    else
                    {
                        tl.texFileName = "placeholder.png";
                    }
                    tl.tex = (Bitmap)Bitmap.FromFile(tl.texFileName);
                    luts.texLUT.Add(tl);
                }
            }
        }