// Methods public void Read(BINAReader reader) { // Read the data uint lineType = reader.ReadUInt32(); uint padding1 = reader.ReadUInt32(); ulong nameOffset = reader.ReadUInt64(); ulong padding2 = reader.ReadUInt64(); UnknownFloat1 = reader.ReadSingle(); byte firstCharacter = reader.ReadByte(); byte firstAnim = reader.ReadByte(); byte secondCharacter = reader.ReadByte(); byte secondAnim = reader.ReadByte(); TalkingCharacter = reader.ReadUInt64(); // Parse it if (nameOffset != 0) { Name = reader.GetString((uint)nameOffset + reader.Offset); } LineType = (LineTypes)lineType; FirstCharacter = (CharacterTypes)firstCharacter; FirstCharAnimation = (AnimationTypes)firstAnim; SecondCharacter = (CharacterTypes)secondCharacter; SecondCharAnimation = (AnimationTypes)secondAnim; }
// Methods public void Read(BINAReader reader, bool readStageID = false) { // Stage Index StageIndex = reader.ReadByte(); byte unknown2 = reader.ReadByte(); byte unknown3 = reader.ReadByte(); byte unknown4 = reader.ReadByte(); // Time Bonus TimeBasis = reader.ReadUInt32(); TimeDown = reader.ReadUInt32(); // Miss Bonuses NoMissBonus = reader.ReadUInt32(); OneMissBonus = reader.ReadUInt32(); TwoMissBonus = reader.ReadUInt32(); ThreeMissBonus = reader.ReadUInt32(); FourMissBonus = reader.ReadUInt32(); FivePlusMissBonus = reader.ReadUInt32(); // Rank Scores SRankScore = reader.ReadUInt32(); ARankScore = reader.ReadUInt32(); BRankScore = reader.ReadUInt32(); uint CRankScore = reader.ReadUInt32(); // Not really used uint DRankScore = reader.ReadUInt32(); // Unused // Stage ID stageIDOffset = reader.ReadUInt64(); ulong unknown5 = reader.ReadUInt64(); if (readStageID) { StageID = reader.GetString((uint)stageIDOffset); } // Padding/Unknown Value Checks if (unknown2 != 0) { Console.WriteLine($"WARNING: Unknown2 != 0! ({unknown2})"); } if (unknown3 != 0) { Console.WriteLine($"WARNING: Unknown3 != 0! ({unknown3})"); } if (unknown4 != 0) { Console.WriteLine($"WARNING: Unknown4 != 0! ({unknown4})"); } if (unknown5 != 0) { Console.WriteLine($"WARNING: Unknown5 != 0! ({unknown5})"); } }
// Methods public override void Load(Stream fileStream) { var reader = new BINAReader(fileStream); Header = reader.ReadHeader(); IsBigEndian = reader.IsBigEndian; System.Console.WriteLine(reader.BaseStream.Position); RangeIn = reader.ReadSingle(); // Unused RangeDistance = reader.ReadSingle(); // Unused ModelName = reader.GetString(); reader.JumpAhead(12); SkeletonName = reader.GetString(); reader.JumpAhead(12); BoundingShape = (BoundingShapes)reader.ReadUInt32(); BoundingSize = reader.ReadVector3(); MeshName = reader.GetString(); reader.JumpAhead(20); ShapeOffset = reader.ReadVector3(); reader.JumpAhead(4); ShapeSizeOffset = reader.ReadSingle(); RigidBodyType = (RigidBodyTypes)reader.ReadByte(); RigidBodyMaterial = (RigidBodyMaterials)reader.ReadByte(); reader.JumpAhead(2); _PhysicsParam = new PhysicsParam(reader); ContactDamageType = (ContactDamageTypes)reader.ReadByte(); RideOnDamage = reader.ReadBoolean(); AerialBounce = reader.ReadBoolean(); reader.JumpAhead(9); // ReactionData for (uint i = 0; i < ReactionDataCount; i++) { _ReactionData[i] = new ReactionData(reader); } }
public void Read(BINAReader reader, bool readChildIndices = true) { long nameOffset = reader.ReadInt64(); long dataOffset = reader.ReadInt64(); long childIndexTableOffset = reader.ReadInt64(); ParentIndex = reader.ReadInt32(); Index = reader.ReadInt32(); DataIndex = reader.ReadInt32(); ushort childCount = reader.ReadUInt16(); bool hasData = reader.ReadBoolean(); byte fullPathSize = reader.ReadByte(); // Not counting this node in // Read name if (nameOffset != 0) { Name = reader.GetString((uint)nameOffset); } // (MINOR HACK) Store data offset in Data // to be read later, avoiding some Seeks if (hasData && dataOffset != 0) { Data = dataOffset; } // Read Child Indices if (!readChildIndices) { return; } long curPos = reader.BaseStream.Position; reader.JumpTo(childIndexTableOffset); ChildIndices.Capacity = childCount; for (int i = 0; i < childCount; ++i) { ChildIndices.Add(reader.ReadInt32()); } reader.JumpTo(curPos); }
public const uint Signature = 0x4658434F; // FXCO in ASCII // Methods public override void Load(Stream fileStream) { // Header var reader = new BINAReader(fileStream); Header = reader.ReadHeader(); uint sig = reader.ReadUInt32(); if (sig != Signature) { throw new InvalidSignatureException("FXCO", Encoding.ASCII.GetString(BitConverter.GetBytes(sig))); } uint unknown1 = reader.ReadUInt32(); // Version number? ulong instanceCount = reader.ReadUInt64(); ulong instancesOffset = reader.ReadUInt64(); ulong shapesCount = reader.ReadUInt64(); ulong shapesOffset = reader.ReadUInt64(); ulong unknownCount = reader.ReadUInt64(); ulong unknownOffset = reader.ReadUInt64(); // Instances reader.JumpTo((long)instancesOffset, false); for (uint i = 0; i < instanceCount; ++i) { reader.FixPadding(8); ulong nameOffset = reader.ReadUInt64(); byte unknownFlag1 = reader.ReadByte(); byte unknownFlag2 = reader.ReadByte(); byte unknownFlag3 = reader.ReadByte(); byte unknownFlag4 = reader.ReadByte(); var vect1 = reader.ReadVector3(); // Position or size? ulong instPadding1 = reader.ReadUInt64(); uint instPadding2 = reader.ReadUInt32(); uint instUnknown1 = reader.ReadUInt32(); ulong instPadding3 = reader.ReadUInt64(); ulong instPadding4 = reader.ReadUInt64(); ulong instPadding5 = reader.ReadUInt64(); ulong instPadding6 = reader.ReadUInt64(); ulong unknownString1 = reader.ReadUInt64(); // Always "none"? var vect2 = reader.ReadVector3(); // Position or size? uint instUnknown2 = reader.ReadUInt32(); // Always 0x00000080? uint instPadding7 = reader.ReadUInt32(); uint instUnknown3 = reader.ReadUInt32(); // Always 0x00000080? float instUnknown4 = reader.ReadSingle(); // Always 1? } // Unknown reader.JumpTo((long)unknownOffset, false); for (uint i = 0; i < unknownCount; ++i) { ulong uk1 = reader.ReadUInt64(); // Maybe 8 indices? } // Shapes reader.JumpTo((long)shapesOffset, false); for (uint i = 0; i < shapesCount; ++i) { uint shapeUnknown1 = reader.ReadUInt32(); uint shapeUnknown2 = reader.ReadUInt32(); var shapeUnknown3 = reader.ReadVector3(); var shapeUnknown4 = reader.ReadVector3(); } }
// Methods public override void Load(Stream fileStream) { // BINA Header var reader = new BINAReader(fileStream); Header = reader.ReadHeader(); // Header byte unknown1 = reader.ReadByte(); // Always 3? byte sheetCount = reader.ReadByte(); // ? byte unknown2 = reader.ReadByte(); // Always 0? byte unknown3 = reader.ReadByte(); // Always 0? uint unknown4 = reader.ReadUInt32(); long sheetsOffset = reader.ReadInt64(); // Sheets reader.JumpTo(sheetsOffset, false); for (uint i = 0; i < sheetCount; ++i) { Sheets.Add(new Sheet() { NameOffset = reader.ReadInt64(), CellCount = reader.ReadUInt64(), CellsOffset = reader.ReadInt64() }); } // Cells for (int i = 0; i < sheetCount; ++i) { var sheet = Sheets[i]; reader.JumpTo(sheet.CellsOffset, false); for (uint i2 = 0; i2 < sheet.CellCount; ++i2) { sheet.Cells.Add(new Cell() { UUID = reader.ReadUInt64(), NameOffset = reader.ReadInt64(), SecondEntryOffset = reader.ReadInt64(), DataOffset = reader.ReadInt64() }); } } // Data foreach (var sheet in Sheets) { for (int i = 0; i < sheet.Cells.Count; ++i) { var cell = sheet.Cells[i]; reader.JumpTo(cell.DataOffset.Value, false); var chars = new List <byte>(); bool isReadingButton = false; // Read Unicode strings do { byte b1 = reader.ReadByte(); byte b2 = reader.ReadByte(); if (b1 != 0 && ((b2 & 0xE0) == 0xE0)) { isReadingButton = true; } if (b1 == 0 && b2 == 0) { if (isReadingButton) { isReadingButton = false; chars.Add(0x57); // NullReplaceChar byte1 chars.Add(0x2B); // NullReplaceChar byte2 continue; } else { break; } } chars.Add(b1); chars.Add(b2); }while (fileStream.Position < fileStream.Length); cell.Data = Encoding.Unicode.GetString(chars.ToArray()); } } // Second Entries var typeOffsets = new Dictionary <long, string>(); foreach (var sheet in Sheets) { for (int i = 0; i < sheet.Cells.Count; ++i) { var cell = sheet.Cells[i]; reader.JumpTo(cell.SecondEntryOffset.Value, false); long nameOffset = reader.ReadInt64(); long typeOffset = reader.ReadInt64(); cell.LayoutOffset = reader.ReadInt64(); if (nameOffset != cell.NameOffset) { Console.WriteLine( "WARNING: Second name offset ({0:X}) != first ({1:X})!", nameOffset, cell.NameOffset); } // Caption Type if (typeOffsets.ContainsKey(typeOffset)) { cell.TypeName = typeOffsets[typeOffset]; continue; } var type = new CellType(); reader.JumpTo(typeOffset, false); long typeNameOffset = reader.ReadInt64(); long typeNamespaceOffset = reader.ReadInt64(); long unknownFloat1Offset = reader.ReadInt64(); long unknownFloat2Offset = reader.ReadInt64(); long unknownFloat3Offset = reader.ReadInt64(); long unknownInt1Offset = reader.ReadInt64(); long unknownInt2Offset = reader.ReadInt64(); long unknownOffset1 = reader.ReadInt64(); long unknownULong2Offset = reader.ReadInt64(); long unknownOffset2 = reader.ReadInt64(); long unknownOffset3 = reader.ReadInt64(); long unknownOffset4 = reader.ReadInt64(); long unknownULong1Offset = reader.ReadInt64(); long unknownOffset5 = reader.ReadInt64(); // UnknownFloat1 if (unknownFloat1Offset > 0) { reader.JumpTo(unknownFloat1Offset, false); type.UnknownFloat1 = reader.ReadSingle(); uint padding1 = reader.ReadUInt32(); if (padding1 != 0) { Console.WriteLine("WARNING: Type Padding1 != 0 (0x{0:X})", padding1); } } // UnknownFloat2 if (unknownFloat2Offset > 0) { reader.JumpTo(unknownFloat2Offset, false); type.UnknownFloat2 = reader.ReadSingle(); uint padding2 = reader.ReadUInt32(); if (padding2 != 0) { Console.WriteLine("WARNING: Type Padding2 != 0 (0x{0:X})", padding2); } } // UnknownFloat3 if (unknownFloat3Offset > 0) { reader.JumpTo(unknownFloat3Offset, false); type.UnknownFloat3 = reader.ReadSingle(); uint padding3 = reader.ReadUInt32(); if (padding3 != 0) { Console.WriteLine("WARNING: Type Padding3 != 0 (0x{0:X})", padding3); } } // UnknownInt1 if (unknownInt1Offset > 0) { reader.JumpTo(unknownInt1Offset, false); type.UnknownInt1 = reader.ReadInt32(); uint padding4 = reader.ReadUInt32(); if (padding4 != 0) { Console.WriteLine("WARNING: Type Padding4 != 0 (0x{0:X})", padding4); } } // UnknownInt2 if (unknownInt2Offset > 0) { reader.JumpTo(unknownInt2Offset, false); type.UnknownInt2 = reader.ReadInt32(); uint padding5 = reader.ReadUInt32(); if (padding5 != 0) { Console.WriteLine("WARNING: Type Padding5 != 0 (0x{0:X})", padding5); } } if (unknownOffset1 != 0) { Console.WriteLine("WARNING: Type ukOff1 != 0 (0x{0:X})", unknownOffset1); } // UnknownULong2Offset if (unknownULong2Offset > 0) { reader.JumpTo(unknownULong2Offset, false); type.UnknownULong2 = reader.ReadUInt64(); } if (unknownOffset2 != 0) { Console.WriteLine("WARNING: Type ukOff2 != 0 (0x{0:X})", unknownOffset2); } if (unknownOffset3 != 0) { Console.WriteLine("WARNING: Type ukOff3 != 0 (0x{0:X})", unknownOffset3); } if (unknownOffset4 != 0) { Console.WriteLine("WARNING: Type ukOff4 != 0 (0x{0:X})", unknownOffset4); } // UnknownULong1Offset if (unknownULong1Offset > 0) { reader.JumpTo(unknownULong1Offset, false); type.UnknownULong1 = reader.ReadUInt64(); } if (unknownOffset5 != 0) { Console.WriteLine("WARNING: Type ukOff5 != 0 (0x{0:X})", unknownOffset5); } // Strings reader.JumpTo(typeNameOffset, false); string typeName = reader.ReadNullTerminatedString(); reader.JumpTo(typeNamespaceOffset, false); type.Namespace = reader.ReadNullTerminatedString(); cell.TypeName = typeName; typeOffsets.Add(typeOffset, typeName); Types.Add(typeName, type); } } // Layouts var layoutOffsets = new List <long>(); foreach (var sheet in Sheets) { foreach (var cell in sheet.Cells) { if (!layoutOffsets.Contains(cell.LayoutOffset.Value)) { var layout = new Layout(); reader.JumpTo(cell.LayoutOffset.Value, false); long layoutNameOffset = reader.ReadInt64(); long unknownData1Offset = reader.ReadInt64(); long unknownData2Offset = reader.ReadInt64(); long unknownData3Offset = reader.ReadInt64(); long unknownData4Offset = reader.ReadInt64(); long unknownData5Offset = reader.ReadInt64(); long unknownData6Offset = reader.ReadInt64(); long unknownData7Offset = reader.ReadInt64(); layout.UnknownData8 = reader.ReadInt64(); // Always 0? if (layout.UnknownData8 != 0) { Console.WriteLine( "WARNING: Layout UnknownData8 != 0! ({0:X})", layout.UnknownData8); } // Unknown Data 1 if (unknownData1Offset > 0) { reader.JumpTo(unknownData1Offset, false); layout.UnknownData1 = reader.ReadInt32(); // Always 1? } // Unknown Data 2 if (unknownData2Offset > 0) { reader.JumpTo(unknownData2Offset, false); layout.UnknownData2 = reader.ReadSingle(); uint padding = reader.ReadUInt32(); if (padding != 0) { Console.WriteLine( "WARNING: Layout UnknownData2 Padding != 0! ({0:X})", padding); } } // Unknown Data 3 if (unknownData3Offset > 0) { reader.JumpTo(unknownData3Offset, false); layout.UnknownData3 = reader.ReadSingle(); uint padding = reader.ReadUInt32(); if (padding != 0) { Console.WriteLine( "WARNING: Layout UnknownData3 Padding != 0! ({0:X})", padding); } } // Unknown Data 4 if (unknownData4Offset > 0) { reader.JumpTo(unknownData4Offset, false); layout.UnknownData4 = reader.ReadInt32(); // Always 0? } // Unknown Data 5 if (unknownData5Offset > 0) { reader.JumpTo(unknownData5Offset, false); layout.UnknownData5 = reader.ReadInt32(); } // Unknown Data 6 if (unknownData6Offset > 0) { reader.JumpTo(unknownData6Offset, false); layout.UnknownData6 = reader.ReadInt32(); // Always 1? } // Unknown Data 7 if (unknownData7Offset > 0) { reader.JumpTo(unknownData7Offset, false); layout.UnknownData7 = reader.ReadInt32(); // Always 2? } // Layout Name reader.JumpTo(layoutNameOffset, false); layout.Name = reader.ReadNullTerminatedString(); layout.Offset = cell.LayoutOffset; cell.LayoutIndex = layoutOffsets.Count; layoutOffsets.Add(cell.LayoutOffset.Value); Layouts.Add(layout); } else { cell.LayoutIndex = layoutOffsets.IndexOf( cell.LayoutOffset.Value); } } } // Names foreach (var sheet in Sheets) { reader.JumpTo(sheet.NameOffset, false); sheet.Name = reader.ReadNullTerminatedString(); for (int i = 0; i < sheet.Cells.Count; ++i) { var cell = sheet.Cells[i]; reader.JumpTo(cell.NameOffset.Value, false); cell.Name = reader.ReadNullTerminatedString(); } } }