예제 #1
0
        private ResultCode ParseNrr(out NrrInfo nrrInfo, ServiceCtx context, long nrrAddress, long nrrSize)
        {
            nrrInfo = null;

            if (nrrSize == 0 || nrrAddress + nrrSize <= nrrAddress || (nrrSize & 0xFFF) != 0)
            {
                return(ResultCode.BadSize);
            }
            else if ((nrrAddress & 0xFFF) != 0)
            {
                return(ResultCode.UnalignedAddress);
            }

            StructReader reader = new StructReader(context.Memory, nrrAddress);
            NrrHeader    header = reader.Read <NrrHeader>();

            if (header.Magic != NrrMagic)
            {
                return(ResultCode.InvalidNrr);
            }
            else if (header.NrrSize != nrrSize)
            {
                return(ResultCode.BadSize);
            }

            List <byte[]> hashes = new List <byte[]>();

            for (int i = 0; i < header.HashCount; i++)
            {
                hashes.Add(context.Memory.ReadBytes(nrrAddress + header.HashOffset + (i * 0x20), 0x20));
            }

            nrrInfo = new NrrInfo(nrrAddress, header, hashes);

            return(ResultCode.Success);
        }
예제 #2
0
 public NrrInfo(long nrrAddress, NrrHeader header, List <byte[]> hashes)
 {
     NrrAddress = nrrAddress;
     Header     = header;
     Hashes     = hashes;
 }