コード例 #1
0
ファイル: InterpTracks.cs プロジェクト: Dybuk/ME3Explorer
 public string ToString(PCCObject p)
 {
     if (val == -1)
         return enumName + ", " + values[0];
     else
         return p.getNameEntry(type) + ", " + p.getNameEntry(val);
 }
コード例 #2
0
ファイル: PropertyReader.cs プロジェクト: Dybuk/ME3Explorer
        public static CustomProperty PropertyToGrid(Property p, PCCObject pcc)
        {
            string         cat = p.TypeVal.ToString();
            CustomProperty pg;

            switch (p.TypeVal)
            {
            case Type.BoolProperty:
                pg = new CustomProperty(pcc.Names[p.Name], cat, (p.Value.IntValue == 1), typeof(bool), false, true);
                break;

            case Type.FloatProperty:
                byte[] buff = BitConverter.GetBytes(p.Value.IntValue);
                float  f    = BitConverter.ToSingle(buff, 0);
                pg = new CustomProperty(pcc.Names[p.Name], cat, f, typeof(float), false, true);
                break;

            case Type.ByteProperty:
            case Type.NameProperty:
                NameProp pp = new NameProp();
                pp.name      = pcc.getNameEntry(p.Value.IntValue);
                pp.nameindex = p.Value.IntValue;
                pg           = new CustomProperty(pcc.Names[p.Name], cat, pp, typeof(NameProp), false, true);
                break;

            case Type.ObjectProperty:
                ObjectProp ppo = new ObjectProp();
                ppo.name      = pcc.getObjectName(p.Value.IntValue);
                ppo.nameindex = p.Value.IntValue;
                pg            = new CustomProperty(pcc.Names[p.Name], cat, ppo, typeof(ObjectProp), false, true);
                break;

            case Type.StructProperty:
                StructProp ppp = new StructProp();
                ppp.name      = pcc.getNameEntry(p.Value.IntValue);
                ppp.nameindex = p.Value.IntValue;
                byte[] buf = new byte[p.Value.Array.Count()];
                for (int i = 0; i < p.Value.Array.Count(); i++)
                {
                    buf[i] = (byte)p.Value.Array[i].IntValue;
                }
                List <int> buf2 = new List <int>();
                for (int i = 0; i < p.Value.Array.Count() / 4; i++)
                {
                    buf2.Add(BitConverter.ToInt32(buf, i * 4));
                }
                ppp.data = buf2.ToArray();
                pg       = new CustomProperty(pcc.Names[p.Name], cat, ppp, typeof(StructProp), false, true);
                break;

            default:
                pg = new CustomProperty(pcc.Names[p.Name], cat, p.Value.IntValue, typeof(int), false, true);
                break;
            }
            return(pg);
        }
コード例 #3
0
        public static string PropertyToText(Property p, PCCObject pcc)
        {
            string s = "";

            s  = "Name: " + pcc.Names[p.Name];
            s += " Type: " + TypeToString((int)p.TypeVal);
            s += " Size: " + p.Value.len.ToString();
            switch (p.TypeVal)
            {
            case Type.StructProperty:
                s += " \"" + pcc.getNameEntry(p.Value.IntValue) + "\" with " + p.Value.Array.Count.ToString() + " bytes";
                break;

            case Type.IntProperty:
            case Type.ObjectProperty:
            case Type.BoolProperty:
            case Type.StringRefProperty:
                s += " Value: " + p.Value.IntValue.ToString();
                break;

            case Type.FloatProperty:
                byte[] buff = BitConverter.GetBytes(p.Value.IntValue);
                float  f    = BitConverter.ToSingle(buff, 0);
                s += " Value: " + f.ToString();
                break;

            case Type.NameProperty:
                s += " " + pcc.Names[p.Value.IntValue];
                break;

            case Type.ByteProperty:
                s += " Value: \"" + p.Value.StringValue + "\" with \"" + pcc.getNameEntry(p.Value.IntValue) + "\"";
                break;

            case Type.ArrayProperty:
                s += " bytes";     //Value: " + p.Value.Array.Count.ToString() + " Elements";
                break;

            case Type.StrProperty:
                if (p.Value.StringValue.Length == 0)
                {
                    break;
                }
                s += " Value: " + p.Value.StringValue.Substring(0, p.Value.StringValue.Length - 1);
                break;
            }
            return(s);
        }
コード例 #4
0
        public StaticMeshCollectionActor(PCCObject Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            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();
        }
コード例 #5
0
ファイル: AnimTree.cs プロジェクト: CreeperLava/ME3Explorer
        public AnimTree(PCCObject Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            AnimGroups = new List<AnimGroupEntry>();
            ComposePrePassBoneNames = new List<string>();
            SkelControlLists = new List<SkelControlListEntry>();
            Children = new List<ChildrenEntry>();
            BitConverter.IsLittleEndian = true;
            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;
                }
        }
コード例 #6
0
        private static Type getType(PCCObject pcc, int type)
        {
            switch (pcc.getNameEntry(type))
            {
            case "None": return(Type.None);

            case "StructProperty": return(Type.StructProperty);

            case "IntProperty": return(Type.IntProperty);

            case "FloatProperty": return(Type.FloatProperty);

            case "ObjectProperty": return(Type.ObjectProperty);

            case "NameProperty": return(Type.NameProperty);

            case "BoolProperty": return(Type.BoolProperty);

            case "ByteProperty": return(Type.ByteProperty);

            case "ArrayProperty": return(Type.ArrayProperty);

            case "DelegateProperty": return(Type.DelegateProperty);

            case "StrProperty": return(Type.StrProperty);

            case "StringRefProperty": return(Type.StringRefProperty);

            default:
                return(Type.Unknown);
            }
        }
コード例 #7
0
ファイル: AnimSet.cs プロジェクト: CreeperLava/ME3Explorer
        public AnimSet(PCCObject Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            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;
                }
        }
コード例 #8
0
        public WwiseAmbientSound(PCCObject Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            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();
        }
コード例 #9
0
        public AnimNodeSlot(PCCObject Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            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;
                }
        }
コード例 #10
0
        public BioAnimSetData(PCCObject Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            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;
                }
        }
コード例 #11
0
        public MantleMarker(PCCObject Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            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();
        }
コード例 #12
0
ファイル: DecalActor.cs プロジェクト: CreeperLava/ME3Explorer
        public DecalActor(PCCObject Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            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);
        }
コード例 #13
0
 public TreeNode ToTree(int MyIndex, TalkFile talk, PCCObject pcc)
 {
     string s = "";
     if (Text.Length != 0)
         s = Text.Substring(0, Text.Length - 1);
     TreeNode res = new TreeNode(MyIndex + " : " + s + "  " + talk.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 
                       + " " 
                       + talk.findDataById(e.refParaphrase) 
                       + " " 
                       + e.Index 
                       + " " 
                       + pcc.getNameEntry(e.CategoryType)
                       + " " 
                       + 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 + " " + talk.findDataById(refText));
     res.Nodes.Add("GUIStyle : (" + pcc.getNameEntry(GUIStyleType) + ") " + pcc.getNameEntry(GUIStyleValue));
     return res;
 }
コード例 #14
0
        public WwiseEnvironmentVolume(PCCObject Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            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);
        }
コード例 #15
0
        public AnimSequence(PCCObject Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;            
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            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();
        }
コード例 #16
0
        public SplineActor(PCCObject Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            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();
        }
コード例 #17
0
 public static Vector3 GetLocation(PCCObject Pcc, int Index)
 {
     Vector3 r = new Vector3();
     if (!Pcc.isExport(Index))
         return new Vector3();
     List<PropertyReader.Property> pp = PropertyReader.getPropList(Pcc,Pcc.Exports[Index].Data);
     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;
 }
コード例 #18
0
 public LightVolume(PCCObject Pcc, int Index)
 {
     pcc = Pcc;
     MyIndex = Index;
     if (pcc.isExport(Index))
         data = pcc.Exports[Index].Data;
     Props = PropertyReader.getPropList(pcc, data);
     BitConverter.IsLittleEndian = true;
     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);
 }
コード例 #19
0
        private static PropertyValue ReadValue(PCCObject pcc, byte[] raw, int start, int type)
        {
            PropertyValue v = new PropertyValue();

            switch (pcc.Names[type])
            {
            case "IntProperty":
            case "FloatProperty":
            case "ObjectProperty":
            case "StringRefProperty":
                v.IntValue = BitConverter.ToInt32(raw, start);
                v.len      = 4;
                break;

            case "NameProperty":
                v.IntValue = BitConverter.ToInt32(raw, start);
                var nameRef = new NameReference();
                nameRef.index = v.IntValue;
                nameRef.count = BitConverter.ToInt32(raw, start + 4);
                nameRef.Name  = pcc.getNameEntry(nameRef.index);
                if (nameRef.count > 0)
                {
                    nameRef.Name += "_" + (nameRef.count - 1);
                }
                v.NameValue = nameRef;
                v.len       = 8;
                break;

            case "BoolProperty":
                if (start < raw.Length)
                {
                    v.IntValue = raw[start];
                }
                v.len = 1;
                break;
            }
            return(v);
        }
コード例 #20
0
 public BlockingVolume(PCCObject Pcc, int Index)
 {
     pcc = Pcc;
     MyIndex = Index;
     if (pcc.isExport(Index))
         data = pcc.Exports[Index].Data;
     Props = PropertyReader.getPropList(pcc, data);
     BitConverter.IsLittleEndian = true;
     Vector3 v;
     Tag = -1;
     Group = -1;
     foreach (PropertyReader.Property p in Props)
         switch (pcc.getNameEntry(p.Name))
         {
             #region Props
             case "bAllowFluidSurfaceInteraction":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bAllowFluidSurfaceInteraction = true;
                 break;
             case "bBlockCamera":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bBlockCamera = true;
                 break;
             case "bCanStepUpOn":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bCanStepUpOn = true;
                 break;
             case "bCollideActors":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bCollideActors = true;
                 break;
             case "bHiddenEdGroup":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bHiddenEdGroup = true;
                 break;
             case "bInclusionaryList":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bInclusionaryList = true;
                 break;
             case "bPathColliding":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bPathColliding = true;
                 break;
             case "bSafeFall":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bSafeFall = true;
                 break;
             case "OverridePhysMat":
                 if (p.raw[p.raw.Length - 1] == 1)
                     OverridePhysMat = true;
                 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 "Tag":
                 Tag = p.Value.IntValue;
                 break;
             case "Group":
                 Group = p.Value.IntValue;
                 break;
             case "location":
                 v.X = BitConverter.ToSingle(p.raw, p.raw.Length - 12);
                 v.Y = BitConverter.ToSingle(p.raw, p.raw.Length - 8);
                 v.Z = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 location = v;
                 break;
             case "DrawScale3D":                        
                 v.X = BitConverter.ToSingle(p.raw, p.raw.Length - 12);
                 v.Y = BitConverter.ToSingle(p.raw, p.raw.Length - 8);
                 v.Z = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 DrawScale3D = v;
                 break;
             #endregion
         }
     MyMatrix = Matrix.Scaling(DrawScale3D) * Matrix.Translation(location);
 }
コード例 #21
0
ファイル: PropDumper.cs プロジェクト: Dybuk/ME3Explorer
        public void LetsDump2(string classname)
        {
            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 path = ME3Directory.cookedPath;
            string[] files = Directory.GetFiles(path,"*.pcc");
            pb1.Minimum = 0;
            rtb1.Text = "";
            pauseToolStripMenuItem.Visible = true;
            pb2.Value = 0;
            pb2.Maximum = files.Length;
            List<string> Names = new List<string>();
            List<string> Types = new List<string>();
            List<string> First = new List<string>();
            DebugOutput.Clear();
            for (int i = 0; i < files.Length; i++)
                {

                    while (pause)
                        Application.DoEvents();
                    pcc = new PCCObject(files[i]);
                    DebugOutput.PrintLn(i + "/" + files.Length + " Scanning file : " + Path.GetFileName(files[i]));
                    pb1.Maximum = pcc.Exports.Count;
                    pb2.Value = i;
                    for (int j = 0; j < pcc.Exports.Count; j++)
                    {
                        PCCObject.ExportEntry ent = pcc.Exports[j];
                        if (ent.ClassName == classname)
                        {
                            List<PropertyReader.Property> p = PropertyReader.getPropList(pcc, ent.Data);
                            for (int k = 0; k < p.Count; k++)
                            {
                                PropertyReader.Property prop = p[k];
                                int found = -1;
                                for (int l = 0; l < Names.Count(); l++)
                                    if (pcc.getNameEntry(prop.Name) == Names[l])
                                        found = l;
                                if (found == -1)
                                {
                                    Names.Add(pcc.getNameEntry(prop.Name));
                                    Types.Add(PropertyReader.TypeToString((int)prop.TypeVal));
                                    First.Add(Path.GetFileName(files[i]) + " #" + j);
                                }
                            }
                        }
                        if (j%500 == 0)
                        {
                            pb1.Value = j;
                            Status.Text = "State : " + j + " / " + pcc.Exports.Count;
                            string s = "Possible properties found so far for class \"" + classname + "\":\n";
                            for (int k = 0; k < Names.Count(); k++)
                                s += Types[k] + " : \"" + Names[k] + "\" first found: " + First[k] +"\n";
                            Action action = () => rtb1.Text = s;
                            rtb1.Invoke(action);
                            action = () => rtb1.SelectionStart = s.Length;
                            rtb1.Invoke(action);
                            action = () => rtb1.ScrollToCaret();
                            rtb1.Invoke(action);
                            Application.DoEvents();
                        }
                    }

                }
            Status.Text = "State : Done";
            string t = "Possible properties found for class \"" + classname + "\":\n";
            for (int k = 0; k < Names.Count(); k++)
                t += Types[k] + " : \"" + Names[k] + "\" first found: " + First[k] + "\n";
            rtb1.Text = t;
            rtb1.SelectionStart = rtb1.TextLength;
            rtb1.ScrollToCaret();
            pb1.Value = 0;
            pauseToolStripMenuItem.Visible = false;
        }
コード例 #22
0
 private static Type getType(PCCObject pcc, int type)
 {
     switch (pcc.getNameEntry(type))
     {
         case "None": return Type.None;
         case "StructProperty": return Type.StructProperty;
         case "IntProperty": return Type.IntProperty;
         case "FloatProperty": return Type.FloatProperty;
         case "ObjectProperty": return Type.ObjectProperty;
         case "NameProperty": return Type.NameProperty;
         case "BoolProperty": return Type.BoolProperty;
         case "ByteProperty": return Type.ByteProperty;
         case "ArrayProperty": return Type.ArrayProperty;
         case "DelegateProperty": return Type.DelegateProperty;
         case "StrProperty": return Type.StrProperty;
         case "StringRefProperty": return Type.StringRefProperty;                    
         default:
             return Type.Unknown;
     }
 }
コード例 #23
0
        public static List<Property> ReadProp(PCCObject pcc, byte[] raw, int start)
        {
            Property p;
            PropertyValue v;
            int sname;
            List<Property> result = new List<Property>();
            int pos = start;
            if(raw.Length - pos < 8)
                return result;
            int name = (int)BitConverter.ToInt64(raw, pos);
            if (!pcc.isName(name))
                return result;
            string t = pcc.Names[name];
            if (pcc.Names[name] == "None")
            {
                p = new Property();
                p.Name = name;
                p.TypeVal = Type.None;
                p.i = 0;                
                p.offsetval = pos;
                p.Size = 8;
                p.Value = new PropertyValue();
                p.raw = BitConverter.GetBytes((Int64)name);
                p.offend = pos + 8;
                result.Add(p);
                return result;
            }
            int type = (int)BitConverter.ToInt64(raw, pos + 8);            
            int size = BitConverter.ToInt32(raw, pos + 16);
            int idx = BitConverter.ToInt32(raw, pos + 20);
            if (!pcc.isName(type) || size < 0 || size >= raw.Length)
                return result;
            string tp = pcc.Names[type];
            switch (tp)
            {

                case "DelegateProperty":
                    p = new Property();
                    p.Name = name;
                    p.TypeVal = Type.DelegateProperty;
                    p.i = 0;
                    p.offsetval = pos + 24;
                    v = new PropertyValue();
                    v.IntValue = BitConverter.ToInt32(raw, pos + 28);
                    v.len = size;
                    v.Array = new List<PropertyValue>();
                    pos += 24;
                    for (int i = 0; i < size; i++)
                    {
                        PropertyValue v2 = new PropertyValue();
                        if(pos < raw.Length)
                            v2.IntValue = raw[pos];
                        v.Array.Add(v2);
                        pos ++;
                    }
                    p.Value = v;
                    break;
                case "ArrayProperty":
                    int count = (int)BitConverter.ToInt64(raw, pos + 24);
                    p = new Property();
                    p.Name = name;
                    p.TypeVal = Type.ArrayProperty;
                    p.i = 0;
                    p.offsetval = pos + 24;
                    v = new PropertyValue();
                    v.IntValue = type;
                    v.len = size - 4;
                    count = v.len;//TODO can be other objects too
                    v.Array = new List<PropertyValue>();
                    pos += 28;
                    for (int i = 0; i < count; i++)
                    {
                        PropertyValue v2 = new PropertyValue();
                        if(pos < raw.Length)
                            v2.IntValue = raw[pos];
                        v.Array.Add(v2);
                        pos ++;
                    }
                    p.Value = v;
                    break;
                case "StrProperty":
                    count = (int)BitConverter.ToInt64(raw, pos + 24);
                    p = new Property();
                    p.Name = name;
                    p.TypeVal = Type.StrProperty;
                    p.i = 0;
                    p.offsetval = pos + 24;
                    count *= -1;
                    v = new PropertyValue();
                    v.IntValue = type;
                    v.len = count;
                    pos += 28;
                    string s = "";
                    for (int i = 0; i < count; i++)
                    {
                        s += (char)raw[pos];
                        pos += 2;
                    }
                    v.StringValue = s;
                    p.Value = v;
                    break;
                case "StructProperty":
                    sname = (int)BitConverter.ToInt64(raw, pos + 24);
                    p = new Property();
                    p.Name = name;
                    p.TypeVal = Type.StructProperty;
                    p.i = 0;
                    p.offsetval = pos + 24;
                    v = new PropertyValue();
                    v.IntValue = sname;
                    v.len = size;
                    v.Array = new List<PropertyValue>();
                    pos += 32;
                    for (int i = 0; i < size; i++)
                    {
                        PropertyValue v2 = new PropertyValue();
                        if (pos < raw.Length)
                            v2.IntValue = raw[pos];
                        v.Array.Add(v2);
                        pos++;
                    }
                    p.Value = v;
                    break;
                case "ByteProperty":
                    sname = (int)BitConverter.ToInt64(raw, pos + 24);
                    p = new Property();
                    p.Name = name;
                    p.TypeVal = Type.ByteProperty;
                    p.i = 0;
                    p.offsetval = pos + 32;
                    v = new PropertyValue();
                    v.StringValue = pcc.getNameEntry(sname);
                    v.len = size;
                    pos += 32;
                    v.IntValue = (int)BitConverter.ToInt64(raw, pos);
                    pos += size;
                    p.Value = v;
                    break;                
                default:
                    p = new Property();
                    p.Name = name;
                    p.TypeVal = getType(pcc,type);
                    p.i = 0;
                    p.offsetval = pos + 24;
                    p.Value = ReadValue(pcc, raw, pos + 24, type);
                    pos += p.Value.len + 24;
                    break;
            }
            p.raw = new byte[pos - start];
            p.offend = pos;
            if(pos < raw.Length)
                for (int i = 0; i < pos - start; i++) 
                    p.raw[i] = raw[start + i];
            result.Add(p);            
            if(pos!=start) result.AddRange(ReadProp(pcc, raw, pos));
            return result;
        }
コード例 #24
0
 public static CustomProperty PropertyToGrid(Property p, PCCObject pcc)
 {
     string cat = p.TypeVal.ToString();
     CustomProperty pg;
     switch(p.TypeVal)
     {
         case Type.BoolProperty :
             pg = new CustomProperty(pcc.Names[p.Name], cat, (p.Value.IntValue == 1), typeof(bool), false, true);
             break;
         case Type.FloatProperty:
             byte[] buff = BitConverter.GetBytes(p.Value.IntValue);
             float f = BitConverter.ToSingle(buff, 0);
             pg = new CustomProperty(pcc.Names[p.Name], cat, f, typeof(float), false, true);
             break;
         case Type.ByteProperty:
         case Type.NameProperty:
             NameProp pp = new NameProp();
             pp.name = pcc.getNameEntry(p.Value.IntValue);
             pp.nameindex = p.Value.IntValue;
             pg = new CustomProperty(pcc.Names[p.Name], cat, pp, typeof(NameProp), false, true);
             break;
         case Type.ObjectProperty:
             ObjectProp ppo = new ObjectProp();
             ppo.name = pcc.getObjectName(p.Value.IntValue);
             ppo.nameindex = p.Value.IntValue;
             pg = new CustomProperty(pcc.Names[p.Name], cat, ppo, typeof(ObjectProp), false, true);
             break;
         case Type.StructProperty:
             StructProp ppp = new StructProp();
             ppp.name = pcc.getNameEntry(p.Value.IntValue);
             ppp.nameindex = p.Value.IntValue;
             byte[] buf = new byte[p.Value.Array.Count()];
             for (int i = 0; i < p.Value.Array.Count(); i++)
                 buf[i] = (byte)p.Value.Array[i].IntValue;
             List<int> buf2 = new List<int>();
             for (int i = 0; i < p.Value.Array.Count() / 4; i++)
                 buf2.Add(BitConverter.ToInt32(buf ,i * 4));
             ppp.data = buf2.ToArray();
             pg = new CustomProperty(pcc.Names[p.Name], cat, ppp, typeof(StructProp), false, true);
             break;                    
         default:
             pg = new CustomProperty(pcc.Names[p.Name],cat,p.Value.IntValue,typeof(int),false,true);
             break;
     }
     return pg;
 }
コード例 #25
0
        public StaticMeshComponent (PCCObject Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {
                    #region
                    case "LightMapEncoding":
						LightMapEncoding = p.Value.IntValue;
						break;
					case "RBChannel":
						RBChannel = p.Value.IntValue;
						break;
					case "DepthPriorityGroup":
						DepthPriorityGroup = p.Value.IntValue;
						break;
					case "TickGroup":
						TickGroup = p.Value.IntValue;
						break;
					case "bIgnoreInstanceForTextureStreaming":
						if (p.raw[p.raw.Length - 1] == 1)
						bIgnoreInstanceForTextureStreaming = true;
						break;
					case "CastShadow":
						if (p.raw[p.raw.Length - 1] == 1)
						CastShadow = true;
						break;
					case "CollideActors":
						if (p.raw[p.raw.Length - 1] == 1)
						CollideActors = true;
						break;
					case "BlockRigidBody":
						if (p.raw[p.raw.Length - 1] == 1)
						BlockRigidBody = true;
						break;
					case "bForceDirectLightMap":
						if (p.raw[p.raw.Length - 1] == 1)
						bForceDirectLightMap = true;
						break;
					case "bCastDynamicShadow":
						if (p.raw[p.raw.Length - 1] == 1)
						bCastDynamicShadow = true;
						break;
					case "bAcceptsDynamicDominantLightShadows":
						if (p.raw[p.raw.Length - 1] == 1)
						bAcceptsDynamicDominantLightShadows = true;
						break;
					case "bAcceptsLights":
						if (p.raw[p.raw.Length - 1] == 1)
						bAcceptsLights = true;
						break;
					case "bAcceptsDynamicLights":
						if (p.raw[p.raw.Length - 1] == 1)
						bAcceptsDynamicLights = true;
						break;
					case "bCullModulatedShadowOnBackfaces":
						if (p.raw[p.raw.Length - 1] == 1)
						bCullModulatedShadowOnBackfaces = true;
						break;
					case "bCullModulatedShadowOnEmissive":
						if (p.raw[p.raw.Length - 1] == 1)
						bCullModulatedShadowOnEmissive = true;
						break;
					case "bAllowAmbientOcclusion":
						if (p.raw[p.raw.Length - 1] == 1)
						bAllowAmbientOcclusion = true;
						break;
					case "bUsePrecomputedShadows":
						if (p.raw[p.raw.Length - 1] == 1)
						bUsePrecomputedShadows = true;
						break;
					case "CanBlockCamera":
						if (p.raw[p.raw.Length - 1] == 1)
						CanBlockCamera = true;
						break;
					case "bAllowShadowFade":
						if (p.raw[p.raw.Length - 1] == 1)
						bAllowShadowFade = true;
						break;
					case "bBioIsReceivingDecals":
						if (p.raw[p.raw.Length - 1] == 1)
						bBioIsReceivingDecals = true;
						break;
					case "BlockNonZeroExtent":
						if (p.raw[p.raw.Length - 1] == 1)
						BlockNonZeroExtent = true;
						break;
					case "bAcceptsStaticDecals":
						if (p.raw[p.raw.Length - 1] == 1)
						bAcceptsStaticDecals = true;
						break;
					case "bAcceptsDynamicDecals":
						if (p.raw[p.raw.Length - 1] == 1)
						bAcceptsDynamicDecals = true;
						break;
					case "bAcceptsFoliage":
						if (p.raw[p.raw.Length - 1] == 1)
						bAcceptsFoliage = true;
						break;
					case "HiddenGame":
						if (p.raw[p.raw.Length - 1] == 1)
						HiddenGame = true;
						break;
					case "bBioForcePrecomputedShadows":
						if (p.raw[p.raw.Length - 1] == 1)
						bBioForcePrecomputedShadows = true;
						break;
					case "bCastHiddenShadow":
						if (p.raw[p.raw.Length - 1] == 1)
						bCastHiddenShadow = true;
						break;
					case "bUseAsOccluder":
						if (p.raw[p.raw.Length - 1] == 1)
						bUseAsOccluder = true;
						break;
					case "BlockZeroExtent":
						if (p.raw[p.raw.Length - 1] == 1)
						BlockZeroExtent = true;
						break;
					case "bAllowCullDistanceVolume":
						if (p.raw[p.raw.Length - 1] == 1)
						bAllowCullDistanceVolume = true;
						break;
					case "bAllowApproximateOcclusion":
						if (p.raw[p.raw.Length - 1] == 1)
						bAllowApproximateOcclusion = true;
						break;
					case "bSelfShadowOnly":
						if (p.raw[p.raw.Length - 1] == 1)
						bSelfShadowOnly = true;
						break;
					case "OverridePhysMat":
						if (p.raw[p.raw.Length - 1] == 1)
						OverridePhysMat = true;
						break;
					case "bUseOnePassLightingOnTranslucency":
						if (p.raw[p.raw.Length - 1] == 1)
						bUseOnePassLightingOnTranslucency = true;
						break;
					case "bLockLightingCache":
						if (p.raw[p.raw.Length - 1] == 1)
						bLockLightingCache = true;
						break;
					case "bDisableAllRigidBody":
						if (p.raw[p.raw.Length - 1] == 1)
						bDisableAllRigidBody = true;
						break;
					case "BlockActors":
						if (p.raw[p.raw.Length - 1] == 1)
						BlockActors = true;
						break;
					case "bNotifyRigidBodyCollision":
						if (p.raw[p.raw.Length - 1] == 1)
						bNotifyRigidBodyCollision = true;
						break;
					case "bIgnoreRadialImpulse":
						if (p.raw[p.raw.Length - 1] == 1)
						bIgnoreRadialImpulse = true;
						break;
					case "bIgnoreRadialForce":
						if (p.raw[p.raw.Length - 1] == 1)
						bIgnoreRadialForce = true;
						break;
					case "HiddenEditor":
						if (p.raw[p.raw.Length - 1] == 1)
						HiddenEditor = true;
						break;
					case "StaticMesh":
						StaticMesh_ = p.Value.IntValue;
						break;
					case "ReplacementPrimitive":
						ReplacementPrimitive = p.Value.IntValue;
						break;
					case "LightEnvironment":
						LightEnvironment = p.Value.IntValue;
						break;
					case "ShadowParent":
						ShadowParent = p.Value.IntValue;
						break;
					case "PhysMaterialOverride":
						PhysMaterialOverride = p.Value.IntValue;
						break;
					case "MaxDrawDistance":
						MaxDrawDistance = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
						break;
					case "CachedMaxDrawDistance":
						CachedMaxDrawDistance = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
						break;
					case "MinDrawDistance":
						MinDrawDistance = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
						break;
					case "AudioObstruction":
						AudioObstruction = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
						break;
					case "AudioOcclusion":
						AudioOcclusion = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
						break;
					case "OverriddenLODMaxRange":
						OverriddenLODMaxRange = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
						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;
					case "MassiveLODDistance":
						MassiveLODDistance = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
						break;
					case "MotionBlurScale":
						MotionBlurScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
						break;
					case "TranslucencySortPriority":
						TranslucencySortPriority = p.Value.IntValue;
						break;
					case "LocalTranslucencySortPriority":
						LocalTranslucencySortPriority = p.Value.IntValue;
						break;
					case "ForcedLodModel":
						ForcedLodModel = p.Value.IntValue;
						break;
                    #endregion
                }
            if (StaticMesh_ - 1 >= 0 && StaticMesh_ - 1 < pcc.Exports.Count)
                if (pcc.Exports[StaticMesh_ - 1].ClassName == "StaticMesh")
                {
                    STM = new StaticMesh(pcc, StaticMesh_ - 1);
                    STM.Mesh.Bounds.t = null;//save memory
                    STM.Mesh.Edges.t = null;
                    STM.Mesh.Buffers.t = null;
                    STM.Mesh.IdxBuf.t = null;
                    STM.Mesh.kDOPTree.t = null;
                    STM.Mesh.Mat.t = null;
                    STM.Mesh.RawTris.t = null;
                    STM.Mesh.UnknownPart.t = null;
                    STM.Mesh.Vertices.t = null;
                }
            MyMatrix = Matrix.Identity;
            MyMatrix *=  Matrix.Scaling(Scale3D);
            MyMatrix *=  Matrix.Scaling(Scale, Scale, Scale);
            Vector3 rot = RotatorToDX(Rotation);
            MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z);
            MyMatrix *= Matrix.Translation(Translation);
        }
コード例 #26
0
        public static List <Property> ReadProp(PCCObject pcc, byte[] raw, int start)
        {
            Property        p;
            PropertyValue   v;
            int             sname;
            List <Property> result = new List <Property>();
            int             pos    = start;

            if (raw.Length - pos < 8)
            {
                return(result);
            }
            int name = (int)BitConverter.ToInt64(raw, pos);

            if (!pcc.isName(name))
            {
                return(result);
            }
            string t = pcc.Names[name];

            if (pcc.Names[name] == "None")
            {
                p           = new Property();
                p.Name      = name;
                p.TypeVal   = Type.None;
                p.i         = 0;
                p.offsetval = pos;
                p.Size      = 8;
                p.Value     = new PropertyValue();
                p.raw       = BitConverter.GetBytes((Int64)name);
                p.offend    = pos + 8;
                result.Add(p);
                return(result);
            }
            int type = (int)BitConverter.ToInt64(raw, pos + 8);
            int size = BitConverter.ToInt32(raw, pos + 16);
            int idx  = BitConverter.ToInt32(raw, pos + 20);

            if (!pcc.isName(type) || size < 0 || size >= raw.Length)
            {
                return(result);
            }
            string tp = pcc.Names[type];

            switch (tp)
            {
            case "DelegateProperty":
                p           = new Property();
                p.Name      = name;
                p.TypeVal   = Type.DelegateProperty;
                p.i         = 0;
                p.offsetval = pos + 24;
                v           = new PropertyValue();
                v.IntValue  = BitConverter.ToInt32(raw, pos + 28);
                v.len       = size;
                v.Array     = new List <PropertyValue>();
                pos        += 24;
                for (int i = 0; i < size; i++)
                {
                    PropertyValue v2 = new PropertyValue();
                    if (pos < raw.Length)
                    {
                        v2.IntValue = raw[pos];
                    }
                    v.Array.Add(v2);
                    pos++;
                }
                p.Value = v;
                break;

            case "ArrayProperty":
                int count = (int)BitConverter.ToInt64(raw, pos + 24);
                p           = new Property();
                p.Name      = name;
                p.TypeVal   = Type.ArrayProperty;
                p.i         = 0;
                p.offsetval = pos + 24;
                v           = new PropertyValue();
                v.IntValue  = type;
                v.len       = size - 4;
                count       = v.len;//TODO can be other objects too
                v.Array     = new List <PropertyValue>();
                pos        += 28;
                for (int i = 0; i < count; i++)
                {
                    PropertyValue v2 = new PropertyValue();
                    if (pos < raw.Length)
                    {
                        v2.IntValue = raw[pos];
                    }
                    v.Array.Add(v2);
                    pos++;
                }
                p.Value = v;
                break;

            case "StrProperty":
                count       = (int)BitConverter.ToInt64(raw, pos + 24);
                p           = new Property();
                p.Name      = name;
                p.TypeVal   = Type.StrProperty;
                p.i         = 0;
                p.offsetval = pos + 24;
                count      *= -1;
                v           = new PropertyValue();
                v.IntValue  = type;
                v.len       = count;
                pos        += 28;
                string s = "";
                for (int i = 0; i < count; i++)
                {
                    s   += (char)raw[pos];
                    pos += 2;
                }
                v.StringValue = s;
                p.Value       = v;
                break;

            case "StructProperty":
                sname       = (int)BitConverter.ToInt64(raw, pos + 24);
                p           = new Property();
                p.Name      = name;
                p.TypeVal   = Type.StructProperty;
                p.i         = 0;
                p.offsetval = pos + 24;
                v           = new PropertyValue();
                v.IntValue  = sname;
                v.len       = size;
                v.Array     = new List <PropertyValue>();
                pos        += 32;
                for (int i = 0; i < size; i++)
                {
                    PropertyValue v2 = new PropertyValue();
                    if (pos < raw.Length)
                    {
                        v2.IntValue = raw[pos];
                    }
                    v.Array.Add(v2);
                    pos++;
                }
                p.Value = v;
                break;

            case "ByteProperty":
                sname         = (int)BitConverter.ToInt64(raw, pos + 24);
                p             = new Property();
                p.Name        = name;
                p.TypeVal     = Type.ByteProperty;
                p.i           = 0;
                p.offsetval   = pos + 32;
                v             = new PropertyValue();
                v.StringValue = pcc.getNameEntry(sname);
                v.len         = size;
                pos          += 32;
                v.IntValue    = (int)BitConverter.ToInt64(raw, pos);
                pos          += size;
                p.Value       = v;
                break;

            default:
                p           = new Property();
                p.Name      = name;
                p.TypeVal   = getType(pcc, type);
                p.i         = 0;
                p.offsetval = pos + 24;
                p.Value     = ReadValue(pcc, raw, pos + 24, type);
                pos        += p.Value.len + 24;
                break;
            }
            p.raw    = new byte[pos - start];
            p.offend = pos;
            if (pos < raw.Length)
            {
                for (int i = 0; i < pos - start; i++)
                {
                    p.raw[i] = raw[start + i];
                }
            }
            result.Add(p);
            if (pos != start)
            {
                result.AddRange(ReadProp(pcc, raw, pos));
            }
            return(result);
        }
コード例 #27
0
        public BrushComponent(PCCObject Pcc, int Index)
        {
            pcc = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
                data = pcc.Exports[Index].Data;
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            foreach (PropertyReader.Property p in Props)
                switch (pcc.getNameEntry(p.Name))
                {

                    case "RBChannel":
                        RBChannel = p.Value.IntValue;
                        break;
                    case "BlockRigidBody":
                        if (p.raw[p.raw.Length - 1] == 1)
                            BlockRigidBody = true;
                        break;
                    case "CollideActors":
                        if (p.raw[p.raw.Length - 1] == 1)
                            CollideActors = true;
                        break;
                    case "CanBlockCamera":
                        if (p.raw[p.raw.Length - 1] == 1)
                            CanBlockCamera = true;
                        break;
                    case "BlockZeroExtent":
                        if (p.raw[p.raw.Length - 1] == 1)
                            BlockZeroExtent = true;
                        break;
                    case "BlockNonZeroExtent":
                        if (p.raw[p.raw.Length - 1] == 1)
                            BlockNonZeroExtent = true;
                        break;
                    case "BlockActors":
                        if (p.raw[p.raw.Length - 1] == 1)
                            BlockActors = true;
                        break;
                    case "bAcceptsDynamicDecals":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bAcceptsDynamicDecals = true;
                        break;
                    case "bCastDynamicShadow":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bCastDynamicShadow = true;
                        break;
                    case "bAcceptsDynamicDominantLightShadows":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bAcceptsDynamicDominantLightShadows = true;
                        break;
                    case "bAcceptsLights":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bAcceptsLights = true;
                        break;
                    case "bAcceptsDynamicLights":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bAcceptsDynamicLights = true;
                        break;
                    case "bAllowCullDistanceVolume":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bAllowCullDistanceVolume = true;
                        break;
                    case "bAcceptsFoliage":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bAcceptsFoliage = true;
                        break;
                    case "bAllowAmbientOcclusion":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bAllowAmbientOcclusion = true;
                        break;
                    case "bAllowShadowFade":
                        if (p.raw[p.raw.Length - 1] == 1)
                            bAllowShadowFade = true;
                        break;
                    case "Brush":
                        Brush = p.Value.IntValue;
                        break;
                    case "ReplacementPrimitive":
                        ReplacementPrimitive = p.Value.IntValue;
                        break;
                    case "PhysMaterialOverride":
                        PhysMaterialOverride = p.Value.IntValue;
                        break;
                    case "CachedPhysBrushDataVersion":
                        CachedPhysBrushDataVersion = p.Value.IntValue;
                        break;
                    case "BrushAggGeom":
                        ReadMesh(p.raw);
                        break;
                        
                }
        }        
コード例 #28
0
ファイル: SubtitleScanner.cs プロジェクト: Dybuk/ME3Explorer
 public void ScanDLCfolder1()
 {
     DebugOutput.PrintLn("\n\nDLC Scan for unpacked files...\n", true);
     string dir = ME3Directory.DLCPath;
     string[] files = Directory.GetFiles(dir, "*.pcc", SearchOption.AllDirectories);
     if (files.Length == 0)
         return;
     pbar1.Maximum = files.Length - 1;
     int count = 0;
     foreach (string file in files)
         if (!file.ToLower().Contains("patch"))
         {
             DebugOutput.PrintLn("Scan file #" + count + " : " + file, count % 10 == 0);
             try
             {
                 PCCObject pcc = new PCCObject(file);
                 for (int i = 0; i < pcc.Exports.Count; i++)
                     if (pcc.Exports[i].ClassName == "BioConversation")
                     {
                         DebugOutput.PrintLn("Found dialog \"" + pcc.Exports[i].ObjectName + "\"", false);
                         BioConversation Dialog = new BioConversation(pcc, i);
                         foreach (BioConversation.EntryListStuct e in Dialog.EntryList)
                         {
                             string text = talkFile.findDataById(e.refText);
                             if (text.Length != 7 && text != "No Data")
                             {
                                 EntryStruct t = new EntryStruct();
                                 t.inDLC = false;
                                 t.text = text;
                                 t.ID = e.refText;
                                 t.indexpcc = i;
                                 t.pathafc = "";//Todo
                                 t.pathdlc = "";
                                 t.pathpcc = file;
                                 t.convname = pcc.Exports[i].ObjectName;
                                 if (e.SpeakerIndex >= 0 && e.SpeakerIndex < Dialog.SpeakerList.Count)
                                     t.speaker = pcc.getNameEntry(Dialog.SpeakerList[e.SpeakerIndex]);
                                 else
                                     t.speaker = "unknown";
                                 if (t.speaker == null || t.speaker == "")
                                     t.speaker = "unknown";
                                 Entries.Add(t);
                                 DebugOutput.PrintLn("Requ.: (" + t.speaker + ") " + t.text, false);
                             }
                         }
                         foreach (BioConversation.ReplyListStruct e in Dialog.ReplyList)
                         {
                             string text = talkFile.findDataById(e.refText);
                             if (text.Length != 7 && text != "No Data")
                             {
                                 EntryStruct t = new EntryStruct();
                                 t.inDLC = false;
                                 t.text = text;
                                 t.ID = e.refText;
                                 t.indexpcc = i;
                                 t.pathafc = "";//Todo
                                 t.pathdlc = "";
                                 t.pathpcc = file;
                                 t.convname = pcc.Exports[i].ObjectName;
                                 Entries.Add(t);
                                 DebugOutput.PrintLn("Reply: " + t.text, false);
                             }
                         }
                     }
                 if (count % 10 == 0)
                 {
                     Application.DoEvents();
                     pbar1.Value = count;
                 }
                 count++;
             }
             catch (Exception ex)
             {
                 DebugOutput.PrintLn("=====ERROR=====\n" + ex.ToString() + "\n=====ERROR=====");
             }
         }
 }
コード例 #29
0
ファイル: SubtitleScanner.cs プロジェクト: Dybuk/ME3Explorer
 public void ScanDLCfolder2()
 {
     DebugOutput.PrintLn("\n\nDLC Scan for packed files...\n", true);
     string dir = ME3Directory.DLCPath;
     string[] files = Directory.GetFiles(dir, "*.sfar", SearchOption.AllDirectories);
     if (files.Length == 0)
         return;
     pbar1.Maximum = files.Length - 1;
     int count = 0;
     foreach (string file in files)
         if (!file.ToLower().Contains("patch"))
         {
             DebugOutput.PrintLn("Scan file #" + count + " : " + file, count % 10 == 0);
             try
             {
                 DLCPackage dlc = new DLCPackage(file);
                 DebugOutput.PrintLn("found " + dlc.Files.Length + " files : " + file);
                 for (int j = 0; j < dlc.Files.Length; j++)
                 {
                     if (dlc.Files[j].FileName.ToLower().EndsWith(".pcc"))
                     {
                         string filename = dlc.Files[j].FileName;
                         DebugOutput.PrintLn(" " + j.ToString("d4") + " / " + dlc.Files.Length.ToString("d4") + " : opening " + Path.GetFileName(filename),true);
                         MemoryStream mem = dlc.DecompressEntry(j);
                         File.WriteAllBytes("temp.pcc", mem.ToArray());
                         PCCObject pcc = new PCCObject("temp.pcc");
                         for (int i = 0; i < pcc.Exports.Count; i++)
                             if (pcc.Exports[i].ClassName == "BioConversation")
                             {
                                 DebugOutput.PrintLn("Found dialog \"" + pcc.Exports[i].ObjectName + "\"", false);
                                 BioConversation Dialog = new BioConversation(pcc, i);
                                 foreach (BioConversation.EntryListStuct e in Dialog.EntryList)
                                 {
                                     string text = talkFile.findDataById(e.refText);
                                     if (text.Length != 7 && text != "No Data")
                                     {
                                         EntryStruct t = new EntryStruct();
                                         t.inDLC = true;
                                         t.text = text;
                                         t.ID = e.refText;
                                         t.indexpcc = i;
                                         t.pathafc = "";//Todo
                                         t.pathdlc = file;
                                         t.pathpcc = filename;
                                         t.convname = pcc.Exports[i].ObjectName;
                                         if (e.SpeakerIndex >= 0 && e.SpeakerIndex < Dialog.SpeakerList.Count)
                                             t.speaker = pcc.getNameEntry(Dialog.SpeakerList[e.SpeakerIndex]);
                                         else
                                             t.speaker = "unknown";
                                         if (t.speaker == null || t.speaker == "")
                                             t.speaker = "unknown";
                                         Entries.Add(t);
                                         DebugOutput.PrintLn("Requ.: (" + t.speaker + ") " + t.text, false);
                                     }
                                 }
                                 foreach (BioConversation.ReplyListStruct e in Dialog.ReplyList)
                                 {
                                     string text = talkFile.findDataById(e.refText);
                                     if (text.Length != 7 && text != "No Data")
                                     {
                                         EntryStruct t = new EntryStruct();
                                         t.inDLC = true;
                                         t.text = text;
                                         t.ID = e.refText;
                                         t.indexpcc = i;
                                         t.pathafc = "";//Todo
                                         t.pathdlc = file;
                                         t.pathpcc = filename;
                                         t.convname = pcc.Exports[i].ObjectName;
                                         Entries.Add(t);
                                         DebugOutput.PrintLn("Reply: " + t.text, false);
                                     }
                                 }
                             }
                     }
                 }
                 if (count % 10 == 0)
                 {
                     Application.DoEvents();
                     pbar1.Value = count;
                 }
                 count++;
             }
             catch (Exception ex)
             {
                 DebugOutput.PrintLn("=====ERROR=====\n" + ex.ToString() + "\n=====ERROR=====");
             }
         }
     if (File.Exists("temp.pcc"))
         File.Delete("temp.pcc");
 }
コード例 #30
0
 public InterpActor(PCCObject Pcc, int Index)
 {
     pcc = Pcc;
     MyIndex = Index;
     if (pcc.isExport(Index))
         data = pcc.Exports[Index].Data;
     Props = PropertyReader.getPropList(pcc, data);
     BitConverter.IsLittleEndian = true;
     foreach (PropertyReader.Property p in Props)
         switch (pcc.getNameEntry(p.Name))
         {
             #region
             case "Physics":
                 Physics = p.Value.IntValue;
                 break;
             case "RemoteRole":
                 RemoteRole = p.Value.IntValue;
                 break;
             case "bShadowParented":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bShadowParented = true;
                 break;
             case "bCollideActors":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bCollideActors = true;
                 break;
             case "bHidden":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bHidden = true;
                 break;
             case "bPathColliding":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bPathColliding = true;
                 break;
             case "bCanStepUpOn":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bCanStepUpOn = true;
                 break;
             case "bHardAttach":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bHardAttach = true;
                 break;
             case "bStopOnEncroach":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bStopOnEncroach = true;
                 break;
             case "bHiddenEdGroup":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bHiddenEdGroup = true;
                 break;
             case "bNoEncroachCheck":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bNoEncroachCheck = true;
                 break;
             case "bPawnCanBaseOn":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bPawnCanBaseOn = true;
                 break;
             case "bLockLocation":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bLockLocation = true;
                 break;
             case "bCollideComplex":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bCollideComplex = true;
                 break;
             case "bBlockActors":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bBlockActors = true;
                 break;
             case "bHiddenEd":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bHiddenEd = true;
                 break;
             case "bBioSnapToBase":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bBioSnapToBase = true;
                 break;
             case "bIgnoreBaseRotation":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bIgnoreBaseRotation = true;
                 break;
             case "Tag":
                 Tag = p.Value.IntValue;
                 break;
             case "Group":
                 Group = p.Value.IntValue;
                 break;
             case "BaseBoneName":
                 BaseBoneName = p.Value.IntValue;
                 break;
             case "UniqueTag":
                 UniqueTag = p.Value.IntValue;
                 break;
             case "StaticMeshComponent":
                 StaticMeshComponent = p.Value.IntValue;
                 if (pcc.isExport(StaticMeshComponent - 1) && pcc.Exports[StaticMeshComponent - 1].ClassName == "StaticMeshComponent")
                     STMC = new StaticMeshComponent(pcc, StaticMeshComponent - 1);
                 break;
             case "LightEnvironment":
                 LightEnvironment = p.Value.IntValue;
                 break;
             case "CollisionComponent":
                 CollisionComponent = 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 "CreationTime":
                 CreationTime = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "TickFrequencyAtEndDistance":
                 TickFrequencyAtEndDistance = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "NetUpdateFrequency":
                 NetUpdateFrequency = 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;
             #endregion
         }
     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);
 }
コード例 #31
0
        public static CustomProperty PropertyToGrid(Property p, PCCObject pcc)
        {
            string         cat = p.TypeVal.ToString();
            CustomProperty pg;

            switch (p.TypeVal)
            {
            case Type.BoolProperty:
                pg = new CustomProperty(pcc.Names[p.Name], cat, (p.Value.IntValue == 1), typeof(bool), false, true);
                break;

            case Type.FloatProperty:
                byte[] buff = BitConverter.GetBytes(p.Value.IntValue);
                float  f    = BitConverter.ToSingle(buff, 0);
                pg = new CustomProperty(pcc.Names[p.Name], cat, f, typeof(float), false, true);
                break;

            case Type.ByteProperty:
            case Type.NameProperty:
                NameProp pp = new NameProp();
                pp.name      = pcc.getNameEntry(p.Value.IntValue);
                pp.nameindex = p.Value.IntValue;
                pg           = new CustomProperty(pcc.Names[p.Name], cat, pp, typeof(NameProp), false, true);
                break;

            case Type.ObjectProperty:
                ObjectProp ppo = new ObjectProp();
                ppo.name      = pcc.getObjectName(p.Value.IntValue);
                ppo.nameindex = p.Value.IntValue;
                pg            = new CustomProperty(pcc.Names[p.Name], cat, ppo, typeof(ObjectProp), false, true);
                break;

            case Type.StrProperty:
                pg = new CustomProperty(pcc.Names[p.Name], cat, p.Value.StringValue, typeof(string), false, true);
                break;

            case Type.ArrayProperty:
                pg = new CustomProperty(pcc.Names[p.Name], cat, BitConverter.ToInt32(p.raw, 24) + " elements", typeof(string), false, true);
                break;

            case Type.StructProperty:
                string structType = pcc.getNameEntry(p.Value.IntValue);
                if (structType == "Color")
                {
                    ColorProp cp = new ColorProp();
                    cp.name      = structType;
                    cp.nameindex = p.Value.IntValue;
                    System.Drawing.Color color = System.Drawing.Color.FromArgb(BitConverter.ToInt32(p.raw, 32));
                    cp.Alpha = color.A;
                    cp.Red   = color.R;
                    cp.Green = color.G;
                    cp.Blue  = color.B;
                    pg       = new CustomProperty(pcc.Names[p.Name], cat, cp, typeof(ColorProp), false, true);
                }
                else if (structType == "Vector")
                {
                    VectorProp vp = new VectorProp();
                    vp.name      = structType;
                    vp.nameindex = p.Value.IntValue;
                    vp.X         = BitConverter.ToSingle(p.raw, 32);
                    vp.Y         = BitConverter.ToSingle(p.raw, 36);
                    vp.Z         = BitConverter.ToSingle(p.raw, 40);
                    pg           = new CustomProperty(pcc.Names[p.Name], cat, vp, typeof(VectorProp), false, true);
                }
                else if (structType == "Rotator")
                {
                    RotatorProp rp = new RotatorProp();
                    rp.name      = structType;
                    rp.nameindex = p.Value.IntValue;
                    rp.Pitch     = (float)BitConverter.ToInt32(p.raw, 32) * 360f / 65536f;
                    rp.Yaw       = (float)BitConverter.ToInt32(p.raw, 36) * 360f / 65536f;
                    rp.Roll      = (float)BitConverter.ToInt32(p.raw, 40) * 360f / 65536f;
                    pg           = new CustomProperty(pcc.Names[p.Name], cat, rp, typeof(RotatorProp), false, true);
                }
                else if (structType == "LinearColor")
                {
                    LinearColorProp lcp = new LinearColorProp();
                    lcp.name      = structType;
                    lcp.nameindex = p.Value.IntValue;
                    lcp.Red       = BitConverter.ToSingle(p.raw, 32);
                    lcp.Green     = BitConverter.ToSingle(p.raw, 36);
                    lcp.Blue      = BitConverter.ToSingle(p.raw, 40);
                    lcp.Alpha     = BitConverter.ToSingle(p.raw, 44);
                    pg            = new CustomProperty(pcc.Names[p.Name], cat, lcp, typeof(VectorProp), false, true);
                }
                else
                {
                    StructProp ppp = new StructProp();
                    ppp.name      = structType;
                    ppp.nameindex = p.Value.IntValue;
                    byte[] buf = new byte[p.Value.Array.Count()];
                    for (int i = 0; i < p.Value.Array.Count(); i++)
                    {
                        buf[i] = (byte)p.Value.Array[i].IntValue;
                    }
                    List <int> buf2 = new List <int>();
                    for (int i = 0; i < p.Value.Array.Count() / 4; i++)
                    {
                        buf2.Add(BitConverter.ToInt32(buf, i * 4));
                    }
                    ppp.data = buf2.ToArray();
                    pg       = new CustomProperty(pcc.Names[p.Name], cat, ppp, typeof(StructProp), false, true);
                }
                break;

            default:
                pg = new CustomProperty(pcc.Names[p.Name], cat, p.Value.IntValue, typeof(int), false, true);
                break;
            }
            return(pg);
        }
コード例 #32
0
ファイル: PropertyDB.cs プロジェクト: CreeperLava/ME3Explorer
 private void startScanToolStripMenuItem_Click(object sender, EventArgs e)
 {
     string path = ME3Directory.cookedPath;
     string[] files = Directory.GetFiles(path, "*.pcc");
     pb1.Maximum = files.Length;
     DebugOutput.Clear();
     Classes = new List<ClassDef>();
     for (int i = 0; i < files.Length; i++)
     {
         string file = files[i];
         DebugOutput.PrintLn(i.ToString("d4")
                             + "\\"
                             + (files.Length - 1)
                             + " : Loading file \""
                             + file
                             + "\"");
         PCCObject pcc = new PCCObject(file);
         pb2.Maximum = pcc.Exports.Count();
         {
             pb1.Value = i;
             RefreshLists();
             Application.DoEvents();
         }
         for (int j = 0; j < pcc.Exports.Count(); j++)
         {
             if (j % 100 == 0)//refresh
             {
                 pb1.Value = i;
                 pb2.Value = j;
                 Application.DoEvents();
             }
             int f = -1;
             for (int k = 0; k < Classes.Count(); k++)
                 if (Classes[k].name == pcc.Exports[j].ClassName)
                 {
                     f = k;
                     break;
                 }
             if (f == -1)//New Class found, add
             {
                 ClassDef tmp = new ClassDef();
                 tmp.name = pcc.Exports[j].ClassName;
                 tmp.props = new List<PropDef>();
                 Classes.Add(tmp);
                 f = Classes.Count() - 1;
                 UpdateStatus();
             }
             List<PropertyReader.Property> props = PropertyReader.getPropList(pcc, pcc.Exports[j].Data);
             ClassDef res = Classes[f];
             foreach (PropertyReader.Property p in props)
             {
                 int f2 = -1;
                 string name = pcc.getNameEntry(p.Name);
                 for (int k = 0; k < res.props.Count(); k++)
                     if (res.props[k].name == name)
                     {
                         f2 = k;
                         break;
                     }
                 if (f2 == -1) //found new prop
                 {
                     PropDef ptmp = new PropDef();
                     ptmp.name = name;
                     ptmp.type = (int)p.TypeVal;
                     ptmp.ffpath = Path.GetFileName(file);
                     ptmp.ffidx = j;
                     res.props.Add(ptmp);
                     //DebugOutput.PrintLn("\tin object #" 
                     //                    + j 
                     //                    + " class \"" 
                     //                    + pcc.Exports[j].ClassName 
                     //                    + "\" found property \"" 
                     //                    + name 
                     //                    + "\" type " 
                     //                    + PropertyReader.TypeToString(ptmp.type));
                 }
             }
         }
     }            
     Sort();
     RefreshLists();
     UpdateStatus();
     MessageBox.Show("Done.");
 }
コード例 #33
0
 public DecalComponent(PCCObject Pcc, int Index)
 {
     pcc = Pcc;
     MyIndex = Index;
     if (pcc.isExport(Index))
         data = pcc.Exports[Index].Data;
     Props = PropertyReader.getPropList(pcc, data);
     BitConverter.IsLittleEndian = true;
     foreach (PropertyReader.Property p in Props)
         switch (pcc.getNameEntry(p.Name))
             #region
         {
             case "FilterMode":
                 FilterMode = p.Value.IntValue;
                 break;
             case "bAcceptsDynamicDecals":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bAcceptsDynamicDecals = true;
                 break;
             case "bFlipBackfaceDirection":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bFlipBackfaceDirection = true;
                 break;
             case "bProjectOnBackfaces":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bProjectOnBackfaces = true;
                 break;
             case "bNoClip":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bNoClip = true;
                 break;
             case "bAcceptsLights":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bAcceptsLights = true;
                 break;
             case "bAllowCullDistanceVolume":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bAllowCullDistanceVolume = true;
                 break;
             case "bProjectOnBSP":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bProjectOnBSP = true;
                 break;
             case "bProjectOnSkeletalMeshes":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bProjectOnSkeletalMeshes = true;
                 break;
             case "bProjectOnTerrain":
                 if (p.raw[p.raw.Length - 1] == 1)
                     bProjectOnTerrain = true;
                 break;
             case "DecalMaterial":
                 DecalMaterial = p.Value.IntValue;
                 break;
             case "ReplacementPrimitive":
                 ReplacementPrimitive = p.Value.IntValue;
                 break;
             case "Width":
                 Width = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "Height":
                 Height = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "FarPlane":
                 FarPlane = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "TileX":
                 TileX = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "TileY":
                 TileY = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "NearPlane":
                 NearPlane = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "DecalRotation":
                 DecalRotation = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "OffsetX":
                 OffsetX = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "DepthBias":
                 DepthBias = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "SlopeScaleDepthBias":
                 SlopeScaleDepthBias = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "OffsetY":
                 OffsetY = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "MaxDrawDistance":
                 MaxDrawDistance = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "CachedMaxDrawDistance":
                 CachedMaxDrawDistance = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "SortOrder":
                 SortOrder = p.Value.IntValue;
                 break;
             case "TranslucencySortPriority":
                 TranslucencySortPriority = p.Value.IntValue;
                 break;
             case "LocalTranslucencySortPriority":
                 LocalTranslucencySortPriority = p.Value.IntValue;
                 break;
         }
             #endregion                
 }
コード例 #34
0
 public static string PropertyToText(Property p,PCCObject pcc)
 {
     string s = "";
     s = "Name: " + pcc.Names[p.Name];
     s += " Type: " + TypeToString((int)p.TypeVal);
     s += " Size: " + p.Value.len.ToString();
     switch (p.TypeVal)
     {
         case Type.StructProperty:
             s += " \"" + pcc.getNameEntry (p.Value.IntValue) + "\" with " + p.Value.Array.Count.ToString() + " bytes";
             break;
         case Type.IntProperty:                
         case Type.ObjectProperty:
         case Type.BoolProperty:
         case Type.StringRefProperty :
             s += " Value: " + p.Value.IntValue.ToString();
             break;
         case Type.FloatProperty:
             byte[] buff = BitConverter.GetBytes(p.Value.IntValue);
             float f = BitConverter.ToSingle(buff,0);
             s += " Value: " + f.ToString();
             break;
         case Type.NameProperty:
             s += " " + pcc.Names[p.Value.IntValue];
             break;
         case Type.ByteProperty:
             s += " Value: \"" + p.Value.StringValue + "\" with \"" + pcc.getNameEntry(p.Value.IntValue) + "\"";
             break;
         case Type.ArrayProperty:
             s += " bytes"; //Value: " + p.Value.Array.Count.ToString() + " Elements";
             break;
         case Type.StrProperty:
             if (p.Value.StringValue.Length == 0)
                 break;
             s += " Value: " + p.Value.StringValue.Substring(0,p.Value.StringValue.Length - 1);
             break;
     }
     return s;
 }
コード例 #35
0
ファイル: Timeline.cs プロジェクト: CreeperLava/ME3Explorer
        public void LoadInterpData(int idx, PCCObject pccobject)
        {
            TimeScale.RemoveAllChildren();
            TimeScale.Width = 3600;
            TimelineView.RemoveAllChildren();
            TimelineView.Width = 3600;
            scrollbarH.Maximum = 3600;
            PPath line;
            SText text;
            for (int i = 0; i < TimeScale.Width; i += 60)
            {
                line = PPath.CreateLine(i, 1, i, Timeline.InfoHeight);
                line.Pickable = false;
                line.Pen = new Pen(Color.FromArgb(110, 110, 110));
                TimeScale.AddChild(line);
                text = new SText(i / 60 - 1 + ".00", Color.FromArgb(175, 175, 175), false);
                text.Pickable = false;
                text.TranslateBy(i + 2, Timeline.InfoHeight - text.Height);
                TimeScale.AddChild(text);
            }

            pcc = pccobject;
            index = idx;
            foreach (InterpGroup g in InterpGroups)
                RemoveChild(g.listEntry);
            InterpGroups.Clear();

            BitConverter.IsLittleEndian = true;
            List<PropertyReader.Property> props = PropertyReader.getPropList(pcc, pcc.Exports[index].Data);
            List<int> groups = new List<int>();
            foreach (PropertyReader.Property p in props)
            {
                if (pcc.getNameEntry(p.Name) == "InterpLength")
                    InterpLength = BitConverter.ToSingle(p.raw, 24);
                if (pcc.getNameEntry(p.Name) == "EdSectionStart")
                    EdSectionStart = BitConverter.ToSingle(p.raw, 24);
                if (pcc.getNameEntry(p.Name) == "EdSectionEnd")
                    EdSectionEnd = BitConverter.ToSingle(p.raw, 24);
                if (pcc.getNameEntry(p.Name) == "m_nBioCutSceneVersion")
                    m_nBioCutSceneVersion = p.Value.IntValue;
                if (pcc.getNameEntry(p.Name) == "m_pSFXSceneData")
                    m_pSFXSceneData = p.Value.IntValue;
                if (pcc.getNameEntry(p.Name) == "ObjInstanceVersion")
                    ObjInstanceVersion = p.Value.IntValue;
                if (pcc.getNameEntry(p.Name) == "ParentSequence")
                    ParentSequence = p.Value.IntValue;
                if (pcc.getNameEntry(p.Name) == "InterpGroups")
                {
                    for (int i = 0; i < p.Value.Array.Count; i += 4)
                        groups.Add(BitConverter.ToInt32(new byte[] { (byte)p.Value.Array[i].IntValue, (byte)p.Value.Array[i + 1].IntValue, (byte)p.Value.Array[i + 2].IntValue, (byte)p.Value.Array[i + 3].IntValue }, 0) - 1);
                }
            }
            foreach(int i in groups)
            {
                if(pcc.Exports[i].ClassName.StartsWith("InterpGroup"))
                    addGroup(new InterpGroup(i, pcc));
            }
            TimeScale.MoveToFront();
            PPath startmark = PPath.CreatePolygon(53,1, 61,1, 61,9);
            startmark.Pen = null;
            startmark.Brush = new SolidBrush(Color.FromArgb(255,80,80));
            startmark.Pickable = false;
            TimeScale.AddChild(startmark);
            endmark = PPath.CreatePolygon(InterpLength * 60 + 61, 1, InterpLength * 60 + 69, 1, InterpLength * 60 + 61, 9);
            endmark.Pen = null;
            endmark.Brush = startmark.Brush;
            TimeScale.AddChild(endmark);
            foreach (InterpGroup g in InterpGroups)
            {
                foreach (InterpTrack t in g.InterpTracks)
                {
                    t.GetKeyFrames();
                    t.DrawKeyFrames();
                    TimelineView.AddChild(t.timelineEntry);
                }
            }
        }
コード例 #36
0
ファイル: SequenceEditor.cs プロジェクト: Dybuk/ME3Explorer
 public TreeNode FindSequences(PCCObject pcc, int index, bool wantFullName = false)
 {
     TreeNode ret = new TreeNode("#" + index.ToString() + ": " + (wantFullName ? pcc.Exports[index].GetFullPath : pcc.Exports[index].ObjectName));
     ret.Name = index.ToString();
     Sequence seq = new Sequence(pcc, index);
     if (seq.SequenceObjects != null)
         for (int i = 0; i < seq.SequenceObjects.Count(); i++)
             if (pcc.Exports[seq.SequenceObjects[i] - 1].ClassName == "Sequence" || pcc.Exports[seq.SequenceObjects[i] - 1].ClassName.StartsWith("PrefabSequence"))
             {
                 TreeNode t = FindSequences(pcc, seq.SequenceObjects[i] - 1, wantFullName);
                 ret.Nodes.Add(t);
             }
             else if (pcc.Exports[seq.SequenceObjects[i] - 1].ClassName == "SequenceReference")
             {
                 var props = ME3Explorer.Unreal.PropertyReader.getPropList(pcc, pcc.Exports[seq.SequenceObjects[i] - 1].Data);
                 var propSequenceReference = props.FirstOrDefault(p => pcc.getNameEntry(p.Name).Equals("oSequenceReference"));
                 if (propSequenceReference != null)
                 {
                     TreeNode t = FindSequences(pcc, propSequenceReference.Value.IntValue - 1, wantFullName);
                     ret.Nodes.Add(t);
                 }
             }
     return ret;
 }