예제 #1
0
파일: ACI0.cs 프로젝트: zhubaojian/Ryujinx
        public ACI0(Stream Stream, int Offset)
        {
            Stream.Seek(Offset, SeekOrigin.Begin);

            BinaryReader Reader = new BinaryReader(Stream);

            if (Reader.ReadInt32() != ACI0Magic)
            {
                throw new InvalidNpdmException("ACI0 Stream doesn't contain ACI0 section!");
            }

            Stream.Seek(0xc, SeekOrigin.Current);

            TitleId = Reader.ReadInt64();

            //Reserved.
            Stream.Seek(8, SeekOrigin.Current);

            int FsAccessHeaderOffset       = Reader.ReadInt32();
            int FsAccessHeaderSize         = Reader.ReadInt32();
            int ServiceAccessControlOffset = Reader.ReadInt32();
            int ServiceAccessControlSize   = Reader.ReadInt32();
            int KernelAccessControlOffset  = Reader.ReadInt32();
            int KernelAccessControlSize    = Reader.ReadInt32();

            FsAccessHeader FsAccessHeader = new FsAccessHeader(Stream, Offset + FsAccessHeaderOffset, FsAccessHeaderSize);

            FsVersion            = FsAccessHeader.Version;
            FsPermissionsBitmask = FsAccessHeader.PermissionsBitmask;

            ServiceAccessControl = new ServiceAccessControl(Stream, Offset + ServiceAccessControlOffset, ServiceAccessControlSize);

            KernelAccessControl = new KernelAccessControl(Stream, Offset + KernelAccessControlOffset, KernelAccessControlSize);
        }
예제 #2
0
        public Aci0(Stream stream, int offset)
        {
            stream.Seek(offset, SeekOrigin.Begin);

            BinaryReader reader = new BinaryReader(stream);

            if (reader.ReadInt32() != Aci0Magic)
            {
                throw new InvalidNpdmException("ACI0 Stream doesn't contain ACI0 section!");
            }

            stream.Seek(0xc, SeekOrigin.Current);

            TitleId = reader.ReadInt64();

            //Reserved.
            stream.Seek(8, SeekOrigin.Current);

            int fsAccessHeaderOffset       = reader.ReadInt32();
            int fsAccessHeaderSize         = reader.ReadInt32();
            int serviceAccessControlOffset = reader.ReadInt32();
            int serviceAccessControlSize   = reader.ReadInt32();
            int kernelAccessControlOffset  = reader.ReadInt32();
            int kernelAccessControlSize    = reader.ReadInt32();

            FsAccessHeader fsAccessHeader = new FsAccessHeader(stream, offset + fsAccessHeaderOffset, fsAccessHeaderSize);

            FsVersion            = fsAccessHeader.Version;
            FsPermissionsBitmask = fsAccessHeader.PermissionsBitmask;

            ServiceAccessControl = new ServiceAccessControl(stream, offset + serviceAccessControlOffset, serviceAccessControlSize);

            KernelAccessControl = new KernelAccessControl(stream, offset + kernelAccessControlOffset, kernelAccessControlSize);
        }
예제 #3
0
파일: ACI0.cs 프로젝트: splatax/Ryujinx-1
        public ACI0(Stream ACI0Stream, int Offset)
        {
            ACI0Stream.Seek(Offset, SeekOrigin.Begin);

            BinaryReader Reader = new BinaryReader(ACI0Stream);

            if (Reader.ReadInt32() != ACI0Magic)
            {
                throw new InvalidNpdmException("ACI0 Stream doesn't contain ACI0 section!");
            }

            ACI0Stream.Seek(0x0C, SeekOrigin.Current);

            byte[] TempTitleId = Reader.ReadBytes(8);
            Array.Reverse(TempTitleId);
            TitleId = BitConverter.ToString(TempTitleId).Replace("-", "");

            // Reserved (Not currently used, potentially to be used for lowest title ID in future.)
            ACI0Stream.Seek(0x08, SeekOrigin.Current);

            FSAccessHeaderOffset       = Reader.ReadInt32();
            FSAccessHeaderSize         = Reader.ReadInt32();
            ServiceAccessControlOffset = Reader.ReadInt32();
            ServiceAccessControlSize   = Reader.ReadInt32();
            KernelAccessControlOffset  = Reader.ReadInt32();
            KernelAccessControlSize    = Reader.ReadInt32();

            FSAccessHeader       = new FSAccessHeader(ACI0Stream, Offset + FSAccessHeaderOffset, FSAccessHeaderSize);
            ServiceAccessControl = new ServiceAccessControl(ACI0Stream, Offset + ServiceAccessControlOffset, ServiceAccessControlSize);
            KernelAccessControl  = new KernelAccessControl(ACI0Stream, Offset + KernelAccessControlOffset, KernelAccessControlSize);
        }
예제 #4
0
파일: ACID.cs 프로젝트: woxihuanjia/Ryujinx
        public Acid(Stream stream, int offset)
        {
            stream.Seek(offset, SeekOrigin.Begin);

            BinaryReader reader = new BinaryReader(stream);

            Rsa2048Signature = reader.ReadBytes(0x100);
            Rsa2048Modulus   = reader.ReadBytes(0x100);

            if (reader.ReadInt32() != AcidMagic)
            {
                throw new InvalidNpdmException("ACID Stream doesn't contain ACID section!");
            }

            // Size field used with the above signature (?).
            Unknown1 = reader.ReadInt32();

            reader.ReadInt32();

            // Bit0 must be 1 on retail, on devunit 0 is also allowed. Bit1 is unknown.
            Flags = reader.ReadInt32();

            TitleIdRangeMin = reader.ReadInt64();
            TitleIdRangeMax = reader.ReadInt64();

            int fsAccessControlOffset      = reader.ReadInt32();
            int fsAccessControlSize        = reader.ReadInt32();
            int serviceAccessControlOffset = reader.ReadInt32();
            int serviceAccessControlSize   = reader.ReadInt32();
            int kernelAccessControlOffset  = reader.ReadInt32();
            int kernelAccessControlSize    = reader.ReadInt32();

            FsAccessControl = new FsAccessControl(stream, offset + fsAccessControlOffset, fsAccessControlSize);

            ServiceAccessControl = new ServiceAccessControl(stream, offset + serviceAccessControlOffset, serviceAccessControlSize);

            KernelAccessControl = new KernelAccessControl(stream, offset + kernelAccessControlOffset, kernelAccessControlSize);
        }
예제 #5
0
파일: ACID.cs 프로젝트: zhubaojian/Ryujinx
        public ACID(Stream Stream, int Offset)
        {
            Stream.Seek(Offset, SeekOrigin.Begin);

            BinaryReader Reader = new BinaryReader(Stream);

            RSA2048Signature = Reader.ReadBytes(0x100);
            RSA2048Modulus   = Reader.ReadBytes(0x100);

            if (Reader.ReadInt32() != ACIDMagic)
            {
                throw new InvalidNpdmException("ACID Stream doesn't contain ACID section!");
            }

            //Size field used with the above signature (?).
            Unknown1 = Reader.ReadInt32();

            Reader.ReadInt32();

            //Bit0 must be 1 on retail, on devunit 0 is also allowed. Bit1 is unknown.
            Flags = Reader.ReadInt32();

            TitleIdRangeMin = Reader.ReadInt64();
            TitleIdRangeMax = Reader.ReadInt64();

            int FsAccessControlOffset      = Reader.ReadInt32();
            int FsAccessControlSize        = Reader.ReadInt32();
            int ServiceAccessControlOffset = Reader.ReadInt32();
            int ServiceAccessControlSize   = Reader.ReadInt32();
            int KernelAccessControlOffset  = Reader.ReadInt32();
            int KernelAccessControlSize    = Reader.ReadInt32();

            FsAccessControl = new FsAccessControl(Stream, Offset + FsAccessControlOffset, FsAccessControlSize);

            ServiceAccessControl = new ServiceAccessControl(Stream, Offset + ServiceAccessControlOffset, ServiceAccessControlSize);

            KernelAccessControl = new KernelAccessControl(Stream, Offset + KernelAccessControlOffset, KernelAccessControlSize);
        }
예제 #6
0
        public ACID(Stream ACIDStream, int Offset)
        {
            ACIDStream.Seek(Offset, SeekOrigin.Begin);

            BinaryReader Reader = new BinaryReader(ACIDStream);

            RSA2048Signature = Reader.ReadBytes(0x100);
            RSA2048Modulus   = Reader.ReadBytes(0x100);

            if (Reader.ReadInt32() != ACIDMagic)
            {
                throw new InvalidNpdmException("ACID Stream doesn't contain ACID section!");
            }

            Unknown1 = Reader.ReadInt32(); // Size field used with the above signature(?).
            Reader.ReadInt32();            // Padding / Unused
            Flags = Reader.ReadInt32();    // Bit0 must be 1 on retail, on devunit 0 is also allowed. Bit1 is unknown.

            byte[] TempTitleIdRangeMin = Reader.ReadBytes(8);
            Array.Reverse(TempTitleIdRangeMin);
            TitleIdRangeMin = BitConverter.ToString(TempTitleIdRangeMin).Replace("-", "");

            byte[] TempTitleIdRangeMax = Reader.ReadBytes(8);
            Array.Reverse(TempTitleIdRangeMax);
            TitleIdRangeMax = BitConverter.ToString(TempTitleIdRangeMax).Replace("-", "");

            FSAccessControlOffset      = Reader.ReadInt32();
            FSAccessControlSize        = Reader.ReadInt32();
            ServiceAccessControlOffset = Reader.ReadInt32();
            ServiceAccessControlSize   = Reader.ReadInt32();
            KernelAccessControlOffset  = Reader.ReadInt32();
            KernelAccessControlSize    = Reader.ReadInt32();

            FSAccessControl      = new FSAccessControl(ACIDStream, Offset + FSAccessControlOffset, FSAccessControlSize);
            ServiceAccessControl = new ServiceAccessControl(ACIDStream, Offset + ServiceAccessControlOffset, ServiceAccessControlSize);
            KernelAccessControl  = new KernelAccessControl(ACIDStream, Offset + KernelAccessControlOffset, KernelAccessControlSize);
        }