public static GameObjectTableHead ReadEntry(IOMemoryStream ms, UAssetFile f) { //Read in GameObjectTableHead g = new GameObjectTableHead(); g.startPos = ms.position; g.coreType = ms.ReadNameTableEntry(f); g.unknown1 = ms.ReadInt(); g.objectType = ms.ReadNameTableEntry(f); g.unknown2 = ms.ReadInt(); g.index = ms.ReadInt(); g.name = ms.ReadNameTableEntry(f); g.unknown4 = ms.ReadInt(); return(g); }
void ReadHeaderData() { stream.position = 0; //Start reading header data headerUnknown1 = stream.ReadInt(); headerUnknown2 = stream.ReadInt(); headerUnknown3 = stream.ReadInt(); headerUnknown4 = stream.ReadInt(); headerUnknown5 = stream.ReadInt(); headerUnknown6 = stream.ReadInt(); headerUnknown7 = stream.ReadInt(); headerUnknown9 = stream.ReadUEString(); headerUnknown10 = stream.ReadInt(); nameTableLength = stream.ReadInt(); nameTableOffset = stream.ReadInt(); embeddedGameObjectCount = stream.ReadInt(); headerUnknown11 = stream.ReadInt(); refGameObjectCount = stream.ReadInt(); headerUnknown12 = stream.ReadInt(); binaryIdTableOffset = stream.ReadInt(); headerUnknown13 = stream.ReadInt(); thumbnailOffset = stream.ReadInt(); packagePropertyDictOffset = stream.ReadInt(); //There's some data that we don't know how to get to that seems to sit at 16 bytes before the name table. Read it stream.position = nameTableOffset - 16; headerPayloadBegin = stream.ReadInt(); //Dump DebugDump("Header Data", ConsoleColor.Cyan, "headerUnknown1", headerUnknown1.ToString(), "headerUnknown2", headerUnknown2.ToString(), "headerUnknown3", headerUnknown3.ToString(), "headerUnknown4", headerUnknown4.ToString(), "headerUnknown5", headerUnknown5.ToString(), "headerUnknown6", headerUnknown6.ToString(), "headerUnknown7", headerUnknown7.ToString(), "headerUnknown9", headerUnknown9.ToString(), "headerUnknown10", headerUnknown10.ToString() ); DebugDump("Header Data", ConsoleColor.Cyan, "nameTableLength", nameTableLength.ToString(), "nameTableOffset", nameTableOffset.ToString(), "embeddedGameObjectCount", embeddedGameObjectCount.ToString(), "headerUnknown11", headerUnknown11.ToString(), "refGameObjectCount", refGameObjectCount.ToString(), "headerUnknown12", headerUnknown12.ToString(), "binaryIdTableOffset", binaryIdTableOffset.ToString(), "headerUnknown13", headerUnknown13.ToString(), "binaryIdTableOffset", binaryIdTableOffset.ToString(), "headerUnknown13", headerUnknown13.ToString(), "thumbnailOffset", thumbnailOffset.ToString(), "packagePropertyDictOffset", packagePropertyDictOffset.ToString()); }
public static EmbeddedGameObjectTableHead ReadEntry(IOMemoryStream ms, UAssetFile f) { //Read in EmbeddedGameObjectTableHead g = new EmbeddedGameObjectTableHead(); g.entryLocation = ms.position; g.id = ms.ReadInt(); g.unknown2 = ms.ReadInt(); g.unknown3 = ms.ReadInt(); g.type = ms.ReadNameTableEntry(f); g.unknown4 = ms.ReadInt(); g.unknown5 = ms.ReadInt(); g.dataLength = ms.ReadInt(); g.dataLocation = ms.ReadInt(); g.unknown6 = ms.ReadInt(); g.unknown7 = ms.ReadInt(); g.unknown8 = ms.ReadInt(); g.unknown9 = ms.ReadInt(); g.unknown10 = ms.ReadInt(); g.unknown11 = ms.ReadInt(); g.unknown12 = ms.ReadInt(); g.unknown13 = ms.ReadInt(); g.unknown14 = ms.ReadInt(); return(g); }
public static UProperty ReadProp(IOMemoryStream ms, UAssetFile f, string arrayType, bool isStruct) { //Read the name long start = ms.position; //Read the remainder of the properties string name; int u1; string type; int u2; int length; int index; if (arrayType == null) { //Not an array name = ms.ReadNameTableEntry(f); //Return null if this is "None". That means we're done reading if (name == "None") { return(null); } u1 = ms.ReadInt(); type = ms.ReadNameTableEntry(f); u2 = ms.ReadInt(); length = ms.ReadInt(); index = ms.ReadInt(); } else { name = null; u1 = 0; type = arrayType; u2 = 0; length = 0; index = 0; } long payloadStart = ms.position; //Create the object UProperty u; switch (type) { case "ArrayProperty": u = new ArrayProperty(ms, f); break; case "BoolProperty": u = new BoolProperty(ms, f); break; case "ByteProperty": u = new ByteProperty(ms, f); break; case "DoubleProperty": u = new DoubleProperty(ms, f); break; case "FloatProperty": u = new FloatProperty(ms, f); break; case "Int16Property": u = new Int16Property(ms, f); break; case "Int8Property": u = new Int8Property(ms, f); break; case "IntProperty": u = new IntProperty(ms, f); break; case "NameProperty": u = new NameProperty(ms, f); break; case "ObjectProperty": u = new ObjectProperty(ms, f); break; case "StrProperty": u = new StrProperty(ms, f); break; case "StructProperty": u = new StructProperty(ms, f); break; case "TextProperty": u = new TextProperty(ms, f); break; case "UInt16Property": u = new UInt16Property(ms, f); break; case "UInt32Property": u = new UInt32Property(ms, f); break; case "UInt64Property": u = new UInt64Property(ms, f); break; default: throw new Exception($"FAILED TO READ UPROPERTY: Type {type} was not a valid type. Name={name}, u1={u1}, u2={u2}, length={length}, index={index}, position={start}"); } //Set attributes u.name = name; u.unknown1 = u1; u.type = type; u.unknown2 = u2; u.length = length; u.index = index; u.start = start; u.payloadStart = payloadStart; u.isArray = arrayType != null; //Dump f.DebugDump("UProperty Reading", ConsoleColor.Green, "name", name, "u1", u1.ToString(), "type", type, "u2", u2.ToString(), "length", length.ToString(), "index", index.ToString(), "start", start.ToString(), "payloadStart", payloadStart.ToString()); //Read u.Read(ms, f); //Log string msg = u.WriteString(); f.Debug("UProperty Read " + type, msg, ConsoleColor.DarkGreen); return(u); }