private void ReadCommands(SoundAudioBinaryFile file, BinaryReader binaryReader, SoundEntry soundEntry) { uint commandsOffsetInEntry; if (Version <= 2) { commandsOffsetInEntry = binaryReader.ReadUInt16At(Offset + 0x16); } else { commandsOffsetInEntry = binaryReader.ReadUInt16At(Offset + 0x06); } var currentCommandsOffset = Offset + commandsOffsetInEntry; while (currentCommandsOffset < file.TrackSectionOffset) { var command = new SequenceCommand(binaryReader, currentCommandsOffset); Commands.Add(command); currentCommandsOffset += (uint)(command.Size + command.BodySize); if (ShouldStopReadingCommands(soundEntry, command)) { break; } } }
public SequenceEntry(SoundAudioBinaryFile file, BinaryReader binaryReader, SoundEntry soundEntry, long offset) { DeclarationVersion = binaryReader.ReadByteAt(offset); //1 reserved DeclarationSize = binaryReader.ReadUInt16At(offset + 0x02); DeclarationIndex = binaryReader.ReadUInt16At(offset + 0x04); Offset = file.SequenceSectionOffset + binaryReader.ReadUInt32At(file.SequenceSectionOffset + 0x10 + DeclarationIndex * 0x04); Version = binaryReader.ReadByteAt(Offset); //1 reserved //2 size? ReadCommands(file, binaryReader, soundEntry); }
public TrackEntry(SoundAudioBinaryFile file, BinaryReader reader, int index) { var trackSectionOffset = file.TrackSectionOffset; var trackOffsetInSection = reader.ReadUInt32At(trackSectionOffset + 0x10 + index * 0x04); var trackOffsetInFile = trackSectionOffset + trackOffsetInSection; Offset = trackOffsetInFile; Version = reader.ReadByteAt(Offset); Type = reader.ReadByteAt(Offset + 0x01); Size = reader.ReadUInt16At(Offset + 0x02); Id = reader.ReadUInt16At(Offset + 0x08); ChildId = reader.ReadUInt16At(Offset + 0x0a); if (HasMaterial) { MaterialIndex = reader.ReadUInt16At(Offset + 0x04); } }
public SoundEntry(SoundAudioBinaryFile file, BinaryReader binaryReader, int entryIndex) { Offset = (uint)file.SoundSectionOffset + binaryReader.ReadUInt32At(file.SoundSectionOffset + 0x10 + entryIndex * 0x04); Version = binaryReader.ReadByteAt(Offset); UnknownAt1 = binaryReader.ReadByteAt(Offset + 0x01); Size = binaryReader.ReadUInt16At(Offset + 0x02); Type = binaryReader.ReadByteAt(Offset + 0x04); SequenceCount = binaryReader.ReadByte(); SequencesOffsetInEntry = binaryReader.ReadUInt16At(Offset + 0x1a); if (Version <= 8) { NameSize = 0x0f; NameOffset = Offset + 0x50; } else { NameSize = binaryReader.ReadByteAt(Offset + 0x23); NameOffset = Offset + Size; } Name = Encoding.ASCII.GetString(binaryReader.ReadBytesAt(NameOffset, NameSize)); var currentSequenceOffset = Offset + SequencesOffsetInEntry; for (int sequenceIndex = 0; sequenceIndex < SequenceCount; sequenceIndex++) { var sequence = new SequenceEntry(file, binaryReader, this, currentSequenceOffset); Sequences.Add(sequence); currentSequenceOffset += sequence.DeclarationSize; } }