示例#1
0
        public UnrealObject(byte[] mem, string Uclass, string[] Names)
        {
            objectclass = Uclass;
            names       = Names;
            switch (objectclass)
            {
            case "DecalActor":
                UDecA = new UDecalActor(mem, names);
                break;

            case "DecalComponent":
                UDecC = new UDecalComponent(mem, names);
                break;

            case "InterpActor":
                UIntA = new UInterpActor(mem, names);
                break;

            case "StaticMesh":
                UStat = new UStaticMesh(mem, names);
                break;

            case "StaticMeshActor":
                UStatA = new  UStaticMeshActor(mem, names);
                break;

            case "StaticMeshComponent":
                UStatC = new UStaticMeshComponent(mem, names);
                break;

            case "SkeletalMesh":
                USkel = new USkelMesh(mem, names);
                break;

            case "Texture2D":
                UTex2D = new UTexture2D(mem, names);
                break;

            case "Material":
                UMat = new UMaterial(mem, names);
                break;

            case "WwiseStream":
                UWws = new UWwiseStream(mem, names);
                break;

            default:
                UUkn = new UnknownObject(mem, objectclass, names);
                break;
            }
        }
示例#2
0
 public void LoadLevelObjects(Device d, RichTextBox Rtb=null)
 {
     rtb = Rtb;
     device = d;
     UStatComp = new List<UStaticMeshComponent>();
     UStatActors = new List<UStaticMeshActor>();
     UStatColl = new List<UStaticMeshCollectionActor>();
     UIntAct = new List<UInterpActor>();
     UStat = new List<UStaticMesh>();
     Tex = new List<TextureEntry>();
     TextOut("Loading Level Objects...\n");
     for(int i=0;i<LObjects.Count;i++)
         switch(LObjects[i].cls)
         {
             case "StaticMeshActor":
                 UStaticMeshActor t = new UStaticMeshActor(pcc.EntryToBuff(LObjects[i].entry), pcc.names);
                 t.UPR = UPR;
                 t.Deserialize();
                 LevelProperties LP = new LevelProperties();
                 LP.source = 0;
                 LP.sourceentry = LObjects[i].entry;
                 t.LP = LP;
                 UStatActors.Add(t);
                 break;                    
             case "StaticMeshCollectionActor":
                 UStaticMeshCollectionActor t2 = new UStaticMeshCollectionActor(pcc.EntryToBuff(LObjects[i].entry), pcc);
                 t2.UPR = UPR;
                 t2.Deserialize();
                 LevelProperties LP2 = new LevelProperties();
                 LP2.source = 1;
                 LP2.sourceentry = LObjects[i].entry;
                 t2.LP = LP2;
                 UStatColl.Add(t2);
                 break;
             case "InterpActor":
                 UInterpActor t3 = new UInterpActor(pcc.EntryToBuff(LObjects[i].entry), pcc.names);
                 t3.UPR = UPR;
                 t3.Deserialize();
                 LevelProperties LP3 = new LevelProperties();
                 LP3.source = 2;
                 LP3.sourceentry = LObjects[i].entry;
                 t3.LP = LP3;
                 UIntAct.Add(t3);
                 break;
         }
     TextOut("Loading Static Mesh Actors...\n");
     LoadStaticMeshActors();
     TextOut("Loading Static Mesh Collection Actors...\n");
     LoadStaticMeshCollectionActors();
     TextOut("Loading Interp Actors...\n");
     LoadInterpActors();
     TextOut("Loading Static Mesh Components...\n");
     LoadStaticMeshComponents();
     TextOut("Loading Static Meshes...\n");
     LoadStaticMesh();
     TextOut("Loading Textures...\n");
     LoadTextures();
     TextOut("\nDone");
 }
示例#3
0
        private void button13_Click(object sender, EventArgs e)
        {
            int source = refO.Level.UStat[refStat].LP.source;
            int entry = refO.Level.UStat[refStat].LP.sourceentry;
            int parent = refO.Level.UStat[refStat].index2;
            int parentidx = refO.Level.UStat[refStat].index3;
            UPropertyReader UPR = refO.Level.UPR;
            PCCFile pcc = refO.Level.pcc;
            UMath math = new UMath();
            if (source == 0)//Static Actor
            {
                UStaticMeshActor u = new UStaticMeshActor(pcc.EntryToBuff(entry), pcc.names);
                u.UPR = UPR;
                u.Deserialize();
                int ent = UPR.FindProperty("location", u.props);
                if(ent!=-1)
                {
                    ent++;
                    int off1 = (int)pcc.Export[entry].DataOffset;
                    int off2 = u.props[ent].offset + u.props[ent].raw.Length - 12;
                    Vector3 v = UPR.PropToVector3(u.props[ent].raw);
                    v += loc;
                    byte[] buff = BitConverter.GetBytes(v.X);
                    for (int i = 0; i < 4; i++) pcc.memory[off1 + off2 + i] = buff[i];
                    buff = BitConverter.GetBytes(v.Y);
                    for (int i = 0; i < 4; i++) pcc.memory[off1 + off2 + i + 4] = buff[i];
                    buff = BitConverter.GetBytes(v.Z);
                    for (int i = 0; i < 4; i++) pcc.memory[off1 + off2 + i + 8] = buff[i];
                }
                ent = UPR.FindProperty("Rotator", u.props);
                if (ent != -1)
                {
                    int off1 = (int)pcc.Export[entry].DataOffset;
                    int off2 = u.props[ent].offset + u.props[ent].raw.Length - 12;
                    UMath.Rotator r = math.PropToRotator(u.props[ent].raw);
                    UMath.Rotator r2 = math.IntVectorToRotator(rot);
                    r = r + r2;
                    byte[] buff = BitConverter.GetBytes(r.Pitch);
                    for (int i = 0; i < 4; i++) pcc.memory[off1 + off2 + i] = buff[i];
                    buff = BitConverter.GetBytes(r.Roll);
                    for (int i = 0; i < 4; i++) pcc.memory[off1 + off2 + i + 4] = buff[i];
                    buff = BitConverter.GetBytes(r.Yaw);
                    for (int i = 0; i < 4; i++) pcc.memory[off1 + off2 + i + 8] = buff[i];
                }
            }
            if (source == 1)//Collection
            {
                UStaticMeshComponent uc = refO.Level.UStatComp[parentidx];
                UStaticMeshCollectionActor u = refO.Level.UStatColl[uc.index3];
                int ent = UPR.FindProperty("Scale3D", uc.props);
                if (ent != -1)
                {
                    Matrix m = current;
                    Vector3 v =  new Vector3(m.M41, m.M42, m.M43);
                    Vector3 v2 = UPR.PropToVector3(uc.props[ent+1].raw);
                    v2.X = 1 / v2.X;
                    v2.Y = 1 / v2.Y;
                    v2.Z = 1 / v2.Z;
                    m.M41 = 0;
                    m.M42 = 0;
                    m.M43 = 0;
                    m *= Matrix.Scaling(v2);
                    m.M41 = v.X;
                    m.M42 = v.Y;
                    m.M43 = v.Z;
                    current = m;
                }
                int ent2 = uc.index2;
                    if (ent2 != -1)
                    {
                        int off = u.props[u.props.Count - 1].offset + u.props[u.props.Count - 1].raw.Length + (int)pcc.Export[entry].DataOffset + ent2 * 16 * 4;
                        byte[] buff = BitConverter.GetBytes(current.M11);
                        WriteMemory(off, buff); off += 4;
                        buff = BitConverter.GetBytes(current.M12);
                        WriteMemory(off, buff); off += 4;
                        buff = BitConverter.GetBytes(current.M13);
                        WriteMemory(off, buff); off += 4;
                        buff = BitConverter.GetBytes(current.M14);
                        WriteMemory(off, buff); off += 4;

                        buff = BitConverter.GetBytes(current.M21);
                        WriteMemory(off, buff); off += 4;
                        buff = BitConverter.GetBytes(current.M22);
                        WriteMemory(off, buff); off += 4;
                        buff = BitConverter.GetBytes(current.M23);
                        WriteMemory(off, buff); off += 4;
                        buff = BitConverter.GetBytes(current.M24);
                        WriteMemory(off, buff); off += 4;

                        buff = BitConverter.GetBytes(current.M31);
                        WriteMemory(off, buff); off += 4;
                        buff = BitConverter.GetBytes(current.M32);
                        WriteMemory(off, buff); off += 4;
                        buff = BitConverter.GetBytes(current.M33);
                        WriteMemory(off, buff); off += 4;
                        buff = BitConverter.GetBytes(current.M34);
                        WriteMemory(off, buff); off += 4;

                        buff = BitConverter.GetBytes(current.M41);
                        WriteMemory(off, buff); off += 4;
                        buff = BitConverter.GetBytes(current.M42);
                        WriteMemory(off, buff); off += 4;
                        buff = BitConverter.GetBytes(current.M43);
                        WriteMemory(off, buff); off += 4;
                        buff = BitConverter.GetBytes(current.M44);
                        WriteMemory(off, buff); off += 4;
                    }
            }
            if (source == 2)//Interp Actor
            {
                UInterpActor u = new UInterpActor(pcc.EntryToBuff(entry), pcc.names);
                u.UPR = UPR;
                u.Deserialize();
                int ent = UPR.FindProperty("location", u.props);
                if (ent != -1)
                {
                    ent++;
                    int off1 = (int)pcc.Export[entry].DataOffset;
                    int off2 = u.props[ent].offset + u.props[ent].raw.Length - 12;
                    Vector3 v = UPR.PropToVector3(u.props[ent].raw);
                    v += loc;
                    byte[] buff = BitConverter.GetBytes(v.X);
                    for (int i = 0; i < 4; i++) pcc.memory[off1 + off2 + i] = buff[i];
                    buff = BitConverter.GetBytes(v.Y);
                    for (int i = 0; i < 4; i++) pcc.memory[off1 + off2 + i + 4] = buff[i];
                    buff = BitConverter.GetBytes(v.Z);
                    for (int i = 0; i < 4; i++) pcc.memory[off1 + off2 + i + 8] = buff[i];
                }
                ent = UPR.FindProperty("Rotator", u.props);
                if (ent != -1)
                {
                    int off1 = (int)pcc.Export[entry].DataOffset;
                    int off2 = u.props[ent].offset + u.props[ent].raw.Length - 12;
                    UMath.Rotator r = math.PropToRotator(u.props[ent].raw);
                    UMath.Rotator r2 = math.IntVectorToRotator(rot);
                    r = r + r2;
                    byte[] buff = BitConverter.GetBytes(r.Pitch);
                    for (int i = 0; i < 4; i++) pcc.memory[off1 + off2 + i] = buff[i];
                    buff = BitConverter.GetBytes(r.Roll);
                    for (int i = 0; i < 4; i++) pcc.memory[off1 + off2 + i + 4] = buff[i];
                    buff = BitConverter.GetBytes(r.Yaw);
                    for (int i = 0; i < 4; i++) pcc.memory[off1 + off2 + i + 8] = buff[i];
                }
            }
        }
示例#4
0
        public void LoadLevelObjects(Device d, RichTextBox Rtb = null)
        {
            rtb         = Rtb;
            device      = d;
            UStatComp   = new List <UStaticMeshComponent>();
            UStatActors = new List <UStaticMeshActor>();
            UStatColl   = new List <UStaticMeshCollectionActor>();
            UIntAct     = new List <UInterpActor>();
            UStat       = new List <UStaticMesh>();
            Tex         = new List <TextureEntry>();
            TextOut("Loading Level Objects...\n");
            for (int i = 0; i < LObjects.Count; i++)
            {
                switch (LObjects[i].cls)
                {
                case "StaticMeshActor":
                    UStaticMeshActor t = new UStaticMeshActor(pcc.EntryToBuff(LObjects[i].entry), pcc.names);
                    t.UPR = UPR;
                    t.Deserialize();
                    LevelProperties LP = new LevelProperties();
                    LP.source      = 0;
                    LP.sourceentry = LObjects[i].entry;
                    t.LP           = LP;
                    UStatActors.Add(t);
                    break;

                case "StaticMeshCollectionActor":
                    UStaticMeshCollectionActor t2 = new UStaticMeshCollectionActor(pcc.EntryToBuff(LObjects[i].entry), pcc);
                    t2.UPR = UPR;
                    t2.Deserialize();
                    LevelProperties LP2 = new LevelProperties();
                    LP2.source      = 1;
                    LP2.sourceentry = LObjects[i].entry;
                    t2.LP           = LP2;
                    UStatColl.Add(t2);
                    break;

                case "InterpActor":
                    UInterpActor t3 = new UInterpActor(pcc.EntryToBuff(LObjects[i].entry), pcc.names);
                    t3.UPR = UPR;
                    t3.Deserialize();
                    LevelProperties LP3 = new LevelProperties();
                    LP3.source      = 2;
                    LP3.sourceentry = LObjects[i].entry;
                    t3.LP           = LP3;
                    UIntAct.Add(t3);
                    break;
                }
            }
            TextOut("Loading Static Mesh Actors...\n");
            LoadStaticMeshActors();
            TextOut("Loading Static Mesh Collection Actors...\n");
            LoadStaticMeshCollectionActors();
            TextOut("Loading Interp Actors...\n");
            LoadInterpActors();
            TextOut("Loading Static Mesh Components...\n");
            LoadStaticMeshComponents();
            TextOut("Loading Static Meshes...\n");
            LoadStaticMesh();
            TextOut("Loading Textures...\n");
            LoadTextures();
            TextOut("\nDone");
        }