Exemplo n.º 1
0
 public void LoadFile(string path)
 {
     currfilepath = path;
     this.Text    = "Camera Tool - " + Path.GetFileName(path);
     pcc          = new PCCPackage(path, true, false, true);
     Indexes      = new List <int>();
     for (int i = 0; i < pcc.Exports.Count; i++)
     {
         PCCPackage.ExportEntry e = pcc.Exports[i];
         string c = pcc.GetObject(e.idxClass);
         if (c == "InterpData")
         {
             List <PropertyReader.Property> props = PropertyReader.ReadProp(pcc, e.Data, PropertyReader.detectStart(pcc, e.Data, (uint)e.ObjectFlags));
             bool has = false;
             foreach (PropertyReader.Property p in props)
             {
                 if (pcc.GetName(p.Name) == "InterpGroups")
                 {
                     has = true;
                     break;
                 }
             }
             if (has)
             {
                 Indexes.Add(i);
             }
         }
     }
     FreshList();
 }
Exemplo n.º 2
0
        public void FreshTree(int n)
        {
            splitContainer1.BringToFront();
            treeView1.Nodes.Clear();
            PCCPackage.ExportEntry         e     = pcc.Exports[n];
            List <PropertyReader.Property> props = PropertyReader.ReadProp(pcc, e.Data, PropertyReader.detectStart(pcc, e.Data, (uint)e.ObjectFlags));
            TreeNode t = new TreeNode(n + " : " + pcc.GetObject(n + 1));
            int      idx;

            foreach (PropertyReader.Property p in props)
            {
                switch (pcc.GetName(p.Name))
                {
                case "InterpGroups":
                    int      count  = BitConverter.ToInt32(p.raw, 24);
                    TreeNode groups = new TreeNode("Interp Groups (" + count + ")");
                    for (int i = 0; i < count; i++)
                    {
                        idx = BitConverter.ToInt32(p.raw, 28 + i * 4);
                        if (idx > 0)
                        {
                            groups.Nodes.Add(MakeInterpGroupNode(idx - 1));
                        }
                        else
                        {
                            groups.Nodes.Add(idx + "");
                        }
                    }
                    if (groups.Nodes.Count != 0)
                    {
                        t.Nodes.Add(groups);
                    }
                    break;

                case "InterpLength":
                    byte[] buff = BitConverter.GetBytes(p.Value.IntValue);
                    float  f    = BitConverter.ToSingle(buff, 0);
                    t.Nodes.Add("Interp Length : " + f);
                    break;

                case "ParentSequence":
                    idx = p.Value.IntValue;
                    if (idx > 0)
                    {
                        t.Nodes.Add("Parent Sequence : " + idx + " (" + pcc.GetObject(idx) + ")");
                    }
                    break;
                }
            }
            treeView1.Nodes.Add(t);
            treeView1.Nodes[0].Expand();
        }
Exemplo n.º 3
0
        public TreeNode MakeInterpGroupNode(int n)
        {
            TreeNode res = new TreeNode(n + " : " + pcc.GetObject(n + 1));

            PCCPackage.ExportEntry         e     = pcc.Exports[n];
            List <PropertyReader.Property> props = PropertyReader.ReadProp(pcc, e.Data, PropertyReader.detectStart(pcc, e.Data, (uint)e.ObjectFlags));
            int idx;

            foreach (PropertyReader.Property p in props)
            {
                switch (pcc.GetName(p.Name))
                {
                case "InterpTracks":
                    int      count = BitConverter.ToInt32(p.raw, 24);
                    TreeNode t     = new TreeNode("Interp Tracks (" + count + ")");
                    for (int i = 0; i < count; i++)
                    {
                        idx = BitConverter.ToInt32(p.raw, 28 + i * 4);
                        if (idx > 0)
                        {
                            t.Nodes.Add(MakeInterpTrackNode(idx - 1));
                        }
                        else
                        {
                            t.Nodes.Add(idx + "");
                        }
                    }
                    if (t.Nodes.Count != 0)
                    {
                        res.Nodes.Add(t);
                    }
                    break;

                case "GroupName":
                    idx       = p.Value.IntValue;
                    res.Text += " (" + pcc.GetName(idx) + ")";
                    break;

                case "GroupColor":
                    idx           = BitConverter.ToInt32(p.raw, 0x20);
                    res.BackColor = Color.FromArgb(idx);
                    break;

                case "m_nmSFXFindActor":
                    idx = p.Value.IntValue;
                    res.Nodes.Add("m_nmSFXFindActor : " + pcc.GetName(idx));
                    break;
                }
            }
            return(res);
        }
Exemplo n.º 4
0
        public TreeNode MakeInterpTrackNode(int n)
        {
            TreeNode res = new TreeNode(n + " : " + pcc.GetObject(n + 1));

            PCCPackage.ExportEntry         e = pcc.Exports[n];
            List <PropertyReader.Property> props = PropertyReader.ReadProp(pcc, e.Data, PropertyReader.detectStart(pcc, e.Data, (uint)e.ObjectFlags));
            int      pos, count;
            TreeNode t;

            foreach (PropertyReader.Property p in props)
            {
                switch (pcc.GetName(p.Name))
                {
                case "m_aTrackKeys":
                    count = BitConverter.ToInt32(p.raw, 24);
                    t     = new TreeNode("Track Keys (" + count + ")");
                    pos   = 28;
                    for (int i = 0; i < count; i++)
                    {
                        List <PropertyReader.Property> key = PropertyReader.ReadProp(pcc, p.raw, pos);
                        if (key.Count != 0)
                        {
                            TreeNode t2 = new TreeNode("Key " + i);
                            int      idx2;
                            foreach (PropertyReader.Property p2 in key)
                            {
                                switch (pcc.GetName(p2.Name))
                                {
                                case "KeyName":
                                    idx2 = p2.Value.IntValue;
                                    t2.Nodes.Add("Key Name : " + pcc.GetName(idx2));
                                    break;

                                case "fTime":
                                    float f = BitConverter.ToSingle(p2.raw, 24);
                                    t2.Nodes.Add("Time : " + f);
                                    break;
                                }
                            }
                            if (t2.Nodes.Count != 0)
                            {
                                t.Nodes.Add(t2);
                            }
                            pos = key[key.Count - 1].offend;
                        }
                    }
                    if (t.Nodes.Count != 0)
                    {
                        res.Nodes.Add(t);
                    }
                    break;

                case "m_aGestures":
                    count = BitConverter.ToInt32(p.raw, 24);
                    t     = new TreeNode("Gestures (" + count + ")");
                    pos   = 28;
                    for (int i = 0; i < count; i++)
                    {
                        List <PropertyReader.Property> key = PropertyReader.ReadProp(pcc, p.raw, pos);
                        if (key.Count != 0)
                        {
                            TreeNode t2 = new TreeNode("Gesture " + i);
                            foreach (PropertyReader.Property p2 in key)
                            {
                                switch (pcc.GetName(p2.Name))
                                {
                                default:
                                    TreeNode td = MakeDefaultPropNode(p2);
                                    if (td != null)
                                    {
                                        t2.Nodes.Add(td);
                                    }
                                    break;
                                }
                            }
                            if (t2.Nodes.Count != 0)
                            {
                                t.Nodes.Add(t2);
                            }
                            pos = key[key.Count - 1].offend;
                        }
                    }
                    if (t.Nodes.Count != 0)
                    {
                        res.Nodes.Add(t);
                    }
                    break;

                case "m_aDOFData":
                case "CutTrack":
                    count = BitConverter.ToInt32(p.raw, 24);
                    t     = new TreeNode(pcc.GetName(p.Name) + " (" + count + ")");
                    pos   = 28;
                    for (int i = 0; i < count; i++)
                    {
                        List <PropertyReader.Property> key = PropertyReader.ReadProp(pcc, p.raw, pos);
                        if (key.Count != 0)
                        {
                            TreeNode t2 = new TreeNode("Entry " + i);
                            foreach (PropertyReader.Property p2 in key)
                            {
                                switch (pcc.GetName(p2.Name))
                                {
                                default:
                                    TreeNode td = MakeDefaultPropNode(p2);
                                    if (td != null)
                                    {
                                        t2.Nodes.Add(td);
                                    }
                                    break;
                                }
                            }
                            if (t2.Nodes.Count != 0)
                            {
                                t.Nodes.Add(t2);
                            }
                            pos = key[key.Count - 1].offend;
                        }
                    }
                    if (t.Nodes.Count != 0)
                    {
                        res.Nodes.Add(t);
                    }
                    break;

                case "FloatTrack":
                case "PosTrack":
                case "LookupTrack":
                case "EulerTrack":
                    List <PropertyReader.Property> content = PropertyReader.ReadProp(pcc, p.raw, 32);
                    if (content.Count == 2)
                    {
                        count = BitConverter.ToInt32(content[0].raw, 24);
                        t     = new TreeNode(pcc.GetName(p.Name) + " Points (" + count + ")");
                        pos   = 28;
                        for (int i = 0; i < count; i++)
                        {
                            List <PropertyReader.Property> point = PropertyReader.ReadProp(pcc, content[0].raw, pos);
                            if (point.Count != 0)
                            {
                                TreeNode t2 = new TreeNode("Point " + i);
                                foreach (PropertyReader.Property p2 in point)
                                {
                                    switch (pcc.GetName(p2.Name))
                                    {
                                    default:
                                        TreeNode td = MakeDefaultPropNode(p2);
                                        if (td != null)
                                        {
                                            t2.Nodes.Add(td);
                                        }
                                        break;
                                    }
                                }
                                if (t2.Nodes.Count != 0)
                                {
                                    t.Nodes.Add(t2);
                                }
                                pos = point[point.Count - 1].offend;
                            }
                        }
                        if (t.Nodes.Count != 0)
                        {
                            res.Nodes.Add(t);
                        }
                    }
                    break;

                default:
                    TreeNode t3 = MakeDefaultPropNode(p);
                    if (t3 != null)
                    {
                        res.Nodes.Add(t3);
                    }
                    break;
                }
            }
            return(res);
        }