コード例 #1
0
        public string DumpArray(ME3Package pcc, byte[] raw, int pos, int depth)
        {
            string res = "";
            List <PropertyReader.Property> p = PropertyReader.ReadProp(pcc, raw, pos);

            for (int i = 0; i < p.Count; i++)
            {
                if (p[i].TypeVal == PropertyType.StringRefProperty)
                {
                    for (int j = 0; j < depth; j++)
                    {
                        res += "\t";
                    }
                    res += i + " : " + PropertyReader.PropertyToText(p[i], pcc) + "\n";
                }
                if (p[i].TypeVal == PropertyType.ArrayProperty)
                {
                    //for (int j = 0; j < depth; j++)
                    //    res += "\t";
                    //res += "in Property #" + i + " : " + PropertyReader.PropertyToText(p[i], pcc) + "\n";
                    res += DumpArray(pcc, raw, p[i].offsetval + 4, depth + 1);
                }
                if (p[i].TypeVal == PropertyType.StructProperty)
                {
                    //for (int j = 0; j < depth; j++)
                    //    res += "\t";
                    //res += "in Property #" + i + " : " + PropertyReader.PropertyToText(p[i], pcc) + "\n";
                    res += DumpArray(pcc, raw, p[i].offsetval + 8, depth + 1);
                }
            }
            return(res);
        }
コード例 #2
0
        private void ReadColors(PropertyReader.Property p, IMEPackage pcc)
        {
            int count = BitConverter.ToInt32(p.raw, 24);
            int start = 28;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> props = PropertyReader.ReadProp(pcc, p.raw, start);
                ColorOverride co = new ColorOverride();

                foreach (PropertyReader.Property sp in props)
                {
                    string propName = pcc.getNameEntry(sp.Name);
                    switch (propName)
                    {
                    case "nName":
                        int nameI = sp.Value.IntValue;
                        if (pcc.isName(nameI))
                        {
                            co.ParamName = pcc.Names[nameI];
                        }
                        break;

                    case "cValue":
                        co.Value = new LinearColor(sp);
                        break;

                    case "None":
                        break;
                    }
                }
                ColorOverrides.Add(co);
                start = props[props.Count - 1].offend;
            }
        }
コード例 #3
0
        public void ReadMesh(byte[] raw)
        {
            byte[] t1 = new byte[raw.Length - 32];
            for (int i = 0; i < raw.Length - 32; i++)
            {
                t1[i] = raw[i + 32];
            }
            int size1 = GetArraySize(t1);

            byte[] t2 = new byte[size1];
            for (int i = 0; i < size1; i++)
            {
                t2[i] = t1[i + 28];
            }
            List <PropertyReader.Property> pp = PropertyReader.ReadProp(pcc, t2, 0);

            foreach (PropertyReader.Property p in pp)
            {
                string name = pcc.getNameEntry(p.Name);
                switch (name)
                {
                case "VertexData":
                    ReadVertices(p.raw);
                    break;

                case "FaceTriData":
                    ReadFaces(p.raw);
                    break;
                }
            }
        }
コード例 #4
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();
 }
コード例 #5
0
        public void ReadAnimGroups(byte[] raw)
        {
            int count = GetArrayCount(raw);

            byte[] buff = GetArrayContent(raw);
            int    pos  = 0;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> pp = PropertyReader.ReadProp(pcc, buff, pos);
                pos = pp[pp.Count - 1].offend;
                AnimGroupEntry e = new AnimGroupEntry();
                foreach (PropertyReader.Property p in pp)
                {
                    switch (pcc.getNameEntry(p.Name))
                    {
                    case "GroupName":
                        e.GroupName = pcc.getNameEntry(p.Value.IntValue);
                        break;

                    case "RateScale":
                        e.RateScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                        break;

                    case "SynchPctPosition":
                        e.SynchPctPosition = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                        break;
                    }
                }
                AnimGroups.Add(e);
            }
        }
コード例 #6
0
        public void ReadSkelControlLists(byte[] raw)
        {
            int count = GetArrayCount(raw);

            byte[] buff = GetArrayContent(raw);
            int    pos  = 0;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> pp = PropertyReader.ReadProp(pcc, buff, pos);
                pos = pp[pp.Count - 1].offend;
                SkelControlListEntry e = new SkelControlListEntry();
                foreach (PropertyReader.Property p in pp)
                {
                    switch (pcc.getNameEntry(p.Name))
                    {
                    case "BoneName":
                        e.BoneName = pcc.getNameEntry(p.Value.IntValue);
                        break;

                    case "ControlHead":
                        e.ControlHead = p.Value.IntValue;
                        break;
                    }
                }
                SkelControlLists.Add(e);
            }
        }
コード例 #7
0
        void ReadStageDirections()
        {
            StageDirections = new List <StageDirectionStruct>();
            int f = FindPropByName("m_aStageDirections");

            if (f == -1)
            {
                return;
            }
            byte[] buff  = Props[f].raw;
            int    count = BitConverter.ToInt32(buff, 0x18);
            int    pos   = 0x1C;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> p  = PropertyReader.ReadProp(pcc, buff, pos);
                StageDirectionStruct           sd = new StageDirectionStruct
                {
                    Text      = p[0].Value.StringValue,
                    StringRef = p[1].Value.IntValue
                };
                StageDirections.Add(sd);
                pos = p[p.Count - 1].offend;
            }
        }
コード例 #8
0
        public void ReadTextureParams(byte[] raw)
        {
            int count = BitConverter.ToInt32(raw, 24);
            int pos   = 28;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> tp = PropertyReader.ReadProp(pcc, raw, pos);
                string       name = pcc.getNameEntry(tp[1].Value.IntValue);
                int          Idx  = tp[2].Value.IntValue;
                TextureParam t    = new TextureParam();
                t.Desc     = name;
                t.TexIndex = Idx;
                if (name.ToLower().Contains("diffuse") && Idx > 0)
                {
                    Texture2D           tex = new Texture2D(pcc, Idx - 1);
                    string              loc = Path.GetDirectoryName(Application.ExecutablePath);
                    Texture2D.ImageInfo inf = new Texture2D.ImageInfo();
                    for (int j = 0; j < tex.imgList.Count(); j++)
                    {
                        if (tex.imgList[j].storageType != Texture2D.storage.empty)
                        {
                            inf = tex.imgList[j];
                            break;
                        }
                    }
                    if (File.Exists(loc + "\\exec\\TempTex.dds"))
                    {
                        File.Delete(loc + "\\exec\\TempTex.dds");
                    }
                    tex.extractImage(inf, ME3Directory.cookedPath, loc + "\\exec\\TempTex.dds");
                    if (File.Exists(loc + "\\exec\\TempTex.dds"))
                    {
                        try
                        {
                            t.Texture = TextureLoader.FromFile(Meshplorer.Preview3D.device, loc + "\\exec\\TempTex.dds");
                        }
                        catch (Direct3DXException e)
                        {
                        }
                    }
                    else
                    {
                        t.Texture = null;
                    }
                }
                else
                {
                    t.Texture = null;
                }
                Textures.Add(t);
                pos = tp[tp.Count - 1].offend;
            }
        }
コード例 #9
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();
        }
コード例 #10
0
        private void ReadFinalSkeleton(PropertyReader.Property p)
        {
            int count     = BitConverter.ToInt32(p.raw, 24);
            int propStart = 28;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> BoneOffsetProps = PropertyReader.ReadProp(pcc, p.raw, propStart);
                propStart = BoneOffsetProps[BoneOffsetProps.Count - 1].offend;
                BoneOffset bone = new BoneOffset(BoneOffsetProps, pcc);
                m_aFinalSkeleton.Add(bone);
            }
        }
コード例 #11
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);
        }
コード例 #12
0
        private void ReadMorphFeatures(PropertyReader.Property p)
        {
            int count = BitConverter.ToInt32(p.raw, 24);

            int propStart = 28;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> FeatureProps = PropertyReader.ReadProp(pcc, p.raw, propStart);
                propStart = FeatureProps[FeatureProps.Count - 1].offend;
                BioFeature Feature = new BioFeature(FeatureProps, pcc);
                m_aMorphFeatures.Add(Feature);
            }
        }
コード例 #13
0
        protected void LoadData()
        {
            List <PropertyReader.Property> props = PropertyReader.getPropList(pcc.Exports[index]);
            List <int> tracks = new List <int>();

            foreach (PropertyReader.Property p in props)
            {
                if (pcc.getNameEntry(p.Name) == "m_fSceneLength")
                {
                    m_fSceneLength = BitConverter.ToSingle(p.raw, 24);
                }
                else if (pcc.getNameEntry(p.Name) == "m_fPlayRate")
                {
                    m_fPlayRate = BitConverter.ToSingle(p.raw, 24);
                }
                else if (pcc.getNameEntry(p.Name) == "m_aBioPreloadData")
                {
                    int pos   = 28;
                    int count = BitConverter.ToInt32(p.raw, 24);
                    for (int j = 0; j < count; j++)
                    {
                        List <PropertyReader.Property> p2  = PropertyReader.ReadProp(pcc, p.raw, pos);
                        BioResourcePreloadItem         key = new BioResourcePreloadItem();
                        for (int i = 0; i < p2.Count; i++)
                        {
                            if (pcc.getNameEntry(p2[i].Name) == "pObject")
                            {
                                key.pObject = p2[i].Value.IntValue;
                            }
                            else if (pcc.getNameEntry(p2[i].Name) == "nKeyIndex")
                            {
                                key.nKeyIndex = p2[i].Value.IntValue;
                            }
                            else if (pcc.getNameEntry(p2[i].Name) == "fTime")
                            {
                                key.fTime = BitConverter.ToSingle(p2[i].raw, 24);
                            }
                            else if (pcc.getNameEntry(p2[i].Name) == "bPreloadFired")
                            {
                                key.bPreloadFired = p2[i].Value.IntValue != 0;
                            }
                            pos += p2[i].raw.Length;
                        }
                        m_aBioPreloadData.Add(key);
                    }
                }
            }
        }
コード例 #14
0
        public void ReadTextureParams(byte[] raw)
        {
            int count = BitConverter.ToInt32(raw, 24);
            int pos   = 28;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> tp = PropertyReader.ReadProp(pcc, raw, pos);
                string       name = pcc.getNameEntry(tp[1].Value.IntValue);
                int          Idx  = tp[2].Value.IntValue;
                TextureParam t    = new TextureParam();
                t.Desc     = name;
                t.TexIndex = Idx;
                Textures.Add(t);
                pos = tp[tp.Count - 1].offend;
            }
        }
コード例 #15
0
        public void ProcessConnections()
        {
            if (Connections.Length == 0)
            {
                return;
            }
            byte[] buff = GetArrayContent(Connections);
            List <PropertyReader.Property> pp = PropertyReader.ReadProp(pcc, buff, 0);
            int f = -1;

            toIdx = -1;
            foreach (PropertyReader.Property p in pp)
            {
                if (pcc.getNameEntry(p.Name) == "ConnectTo")
                {
                    f = p.Value.IntValue - 1;
                }
            }
            if (pcc.isExport(f) && pcc.Exports[f].ClassName == "SplineActor")
            {
                to    = SplineActor.GetLocation(pcc, f);
                toIdx = f;
            }
            from    = new List <Vector3>();
            fromIdx = new List <int>();
            buff    = new byte[0];
            foreach (PropertyReader.Property p in Props)
            {
                if (pcc.getNameEntry(p.Name) == "LinksFrom")
                {
                    buff = GetArrayContent(p.raw);
                }
            }

            for (int i = 0; i < buff.Length / 4; i++)
            {
                int Idx = BitConverter.ToInt32(buff, i * 4) - 1;
                fromIdx.Add(Idx);
                from.Add(SplineActor.GetLocation(pcc, Idx));
            }
        }
コード例 #16
0
        private void ReadTextures(PropertyReader.Property p, IMEPackage pcc)
        {
            int count = BitConverter.ToInt32(p.raw, 24);
            int start = 28;

            for (int i = 0; i < count; i++)
            {
                // read next 68 bytes
                List <PropertyReader.Property> props = PropertyReader.ReadProp(pcc, p.raw, start);
                TextureOverride to = new TextureOverride();

                foreach (PropertyReader.Property sp in props)
                {
                    string propName = pcc.getNameEntry(sp.Name);
                    switch (propName)
                    {
                    case "nName":
                        int nameI = sp.Value.IntValue;
                        if (pcc.isName(nameI))
                        {
                            to.ParamName = pcc.Names[nameI];
                        }
                        break;

                    case "m_pTexture":
                        int objTextIndex = sp.Value.IntValue;
                        if (pcc.isExport(objTextIndex - 1))
                        {
                            to.TextureName = pcc.Exports[objTextIndex - 1].ObjectName;
                        }
                        break;

                    case "None":
                        break;
                    }
                }
                TextureOverrides.Add(to);
                start = props[props.Count - 1].offend;
            }
        }
コード例 #17
0
        public void ReadChildren(byte[] raw)
        {
            int count = GetArrayCount(raw);

            byte[] buff = GetArrayContent(raw);
            int    pos  = 0;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> pp = PropertyReader.ReadProp(pcc, buff, pos);
                pos = pp[pp.Count - 1].offend;
                ChildrenEntry e = new ChildrenEntry();
                foreach (PropertyReader.Property p in pp)
                {
                    switch (pcc.getNameEntry(p.Name))
                    {
                    case "Name":
                        e.Name = pcc.getNameEntry(p.Value.IntValue);
                        break;

                    case "Weight":
                        e.Weight = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                        break;

                    case "Anim":
                        e.Anim = p.Value.IntValue;
                        break;

                    case "bMirrorSkeleton":
                        e.bMirrorSkeleton = (p.raw[p.raw.Length - 1] == 1);
                        break;

                    case "bIsAdditive":
                        e.bIsAdditive = (p.raw[p.raw.Length - 1] == 1);
                        break;
                    }
                }
                Children.Add(e);
            }
        }
コード例 #18
0
        public void ReadMesh(byte[] raw)
        {
            byte[] t1 = new byte[raw.Length - 32];
            for (int i = 0; i < raw.Length - 32; i++)
            {
                t1[i] = raw[i + 32];
            }
            int size1 = GetArraySize(t1);

            byte[] t2 = new byte[size1];
            for (int i = 0; i < size1; i++)
            {
                t2[i] = t1[i + 28];
            }
            List <PropertyReader.Property> pp = PropertyReader.ReadProp(pcc, t2, 0);

            foreach (PropertyReader.Property p in pp)
            {
                string name = pcc.getNameEntry(p.Name);
                switch (name)
                {
                case "VertexData":
                    ReadVertices(p.raw);
                    break;

                case "FaceTriData":
                    ReadFaces(p.raw);
                    break;
                }
            }
            if (Vertices != null && Faces != null)
            {
                BrushMesh = new CustomVertex.PositionColored[Faces.Length];
                for (int i = 0; i < Faces.Length; i++)
                {
                    BrushMesh[i] = new CustomVertex.PositionColored(Vertices[Faces[i]], Color.Orange.ToArgb());
                }
            }
        }
コード例 #19
0
        private void ReadScriptList()
        {
            ScriptList = new List <ScriptListStruct>();
            int f = FindPropByName("m_ScriptList");

            if (f == -1)
            {
                return;
            }
            byte[] buff  = Props[f].raw;
            int    count = BitConverter.ToInt32(buff, 0x18);
            int    pos   = 0x1C;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> p = PropertyReader.ReadProp(pcc, buff, pos);
                ScriptListStruct sd = new ScriptListStruct();
                sd.ScriptTag = p[0].Value.NameValue;
                ScriptList.Add(sd);
                pos = p[p.Count - 1].offend;
            }
        }
コード例 #20
0
        private void ReadSpeakerList()
        {
            SpeakerList = new List <SpeakerListStruct>();
            int f = FindPropByName("m_SpeakerList");

            if (f == -1)
            {
                return;
            }
            byte[] buff  = Props[f].raw;
            int    count = BitConverter.ToInt32(buff, 0x18);
            int    pos   = 0x1C;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> p = PropertyReader.ReadProp(pcc, buff, pos);
                SpeakerListStruct sp             = new SpeakerListStruct();
                sp.SpeakerTag = p[0].Value.IntValue;
                sp.Text       = pcc.getNameEntry(sp.SpeakerTag);
                SpeakerList.Add(sp);
                pos = p[p.Count - 1].offend;
            }
        }
コード例 #21
0
        private void ReadScalars(PropertyReader.Property p, IMEPackage pcc)
        {
            int count = BitConverter.ToInt32(p.raw, 24);
            int start = 28;

            for (int i = 0; i < count; i++)
            {
                // read next 68 bytes
                List <PropertyReader.Property> props = PropertyReader.ReadProp(pcc, p.raw, start);
                ScalarOverride so = new ScalarOverride();

                foreach (PropertyReader.Property sp in props)
                {
                    string propName = pcc.getNameEntry(sp.Name);
                    switch (propName)
                    {
                    case "nName":
                        int nameI = sp.Value.IntValue;
                        if (pcc.isName(nameI))
                        {
                            so.ParamName = pcc.Names[nameI];
                        }
                        break;

                    case "sValue":
                        so.Value = BitConverter.ToSingle(sp.raw, sp.raw.Length - 4);
                        break;

                    case "None":
                        break;
                    }
                }
                ScalarOverrides.Add(so);
                start = props[props.Count - 1].offend;
            }
        }
コード例 #22
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);
        }
コード例 #23
0
        private void ReadReplyList()
        {
            ReplyList = new List <ReplyListStruct>();
            int f = FindPropByName("m_ReplyList");

            if (f == -1)
            {
                return;
            }
            byte[] buff  = Props[f].raw;
            int    count = BitConverter.ToInt32(buff, 0x18);
            int    pos   = 0x1C;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> p = PropertyReader.ReadProp(pcc, buff, pos);
                ReplyListStruct e = new ReplyListStruct();
                foreach (PropertyReader.Property pp in p)
                {
                    string name = pcc.getNameEntry(pp.Name);
                    switch (name)
                    {
                    case "EntryList":
                        byte[] buff2  = pp.raw;
                        int    count2 = BitConverter.ToInt32(buff2, 0x18);
                        int    pos2   = 0x1C;
                        e.EntryList = new List <int>();
                        for (int j = 0; j < count2; j++)
                        {
                            e.EntryList.Add(BitConverter.ToInt32(buff2, pos2));
                            pos2 += 4;
                        }
                        break;

                    case "nListenerIndex":
                        e.ListenerIndex = pp.Value.IntValue;
                        break;

                    case "bUnskippable":
                        e.Unskippable = (pp.raw[pp.raw.Length - 1] == 1);
                        break;

                    case "bIsDefaultAction":
                        e.IsDefaultAction = (pp.raw[pp.raw.Length - 1] == 1);
                        break;

                    case "bIsMajorDecision":
                        e.IsMajorDecision = (pp.raw[pp.raw.Length - 1] == 1);
                        break;

                    case "ReplyType":
                        e.ReplyTypeType  = BitConverter.ToInt32(pp.raw, 24);
                        e.ReplyTypeValue = BitConverter.ToInt32(pp.raw, 32);
                        break;

                    case "sText":
                        e.Text = pp.Value.StringValue;
                        break;

                    case "srText":
                        e.refText = pp.Value.IntValue;
                        break;

                    case "nConditionalFunc":
                        e.ConditionalFunc = pp.Value.IntValue;
                        break;

                    case "nConditionalParam":
                        e.ConditionalParam = pp.Value.IntValue;
                        break;

                    case "nStateTransition":
                        e.StateTransition = pp.Value.IntValue;
                        break;

                    case "nStateTransitionParam":
                        e.StateTransitionParam = pp.Value.IntValue;
                        break;

                    case "nExportID":
                        e.ExportID = pp.Value.IntValue;
                        break;

                    case "nScriptIndex":
                        e.ScriptIndex = pp.Value.IntValue;
                        break;

                    case "nCameraIntimacy":
                        e.CameraIntimacy = pp.Value.IntValue;
                        break;

                    case "bFireConditional":
                        e.FireConditional = (pp.raw[pp.raw.Length - 1] == 1);
                        break;

                    case "bAmbient":
                        e.Ambient = (pp.raw[pp.raw.Length - 1] == 1);
                        break;

                    case "bNonTextLine":
                        e.NonTextLine = (pp.raw[pp.raw.Length - 1] == 1);
                        break;

                    case "bIgnoreBodyGestures":
                        e.IgnoreBodyGestures = (pp.raw[pp.raw.Length - 1] == 1);
                        break;

                    case "bAlwaysHideSubtitle":
                        e.AlwaysHideSubtitle = (pp.raw[pp.raw.Length - 1] == 1);
                        break;

                    case "eGUIStyle":
                        e.GUIStyleType  = BitConverter.ToInt32(pp.raw, 24);
                        e.GUIStyleValue = BitConverter.ToInt32(pp.raw, 32);
                        break;
                    }
                }
                ReplyList.Add(e);
                pos = p[p.Count - 1].offend;
            }
        }
コード例 #24
0
        private void ReadEntryList()
        {
            EntryList = new List <EntryListStuct>();
            int f = FindPropByName("m_EntryList");

            if (f == -1)
            {
                return;
            }
            byte[] buff  = Props[f].raw;
            int    count = BitConverter.ToInt32(buff, 0x18);
            int    pos   = 0x1C;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> p = PropertyReader.ReadProp(pcc, buff, pos);
                EntryListStuct e = new EntryListStuct();
                foreach (PropertyReader.Property pp in p)
                {
                    string name = pcc.getNameEntry(pp.Name);
                    switch (name)
                    {
                    case "ReplyListNew":
                        byte[] buff2  = pp.raw;
                        int    count2 = BitConverter.ToInt32(buff2, 0x18);
                        int    pos2   = 0x1C;
                        e.ReplyList = new List <EntryListReplyListStruct>();
                        for (int j = 0; j < count2; j++)
                        {
                            List <PropertyReader.Property> p2 = PropertyReader.ReadProp(pcc, buff2, pos2);
                            EntryListReplyListStruct       r  = new EntryListReplyListStruct();
                            foreach (PropertyReader.Property ppp in p2)
                            {
                                switch (pcc.getNameEntry(ppp.Name))
                                {
                                case "sParaphrase":
                                    r.Paraphrase = ppp.Value.StringValue;
                                    break;

                                case "nIndex":
                                    r.Index = ppp.Value.IntValue;
                                    break;

                                case "srParaphrase":
                                    r.refParaphrase = ppp.Value.IntValue;
                                    break;

                                case "Category":
                                    r.CategoryType  = BitConverter.ToInt32(ppp.raw, 24);
                                    r.CategoryValue = BitConverter.ToInt32(ppp.raw, 32);
                                    break;
                                }
                            }
                            e.ReplyList.Add(r);
                            pos2 = p2[p2.Count - 1].offend;
                        }
                        break;

                    case "aSpeakerList":
                        buff2         = pp.raw;
                        count2        = BitConverter.ToInt32(buff2, 0x18);
                        e.SpeakerList = new List <int>();
                        for (int j = 0; j < count2; j++)
                        {
                            e.SpeakerList.Add(BitConverter.ToInt32(buff2, 0x1C + 4 * j));
                        }
                        break;

                    case "nSpeakerIndex":
                        e.SpeakerIndex = pp.Value.IntValue;
                        break;

                    case "nListenerIndex":
                        e.ListenerIndex = pp.Value.IntValue;
                        break;

                    case "bSkippable":
                        e.Skippable = (pp.raw[pp.raw.Length - 1] == 1);
                        break;

                    case "sText":
                        e.Text = pp.Value.StringValue;
                        break;

                    case "srText":
                        e.refText = pp.Value.IntValue;
                        break;

                    case "nConditionalFunc":
                        e.ConditionalFunc = pp.Value.IntValue;
                        break;

                    case "nConditionalParam":
                        e.ConditionalParam = pp.Value.IntValue;
                        break;

                    case "nStateTransition":
                        e.StateTransition = pp.Value.IntValue;
                        break;

                    case "nStateTransitionParam":
                        e.StateTransitionParam = pp.Value.IntValue;
                        break;

                    case "nExportID":
                        e.ExportID = pp.Value.IntValue;
                        break;

                    case "nScriptIndex":
                        e.ScriptIndex = pp.Value.IntValue;
                        break;

                    case "nCameraIntimacy":
                        e.CameraIntimacy = pp.Value.IntValue;
                        break;

                    case "bFireConditional":
                        e.FireConditional = (pp.raw[pp.raw.Length - 1] == 1);
                        break;

                    case "bAmbient":
                        e.Ambient = (pp.raw[pp.raw.Length - 1] == 1);
                        break;

                    case "bNonTextLine":
                        e.NonTextline = (pp.raw[pp.raw.Length - 1] == 1);
                        break;

                    case "bIgnoreBodyGestures":
                        e.IgnoreBodyGestures = (pp.raw[pp.raw.Length - 1] == 1);
                        break;

                    case "bAlwaysHideSubtitle":
                        e.AlwaysHideSubtitle = (pp.raw[pp.raw.Length - 1] == 1);
                        break;

                    case "eGUIStyle":
                        e.GUIStyleType  = BitConverter.ToInt32(pp.raw, 24);
                        e.GUIStyleValue = BitConverter.ToInt32(pp.raw, 32);
                        break;
                    }
                }
                EntryList.Add(e);
                pos = p[p.Count - 1].offend;
            }
        }
コード例 #25
0
        public TreeNode MakeSubObj(TreeNode t, int index)
        {
            byte[] buff = pcc.GetObjectData(index);
            List <PropertyReader.Property> Pr = PropertyReader.getPropList(pcc, buff);
            int      count, pos, count2, pos2;
            TreeNode t2, t3, t4;
            List <PropertyReader.Property> Pr2, Pr3;

            foreach (PropertyReader.Property p in Pr)
            {
                string s = pcc.GetName(p.Name);
                switch (s)
                {
                    #region InputLinks
                case "InputLinks":
                    t2    = new TreeNode("Input Links");
                    count = BitConverter.ToInt32(p.raw, 24);
                    pos   = 28;
                    for (int i = 0; i < count; i++)
                    {
                        t3  = new TreeNode(i.ToString());
                        Pr2 = PropertyReader.ReadProp(pcc, p.raw, pos);
                        foreach (PropertyReader.Property pp in Pr2)
                        {
                            string s2 = pcc.GetName(pp.Name);
                            switch (s2)
                            {
                            case "LinkDesc":
                                t3.Nodes.Add("Link Description : " + pp.Value.StringValue);
                                break;

                            case "LinkAction":
                                t3.Nodes.Add("Link Action : " + pcc.GetName(pp.Value.IntValue));
                                break;

                            case "LinkedOp":
                                t3.Nodes.Add("Linked Operation : #" + pp.Value.IntValue + " " + pcc.GetObjectPath(pp.Value.IntValue) + pcc.GetObject(pp.Value.IntValue));
                                break;
                            }
                        }
                        t2.Nodes.Add(t3);
                        pos = Pr2[Pr2.Count - 1].offend;
                    }
                    t.Nodes.Add(t2);
                    break;

                    #endregion
                    #region Output Links
                case "OutputLinks":
                    t2    = new TreeNode("Output Links");
                    count = BitConverter.ToInt32(p.raw, 24);
                    pos   = 28;
                    for (int i = 0; i < count; i++)
                    {
                        t3  = new TreeNode(i.ToString());
                        Pr2 = PropertyReader.ReadProp(pcc, p.raw, pos);
                        foreach (PropertyReader.Property pp in Pr2)
                        {
                            string s2 = pcc.GetName(pp.Name);
                            switch (s2)
                            {
                            case "LinkDesc":
                                t3.Nodes.Add("Link Description : " + pp.Value.StringValue);
                                break;

                            case "LinkAction":
                                t3.Nodes.Add("Link Action : " + pcc.GetName(pp.Value.IntValue));
                                break;

                            case "LinkedOp":
                                t3.Nodes.Add("Linked Operation : #" + pp.Value.IntValue + " " + pcc.GetObjectPath(pp.Value.IntValue) + pcc.GetObject(pp.Value.IntValue));
                                break;

                            case "Links":
                                t4     = new TreeNode("Links");
                                count2 = BitConverter.ToInt32(pp.raw, 24);
                                pos2   = 28;
                                for (int i2 = 0; i2 < count2; i2++)
                                {
                                    Pr3 = PropertyReader.ReadProp(pcc, pp.raw, pos2);
                                    string res = "#" + i2.ToString() + " : ";
                                    foreach (PropertyReader.Property ppp in Pr3)
                                    {
                                        string s3 = pcc.GetName(ppp.Name);
                                        switch (s3)
                                        {
                                        case "LinkedOp":
                                            res += "Linked Operation (" + ppp.Value.IntValue + " " + pcc.GetObjectPath(ppp.Value.IntValue) + pcc.GetObject(ppp.Value.IntValue) + ") ";
                                            break;

                                        case "InputLinkIdx":
                                            res += "Input Link Index(" + ppp.Value.IntValue + ")";
                                            break;
                                        }
                                    }
                                    t4.Nodes.Add(res);
                                    pos2 = Pr3[Pr3.Count - 1].offend;
                                }
                                t3.Nodes.Add(t4);
                                break;
                            }
                        }
                        t2.Nodes.Add(t3);
                        pos = Pr2[Pr2.Count - 1].offend;
                    }
                    t.Nodes.Add(t2);
                    break;

                    #endregion
                    #region Variable Links
                case "VariableLinks":
                    t2    = new TreeNode("Variable Links");
                    count = BitConverter.ToInt32(p.raw, 24);
                    pos   = 28;
                    for (int i = 0; i < count; i++)
                    {
                        t3  = new TreeNode(i.ToString());
                        Pr2 = PropertyReader.ReadProp(pcc, p.raw, pos);
                        foreach (PropertyReader.Property pp in Pr2)
                        {
                            string s2 = pcc.GetName(pp.Name);
                            switch (s2)
                            {
                            case "LinkDesc":
                                t3.Nodes.Add("Link Description : " + pp.Value.StringValue);
                                break;

                            case "LinkVar":
                                t3.Nodes.Add("Link Variable : " + pcc.GetName(pp.Value.IntValue));
                                break;

                            case "PropertyName":
                                t3.Nodes.Add("Property Name : " + pcc.GetName(pp.Value.IntValue));
                                break;

                            case "ExpectedType":
                                t3.Nodes.Add("Expected Type : #" + pp.Value.IntValue + " " + pcc.GetObjectPath(pp.Value.IntValue) + pcc.GetObject(pp.Value.IntValue));
                                break;

                            case "LinkedVariables":
                                t4     = new TreeNode("Linked Variables");
                                count2 = BitConverter.ToInt32(pp.raw, 24);
                                for (int i2 = 0; i2 < count2; i2++)
                                {
                                    int idx = BitConverter.ToInt32(pp.raw, 28 + i2 * 4);
                                    t4.Nodes.Add("#" + i2.ToString() + " : #" + idx + " " + pcc.GetObjectPath(idx) + pcc.GetObject(idx));
                                }
                                t3.Nodes.Add(t4);
                                break;
                            }
                        }
                        t2.Nodes.Add(t3);
                        pos = Pr2[Pr2.Count - 1].offend;
                    }
                    t.Nodes.Add(t2);
                    break;
                    #endregion
                }
            }
            return(t);
        }
コード例 #26
0
ファイル: SplineActor.cs プロジェクト: ijedi1234/ME3Explorer
        public void ProcessConnections()
        {
            List <CustomVertex.PositionColored> list = new List <CustomVertex.PositionColored>();

            if (Connections.Length == 0)
            {
                return;
            }
            byte[] buff = GetArrayContent(Connections);
            List <PropertyReader.Property> pp = PropertyReader.ReadProp(pcc, buff, 0);
            int f = -1;

            toIdx = -1;
            foreach (PropertyReader.Property p in pp)
            {
                if (pcc.getNameEntry(p.Name) == "ConnectTo")
                {
                    f = p.Value.IntValue - 1;
                }
            }
            if (pcc.isExport(f) && pcc.Exports[f].ClassName == "SplineActor")
            {
                to    = SplineActor.GetLocation(pcc, f);
                toIdx = f;
            }
            from    = new List <Vector3>();
            fromIdx = new List <int>();
            buff    = new byte[0];
            foreach (PropertyReader.Property p in Props)
            {
                if (pcc.getNameEntry(p.Name) == "LinksFrom")
                {
                    buff = GetArrayContent(p.raw);
                }
            }

            for (int i = 0; i < buff.Length / 4; i++)
            {
                int Idx = BitConverter.ToInt32(buff, i * 4) - 1;
                fromIdx.Add(Idx);
                from.Add(SplineActor.GetLocation(pcc, Idx));
            }
            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(to, Color.GreenYellow.ToArgb()));
            foreach (Vector3 v in from)
            {
                list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
                list.Add(new CustomVertex.PositionColored(v, Color.GreenYellow.ToArgb()));
            }

            float w = 20;

            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, -w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, -w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, -w, 100), Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, -w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, -w, 100), Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, w, 100), Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, w, 100), Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, -w, 100), Color.GreenYellow.ToArgb()));
            points     = list.ToArray();
            points_sel = list.ToArray();
            for (int i = 0; i < points_sel.Length; i++)
            {
                points_sel[i].Color = Color.Red.ToArgb();
            }
        }