private void ReadControls() { foreach (Title title in Titles.Values.Where(x => x.ControlNca != null)) { var romfs = new Romfs(title.ControlNca.OpenSection(0, false, IntegrityCheckLevel.ErrorOnInvalid, true)); IStorage control = romfs.OpenFile("/control.nacp"); title.Control = new Nacp(control.AsStream()); foreach (NacpDescription desc in title.Control.Descriptions) { if (!string.IsNullOrWhiteSpace(desc.Title)) { title.Name = desc.Title; break; } } } }
public static void Extract(this Romfs romfs, string outDir, IProgressReport logger = null) { foreach (RomfsFile file in romfs.Files) { IStorage storage = romfs.OpenFile(file); string outName = outDir + file.FullPath; string dir = Path.GetDirectoryName(outName); if (!string.IsNullOrWhiteSpace(dir)) { Directory.CreateDirectory(dir); } using (var outFile = new FileStream(outName, FileMode.Create, FileAccess.ReadWrite)) { logger?.LogMessage(file.FullPath); storage.CopyToStream(outFile, storage.Length, logger); } } }
private void ReadControls() { foreach (Title title in Titles.Values.Where(x => x.ControlNca != null)) { var romfs = new Romfs(title.ControlNca.OpenSection(0, false, true)); byte[] control = romfs.GetFile("/control.nacp"); var reader = new BinaryReader(new MemoryStream(control)); title.Control = new Nacp(reader); foreach (NacpLang lang in title.Control.Languages) { if (!string.IsNullOrWhiteSpace(lang.Title)) { title.Name = lang.Title; break; } } } }