public static InterfaceSlot Parse(BytecodeReader reader, BytecodeReader interfaceSlotReader) { var slotSpan = interfaceSlotReader.ReadUInt32(); var count = interfaceSlotReader.ReadUInt32(); var typeIDsOffset = interfaceSlotReader.ReadUInt32(); var typeIDsReader = reader.CopyAtOffset((int) typeIDsOffset); var tableIDsOffset = interfaceSlotReader.ReadUInt32(); var tableIDsReader = reader.CopyAtOffset((int) tableIDsOffset); var result = new InterfaceSlot { SlotSpan = slotSpan }; for (int i = 0; i < count; i++) { result.TypeIDs.Add(typeIDsReader.ReadUInt16()); result.TableIDs.Add(tableIDsReader.ReadUInt32()); } return result; }
public static InterfaceSlot Parse(BytecodeReader reader, BytecodeReader interfaceSlotReader) { var slotSpan = interfaceSlotReader.ReadUInt32(); var count = interfaceSlotReader.ReadUInt32(); var typeIDsOffset = interfaceSlotReader.ReadUInt32(); var typeIDsReader = reader.CopyAtOffset((int)typeIDsOffset); var tableIDsOffset = interfaceSlotReader.ReadUInt32(); var tableIDsReader = reader.CopyAtOffset((int)tableIDsOffset); var result = new InterfaceSlot { SlotSpan = slotSpan }; for (int i = 0; i < count; i++) { result.TypeIDs.Add(typeIDsReader.ReadUInt16()); result.TableIDs.Add(tableIDsReader.ReadUInt32()); } return(result); }
public static InterfacesChunk Parse(BytecodeReader reader, uint sizeInBytes) { var headerReader = reader.CopyAtCurrentPosition(); var result = new InterfacesChunk(); var classInstanceCount = headerReader.ReadUInt32(); var classTypeCount = headerReader.ReadUInt32(); var interfaceSlotRecordCount = headerReader.ReadUInt32(); // Will be same as interfaceSlotRecordCount unless there are interface arrays. result.InterfaceSlotCount = headerReader.ReadUInt32(); // Think this is offset to start of interface slot info, but we // don't need it because it is also contained in the InterfaceSlot class var typeIDsOffset = headerReader.ReadUInt32(); var classTypeOffset = headerReader.ReadUInt32(); var availableClassReader = reader.CopyAtOffset((int)classTypeOffset); var interfaceSlotOffset = headerReader.ReadUInt32(); var interfaceSlotReader = reader.CopyAtOffset((int)interfaceSlotOffset); var unknown1 = headerReader.ReadUInt32(); Debug.Assert(unknown1.ToFourCcString() == "OSGN"); var unknown2 = headerReader.ReadUInt16(); Debug.Assert(unknown2 == 32); var unknown3 = headerReader.ReadUInt16(); Debug.Assert(unknown3 == 16); for (uint i = 0; i < classTypeCount; i++) { var classType = ClassType.Parse(reader, availableClassReader); classType.ID = i; // Really?? result.AvailableClassTypes.Add(classType); } for (uint i = 0; i < classInstanceCount; i++) { var classInstance = ClassInstance.Parse(reader, availableClassReader); result.AvailableClassInstances.Add(classInstance); } uint startSlot = 0; for (uint i = 0; i < interfaceSlotRecordCount; i++) { var interfaceSlot = InterfaceSlot.Parse(reader, interfaceSlotReader); interfaceSlot.StartSlot = startSlot; // Really?? result.InterfaceSlots.Add(interfaceSlot); startSlot += interfaceSlot.SlotSpan; } return(result); }
public static InterfacesChunk Parse(BytecodeReader reader, uint sizeInBytes) { var headerReader = reader.CopyAtCurrentPosition(); var result = new InterfacesChunk(); var classInstanceCount = headerReader.ReadUInt32(); var classTypeCount = headerReader.ReadUInt32(); var interfaceSlotRecordCount = headerReader.ReadUInt32(); // Will be same as interfaceSlotRecordCount unless there are interface arrays. result.InterfaceSlotCount = headerReader.ReadUInt32(); headerReader.ReadUInt32(); // Think this is offset to start of interface slot info, but we don't need it. var classTypeOffset = headerReader.ReadUInt32(); var availableClassReader = reader.CopyAtOffset((int)classTypeOffset); var interfaceSlotOffset = headerReader.ReadUInt32(); var interfaceSlotReader = reader.CopyAtOffset((int)interfaceSlotOffset); for (uint i = 0; i < classTypeCount; i++) { var classType = ClassType.Parse(reader, availableClassReader); classType.ID = i; // Really?? result.AvailableClassTypes.Add(classType); } for (uint i = 0; i < classInstanceCount; i++) { var classInstance = ClassInstance.Parse(reader, availableClassReader); result.AvailableClassInstances.Add(classInstance); } uint startSlot = 0; for (uint i = 0; i < interfaceSlotRecordCount; i++) { var interfaceSlot = InterfaceSlot.Parse(reader, interfaceSlotReader); interfaceSlot.StartSlot = startSlot; // Really?? result.InterfaceSlots.Add(interfaceSlot); startSlot += interfaceSlot.SlotSpan; } return(result); }