2
0
Fork 0
mirror of https://github.com/KillzXGaming/Switch-Toolbox synced 2025-02-02 23:33:25 +00:00

NSP/XCI : Use title IDs in place for multiple NCA file names.

This commit is contained in:
KillzXGaming 2020-09-19 10:12:49 -04:00
parent 4f28c0747f
commit 303aa55215
2 changed files with 8 additions and 4 deletions
File_Format_Library/FileFormats/Rom

View file

@ -71,6 +71,8 @@ namespace FirstPlugin
Stream Input = Pfs.OpenFile(ncaFileName).AsStream();
var Nca = new Nca(Keys, Input.AsStorage(), true);
string root = Nca.Header.TitleId.ToString("X");
Romfs romfs = new Romfs(
Nca.OpenSection(Nca.Sections.FirstOrDefault
(s => s?.Type == SectionType.Romfs || s?.Type == SectionType.Bktr)
@ -82,11 +84,11 @@ namespace FirstPlugin
false, IntegrityCheckLevel.None, true));
foreach (var file in exefs.Files)
files.Add(new ExefsEntry(exefs, file, ncaFileName));
files.Add(new ExefsEntry(exefs, file, root));
}
for (int i = 0; i < romfs.Files.Count; i++)
files.Add(new FileEntry(romfs, romfs.Files[i], ncaFileName));
files.Add(new FileEntry(romfs, romfs.Files[i], root));
}
}
var CtrlEntry = Cnmt.ContentEntries.FirstOrDefault(c => c.Type == CnmtContentType.Control);

View file

@ -68,6 +68,8 @@ namespace FirstPlugin
Stream Input = CnmtPfs.OpenFile(ncaFileName).AsStream();
var Nca = new Nca(Keys, Input.AsStorage(), true);
string root = Nca.Header.TitleId.ToString("X");
Romfs romfs = new Romfs(
Nca.OpenSection(Nca.Sections.FirstOrDefault
(s => s?.Type == SectionType.Romfs || s?.Type == SectionType.Bktr)
@ -79,11 +81,11 @@ namespace FirstPlugin
false, IntegrityCheckLevel.None, true));
foreach (var file in exefs.Files)
files.Add(new NSP.ExefsEntry(exefs, file, ncaFileName));
files.Add(new NSP.ExefsEntry(exefs, file, root));
}
for (int i = 0; i < romfs.Files.Count; i++)
files.Add(new NSP.FileEntry(romfs, romfs.Files[i], ncaFileName));
files.Add(new NSP.FileEntry(romfs, romfs.Files[i], root));
}
}
}