public static async Task <Arm11LocalSystemCapabilities> Load(IReadOnlyBinaryDataAccessor data) { var capabilities = new Arm11LocalSystemCapabilities { ProgramId = await data.ReadInt64Async(0), CoreVersion = await data.ReadInt32Async(0x8), Flag1 = await data.ReadByteAsync(0xC), Flag2 = await data.ReadByteAsync(0xD), Flag0 = await data.ReadByteAsync(0xE), Priority = await data.ReadByteAsync(0xF), ResourceLimitDescriptors = await data.ReadArrayAsync(0x10, 0x20), StorageInformation = await StorageInfo.Load(data.GetReadOnlyDataReference(0x30, 0x20)), }; var accessControl = new long[32]; await AsyncFor.For(0, 32 - 1, async i => { accessControl[i] = await data.ReadInt64Async(0x50 + 8 * i); }); capabilities.ServiceAccessControl = accessControl; capabilities.ExtendedServiceAccessControl = new long[] { await data.ReadInt64Async(0x150), await data.ReadInt64Async(0x158) }; capabilities.Reserved = await data.ReadArrayAsync(0x160, 0xF); capabilities.ResourceLimitCategory = await data.ReadByteAsync(0x16F); return(capabilities); }
public static async Task <IvfcLevel> Load(IReadOnlyBinaryDataAccessor romfsData, IvfcLevelLocation location) { var header = new IvfcLevelHeader(await romfsData.ReadArrayAsync(location.DataOffset, 0x28)); var level = new IvfcLevel(romfsData.GetReadOnlyDataReference(location.DataOffset, location.DataSize), header); await level.Initialize(); return(level); }
public async Task Initialize(IReadOnlyBinaryDataAccessor data) { if (Header != null && Header.RomFsSize > 0) { if (Header.ExeFsOffset > 0 && Header.ExeFsSize > 0) { ExeFs = await ExeFs.Load(data.GetReadOnlyDataReference((long)Header.ExeFsOffset *MediaUnitSize, (long)Header.ExeFsSize *MediaUnitSize)); } if (Header.RomFsOffset > 0 && Header.RomFsOffset > 0) { RomFs = await RomFs.Load(data.GetReadOnlyDataReference((long)Header.RomFsOffset *MediaUnitSize, (long)Header.RomFsSize *MediaUnitSize)); } if (Header.ExHeaderSize > 0) { ExHeader = data.GetReadOnlyDataReference(0x200, Header.ExHeaderSize); } } }
public async Task Initialize(IReadOnlyBinaryDataAccessor data) { this.RawData = data; if (Header != null && Header.RomFsSize > 0) { if (Header.ExeFsOffset > 0 && Header.ExeFsSize > 0) { ExeFs = await ExeFs.Load(data.GetReadOnlyDataReference((long)Header.ExeFsOffset *MediaUnitSize, (long)Header.ExeFsSize *MediaUnitSize)); } if (Header.RomFsOffset > 0 && Header.RomFsOffset > 0) { RomFs = await RomFs.Load(data.GetReadOnlyDataReference((long)Header.RomFsOffset *MediaUnitSize, (long)Header.RomFsSize *MediaUnitSize)); } if (Header.ExHeaderSize > 0) { ExHeader = await NcchExtendedHeader.Load(data.GetReadOnlyDataReference(0x200, Header.ExHeaderSize)); } PlainRegion = await data.ReadStringAsync(Header.PlainRegionOffset *MediaUnitSize, Header.PlainRegionSize *MediaUnitSize, Encoding.ASCII); Logo = await data.ReadArrayAsync(Header.LogoRegionOffset *MediaUnitSize, Header.LogoRegionSize *MediaUnitSize); } }
public static async Task <NcchExtendedHeader> Load(IReadOnlyBinaryDataAccessor data) { var header = new NcchExtendedHeader { ApplicationTitle = await data.ReadStringAsync(0, 8, Encoding.ASCII), Reserved1 = await data.ReadArrayAsync(8, 5), Flag = await data.ReadByteAsync(0xD), RemasterVersion = await data.ReadInt16Async(0xE), TextCodeSetInfo = await CodeSetInfo.Load(data.GetReadOnlyDataReference(0x10, 0xC)), StackSize = await data.ReadInt32Async(0x1C), ReadOnlyCodeSetInfo = await CodeSetInfo.Load(data.GetReadOnlyDataReference(0x20, 0xC)), Reserved2 = await data.ReadInt32Async(0x2C), DataCodeSetInfo = await CodeSetInfo.Load(data.GetReadOnlyDataReference(0x30, 0xC)), BssSize = await data.ReadInt32Async(0x3C) }; var moduleIds = new long[48]; await AsyncFor.For(0, 48 - 1, async i => { moduleIds[i] = await data.ReadInt64Async(0x40 + i * 8); }); header.DependencyModuleIds = moduleIds; header.SystemInformation = await SystemInfo.Load(data.GetReadOnlyDataReference(0x1C0, 0x40)); header.LocalSystemCapabilities = await Arm11LocalSystemCapabilities.Load(data.GetReadOnlyDataReference(0x200, 0x170)); header.KernelCapabilities = await Arm11KernelCapabilities.Load(data.GetReadOnlyDataReference(0x370, 0x80)); header.AccessControl = await Arm9AccessControl.Load(data.GetReadOnlyDataReference(0x3F0, 0x10)); header.AccessDescSignature = await data.ReadArrayAsync(0x400, 0x100); header.NcchHdrPublicKey = await data.ReadArrayAsync(0x500, 0x100); header.Aci = await data.ReadArrayAsync(0x600, 0x200); return(header); }