public void ReadRawToc(byte[] rawToc) { containerCount = ByteTools.ReadUInt(rawToc, 0x10); if (containerCount > 0xFFFF) { ByteTools.bigEndian = true; containerCount = ByteTools.ReadUInt(rawToc, 0x10); } tableOffset = ByteTools.ReadUInt(rawToc, 0x14); namesOffset = ByteTools.ReadUInt(rawToc, 0x18); string[] entryNames = Encoding.ASCII.GetString(rawToc, (int)namesOffset, (int)(rawToc.Length - namesOffset)).Split(new char[] { (char)0 }); entries = new tocEntryStruct[entryNames.Length]; for (int i = 0; i < entries.Length; i++) { tocEntryStruct newTocEntry = new tocEntryStruct { nameChecksum = ByteTools.ReadUInt(rawToc, (int)(tableOffset + i * 24 + 0)), isFolder = ByteTools.ReadBoolean(rawToc, (int)(tableOffset + i * 24 + 4)), container = ByteTools.ReadUInt(rawToc, (int)(tableOffset + i * 24 + 8)), offset = ByteTools.ReadUInt(rawToc, (int)(tableOffset + i * 24 + 12)), length = ByteTools.ReadUInt(rawToc, (int)tableOffset + i * 24 + 16), name = entryNames[i] }; entries[i] = newTocEntry; } }
private void ReadRawStz(byte[] rawStz) { for (int i = 0; i < 6; i++) { uint offset = ByteTools.ReadUInt(rawStz, i * 12); uint decompressedLength = ByteTools.ReadUInt(rawStz, i * 12 + 4); uint compressedLength = ByteTools.ReadUInt(rawStz, i * 12 + 8); if (compressedLength > 0) { data[i] = Decompress(rawStz, offset, compressedLength, decompressedLength); } else { data[i] = new byte[0]; } } }