示例#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();
 }
        public void OpenPccFile(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            if (!File.Exists(path))
            {
                return;
            }

            FileName   = path;
            PccPackage = new PCCPackage(path, closestream: true);

            if (CodexMapViewModel != null)
            {
                CodexMapViewModel.Open(PccPackage);
            }

            if (QuestMapViewModel != null)
            {
                QuestMapViewModel.Open(PccPackage);
            }

            if (StateEventMapViewModel != null)
            {
                StateEventMapViewModel.Open(PccPackage);
            }
        }
 public void Init(PCCPackage pcc, int index)
 {
     comboBox1.Items.Clear();
     comboBox2.Items.Clear();
     for (int i = 0; i < pcc.Header.ExportCount; i++)
     {
         comboBox1.Items.Add(i.ToString("d6") + " : " + pcc.GetObjectPath(i + 1) + pcc.getObjectName(i + 1));
     }
     for (int i = 0; i < pcc.Header.ImportCount; i++)
     {
         comboBox2.Items.Add(i.ToString("d6") + " : " + pcc.GetObjectPath(-i - 1) + pcc.getObjectName(-i - 1));
     }
     comboBox1.SelectedIndex = comboBox2.SelectedIndex = 0;
     if (index == 0)
     {
         r1.Checked = true;
     }
     if (index > 0)
     {
         comboBox1.SelectedIndex = index - 1;
         r2.Checked = true;
     }
     if (index < 0)
     {
         comboBox2.SelectedIndex = -index - 1;
         r3.Checked = true;
     }
 }
示例#4
0
 public Sequence(PCCPackage Pcc, int index)
 {
     pcc     = Pcc;
     MyIndex = index;
     byte[] buff = pcc.GetObjectData(index + 1);
     Props   = PropertyReader.getPropList(pcc, buff);
     Objects = new List <int>();
     foreach (PropertyReader.Property p in Props)
     {
         string s = pcc.GetName(p.Name);
         switch (s)
         {
         case "SequenceObjects":
             int count = BitConverter.ToInt32(p.raw, 24);
             for (int i = 0; i < count; i++)
             {
                 Objects.Add(BitConverter.ToInt32(p.raw, 28 + i * 4));
             }
             break;
         }
     }
     for (int i = 0; i < pcc.Exports.Count; i++)
     {
         if (pcc.Exports[i].idxLink == MyIndex + 1)
         {
             Objects.Add(i + 1);
         }
     }
     Objects.Sort();
 }
示例#5
0
        public bool TryFindQuestMap(PCCPackage pcc, out int exportIndex, out int dataOffset)
        {
            var index = pcc.FindClass("BioQuestMap");

            exportIndex = -1;
            dataOffset  = -1;

            if (index == 0)
            {
                return(false);
            }

            exportIndex = pcc.Exports.FindIndex(entry => entry.idxClass == index);

            if (exportIndex < 0)
            {
                return(false);
            }

            var mapData       = pcc.Exports[exportIndex].Data;
            var mapProperties = PropertyReader.getPropList(pcc, mapData);

            if (mapProperties.Count <= 0)
            {
                return(false);
            }

            var mapProperty = mapProperties.Find(property => property.TypeVal == PropertyReader.Type.None);

            dataOffset = mapProperty.offend;

            return(true);
        }
示例#6
0
        public Level(PCCPackage Pcc, int index)
        {
            pcc     = Pcc;
            MyIndex = index;
            byte[] buff = pcc.GetObjectData(index);
            Props = PropertyReader.getPropList(pcc, buff);
            int off   = Props[Props.Count() - 1].offend + 4;
            int count = BitConverter.ToInt32(buff, off);

            Objects = new List <int>();
            for (int i = 0; i < count; i++)
            {
                int idx = BitConverter.ToInt32(buff, off + 4 + i * 4);
                Objects.Add(idx);
            }
            for (int i = 0; i < pcc.Exports.Count; i++)
            {
                if (pcc.Exports[i].idxLink - 1 == index)
                {
                    bool found = false;
                    foreach (int j in Objects)
                    {
                        if (j == i + 1)
                        {
                            found = true;
                        }
                    }
                    if (!found)
                    {
                        Objects.Add(i + 1);
                    }
                }
            }
            RenderObjects = new List <_DXRenderableObject>();
            foreach (int i in Objects)
            {
                if (i > 0)
                {
                    string c = pcc.GetObject(pcc.Exports[i - 1].idxClass);
                    switch (c)
                    {
                    case "ModelComponent":
                        RenderObjects.Add(new ModelComponent(pcc, i - 1));
                        break;

                    case "StaticMeshActor":
                    case "InterpActor":
                        RenderObjects.Add(new StaticMeshActor(pcc, i - 1));
                        break;

                    case "StaticMeshCollectionActor":
                        RenderObjects.Add(new StaticMeshCollectionActor(pcc, i - 1));
                        break;

                    default: break;
                    }
                }
            }
        }
示例#7
0
        public static int GetValue(PCCPackage p, int index)
        {
            Nameselect prompt = new Nameselect();

            prompt.Init(p, index);

            return(prompt.ShowDialog() == DialogResult.OK ? prompt.returnValue() : -1);
        }
        public static int?GetValue(PCCPackage p, int index)
        {
            Objectselect prompt = new Objectselect();

            prompt.Init(p, index);

            return(prompt.ShowDialog() == DialogResult.OK ? prompt.returnValue() : null);
        }
 public StaticMeshCollectionActor(PCCPackage Pcc, int index)
 {
     pcc = Pcc;
     MyIndex = index;
     data = pcc.GetObjectData(index);
     Props = PropertyReader.getPropList(pcc, data);
     ReadObjects();
     ReadMatrices();
 }
示例#10
0
 public StaticMeshCollectionActor(PCCPackage Pcc, int index)
 {
     pcc     = Pcc;
     MyIndex = index;
     data    = pcc.GetObjectData(index);
     Props   = PropertyReader.getPropList(pcc, data);
     ReadObjects();
     ReadMatrices();
 }
        public StaticMeshComponent(PCCPackage Pcc, int index, Matrix transform)
        {
            pcc     = Pcc;
            MyIndex = index;
            byte[] buff = pcc.GetObjectData(index);
            Props        = PropertyReader.getPropList(pcc, buff);
            ParentMatrix = transform;
            foreach (PropertyReader.Property p in Props)
            {
                string s = pcc.GetName(p.Name);
                switch (s)
                {
                case "StaticMesh":
                    idxSTM = p.Value.IntValue;
                    break;

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

                case "Scale3D":
                    Scale3D = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                          BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                          BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;

                case "Rotation":
                    Rotation = new Vector3(BitConverter.ToInt32(p.raw, p.raw.Length - 12),
                                           BitConverter.ToInt32(p.raw, p.raw.Length - 8),
                                           BitConverter.ToInt32(p.raw, p.raw.Length - 4));
                    break;

                case "Translation":
                    Translation = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                              BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                              BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;

                default:
                    break;
                }
            }
            MyMatrix  = Matrix.Identity;
            MyMatrix *= Matrix.Scaling(Scale3D);
            MyMatrix *= Matrix.Scaling(new Vector3(Scale, Scale, Scale));
            Vector3 rot = DXHelper.RotatorToDX(Rotation);

            MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z);
            MyMatrix *= Matrix.Translation(Translation);
            Matrix t = MyMatrix * ParentMatrix;

            if (idxSTM > 0 && !pcc.getObjectName(idxSTM).ToLower().Contains("volumetric") && !pcc.getObjectName(idxSTM).ToLower().Contains("spheremesh"))
            {
                STM = new StaticMesh(pcc, idxSTM - 1, t);
            }
        }
示例#12
0
 public void Init(PCCPackage p, int index = 0)
 {
     pcc = p;
     comboBox1.Items.Clear();
     for (int i = 0; i < pcc.Header.NameCount; i++)
     {
         comboBox1.Items.Add(i.ToString("d6") + " : " + pcc.Names[i]);
     }
     comboBox1.SelectedIndex = index;
 }
示例#13
0
        public StaticMesh(PCCPackage Pcc, int index, Matrix transform)
        {
            pcc     = Pcc;
            MyIndex = index;
            byte[] buff = pcc.GetObjectData(index);
            Props        = PropertyReader.getPropList(pcc, buff);
            ParentMatrix = transform;
            int off = Props[Props.Count() - 1].offend;

            DeserializeDump(buff, off);
        }
        public StaticMeshActor(PCCPackage Pcc, int index)
        {
            pcc     = Pcc;
            MyIndex = index;
            byte[] buff = pcc.GetObjectData(index);
            Props = PropertyReader.getPropList(pcc, buff);
            foreach (PropertyReader.Property p in Props)
            {
                string s = pcc.GetName(p.Name);
                switch (s)
                {
                case "StaticMeshComponent":
                    idxSTM = p.Value.IntValue;
                    break;

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

                case "DrawScale3D":
                    DrawScale3D = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                              BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                              BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;

                case "Rotation":
                    Rotator = new Vector3(BitConverter.ToInt32(p.raw, p.raw.Length - 12),
                                          BitConverter.ToInt32(p.raw, p.raw.Length - 8),
                                          BitConverter.ToInt32(p.raw, p.raw.Length - 4));
                    break;

                case "location":
                    location = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;

                default:
                    break;
                }
            }
            MyMatrix  = Matrix.Identity;
            MyMatrix *= Matrix.Scaling(DrawScale3D);
            MyMatrix *= Matrix.Scaling(new Vector3(DrawScale, DrawScale, DrawScale));
            Vector3 rot = DXHelper.RotatorToDX(Rotator);

            MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z);
            MyMatrix *= Matrix.Translation(location);
            if (idxSTM != 0)
            {
                STMC = new StaticMeshComponent(pcc, idxSTM - 1, MyMatrix);
            }
        }
        public void SaveToPcc(PCCPackage pcc)
        {
            var index = pcc.FindClass("BioCodexMap");

            if (index == 0)
            {
                return;
            }

            var exportIndex = pcc.Exports.FindIndex(entry => entry.idxClass == index);

            if (exportIndex < 0)
            {
                return;
            }

            var codexMapData       = pcc.Exports[exportIndex].Data;
            var codexMapProperties = PropertyReader.getPropList(pcc, codexMapData);

            if (codexMapProperties.Count <= 0)
            {
                return;
            }

            var codexMapProperty   = codexMapProperties.Find(property => property.TypeVal == PropertyReader.Type.None);
            var codexMapDataOffset = codexMapProperty.offend;

            byte[] bytes;
            var    codexMap = new BioCodexMap(CodexSections.ToDictionary(pair => pair.Key, pair => pair.Value),
                                              CodexPages.ToDictionary(pair => pair.Key, pair => pair.Value));

            // CodexMap
            using (var stream = new MemoryStream())
            {
                ((BinaryBioCodexMap)codexMap).Save(stream);

                bytes = stream.ToArray();
            }

            Array.Resize(ref codexMapData, codexMapDataOffset + bytes.Length);
            bytes.CopyTo(codexMapData, codexMapDataOffset);

            var temp = pcc.Exports[exportIndex];

            Array.Resize(ref temp.Data, codexMapData.Length);
            codexMapData.CopyTo(temp.Data, 0);
            pcc.Exports[exportIndex] = temp;
        }
示例#16
0
        private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            int n = listBox2.SelectedIndex;

            if (n == -1)
            {
                return;
            }
            PCCPackage p = new PCCPackage(OverView[n].filepath, false, false, true);

            listBox3.Items.Clear();
            foreach (int i in OverView[n].Indexes)
            {
                listBox3.Items.Add(i + " : " + p.GetObjectPath(i + 1) + p.GetObject(i + 1) + "(" + p.Exports[i].Index + ")");
            }
        }
 public StaticMeshComponent(PCCPackage Pcc, int index, Matrix transform)
 {
     pcc = Pcc;
     MyIndex = index;
     byte[] buff = pcc.GetObjectData(index);
     Props = PropertyReader.getPropList(pcc, buff);
     ParentMatrix = transform;
     foreach (PropertyReader.Property p in Props)
     {
         string s = pcc.GetName(p.Name);
         switch (s)
         {
             case "StaticMesh":
                 idxSTM = p.Value.IntValue;
                 break;
             case "Scale":
                 Scale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "Scale3D":
                 Scale3D = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                       BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                       BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                 break;
             case "Rotation":
                 Rotation = new Vector3(BitConverter.ToInt32(p.raw, p.raw.Length - 12),
                                       BitConverter.ToInt32(p.raw, p.raw.Length - 8),
                                       BitConverter.ToInt32(p.raw, p.raw.Length - 4));
                 break;
             case "Translation":
                 Translation = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                       BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                       BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                 break;
             default:
                 break;
         }
     }
     MyMatrix = Matrix.Identity;
     MyMatrix *= Matrix.Scaling(Scale3D);
     MyMatrix *= Matrix.Scaling(new Vector3(Scale, Scale, Scale));
     Vector3 rot = DXHelper.RotatorToDX(Rotation);
     MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z);
     MyMatrix *= Matrix.Translation(Translation);
     Matrix t = MyMatrix * ParentMatrix;
     if (idxSTM > 0 && !pcc.getObjectName(idxSTM).ToLower().Contains("volumetric") && !pcc.getObjectName(idxSTM).ToLower().Contains("spheremesh"))
         STM = new StaticMesh(pcc, idxSTM - 1, t);
 }
示例#18
0
 public StaticMeshActor(PCCPackage Pcc, int index)
 {
     pcc = Pcc;
     MyIndex = index;
     byte[]buff = pcc.GetObjectData(index);
     Props = PropertyReader.getPropList(pcc, buff);
     foreach (PropertyReader.Property p in Props)
     {
         string s = pcc.GetName(p.Name);
         switch (s)
         {
             case "StaticMeshComponent":
                 idxSTM = p.Value.IntValue;
                 break;
             case "DrawScale":
                 DrawScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "DrawScale3D":
                 DrawScale3D = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                       BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                       BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                 break;
             case "Rotation":
                 Rotator = new Vector3(BitConverter.ToInt32(p.raw, p.raw.Length - 12),
                                       BitConverter.ToInt32(p.raw, p.raw.Length - 8),
                                       BitConverter.ToInt32(p.raw, p.raw.Length - 4));
                 break;
             case "location":
                 location = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                       BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                       BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                 break;
             default:
                 break;
         }
     }
     MyMatrix = Matrix.Identity;
     MyMatrix *= Matrix.Scaling(DrawScale3D);
     MyMatrix *= Matrix.Scaling(new Vector3(DrawScale, DrawScale, DrawScale));
     Vector3 rot = DXHelper.RotatorToDX(Rotator);
     MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z);
     MyMatrix *= Matrix.Translation(location);
     if (idxSTM != 0)
         STMC = new StaticMeshComponent(pcc, idxSTM - 1, MyMatrix);
 }
示例#19
0
 public Level(PCCPackage Pcc, int index)
 {
     pcc = Pcc;
     MyIndex = index;
     byte[] buff = pcc.GetObjectData(index);
     Props = PropertyReader.getPropList(pcc, buff);
     int off = Props[Props.Count() - 1].offend + 4;
     int count = BitConverter.ToInt32(buff, off);
     Objects = new List<int>();
     for (int i = 0; i < count; i++)
     {
         int idx = BitConverter.ToInt32(buff, off + 4 + i * 4);
         Objects.Add(idx);
     }
     for (int i = 0; i < pcc.Exports.Count; i++)
         if (pcc.Exports[i].idxLink - 1 == index)
         {
             bool found = false;
             foreach (int j in Objects)
                 if (j == i + 1)
                     found = true;
             if (!found)
                 Objects.Add(i + 1);
         }
     RenderObjects = new List<_DXRenderableObject>();
     foreach (int i in Objects)
         if (i > 0)
         {
             string c = pcc.GetObject(pcc.Exports[i - 1].idxClass);
             switch (c)
             {
                 case "ModelComponent":
                     RenderObjects.Add(new ModelComponent(pcc, i - 1));
                     break;
                 case "StaticMeshActor":
                 case "InterpActor":
                     RenderObjects.Add(new StaticMeshActor(pcc, i - 1));
                     break;
                 case "StaticMeshCollectionActor":
                     RenderObjects.Add(new StaticMeshCollectionActor(pcc, i - 1));
                     break;
                 default: break;
             }
         }
 }
        public void Open(PCCPackage pcc)
        {
            int exportIndex;
            int dataOffset;

            if (!TryFindStateEventMap(pcc, out exportIndex, out dataOffset))
            {
                return;
            }

            using (var stream = new MemoryStream(pcc.Exports[exportIndex].Data))
            {
                stream.Seek(dataOffset, SeekOrigin.Begin);

                var stateEventMap = BinaryBioStateEventMap.Load(stream);
                StateEvents = InitCollection(stateEventMap.StateEvents.OrderBy(stateEvent => stateEvent.Key));
            }
        }
示例#21
0
        public SkeletalMesh(PCCPackage pcc, int Index)
        {
            Loaded  = true;
            MyIndex = Index;
            Owner   = pcc;
            Flags   = pcc.Exports[Index].ObjectFlags >> 32;
            int start = GetPropertyEnd();

            byte[] buff = new byte[pcc.Exports[Index].Data.Length - start];
            for (int i = 0; i < pcc.Exports[Index].Data.Length - start; i++)
            {
                buff[i] = pcc.Exports[Index].Data[i + start];
            }
            MemoryStream         m         = new MemoryStream(buff);
            SerializingContainer Container = new SerializingContainer(m);

            Container.isLoading = true;
            Serialize(Container);
        }
示例#22
0
        public void Open(PCCPackage pcc)
        {
            int exportIndex;
            int dataOffset;

            if (!TryFindQuestMap(pcc, out exportIndex, out dataOffset))
            {
                return;
            }

            using (var stream = new MemoryStream(pcc.Exports[exportIndex].Data))
            {
                stream.Seek(dataOffset, SeekOrigin.Begin);

                var questMap = BinaryBioQuestMap.Load(stream);

                SetFromQuestMap(questMap);
            }
        }
示例#23
0
        private void generateFromBasefolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string basepath = KFreonLib.MEDirectories.ME3Directory.cookedPath;

            if (String.IsNullOrEmpty(basepath))
            {
                MessageBox.Show("This functionality requires ME3 to be installed. Set its path at:\n Options > Set Custom Path > Mass Effect 3");
                return;
            }
            KFreonLib.Debugging.DebugOutput.StartDebugger("Main ME3Explorer Form");
            string[] files = Directory.GetFiles(basepath, "*.pcc");
            OverView = new List <OverViewStruct>();
            for (int f = 0; f < files.Length; f++)
            {
                string file = files[f];
                KFreonLib.Debugging.DebugOutput.PrintLn((f + 1) + " / " + files.Length + " : " + file + " :", true);
                PCCPackage     p = new PCCPackage(file, false, false, true);
                OverViewStruct o = new OverViewStruct();
                o.filepath = file;
                o.Indexes  = new List <int>();
                int count = 0;
                for (int i = 0; i < p.Exports.Count; i++)
                {
                    if (p.GetObject(p.Exports[i].idxClass) == "InterpData")
                    {
                        o.Indexes.Add(i);
                        string s = "";
                        if (count++ == 0)
                        {
                            s = "\n";
                        }
                        KFreonLib.Debugging.DebugOutput.PrintLn(s + "found " + i + " : " + p.GetObjectPath(i + 1) + p.GetObject(i + 1), false);
                    }
                }
                if (o.Indexes.Count != 0)
                {
                    OverView.Add(o);
                }
                Application.DoEvents();
            }
            FreshOverView();
        }
        public void Open(PCCPackage pcc)
        {
            int exportIndex;
            int dataOffset;

            if (!TryFindCodexMap(pcc, out exportIndex, out dataOffset))
            {
                return;
            }

            using (var stream = new MemoryStream(pcc.Exports[exportIndex].Data))
            {
                stream.Seek(dataOffset, SeekOrigin.Begin);

                var codexMap = BinaryBioCodexMap.Load(stream);

                CodexPages    = InitCollection(codexMap.Pages.OrderBy(pair => pair.Key));
                CodexSections = InitCollection(codexMap.Sections.OrderBy(pair => pair.Key));
            }
        }
示例#25
0
 public Sequence(PCCPackage Pcc, int index)
 {
     pcc = Pcc;
     MyIndex = index;
     byte[] buff = pcc.GetObjectData(index + 1);
     Props = PropertyReader.getPropList(pcc, buff);
     Objects = new List<int>();
     foreach (PropertyReader.Property p in Props)
     {
         string s = pcc.GetName(p.Name);
         switch (s)
         {
             case "SequenceObjects":
                 int count = BitConverter.ToInt32(p.raw, 24);                        
                 for (int i = 0; i < count; i++)
                     Objects.Add(BitConverter.ToInt32(p.raw, 28 + i * 4));
                 break;
         }
     }
     for (int i = 0; i < pcc.Exports.Count; i++)
         if (pcc.Exports[i].idxLink == MyIndex + 1)
             Objects.Add(i + 1);
     Objects.Sort();
 }
 public ModelComponent(PCCPackage Pcc, int index)
 {
     pcc     = Pcc;
     MyIndex = index;
 }
示例#27
0
 public ModelComponent(PCCPackage Pcc, int index)
 {
     pcc = Pcc;
     MyIndex = index;
 }
示例#28
0
        //for debugging purposes. not exposed to user
        private void InterpTrackScan_Click(object sender, EventArgs e)
        {
            KFreonLib.Debugging.DebugOutput.StartDebugger("Main ME3Explorer Form");
            string basepath = ME3Directory.cookedPath;

            string[]      files  = Directory.GetFiles(basepath, "*.pcc");
            List <string> conds  = new List <string>();
            List <string> conds1 = new List <string>();

            //string property = Microsoft.VisualBasic.Interaction.InputBox("Please enter property name", "ME3 Explorer");
            string name;

            for (int f = 0; f < files.Length; f++)
            {
                string file = files[f];
                //KFreonLib.Debugging.DebugOutput.PrintLn((f + 1) + " / " + files.Length + " : " + file + " :", true);
                PCCPackage p = new PCCPackage(file, true, false, true);
                for (int i = 0; i < p.Exports.Count; i++)
                {
                    if (p.GetObjectClass(i).StartsWith("InterpTrackVisibility")) //GetObject(p.Exports[i].idxLink).StartsWith("InterpGroup"))
                    {
                        List <ME3LibWV.PropertyReader.Property> props = ME3LibWV.PropertyReader.getPropList(p, p.Exports[i].Data);
                        foreach (ME3LibWV.PropertyReader.Property prop in props)
                        {
                            //KFreonLib.Debugging.DebugOutput.PrintLn(p.GetName(prop.Name));
                            if (p.GetName(prop.Name) == "VisibilityTrack")
                            {
                                int pos   = 28;
                                int count = BitConverter.ToInt32(prop.raw, 24);
                                for (int j = 0; j < count; j++)
                                {
                                    List <ME3LibWV.PropertyReader.Property> p2 = ME3LibWV.PropertyReader.ReadProp(p, prop.raw, pos);
                                    for (int k = 0; k < p2.Count; k++)
                                    {
                                        name = p.GetName(p2[k].Name);
                                        if (name == "Action")
                                        {
                                            if (!conds.Contains(p.GetName(BitConverter.ToInt32(p2[k].raw, 32))))
                                            {
                                                conds.Add(p.GetName(BitConverter.ToInt32(p2[k].raw, 32)));
                                                KFreonLib.Debugging.DebugOutput.PrintLn("Action " + p.GetName(BitConverter.ToInt32(p2[k].raw, 24)) + ", " + p.GetName(BitConverter.ToInt32(p2[k].raw, 32)) + "               at: #" + i + " " + p.GetObjectPath(i + 1) + p.GetObjectClass(i + 1) + "        in: " + file.Substring(file.LastIndexOf(@"\") + 1), false);
                                            }
                                        }
                                        else if (name == "ActiveCondition")
                                        {
                                            if (!conds1.Contains(p.GetName(BitConverter.ToInt32(p2[k].raw, 32))))
                                            {
                                                conds1.Add(p.GetName(BitConverter.ToInt32(p2[k].raw, 32)));
                                                KFreonLib.Debugging.DebugOutput.PrintLn("ActiveCondition " + p.GetName(BitConverter.ToInt32(p2[k].raw, 24)) + ", " + p.GetName(BitConverter.ToInt32(p2[k].raw, 32)) + "               at: #" + i + " " + p.GetObjectPath(i + 1) + p.GetObjectClass(i + 1) + "        in: " + file.Substring(file.LastIndexOf(@"\") + 1), false);
                                            }
                                        }
                                        pos += p2[k].raw.Length;
                                    }
                                }
                            }
                            //if (p.GetName(prop.Name) == property)
                            //{
                            //    if(!conds.Contains(p.GetName(BitConverter.ToInt32(prop.raw, 32))))
                            //    {
                            //        conds.Add(p.GetName(BitConverter.ToInt32(prop.raw, 32)));
                            //        KFreonLib.Debugging.DebugOutput.PrintLn(p.GetName(BitConverter.ToInt32(prop.raw, 24)) + ", " + p.GetName(BitConverter.ToInt32(prop.raw, 32)) + "               at: #" + i + " " + p.GetObjectPath(i + 1) + p.GetObjectClass(i + 1) + "        in: " + file.Substring(file.LastIndexOf(@"\") + 1), false);
                            //    }
                            //}
                        }
                        //KFreonLib.Debugging.DebugOutput.PrintLn(i + " : " + p.GetObjectClass(i + 1) + "               at: " + p.GetObjectPath(i + 1) + "        in: " + file.Substring(file.LastIndexOf(@"\") + 1), false);
                    }
                }
                Application.DoEvents();
            }
            KFreonLib.Debugging.DebugOutput.PrintLn();
            KFreonLib.Debugging.DebugOutput.PrintLn("*****************");
            KFreonLib.Debugging.DebugOutput.PrintLn("Done");
        }
 public void LoadStateEventMap(PCCPackage pcc)
 {
 }
示例#30
0
 public SkeletalMesh(PCCPackage pcc, int Index)
 {
     Loaded = true;
     MyIndex = Index;
     Owner = pcc;
     Flags = pcc.Exports[Index].ObjectFlags >> 32;
     int start = GetPropertyEnd();
     byte[] buff = new byte[pcc.Exports[Index].Data.Length - start];
     for (int i = 0; i < pcc.Exports[Index].Data.Length - start; i++)
         buff[i] = pcc.Exports[Index].Data[i + start];
     MemoryStream m = new MemoryStream(buff);
     SerializingContainer Container = new SerializingContainer(m);
     Container.isLoading = true;
     Serialize(Container);
 }
示例#31
0
 public StaticMesh(PCCPackage Pcc, int index, Matrix transform)
 {
     pcc = Pcc;
     MyIndex = index;
     byte[] buff = pcc.GetObjectData(index);
     Props = PropertyReader.getPropList(pcc, buff);
     ParentMatrix = transform;
     int off = Props[Props.Count() - 1].offend;
     DeserializeDump(buff, off);
 }