public StaticMeshCollectionActor(ME3Package Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc.Exports[Index]);
            
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {

                    case "bCanStepUpOn":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bCanStepUpOn = true;
                        break;
                    case "Tag":
                        Tag = p.Value.IntValue;
                        break;
                    case "CreationTime":
                        CreationTime = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                        break;
                }
            ReadObjects();
            ReadMatrices();
        }
Ejemplo n.º 2
0
        public SkeletalMesh(ME3Package pcc, int Index)
        {
            Loaded  = true;
            MyIndex = Index;
            Owner   = pcc;
            Flags   = (int)(pcc.Exports[Index].ObjectFlags >> 32);
            int start = GetPropertyEnd();

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

            Container.isLoading = true;
            Serialize(Container);
            try
            {
                for (int i = 0; i < Materials.Count; i++)
                {
                    MatInsts.Add(new MaterialInstanceConstant(Owner, Materials[i] - 1));
                }
            }
            catch
            {
            }
            GenerateDXMeshes();
        }
Ejemplo n.º 3
0
 public UDKCopy(ME3Package _pcc, int obj, int lod)
 {
     pcc            = _pcc;
     SelectedObject = obj;
     SelectedLOD    = lod;
     InitializeComponent();
 }
        public BioPlaypenVolumeAdditive(ME3Package Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc.Exports[Index]);
            
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {

                    case "Tag":
                        Tag = p.Value.IntValue;
                        break;
                    case "Brush":
                        Brush = p.Value.IntValue;
                        break;
                    case "BrushComponent":
                        BrushComponent = p.Value.IntValue;
                        if (pcc.isExport(BrushComponent - 1) && pcc.Exports[BrushComponent - 1].ClassName == "BrushComponent")
                            brush = new BrushComponent(pcc, BrushComponent - 1);
                        break;
                    case "CollisionComponent":
                        CollisionComponent = p.Value.IntValue;
                        break;
                    case "location":
                        location.X = BitConverter.ToSingle(p.raw, p.raw.Length - 12);
                        location.Y = BitConverter.ToSingle(p.raw, p.raw.Length - 8);
                        location.Z = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                        break;
                }
            MyMatrix = Matrix.Translation(location);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Queues a texture for eventual loading.
 /// </summary>
 /// <param name="pcc">The full path of the pcc where the texture export is.</param>
 public PreviewTextureEntry LoadTexture(string pcc, int exportid)
 {
     foreach (PreviewTextureEntry e in cache)
     {
         if (e.PCCPath == pcc && e.ExportID == exportid)
         {
             return(e);
         }
     }
     using (ME3Package texpcc = MEPackageHandler.OpenME3Package(pcc))
     {
         PreviewTextureEntry      entry = new PreviewTextureEntry(pcc, exportid);
         Unreal.Classes.Texture2D metex = new Unreal.Classes.Texture2D(texpcc, exportid);
         Texture2DDescription     desc  = new Texture2DDescription();
         try
         {
             entry.Texture     = metex.generatePreviewTexture(Device, out desc);
             entry.TextureView = new ShaderResourceView(Device, entry.Texture);
             cache.Add(entry);
             return(entry);
         } catch
         {
             return(null);
         }
     }
 }
Ejemplo n.º 6
0
 public UDKCopy(ME3Package _pcc, int obj, int lod)
 {
     pcc = _pcc;
     SelectedObject = obj;
     SelectedLOD = lod;
     InitializeComponent();
 }
Ejemplo n.º 7
0
        public AnimSet(ME3Package Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc.Exports[Index]);

            Sequences = new List <int>();
            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                case "PreviewSkelMeshName":
                    PreviewSkelMeshName = p.Value.IntValue;
                    break;

                case "m_pBioAnimSetData":
                    m_pBioAnimSetData = p.Value.IntValue;
                    if (pcc.isExport(m_pBioAnimSetData - 1) && pcc.Exports[m_pBioAnimSetData - 1].ClassName == "BioAnimSetData")
                    {
                        SetData = new BioAnimSetData(pcc, m_pBioAnimSetData - 1);
                    }
                    break;

                case "Sequences":
                    ReadSequences(p.raw);
                    break;
                }
            }
        }
Ejemplo n.º 8
0
 public WwiseStream(ME3Package pcc, int index)
 {
     Index = index;
     memory = pcc.Exports[Index].Data;
     memsize = memory.Length;
     Deserialize(pcc);
 }
Ejemplo n.º 9
0
 public void AddLevel(ME3Package pcc)
 {
     try
     {
         Levelfile l = new Levelfile();
         l.path = pcc.FileName;
         l.pcc  = pcc;
         IReadOnlyList <IExportEntry> Exports = l.pcc.Exports;
         for (int i = 0; i < Exports.Count; i++)
         {
             IExportEntry e = Exports[i];
             if (e.ClassName == "Level")
             {
                 DebugOutput.Clear();
                 l.level = new Level(l.pcc, i);
                 TreeNode t = new TreeNode(Path.GetFileName(pcc.FileName));
                 t.Nodes.Add(l.level.ToTree(i));
                 GlobalTree.Visible = false;
                 GlobalTree.Nodes.Add(t);
                 GlobalTree.Visible = true;
                 //DirectXGlobal.Cam.dir = new Vector3(1.0f, 1.0f, 1.0f);
                 Levels.Add(l);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error:\n" + ex.Message);
     }
 }
        private static ClassInfo generateClassInfo(int index, ME3Package pcc)
        {
            ClassInfo info = new ClassInfo();

            info.baseClass   = pcc.Exports[index].ClassParent;
            info.exportIndex = index;
            info.pccPath     = new string(pcc.FileName.Skip(pcc.FileName.LastIndexOf("BIOGame") + 8).ToArray());
            foreach (ME3ExportEntry entry in pcc.Exports)
            {
                if (entry.idxLink - 1 == index && entry.ClassName != "ScriptStruct" && entry.ClassName != "Enum" &&
                    entry.ClassName != "Function" && entry.ClassName != "Const" && entry.ClassName != "State")
                {
                    //Skip if property is transient (only used during execution, will never be in game files)
                    if ((BitConverter.ToUInt64(entry.Data, 24) & 0x0000000000002000) == 0 && !info.properties.ContainsKey(entry.ObjectName))
                    {
                        PropertyInfo p = getProperty(pcc, entry);
                        if (p != null)
                        {
                            info.properties.Add(entry.ObjectName, p);
                        }
                    }
                }
            }
            return(info);
        }
Ejemplo n.º 11
0
        public BioAnimSetData(ME3Package Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc.Exports[Index]);
            
            TrackBoneNames = new List<string>();
            UseTranslationBoneNames = new List<string>();
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {

                    case "bAnimRotationOnly":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bAnimRotationOnly = true;
                        break;
                    case "TrackBoneNames":
                        ReadTBN(p.raw);
                        break;
                    case "UseTranslationBoneNames":
                        ReadUTBN(p.raw);
                        break;
                }
        }
Ejemplo n.º 12
0
 public string ToString(ME3Package p)
 {
     if (val == -1)
         return enumName + ", " + values[0];
     else
         return p.getNameEntry(type) + ", " + p.getNameEntry(val);
 }
Ejemplo n.º 13
0
 public WwiseStream(ME3Package pcc, int index)
 {
     Index   = index;
     memory  = pcc.Exports[Index].Data;
     memsize = memory.Length;
     Deserialize(pcc);
 }
Ejemplo n.º 14
0
        public AnimNodeSlot(ME3Package Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc.Exports[Index]);
            
            Children = new List<ChildrenEntry>();            
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {

                    case "bSkipTickWhenZeroWeight":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bSkipTickWhenZeroWeight = true;
                        break;
                    case "NodeName":
                        NodeName = p.Value.IntValue;
                        break;
                    case "NodeTotalWeight":
                        NodeTotalWeight = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                        break;
                    case "Children":
                        ReadChildren(p.raw);
                        break;
                }
        }
        public StaticMeshCollectionActor(ME3Package Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc.Exports[Index]);

            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                case "bCanStepUpOn":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCanStepUpOn = true;
                    }
                    break;

                case "Tag":
                    Tag = p.Value.IntValue;
                    break;

                case "CreationTime":
                    CreationTime = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;
                }
            }
            ReadObjects();
            ReadMatrices();
        }
Ejemplo n.º 16
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;
 }
Ejemplo n.º 17
0
        public AnimTree(ME3Package Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc.Exports[Index]);
            
            AnimGroups = new List<AnimGroupEntry>();
            ComposePrePassBoneNames = new List<string>();
            SkelControlLists = new List<SkelControlListEntry>();
            Children = new List<ChildrenEntry>();
            
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {

                    case "NodeTotalWeight":
                        NodeTotalWeight = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                        break;
                    case "AnimGroups":
                        ReadAnimGroups(p.raw);
                        break;
                    case "ComposePrePassBoneNames":
                        ReadPrePassBoneNames(p.raw);
                        break;
                    case "SkelControlLists":
                        ReadSkelControlLists(p.raw);
                        break;
                    case "Children":
                        ReadChildren(p.raw);
                        break;
                }
        }
Ejemplo n.º 18
0
        public WwiseAmbientSound(ME3Package Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc.Exports[Index]);
            
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {

                    case "bAutoPlay":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bAutoPlay = true;
                        break;
                    case "Tag":
                        Tag = p.Value.IntValue;
                        break;
                    case "UniqueTag":
                        UniqueTag = p.Value.IntValue;
                        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;
                }
            MyMatrix = Matrix.Translation(location);
            GenerateMesh();
        }
Ejemplo n.º 19
0
        public AnimSet(ME3Package Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc.Exports[Index]);
            
            Sequences = new List<int>();
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {

                    case "PreviewSkelMeshName":
                        PreviewSkelMeshName = p.Value.IntValue;
                        break;
                    case "m_pBioAnimSetData":
                        m_pBioAnimSetData = p.Value.IntValue;
                        if (pcc.isExport(m_pBioAnimSetData - 1) && pcc.Exports[m_pBioAnimSetData - 1].ClassName == "BioAnimSetData")
                            SetData = new BioAnimSetData(pcc, m_pBioAnimSetData - 1);
                        break;
                    case "Sequences":
                        ReadSequences(p.raw);
                        break;
                }
        }
Ejemplo n.º 20
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            int n = listBox1.SelectedIndex;

            if (n == -1)
            {
                return;
            }
            DBEntry l = database[n];

            if (File.Exists(l.filepath))
            {
                try
                {
                    using (ME3Package pcc = MEPackageHandler.OpenME3Package(l.filepath))
                    {
                        Level  lev = new Level(pcc, l.index, true);
                        string s   = "";
                        s += "Loading Level from : " + Path.GetFileName(l.filepath) + "\n";
                        s += "Object count : " + lev.Objects.Count + "\n==============\n\n";
                        for (int i = 0; i < lev.Objects.Count(); i++)
                        {
                            int index = lev.Objects[i];
                            s += "(" + i + "/" + (lev.Objects.Count() - 1) + ") ";
                            s += "#" + index + " : \"" + pcc.Exports[index].ObjectName + "\" Class : \"" + pcc.Exports[index].ClassName + "\"\n";
                        }
                        rtb1.Text = s;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error:\n" + ex.Message);
                }
            }
        }
Ejemplo n.º 21
0
        public InterpGroup(int idx, ME3Package pccobj)
            : base()
        {
            index = idx;
            pcc   = pccobj;

            title = new SText("");
            if (pcc.Exports[index].ClassName == "InterpGroupDirector")
            {
                GroupName = "DirGroup";
            }
            listEntry       = PPath.CreateRectangle(0, 0, Timeline.ListWidth, Timeline.TrackHeight);
            listEntry.Brush = GroupBrush;
            listEntry.Pen   = null;
            PPath p = PPath.CreatePolygon(7, 5, 12, 10, 7, 15);

            p.Brush = Brushes.Black;
            listEntry.AddChild(p);
            listEntry.AddChild(PPath.CreateLine(0, listEntry.Bounds.Bottom, Timeline.ListWidth, listEntry.Bounds.Bottom));
            colorAccent        = new PNode();
            colorAccent.Brush  = null;
            colorAccent.Bounds = new RectangleF(Timeline.ListWidth - 10, 0, 10, listEntry.Bounds.Bottom);
            listEntry.AddChild(colorAccent);
            title.TranslateBy(20, 3);
            listEntry.AddChild(title);
            listEntry.MouseDown += listEntry_MouseDown;
            collapsed            = true;
            InterpTracks         = new List <InterpTrack>();

            LoadData();
            if (bIsParented)
            {
                listEntry.TranslateBy(10, 0);
            }
        }
Ejemplo n.º 22
0
        public BioAnimSetData(ME3Package Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc.Exports[Index]);

            TrackBoneNames          = new List <string>();
            UseTranslationBoneNames = new List <string>();
            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                case "bAnimRotationOnly":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bAnimRotationOnly = true;
                    }
                    break;

                case "TrackBoneNames":
                    ReadTBN(p.raw);
                    break;

                case "UseTranslationBoneNames":
                    ReadUTBN(p.raw);
                    break;
                }
            }
        }
Ejemplo n.º 23
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);
        }
Ejemplo n.º 24
0
        public MantleMarker(ME3Package Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc.Exports[Index]);
            
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {
                    #region
                    case "bHasCrossLevelPaths":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bHasCrossLevelPaths = true;
                        break;
                    case "Tag":
                        Tag = p.Value.IntValue;
                        break;
                    case "nextNavigationPoint":
                        nextNavigationPoint = p.Value.IntValue;
                        break;
                    case "CylinderComponent":
                        CylinderComponent = p.Value.IntValue;
                        break;
                    case "Owner":
                        Owner = p.Value.IntValue;
                        break;
                    case "Base":
                        Base = p.Value.IntValue;
                        break;
                    case "CollisionComponent":
                        CollisionComponent = p.Value.IntValue;
                        break;
                    case "CreationTime":
                        CreationTime = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                        break;
                    case "visitedWeight":
                        visitedWeight = p.Value.IntValue;
                        break;
                    case "bestPathWeight":
                        bestPathWeight = p.Value.IntValue;
                        break;
                    case "NetworkID":
                        NetworkID = p.Value.IntValue;
                        break;
                    case "ApproximateLineOfFire":
                        ApproximateLineOfFire = p.Value.IntValue;
                        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;
#endregion
                }
            MyMatrix = Matrix.Translation(location);
            GenerateMesh();
        }
Ejemplo n.º 25
0
 public WwiseBank(ME3Package Pcc, int Index)
 {
     MyIndex = Index;
     pcc     = Pcc;
     memory  = pcc.Exports[Index].Data;
     memsize = memory.Length;
     Deserialize();
 }
Ejemplo n.º 26
0
 public MaterialInstanceConstant(ME3Package Pcc, int Idx)
 {
     pcc     = Pcc;
     index   = Idx;
     memory  = pcc.Exports[index].Data;
     memsize = memory.Length;
     ReadProperties();
 }
Ejemplo n.º 27
0
 public Level(ME3Package Pcc, int index, bool SimpleRead = false)
 {
     memory    = Pcc.Exports[index].Data;
     memlength = memory.Length;
     pcc       = Pcc;
     Index     = index;
     Deserialize(SimpleRead);
 }
Ejemplo n.º 28
0
 public Level(ME3Package Pcc, int index, bool SimpleRead = false)
 {
     memory = Pcc.Exports[index].Data;
     memlength = memory.Length;
     pcc = Pcc;
     Index = index;
     Deserialize(SimpleRead);
 }
Ejemplo n.º 29
0
            public TreeNode ToTree(int MyIndex, ME3Package pcc)
            {
                string s = "";

                if (Text.Length != 0)
                {
                    s = Text.Substring(0, Text.Length - 1);
                }
                TreeNode res = new TreeNode(MyIndex + " : " + s + "  " + ME3TalkFiles.findDataById(refText));
                TreeNode t   = new TreeNode("Reply List");

                for (int i = 0; i < ReplyList.Count; i++)
                {
                    EntryListReplyListStruct e = ReplyList[i];
                    string par = e.Paraphrase;
                    if (par.Length != 0 && par[par.Length - 1] == '\0')
                    {
                        par = par.Substring(0, par.Length - 1);
                    }
                    t.Nodes.Add(i + " : "
                                + par
                                + " "
                                + e.refParaphrase
                                + " "
                                + ME3TalkFiles.findDataById(e.refParaphrase)
                                + " "
                                + e.Index
                                + " "
                                + pcc.getNameEntry(e.CategoryValue));
                }
                res.Nodes.Add(t);
                TreeNode t2 = new TreeNode("Speaker List");

                for (int i = 0; i < SpeakerList.Count; i++)
                {
                    t2.Nodes.Add(i + " : " + SpeakerList[i]);
                }
                res.Nodes.Add(t2);
                res.Nodes.Add("SpeakerIndex : " + SpeakerIndex);
                res.Nodes.Add("ListenerIndex : " + ListenerIndex);
                res.Nodes.Add("ConditionalFunc : " + ConditionalFunc);
                res.Nodes.Add("ConditionalParam : " + ConditionalParam);
                res.Nodes.Add("StateTransition : " + StateTransition);
                res.Nodes.Add("StateTransitionParam : " + StateTransitionParam);
                res.Nodes.Add("ExportID : " + ExportID);
                res.Nodes.Add("ScriptIndex : " + ScriptIndex);
                res.Nodes.Add("CameraIntimacy : " + CameraIntimacy);
                res.Nodes.Add("Skippable : " + Skippable);
                res.Nodes.Add("FireConditional : " + FireConditional);
                res.Nodes.Add("Ambient : " + Ambient);
                res.Nodes.Add("NonTextline : " + NonTextline);
                res.Nodes.Add("IgnoreBodyGestures : " + IgnoreBodyGestures);
                res.Nodes.Add("AlwaysHideSubtitle : " + AlwaysHideSubtitle);
                res.Nodes.Add("Text : " + Text);
                res.Nodes.Add("refText : " + refText + " " + ME3TalkFiles.findDataById(refText, true));
                res.Nodes.Add("GUIStyle : (" + pcc.getNameEntry(GUIStyleType) + ") " + pcc.getNameEntry(GUIStyleValue));
                return(res);
            }
Ejemplo n.º 30
0
 public Function(byte[] raw, ME3Package Pcc)
 {
     pcc = Pcc;
     memory = raw;
     memsize = raw.Length;
     flagint = GetFlagInt();
     nativeindex = GetNatIdx();
     Deserialize();
 }
Ejemplo n.º 31
0
 public WwiseBank(ME3Package Pcc, int Index)
 {
     
     MyIndex = Index;
     pcc = Pcc;
     memory = pcc.Exports[Index].Data;
     memsize = memory.Length;
     Deserialize();
 }
Ejemplo n.º 32
0
 public Function(byte[] raw, ME3Package Pcc)
 {
     pcc         = Pcc;
     memory      = raw;
     memsize     = raw.Length;
     flagint     = GetFlagInt();
     nativeindex = GetNatIdx();
     Deserialize();
 }
 public MaterialInstanceConstant(ME3Package Pcc,int Idx)
 {
     
     pcc = Pcc;
     index = Idx;
     memory = pcc.Exports[index].Data;
     memsize = memory.Length;
     ReadProperties();         
 }
Ejemplo n.º 34
0
        public LightVolume(ME3Package Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc.Exports[Index]);

            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                    #region
                case "bColored":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bColored = true;
                    }
                    break;

                case "Tag":
                    Tag = p.Value.IntValue;
                    break;

                case "Brush":
                    Brush = p.Value.IntValue;
                    break;

                case "BrushComponent":
                    BrushComponent = p.Value.IntValue;
                    if (pcc.isExport(BrushComponent - 1) && pcc.Exports[BrushComponent - 1].ClassName == "BrushComponent")
                    {
                        brush = new BrushComponent(pcc, BrushComponent - 1);
                    }
                    break;

                case "CollisionComponent":
                    CollisionComponent = p.Value.IntValue;
                    break;

                case "CreationTime":
                    CreationTime = BitConverter.ToSingle(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;
                    #endregion
                }
            }
            MyMatrix = Matrix.Translation(location);
        }
Ejemplo n.º 35
0
            public TreeNode ToTree(int index, ME3Package pcc)
            {
                TreeNode root = new TreeNode(index + ": " + fTime);

                root.Nodes.Add("pObject : " + pObject);
                root.Nodes.Add("nKeyIndex : " + nKeyIndex);
                root.Nodes.Add("fTime : " + fTime);
                root.Nodes.Add("bPreloadFired : " + bPreloadFired);
                return(root);
            }
Ejemplo n.º 36
0
 public SFXSceneGroup(int idx, ME3Package pccobj)
     : base(idx, pccobj)
 {
     LoadData();
     listEntry[0].RotateInPlace(90);
     listEntry[0].TranslateBy(5, 5);
     collapsed = false;
     //hack to undo the triangle rotation
     listEntry.MouseDown += listEntry_MouseDown;
 }
Ejemplo n.º 37
0
 public static PropertyCollection getDefaultStructValue(string className)
 {
     if (Structs.ContainsKey(className))
     {
         bool      immutable = isImmutable(className);
         ClassInfo info      = Structs[className];
         try
         {
             string filepath = (Path.Combine(ME3Directory.gamePath, @"BIOGame\" + info.pccPath));
             if (File.Exists(info.pccPath))
             {
                 filepath = info.pccPath; //Used for dynamic lookup
             }
             using (ME3Package importPCC = MEPackageHandler.OpenME3Package(filepath))
             {
                 byte[] buff;
                 //Plane and CoverReference inherit from other structs, meaning they don't have default values (who knows why)
                 //thus, I have hardcoded what those default values should be
                 if (className == "Plane")
                 {
                     buff = PlaneDefault;
                 }
                 else if (className == "CoverReference")
                 {
                     buff = CoverReferenceDefault;
                 }
                 else
                 {
                     buff = importPCC.Exports[info.exportIndex].Data.Skip(0x24).ToArray();
                 }
                 PropertyCollection props    = PropertyCollection.ReadProps(importPCC, new MemoryStream(buff), className);
                 List <UProperty>   toRemove = new List <UProperty>();
                 foreach (var prop in props)
                 {
                     //remove transient props
                     if (!info.properties.ContainsKey(prop.Name) && info.baseClass == "Class")
                     {
                         toRemove.Add(prop);
                     }
                 }
                 foreach (var prop in toRemove)
                 {
                     props.Remove(prop);
                 }
                 return(props);
             }
         }
         catch
         {
             return(null);
         }
     }
     return(null);
 }
        //call this method to regenerate ME3ObjectInfo.json
        //Takes a long time (~5 minutes maybe?). Application will be completely unresponsive during that time.
        public static void generateInfo()
        {
            string path = ME3Directory.gamePath;

            string[] files = Directory.GetFiles(path, "*.pcc", SearchOption.AllDirectories);
            string   objectName;
            int      length = files.Length;

            for (int i = 0; i < length; i++)
            {
                if (files[i].ToLower().EndsWith(".pcc"))
                {
                    using (ME3Package pcc = MEPackageHandler.OpenME3Package(files[i]))
                    {
                        IReadOnlyList <IExportEntry> Exports = pcc.Exports;
                        IExportEntry exportEntry;
                        for (int j = 0; j < Exports.Count; j++)
                        {
                            exportEntry = Exports[j];
                            if (exportEntry.ClassName == "Enum")
                            {
                                generateEnumValues(j, pcc);
                            }
                            else if (exportEntry.ClassName == "Class")
                            {
                                objectName = exportEntry.ObjectName;
                                if (!Classes.ContainsKey(objectName))
                                {
                                    Classes.Add(objectName, generateClassInfo(j, pcc));
                                }
                                if ((objectName.Contains("SeqAct") || objectName.Contains("SeqCond") || objectName.Contains("SequenceLatentAction") ||
                                     objectName == "SequenceOp" || objectName == "SequenceAction" || objectName == "SequenceCondition") && !SequenceObjects.ContainsKey(objectName))
                                {
                                    SequenceObjects.Add(objectName, generateSequenceObjectInfo(j, pcc));
                                }
                            }
                            else if (exportEntry.ClassName == "ScriptStruct")
                            {
                                objectName = exportEntry.ObjectName;
                                if (!Structs.ContainsKey(objectName))
                                {
                                    Structs.Add(objectName, generateClassInfo(j, pcc));
                                }
                            }
                        }
                    }
                }
                System.Diagnostics.Debug.WriteLine($"{i} of {length} processed");
            }
            File.WriteAllText(Application.StartupPath + "//exec//ME3ObjectInfo.json",
                              JsonConvert.SerializeObject(new { SequenceObjects = SequenceObjects, Classes = Classes, Structs = Structs, Enums = Enums }));
            MessageBox.Show("Done");
        }
Ejemplo n.º 39
0
        public DecalActor(ME3Package Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc.Exports[Index]);
            
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {

                    case "bCanStepUpOn":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bCanStepUpOn = true;
                        break;
                    case "Tag":
                        Tag = p.Value.IntValue;
                        break;
                    case "Group":
                        Group = p.Value.IntValue;
                        break;
                    case "Decal":
                        Decal = 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;
                }
            if (pcc.isExport(Decal - 1) && pcc.Exports[Decal - 1].ClassName == "DecalComponent")
                DC = new DecalComponent(pcc, Decal - 1);
            MyMatrix = Matrix.Identity;
            MyMatrix *= Matrix.Scaling(DrawScale3D);
            MyMatrix *= Matrix.Scaling(new Vector3(DrawScale, DrawScale, DrawScale));
            Vector3 rot = RotatorToDX(Rotator);
            MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z);
            MyMatrix *= Matrix.Translation(location);
        }
Ejemplo n.º 40
0
        private void startScanToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ME3Directory.cookedPath))
            {
                MessageBox.Show("This functionality requires ME3 to be installed. Set its path at:\n Options > Set Custom Path > Mass Effect 3");
                return;
            }
            string pathcook = ME3Directory.cookedPath;

            DebugOutput.StartDebugger("ScriptDB");
            string[] files = Directory.GetFiles(pathcook, "*.pcc");
            int      count = 1;

            database = new List <ScriptEntry>();
            foreach (string file in files)
            {
                DebugOutput.PrintLn(count + "\\" + files.Length + " : Scanning " + Path.GetFileName(file) + " ...");
                try
                {
                    using (ME3Package pcc = MEPackageHandler.OpenME3Package(file))
                    {
                        int count2 = 0;
                        foreach (IExportEntry ent in pcc.Exports)
                        {
                            if (ent.ClassName == "Function")
                            {
                                Function    f = new Function(ent.Data, ent);
                                ScriptEntry n = new ScriptEntry();
                                n.file = Path.GetFileName(file);
                                n.name = ent.PackageFullName + "." + ent.ObjectName;
                                f.ParseFunction();
                                n.script = f.ScriptText;
                                database.Add(n);
                                DebugOutput.PrintLn("\tFound \"" + n.name + "\"", false);
                            }
                            count2++;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error:\n" + ex.Message);
                    DebugOutput.PrintLn("Could not open file: " + Path.GetFileName(file));
                }
                {
                    pb1.Maximum = files.Length;
                    pb1.Value   = count;
                }
                count++;
            }
            RefreshList();
        }
        private static SequenceObjectInfo generateSequenceObjectInfo(int i, ME3Package pcc)
        {
            SequenceObjectInfo info = new SequenceObjectInfo();
            var inLinks             = pcc.Exports[i + 1].GetProperty <ArrayProperty <StructProperty> >("InputLinks");

            if (inLinks != null)
            {
                foreach (var seqOpInputLink in inLinks)
                {
                    info.inputLinks.Add(seqOpInputLink.GetProp <StrProperty>("LinkDesc").Value);
                }
            }
            return(info);
        }
        public WwiseEnvironmentVolume(ME3Package Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc.Exports[Index]);
            
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {

                    case "bHiddenEdGroup":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bHiddenEdGroup = true;
                        break;
                    case "Tag":
                        Tag = p.Value.IntValue;
                        break;
                    case "UniqueTag":
                        UniqueTag = p.Value.IntValue;
                        break;
                    case "Group":
                        Group = p.Value.IntValue;
                        break;
                    case "Settings":
                        Settings = p.Value.IntValue;
                        break;
                    case "Brush":
                        Brush = p.Value.IntValue;
                        break;
                    case "BrushComponent":
                        BrushComponent = p.Value.IntValue;
                        if (pcc.isExport(BrushComponent - 1) && pcc.Exports[BrushComponent - 1].ClassName == "BrushComponent")
                            brush = new BrushComponent(pcc, BrushComponent - 1);
                        break;
                    case "CollisionComponent":
                        CollisionComponent = p.Value.IntValue;
                        break;
                    case "Priority":
                        Priority = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                        break;
                    case "location":
                        location.X = BitConverter.ToSingle(p.raw, p.raw.Length - 12);
                        location.Y = BitConverter.ToSingle(p.raw, p.raw.Length - 8);
                        location.Z = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                        break;
                }
            MyMatrix = Matrix.Translation(location);
        }
Ejemplo n.º 43
0
 public TreeNode ToTree(int MyIndex, ME3Package pcc)
 {
     string s = "";
     if (Text.Length != 0)
         s = Text.Substring(0, Text.Length - 1);
     TreeNode res = new TreeNode(MyIndex + " : " + s + "  " + ME3TalkFiles.findDataById(refText));
     TreeNode t = new TreeNode("Reply List");
     for (int i = 0; i < ReplyList.Count; i++)
     {
         EntryListReplyListStruct e = ReplyList[i];
         string par = e.Paraphrase;
         if (par.Length != 0 && par[par.Length - 1] == '\0')
             par = par.Substring(0, par.Length - 1);
         t.Nodes.Add(i + " : " 
                       + par
                       + " " 
                       + e.refParaphrase 
                       + " " 
                       + ME3TalkFiles.findDataById(e.refParaphrase) 
                       + " " 
                       + e.Index 
                       + " " 
                       + pcc.getNameEntry(e.CategoryValue));
     }
     res.Nodes.Add(t);
     TreeNode t2 = new TreeNode("Speaker List");
     for (int i = 0; i < SpeakerList.Count; i++)
         t2.Nodes.Add(i + " : " + SpeakerList[i]);
     res.Nodes.Add(t2);
     res.Nodes.Add("SpeakerIndex : " + SpeakerIndex);
     res.Nodes.Add("ListenerIndex : " + ListenerIndex);
     res.Nodes.Add("ConditionalFunc : " + ConditionalFunc);
     res.Nodes.Add("ConditionalParam : " + ConditionalParam);
     res.Nodes.Add("StateTransition : " + StateTransition);
     res.Nodes.Add("StateTransitionParam : " + StateTransitionParam);
     res.Nodes.Add("ExportID : " + ExportID);
     res.Nodes.Add("ScriptIndex : " + ScriptIndex);
     res.Nodes.Add("CameraIntimacy : " + CameraIntimacy);
     res.Nodes.Add("Skippable : " + Skippable);
     res.Nodes.Add("FireConditional : " + FireConditional);
     res.Nodes.Add("Ambient : " + Ambient);
     res.Nodes.Add("NonTextline : " + NonTextline);
     res.Nodes.Add("IgnoreBodyGestures : " + IgnoreBodyGestures);
     res.Nodes.Add("AlwaysHideSubtitle : " + AlwaysHideSubtitle);
     res.Nodes.Add("Text : " + Text);
     res.Nodes.Add("refText : " + refText + " " + ME3TalkFiles.findDataById(refText, true));
     res.Nodes.Add("GUIStyle : (" + pcc.getNameEntry(GUIStyleType) + ") " + pcc.getNameEntry(GUIStyleValue));
     return res;
 }
Ejemplo n.º 44
0
 public void Deserialize(ME3Package pcc)
 {
     props = PropertyReader.getPropList(pcc.Exports[Index]);
     int off = props[props.Count - 1].offend + 8;
     ValueOffset = off;
     DataSize = BitConverter.ToInt32(memory, off);
     DataOffset = BitConverter.ToInt32(memory, off + 4);
     for (int i = 0; i < props.Count; i++)
     {
         if (pcc.Names[props[i].Name] == "Filename")
             FileName = pcc.Names[props[i].Value.IntValue];
         if (pcc.Names[props[i].Name] == "Id")
             Id = props[i].Value.IntValue;
     }
 }
Ejemplo n.º 45
0
        public AnimSequence(ME3Package Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;            
            Props = PropertyReader.getPropList(pcc.Exports[Index]);
            
            Unknown = BitConverter.ToInt32(data, 0);
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {

                    case "RotationCompressionFormat":
                        RotationCompressionFormat = p.Value.IntValue;
                        break;
                    case "KeyEncodingFormat":
                        KeyEncodingFormat = p.Value.IntValue;
                        break;
                    case "bIsAdditive":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bIsAdditive = true;
                        break;
                    case "bNoLoopingInterpolation":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bNoLoopingInterpolation = true;
                        break;
                    case "SequenceName":
                        SequenceName = p.Value.IntValue;
                        break;
                    case "m_pBioAnimSetData":
                        m_pBioAnimSetData = p.Value.IntValue;
                        break;
                    case "SequenceLength":
                        SequenceLength = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                        break;
                    case "RateScale":
                        RateScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                        break;
                    case "NumFrames":
                        NumFrames = p.Value.IntValue;
                        break;
                    case "CompressedTrackOffsets":
                        ReadTrackOffsets(p.raw);
                        break;
                }
            ReadCompressedBlob();
        }
Ejemplo n.º 46
0
        private void buttonCompressPCC_Click(object sender, EventArgs e)
        {
            if (openPccDialog.ShowDialog() == DialogResult.OK)
            {
                string fileName   = openPccDialog.FileName;
                string backupFile = fileName + ".bak";
                if (File.Exists(fileName))
                {
                    try
                    {
                        using (ME3Package pccObj = MEPackageHandler.OpenME3Package(fileName))
                        {
                            if (!pccObj.CanReconstruct)
                            {
                                var res = MessageBox.Show("This file contains a SeekFreeShaderCache. Compressing will cause a crash when ME3 attempts to load this file.\n" +
                                                          "Do you want to visit a forum thread with more information and a possible solution?",
                                                          "I'm sorry, Dave. I'm afraid I can't do that.", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);
                                if (res == DialogResult.Yes)
                                {
                                    System.Diagnostics.Process.Start("http://me3explorer.freeforums.org/research-how-to-turn-your-dlc-pcc-into-a-vanilla-one-t2264.html");
                                }
                                return;
                            }
                            DialogResult dialogResult = MessageBox.Show("Do you want to make a backup file?", "Make Backup", MessageBoxButtons.YesNo);
                            if (dialogResult == DialogResult.Yes)
                            {
                                File.Copy(fileName, backupFile);
                            }

                            pccObj.saveByReconstructing(fileName, true);
                        }

                        MessageBox.Show("File " + Path.GetFileName(fileName) + " was successfully compressed.", "Succeed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch (Exception exc)
                    {
                        MessageBox.Show("An error occurred while compressing " + Path.GetFileName(fileName) + ":\n" + exc.Message, "Exception Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        //recovering backup file
                        if (File.Exists(backupFile))
                        {
                            File.Delete(fileName);
                            File.Move(backupFile, fileName);
                        }
                    }
                }
            }
        }
Ejemplo n.º 47
0
        private void ExtractWav(string path, string name = "", bool askSave = true)
        {
            if (!File.Exists(path))
            {
                return;
            }
            string loc = Path.GetDirectoryName(Application.ExecutablePath) + "\\exec";
            Stream fs  = new FileStream(path, FileMode.Open, FileAccess.Read);

            if (path.EndsWith(".pcc"))
            {
                using (ME3Package package = MEPackageHandler.OpenME3Package(path))
                {
                    if (package.IsCompressed)
                    {
                        Stream result = CompressionHelper.DecompressME3(fs);
                        fs.Dispose();
                        fs = result;
                    }
                }
            }
            if (DataOffset + DataSize > fs.Length)
            {
                return;
            }
            ExtractRawFromStream(fs);
            ConvertRiffToWav();
            SaveFileDialog d = new SaveFileDialog();

            d.Filter   = "Wave Files(*.wav)|*.wav";
            d.FileName = name + ".wav";
            if (askSave)
            {
                if (d.ShowDialog() == DialogResult.OK)
                {
                    File.Copy(loc + "\\out.wav", d.FileName);
                }
            }
            else
            {
                File.Copy(loc + "\\out.wav", name, true);
            }
            if (askSave)
            {
                MessageBox.Show("Done.");
            }
        }
Ejemplo n.º 48
0
        public SplineActor(ME3Package Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc.Exports[Index]);
            
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {

                    case "Physics":
                        Physics = p.Value.IntValue;
                        break;
                    case "bEdShouldSnap":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bEdShouldSnap = true;
                        break;
                    case "bDisableDestination":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bDisableDestination = true;
                        break;
                    case "Tag":
                        Tag = p.Value.IntValue;
                        break;
                    case "UniqueTag":
                        UniqueTag = p.Value.IntValue;
                        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));
                        if(to == new Vector3())
                            to = location;
                        break;
                    case "Connections" :
                        Connections = p.raw;
                        break;
                }
            ProcessConnections();
        }
        private static void generateEnumValues(int index, ME3Package pcc)
        {
            string enumName = pcc.Exports[index].ObjectName;

            if (!Enums.ContainsKey(enumName))
            {
                List <string> values = new List <string>();
                byte[]        buff   = pcc.Exports[index].Data;
                //subtract 1 so that we don't get the MAX value, which is an implementation detail
                int count = BitConverter.ToInt32(buff, 20) - 1;
                for (int i = 0; i < count; i++)
                {
                    values.Add(pcc.Names[BitConverter.ToInt32(buff, 24 + i * 8)]);
                }
                Enums.Add(enumName, values);
            }
        }
Ejemplo n.º 50
0
 public static Vector3 GetLocation(ME3Package Pcc, int Index)
 {
     Vector3 r = new Vector3();
     if (!Pcc.isExport(Index))
         return new Vector3();
     List<PropertyReader.Property> pp = PropertyReader.getPropList(Pcc.Exports[Index]);
     foreach (PropertyReader.Property p in pp)
         switch (Pcc.getNameEntry(p.Name))
         {
             case "location":
                 r = 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;
         }
     return r;
 }
Ejemplo n.º 51
0
        private void startScanToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string path = ME3Directory.cookedPath;

            if (string.IsNullOrEmpty(path))
            {
                MessageBox.Show("This functionality requires ME3 to be installed. Set its path at:\n Options > Set Custom Path > Mass Effect 3");
                return;
            }
            string[] files = Directory.GetFiles(path, "*.pcc");
            filenames = new List <string>();
            int count = 1;

            foreach (string file in files)
            {
                try
                {
                    using (ME3Package _pcc = MEPackageHandler.OpenME3Package(file))
                    {
                        DebugOutput.PrintLn((count++) + "/" + files.Length + " : Scanning file " + Path.GetFileName(file) + " ...");
                        bool found = false;
                        IReadOnlyList <IExportEntry> Exports = _pcc.Exports;
                        foreach (IExportEntry ex in Exports)
                        {
                            if (ex.ClassName == "AnimTree" || ex.ClassName == "AnimSet")
                            {
                                DebugOutput.PrintLn("Found Animation!");
                                found = true;
                                break;
                            }
                        }
                        if (found)
                        {
                            filenames.Add(file);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error:\n" + ex.Message);
                    DebugOutput.PrintLn("Could not open " + Path.GetFileName(file));
                }
            }
            RefreshLists();
        }
Ejemplo n.º 52
0
 /*
  * This method is called when using the -compresspcc command line argument
  */
 public static int autoCompressPcc(string sourceFile, string outputFile)
 {
     if (!File.Exists(sourceFile))
     {
         MessageBox.Show("PCC to compress does not exist:\n" + sourceFile, "Auto Compression Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(1);
     }
     using (ME3Package pccObj = MEPackageHandler.OpenME3Package(sourceFile))
     {
         if (!pccObj.CanReconstruct)
         {
             MessageBox.Show("Cannot compress files with a SeekFreeShaderCache", "Auto Compression Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(1);
         }
         pccObj.saveByReconstructing(outputFile, true);
     }
     return(0);
 }
Ejemplo n.º 53
0
        public TextureGroup(ME3Package pccObj, byte[] data)
        {
            enumTextureGroups = new List<ByteProp>();
            pccRef = pccObj;

            MemoryStream buffer = new MemoryStream(data);

            firstVal = buffer.ReadValueU32();
            buffer.Seek(16, SeekOrigin.Begin);
            otherVal = buffer.ReadValueU32();

            int numEnums = buffer.ReadValueS32();
            for (int i = 0; i < numEnums; i++)
            {
                ByteProp aux = new ByteProp(pccRef.Names[buffer.ReadValueS32()], buffer.ReadValueS32());
                enumTextureGroups.Add(aux);
            }
        }
Ejemplo n.º 54
0
        public void PlaySound()
        {
            if (listView1.SelectedItems.Count != 1 || pcc == null)
            {
                return;
            }
            ListViewItem item  = listView1.SelectedItems[0];
            int          index = Convert.ToInt32(item.Name);

            if (pcc.Exports[index].ClassName == "WwiseStream")
            {
                using (ME3Package package = MEPackageHandler.OpenME3Package(pcc.pccFileName))
                {
                    w = new WwiseStream(package, index);
                    w.Play(pathCooked);
                }
            }
        }
Ejemplo n.º 55
0
 public LightVolume(ME3Package Pcc, int Index)
 {
     pcc = Pcc;
     MyIndex = Index;
     if (pcc.isExport(Index))
         data = pcc.Exports[Index].Data;
     Props = PropertyReader.getPropList(pcc.Exports[Index]);
     
     foreach (PropertyReader.Property p in Props)
         switch (pcc.getNameEntry(p.Name))
         {
                 #region
             case "bColored":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bColored = true;
                 break;
             case "Tag":
                 Tag = p.Value.IntValue;
                 break;
             case "Brush":
                 Brush = p.Value.IntValue;
                 break;
             case "BrushComponent":
                 BrushComponent = p.Value.IntValue;
                 if (pcc.isExport(BrushComponent - 1) && pcc.Exports[BrushComponent - 1].ClassName == "BrushComponent")
                     brush = new BrushComponent(pcc, BrushComponent - 1);
                 break;
             case "CollisionComponent":
                 CollisionComponent = p.Value.IntValue;
                 break;
             case "CreationTime":
                 CreationTime = BitConverter.ToSingle(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;
                 #endregion
         }
     MyMatrix = Matrix.Translation(location);
 }
Ejemplo n.º 56
0
 private static ClassInfo generateClassInfo(int index, ME3Package pcc)
 {
     ClassInfo info = new ClassInfo();
     info.baseClass = pcc.Exports[index].ClassParent;
     info.exportIndex = index;
     info.pccPath = new string(pcc.FileName.Skip(pcc.FileName.LastIndexOf("BIOGame") + 8).ToArray());
     foreach (ME3ExportEntry entry in pcc.Exports)
     {
         if (entry.idxLink - 1 == index && entry.ClassName != "ScriptStruct" && entry.ClassName != "Enum"
             && entry.ClassName != "Function" && entry.ClassName != "Const" && entry.ClassName != "State")
         {
             //Skip if property is transient (only used during execution, will never be in game files)
             if ((BitConverter.ToUInt64(entry.Data, 24) & 0x0000000000002000) == 0 && !info.properties.ContainsKey(entry.ObjectName))
             {
                 PropertyInfo p = getProperty(pcc, entry);
                 if (p != null)
                 {
                     info.properties.Add(entry.ObjectName, p);
                 }
             }
         }
     }
     return info;
 }
Ejemplo n.º 57
0
 private static void generateEnumValues(int index, ME3Package pcc)
 {
     string enumName = pcc.Exports[index].ObjectName;
     if (!Enums.ContainsKey(enumName))
     {
         List<string> values = new List<string>();
         byte[] buff = pcc.Exports[index].Data;
         //subtract 1 so that we don't get the MAX value, which is an implementation detail
         int count = BitConverter.ToInt32(buff, 20) - 1;
         for (int i = 0; i < count; i++)
         {
             values.Add(pcc.Names[BitConverter.ToInt32(buff, 24 + i * 8)]);
         }
         Enums.Add(enumName, values);
     }
 }
Ejemplo n.º 58
0
        private static PropertyInfo getProperty(ME3Package pcc, IExportEntry entry)
        {
            PropertyInfo p = new PropertyInfo();
            switch (entry.ClassName)
            {
                case "IntProperty":
                    p.type = PropertyType.IntProperty;
                    break;
                case "StringRefProperty":
                    p.type = PropertyType.StringRefProperty;
                    break;
                case "FloatProperty":
                    p.type = PropertyType.FloatProperty;
                    break;
                case "BoolProperty":
                    p.type = PropertyType.BoolProperty;
                    break;
                case "StrProperty":
                    p.type = PropertyType.StrProperty;
                    break;
                case "NameProperty":
                    p.type = PropertyType.NameProperty;
                    break;
                case "DelegateProperty":
                    p.type = PropertyType.DelegateProperty;
                    break;
                case "ObjectProperty":
                case "ClassProperty":
                case "ComponentProperty":
                    p.type = PropertyType.ObjectProperty;
                    p.reference = pcc.getObjectName(BitConverter.ToInt32(entry.Data, entry.Data.Length - 4));
                    break;
                case "StructProperty":
                    p.type = PropertyType.StructProperty;
                    p.reference = pcc.getObjectName(BitConverter.ToInt32(entry.Data, entry.Data.Length - 4));
                    break;
                case "BioMask4Property":
                case "ByteProperty":
                    p.type = PropertyType.ByteProperty;
                    p.reference = pcc.getObjectName(BitConverter.ToInt32(entry.Data, entry.Data.Length - 4));
                    break;
                case "ArrayProperty":
                    p.type = PropertyType.ArrayProperty;
                    PropertyInfo arrayTypeProp = getProperty(pcc, pcc.Exports[BitConverter.ToInt32(entry.Data, 44) - 1]);
                    if (arrayTypeProp != null)
                    {
                        switch (arrayTypeProp.type)
                        {
                            case PropertyType.ObjectProperty:
                            case PropertyType.StructProperty:
                            case PropertyType.ArrayProperty:
                                p.reference = arrayTypeProp.reference;
                                break;
                            case PropertyType.ByteProperty:
                                if (arrayTypeProp.reference == "")
                                    p.reference = arrayTypeProp.type.ToString();
                                else
                                    p.reference = arrayTypeProp.reference;
                                break;
                            case PropertyType.IntProperty:
                            case PropertyType.FloatProperty:
                            case PropertyType.NameProperty:
                            case PropertyType.BoolProperty:
                            case PropertyType.StrProperty:
                            case PropertyType.StringRefProperty:
                            case PropertyType.DelegateProperty:
                                p.reference = arrayTypeProp.type.ToString();
                                break;
                            case PropertyType.None:
                            case PropertyType.Unknown:
                            default:
                                System.Diagnostics.Debugger.Break();
                                p = null;
                                break;
                        }
                    }
                    else
                    {
                        p = null;
                    }
                    break;
                case "InterfaceProperty":
                default:
                    p = null;
                    break;
            }

            return p;
        }
Ejemplo n.º 59
0
        public TargetPoint(ME3Package Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc.Exports[Index]);
            
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {
                    #region
                    case "Physics":
                        Physics = p.Value.IntValue;
                        break;
                    case "bHardAttach":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bHardAttach = true;
                        break;
                    case "bShadowParented":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bShadowParented = true;
                        break;
                    case "bLockLocation":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bLockLocation = true;
                        break;
                    case "bIgnoreBaseRotation":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bIgnoreBaseRotation = true;
                        break;
                    case "bHidden":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bHidden = true;
                        break;
                    case "bEdShouldSnap":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bEdShouldSnap = true;
                        break;
                    case "Tag":
                        Tag = p.Value.IntValue;
                        break;
                    case "UniqueTag":
                        UniqueTag = p.Value.IntValue;
                        break;
                    case "Group":
                        Group = p.Value.IntValue;
                        break;
                    case "BaseBoneName":
                        BaseBoneName = p.Value.IntValue;
                        break;
                    case "Base":
                        Base = p.Value.IntValue;
                        break;
                    case "BaseSkelComponent":
                        BaseSkelComponent = p.Value.IntValue;
                        break;
                    case "DrawScale":
                        DrawScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                        break;
                    case "TickFrequencyAtEndDistance":
                        TickFrequencyAtEndDistance = BitConverter.ToSingle(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;
                    #endregion
                }

            MyMatrix = Matrix.Translation(location);
            GenerateMesh();
        }
Ejemplo n.º 60
0
        private static SequenceObjectInfo generateSequenceObjectInfo(int i, ME3Package pcc)
        {
            SequenceObjectInfo info = new SequenceObjectInfo();
            PropertyReader.Property inputLinks = PropertyReader.getPropOrNull(pcc.Exports[i + 1], "InputLinks");
            if (inputLinks != null)
            {
                int pos = 28;
                byte[] global = inputLinks.raw;
                int count = BitConverter.ToInt32(global, 24);
                for (int j = 0; j < count; j++)
                {
                    List<PropertyReader.Property> p2 = PropertyReader.ReadProp(pcc, global, pos);

                    info.inputLinks.Add(p2[0].Value.StringValue);
                    for (int k = 0; k < p2.Count(); k++)
                        pos += p2[k].raw.Length;
                }
            }
            return info;
        }