Example #1
0
        public TreeNode Scan()
        {
            readerpos = PropertyReader.detectStart(pcc, memory, pcc.Exports[Index].ObjectFlags);
            BitConverter.IsLittleEndian = true;
            List <PropHeader> topLevelHeaders = ReadHeadersTillNone();
            TreeNode          t = new TreeNode("0000 : " + pcc.Exports[Index].ObjectName);

            return(GenerateTree(t, topLevelHeaders));
        }
Example #2
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            treeView1.Nodes.Clear();
            readerpos = PropertyReader.detectStart(pcc, memory, pcc.Exports[Index].ObjectFlags);
            BitConverter.IsLittleEndian = true;
            List <PropHeader> l = ReadHeadersTillNone();
            TreeNode          t = new TreeNode("0000 : " + pcc.Exports[Index].ObjectName);

            t = GenerateTree(t, l);
            treeView1.Nodes.Add(t);
            treeView1.CollapseAll();
        }
Example #3
0
        private void StartScan()
        {
            treeView1.Nodes.Clear();
            readerpos = PropertyReader.detectStart(pcc, memory, pcc.Exports[Index].flagint);
            BitConverter.IsLittleEndian = true;
            List <PropHeader> l = ReadHeadersTillNone();
            TreeNode          t = new TreeNode("0000 : " + pcc.Exports[Index].ObjectName);

            t = GenerateTree(t, l);
            treeView1.Nodes.Add(t);
            treeView1.CollapseAll();
            treeView1.Nodes[0].Expand();
        }
Example #4
0
        private void StartScan()
        {
            treeView1.Nodes.Clear();
            readerpos = PropertyReader.detectStart(pcc, memory, pcc.Exports[Index].ObjectFlags);
            BitConverter.IsLittleEndian = true;
            List <PropHeader> topLevelHeaders = ReadHeadersTillNone();
            TreeNode          topLevelTree    = new TreeNode("0000 : " + pcc.Exports[Index].ObjectName);

            topLevelTree     = GenerateTree(topLevelTree, topLevelHeaders);
            topLevelTree.Tag = TOPLEVEL_TAG;
            treeView1.Nodes.Add(topLevelTree);
            treeView1.CollapseAll();
            treeView1.Nodes[0].Expand();
        }
Example #5
0
 public TreeNode Scan()
 {
     if (GameVersion == 3)
     {
         readerpos = PropertyReader.detectStart(pcc, memory, pcc.Exports[Index].ObjectFlags);
         BitConverter.IsLittleEndian = true;
         List <PropHeader> l = ReadHeadersTillNone();
         TreeNode          t = new TreeNode("0000 : " + pcc.Exports[Index].ObjectName);
         return(GenerateTree(t, l));
     }
     else
     {
         return(null);
     }
 }
Example #6
0
        }                                                    // showable image list

        public Texture2D(PCCObject pccObj, int texIdx)
        {
            pccRef = pccObj;
            // check if texIdx is an Export index and a Texture2D class
            if (pccObj.isExport(texIdx) && (pccObj.Exports[texIdx].ClassName == className))
            {
                PCCObject.ExportEntry expEntry = pccObj.Exports[texIdx];
                properties = new Dictionary <string, PropertyReader.Property>();
                byte[] rawData          = (byte[])expEntry.Data.Clone();
                int    propertiesOffset = PropertyReader.detectStart(pccObj, rawData);
                headerData = new byte[propertiesOffset];
                Buffer.BlockCopy(rawData, 0, headerData, 0, propertiesOffset);
                pccOffset = (uint)expEntry.DataOffset;
                List <PropertyReader.Property> tempProperties = PropertyReader.getPropList(pccObj, rawData);
                texName = expEntry.ObjectName;
                for (int i = 0; i < tempProperties.Count; i++)
                {
                    PropertyReader.Property property = tempProperties[i];
                    if (!properties.ContainsKey(pccObj.Names[property.Name]))
                    {
                        properties.Add(pccObj.Names[property.Name], property);
                    }

                    switch (pccObj.Names[property.Name])
                    {
                    case "Format": texFormat = pccObj.Names[property.Value.IntValue].Substring(3); break;

                    case "TextureFileCacheName": arcName = pccObj.Names[property.Value.IntValue]; break;

                    case "LODGroup": LODGroup = pccObj.Names[property.Value.IntValue]; break;

                    case "None": dataOffset = (uint)(property.offsetval + property.Size); break;
                    }
                }

                // if "None" property isn't found throws an exception
                if (dataOffset == 0)
                {
                    throw new Exception("\"None\" property not found");
                }
                else
                {
                    imageData = new byte[rawData.Length - dataOffset];
                    Buffer.BlockCopy(rawData, (int)dataOffset, imageData, 0, (int)(rawData.Length - dataOffset));
                }
            }
            else
            {
                throw new Exception("Texture2D " + texIdx + " not found");
            }

            pccExpIdx = texIdx;
            MemoryStream dataStream = new MemoryStream(imageData);

            numMipMaps = dataStream.ReadValueU32();
            uint count = numMipMaps;

            imgList = new List <ImageInfo>();
            while (dataStream.Position < dataStream.Length && count > 0)
            {
                ImageInfo imgInfo = new ImageInfo();
                imgInfo.storageType = (storage)dataStream.ReadValueS32();
                imgInfo.uncSize     = dataStream.ReadValueS32();
                imgInfo.cprSize     = dataStream.ReadValueS32();
                imgInfo.offset      = dataStream.ReadValueS32();
                if (imgInfo.storageType == storage.pccSto)
                {
                    //imgInfo.offset = (int)(pccOffset + dataOffset); // saving pcc offset as relative to exportdata offset, not absolute
                    imgInfo.offset = (int)dataStream.Position; // saving pcc offset as relative to exportdata offset, not absolute
                    //MessageBox.Show("Pcc class offset: " + pccOffset + "\nimages data offset: " + imgInfo.offset.ToString());
                    dataStream.Seek(imgInfo.uncSize, SeekOrigin.Current);
                }
                imgInfo.imgSize = new ImageSize(dataStream.ReadValueU32(), dataStream.ReadValueU32());
                imgList.Add(imgInfo);
                count--;
            }

            // save what remains

            /*int remainingBytes = (int)(dataStream.Length - dataStream.Position);
             * footerData = new byte[remainingBytes];
             * dataStream.Read(footerData, 0, footerData.Length);*/
        }
Example #7
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();
        }
Example #8
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();
 }
Example #9
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);
        }
Example #10
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);
        }