Example #1
0
 public BktrSuperblock(BinaryReader reader)
 {
     IvfcHeader = new IvfcHeader(reader);
     reader.BaseStream.Position += 0x18;
     RelocationHeader            = new BktrHeader(reader);
     SubsectionHeader            = new BktrHeader(reader);
 }
Example #2
0
        public NcaFsHeader(BinaryReader reader)
        {
            long start = reader.BaseStream.Position;

            Version                     = reader.ReadInt16();
            FormatType                  = (NcaFormatType)reader.ReadByte();
            HashType                    = (NcaHashType)reader.ReadByte();
            EncryptionType              = (NcaEncryptionType)reader.ReadByte();
            reader.BaseStream.Position += 3;

            switch (HashType)
            {
            case NcaHashType.Sha256:
                Sha256Info = new Sha256Info(reader);
                break;

            case NcaHashType.Ivfc:
                IvfcInfo = new IvfcHeader(reader);
                break;
            }

            if (EncryptionType == NcaEncryptionType.AesCtrEx)
            {
                BktrInfo = new BktrPatchInfo();

                reader.BaseStream.Position = start + 0x100;

                BktrInfo.RelocationHeader = new BktrHeader(reader);
                BktrInfo.EncryptionHeader = new BktrHeader(reader);
            }

            if (FormatType == NcaFormatType.Pfs0)
            {
                Type = SectionType.Pfs0;
            }
            else if (FormatType == NcaFormatType.Romfs)
            {
                if (EncryptionType == NcaEncryptionType.AesCtrEx)
                {
                    Type = SectionType.Bktr;
                }
                else
                {
                    Type = SectionType.Romfs;
                }
            }

            reader.BaseStream.Position = start + 0x140;
            Ctr = reader.ReadBytes(8).Reverse().ToArray();

            reader.BaseStream.Position = start + 512;
        }
Example #3
0
 public RomfsSuperblock(BinaryReader reader)
 {
     IvfcHeader = new IvfcHeader(reader);
     reader.BaseStream.Position += 0x58;
 }