public UDKStaticMesh(UDKPackage udk, int Index) { MyIndex = Index; Owner = udk; ReadEnd = GetPropertyEnd(Index); byte[] buff = udk.Exports[Index].Data; MemoryStream m = new MemoryStream((byte[])buff.Clone()); Read(m); }
private static ClassInfo generateClassInfo(int index, UDKPackage pcc) { ClassInfo info = new ClassInfo { baseClass = pcc.Exports[index].SuperClassName, exportIndex = index, ClassName = pcc.Exports[index].ObjectName }; if (pcc.FilePath.Contains("BIOGame")) { info.pccPath = new string(pcc.FilePath.Skip(pcc.FilePath.LastIndexOf("BIOGame") + 8).ToArray()); } else { info.pccPath = pcc.FilePath; //used for dynamic resolution of files outside the game directory. } foreach (ExportEntry entry in pcc.Exports) { if (entry.idxLink - 1 == index && entry.ClassName != "ScriptStruct" && entry.ClassName != "Enum" && entry.ClassName != "Function" && entry.ClassName != "Const" && entry.ClassName != "State") { //Skip if property is transient (only used during execution, will never be in game files) if (/*(BitConverter.ToUInt64(entry.Data, 24) & 0x0000000000002000) == 0 &&*/ !info.properties.ContainsKey(entry.ObjectName.Name)) { PropertyInfo p = getProperty(pcc, entry); if (p != null) { info.properties.Add(entry.ObjectName.Name, p); } } //else //{ // //Debug.WriteLine("Skipping property due to flag: " + entry.ObjectName); //} } } return(info); }
/* * * private static void generateEnumValues(int index, ME3Package pcc) * { * string enumName = pcc.Exports[index].ObjectName; * if (!Enums.ContainsKey(enumName)) * { * var values = new List<NameReference>(); * byte[] buff = pcc.Exports[index].Data; * //subtract 1 so that we don't get the MAX value, which is an implementation detail * int count = BitConverter.ToInt32(buff, 20) - 1; * for (int i = 0; i < count; i++) * { * int enumValIndex = 24 + i * 8; * values.Add(new NameReference(pcc.Names[BitConverter.ToInt32(buff, enumValIndex)], BitConverter.ToInt32(buff, enumValIndex + 4))); * } * Enums.Add(enumName, values); * } * } */ private static PropertyInfo getProperty(UDKPackage pcc, ExportEntry entry) { if (!IsLoaded) { loadfromJSON(); } string reference = null; PropertyType type; switch (entry.ClassName) { case "IntProperty": type = PropertyType.IntProperty; break; case "StringRefProperty": type = PropertyType.StringRefProperty; break; case "FloatProperty": type = PropertyType.FloatProperty; break; case "BoolProperty": type = PropertyType.BoolProperty; break; case "StrProperty": type = PropertyType.StrProperty; break; case "NameProperty": type = PropertyType.NameProperty; break; case "DelegateProperty": type = PropertyType.DelegateProperty; break; case "ObjectProperty": case "ClassProperty": case "ComponentProperty": type = PropertyType.ObjectProperty; reference = pcc.getObjectName(BitConverter.ToInt32(entry.Data, entry.Data.Length - 4)); break; case "StructProperty": type = PropertyType.StructProperty; reference = pcc.getObjectName(BitConverter.ToInt32(entry.Data, entry.Data.Length - 4)); break; case "BioMask4Property": case "ByteProperty": type = PropertyType.ByteProperty; reference = pcc.getObjectName(BitConverter.ToInt32(entry.Data, entry.Data.Length - 4)); break; case "ArrayProperty": type = PropertyType.ArrayProperty; PropertyInfo arrayTypeProp = getProperty(pcc, pcc.Exports[BitConverter.ToInt32(entry.Data, 44) - 1]); if (arrayTypeProp != null) { switch (arrayTypeProp.Type) { case PropertyType.ObjectProperty: case PropertyType.StructProperty: case PropertyType.ArrayProperty: reference = arrayTypeProp.Reference; break; case PropertyType.ByteProperty: if (arrayTypeProp.Reference == "Class") { reference = arrayTypeProp.Type.ToString(); } else { reference = arrayTypeProp.Reference; } break; case PropertyType.IntProperty: case PropertyType.FloatProperty: case PropertyType.NameProperty: case PropertyType.BoolProperty: case PropertyType.StrProperty: case PropertyType.StringRefProperty: case PropertyType.DelegateProperty: reference = arrayTypeProp.Type.ToString(); break; case PropertyType.None: case PropertyType.Unknown: default: System.Diagnostics.Debugger.Break(); return(null); } } else { return(null); } break; case "InterfaceProperty": default: return(null); } bool transient = (BitConverter.ToUInt64(entry.Data, 24) & 0x0000000000002000) != 0; return(new PropertyInfo(type, reference, transient)); }